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 datasets with points

See original GitHub issue

Expected Behavior

In version 2.9.3, when you want to update a datasets with data as points (i.e.scatter), you could change the “point” object in its x and y properties. The following code is “randomize” implementation (updated by me to show how it works in 2.9.3) of Scatter chart in CHART.js samples.

document.getElementById('randomizeData').addEventListener('click', function() {
	scatterChartData.datasets.forEach(function(dataset) {
		dataset.data.forEach(function(item) {
			item.x = randomScalingFactor();
			item.y = randomScalingFactor();
		});
	});
	window.myScatter.update();
});

Current Behavior

With version 3, the above code does not work and the data points are not updated and the chart does not change the data representation.

To work properly it seems you have to create every time new point objects (not good for performance), as the code of Scatter chart sample is showing:

document.getElementById('randomizeData').addEventListener('click', function() {
	scatterChartData.datasets.forEach(function(dataset) {
		dataset.data = dataset.data.map(function() {
			return {
				x: randomScalingFactor(),
				y: randomScalingFactor()
			};
		});
	});
	window.myScatter.update();
});

Possible Solution

In my opinion it should work as was in version 2.9.3 because it’s more efficient.

Environment

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
kurklecommented, May 30, 2020

The demo is modifying Input data, not elements. ArrayEquals fails to notice the change (compares the objects, and those are still the same). I’d consider this to be a bug.

(assuming dataset.data is the Input data, I did not verify)

1reaction
benmccanncommented, May 30, 2020

Thanks for the correction @kurkle! I agree this seems like a bug to fix. Maybe we should remove the data checks and just support the splice/push/etc. API for fast data modification?

@stockiNail super glad for all your feedback. We’ve only had one alpha so far, so it’s still very early and appreciated!! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Updating a portion of a terrain dataset with new measurements
Measurements can be added to a terrain dataset through the Append and the Append Terrain Points geoprocessing tools. The Append geoprocessing tool operates...
Read more >
How to create an auto-updating dataset on Kaggle
Step 1: Identify a URL for a dataset that occasionally gets updated · Step 2: Create a new dataset on Kaggle by using...
Read more >
Updating files in a dataset - Amazon QuickSight
To update a file in a dataset​​ In QuickSight, choose Datasets at left. On the Datasets page, choose the dataset that you want...
Read more >
Forecasting, updating datasets, and the “news” - Statsmodels
To compute forecasts based on our updated dataset, we will create an updated ... was more than 10 percentage points below the AR(1)...
Read more >
Updating and Editing Your Data in Map Business Online
That brings up a process for selecting a dataset or starting a new one. If you're adding data to an already plotted group...
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