Loading new JSON data into scatter plot replaces, instead of adding to existing data
See original GitHub issuehttp://c3js.org/samples/chart_scatter.html shows a new category being added to a scatterplot at 1000 milliseconds.
I am trying to do the same but with data being loaded from JSON. I specified the same keys as when initially creating it. Instead of adding the new data as new category (and color) to the existing graph, C3 will remove the existing points, add the new ones and zoom to them.
Is this a bug or am I using it wrong?
var chart_scatterplot = c3.generate({
bindto: '#chart_scatterplot',
data: {
json: jsonfile,
keys: {
x: 'xvariable',
value: ['valuevariable'],
},
type: 'scatter',
},
});
setTimeout(function () {
chart_scatterplot.load({
json: differentjsonfile,
keys: {
x: 'xvariable',
value: ['valuevariable'],
},
});
}, 1000);
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Json file replaces the data instead of adding - Stack Overflow
I have a Json file which i'm using for my website, however when I fill out the form and send it over to...
Read more >Build a Scatter Plot - Tableau Help
Use scatter plots to visualize relationships between numerical variables. In Tableau, you create a scatter plot by placing at least one measure on...
Read more >Creating and updating figures in Python - Plotly
This method accepts a graph object trace (an instance of go.Scatter , go.Bar , etc.) and adds it to the figure. This allows...
Read more >How to Annotate Matplotlib Scatter Plots? - GeeksforGeeks
Approach: Import libraries. Create data. Store all the annotations in a list in order with the sequence of the points to be displayed....
Read more >Adding a dataset to an analysis - Amazon QuickSight
You can also remove or replace data sets. ... Or choose Add on the application bar and then Add Visual to create a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
concat doesn’t work for my case because I want to add a new segment to to graph. Instead of using this code:
If I use the following:
It works because the name of the column in new dataset has a different name (differentCol). Therefore what we need is the ability to specify graph keys for json datasets.
Using your example the following happens for me: First 3 points are shown, the x axis ranges from 100 to 300. When the second dataset is loaded, I see (the newly loaded) 3 points and the x axis updates to the range 200 to 400. The original 3 points are removed. Only the 3 points from the second data set are there.
I am looking for a way to ADD the second set of points to the chart. I would end up with 6 points.