question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Updating chart stops following last value

See original GitHub issue

Hello! There is a little bug - updating chart stops following last value. It happens randomly. If you run “updating data” example on max speed (update speed is not the reason) and wait - you’ll see it.

I’ve spent some time debugging this and I’ve figured out the issue: getDataBetween calculates wrong newRightIndex. Maybe getClosestItemIndexes is the reason. I don’t really understand why we need this calculations, but I’ve found fix: change it

var newLeftIndex = getClosestItemIndexes(dataForInterval, left, xAccessor).right;
var newRightIndex = getClosestItemIndexes(dataForInterval, right, xAccessor).left;

to

var newLeftIndex = getClosestItemIndexes(dataForInterval, left, xAccessor).left;
var newRightIndex = getClosestItemIndexes(dataForInterval, right, xAccessor).right;

Also, I’ve created this fiddle with my data. So, you can reproduce the issue. getDataBetween’ve called form https://github.com/rrag/react-stockcharts/blob/master/src/lib/EventHandler.js#L160 . There is array[364] and last index should be 363 but left == 362 and at the next update last item will become invisible.

Should I create PR for this?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rragcommented, May 14, 2016

Added this fix in the new scale will be published as part of 0.5

1reaction
Dr-Niksoncommented, Apr 21, 2016

@rrag ooh… it makes sense now. Such a dumb comment from me) I’m not familiar with d3 yet.

So, I believe we can safely put it inside invert method

scale.invert = function(x) {
    return Math.round(backingLinearScale.invert(x) * 10000) / 10000;
};

It’ll fix the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update the data in an existing chart - Microsoft Support
To display a hidden item on the chart, right-click and Select Data and reselect it in the list, then choose OK.
Read more >
How to auto update a chart after entering new data in Excel?
This article is talking about how to auto update a chart while entering new data into the relative range in Excel.
Read more >
Charts Do Not Automatically Update When Data Changes
Note that both the data and chart update correctly. Modify the date in cell B2 gain. Note that the data updates, but the...
Read more >
Excel Chart Not Updating with New Data (2 Suitable Solutions)
Note: Enter new data just next to the last entry, i.e., there should be no blank rows or columns between the new and...
Read more >
Rolling Chart Data (Show only last # of data points) - YouTube
Create table and chart that will dynamically update to display only the last number of data points. In other words, as data is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found