I have a simple line chart:
labels: [1.0, 3.0, 4.0]
datasets: [{
label: "Track Plot",
borderColor: 'rgb(255, 0, 0)',
datata: [0.0, 2.0, 3.0]
}]
When I try to add new point (2.0, 5.0) I expect that dataset will be modified in a such way:
labels: [1.0, 2.0, 3.0, 4.0] datata: [0.0, 5.0, 2.0, 3.0]. So x-axis stay sorted.
config.data.labels.push(2.0);
config.data.datasets[0].data.push(5.0);
When I try to add new point (2.0, 5.0) the dataset is be modified in a such way:
labels: [1.0, 3.0, 4.0, 2.0] datata: [0.0, 2.0, 3.0, 5.0]. New point is appended to the end of the dataset.
Is there any options to append new point between other points to make x-axis sorted?
Thanks,
Alina.
@AlinaYablokova the category axis always renders the labels in the order they are given. If you need to have them sorted, you'll need to sort the labels and data before calling update()
Ok, thanks. I'm a bit confused by "category axis". Are there another types of axis?
@AlinaYablokova yes, there are linear, logarithmic, and time axes. The samples show them off
Please ask questions on StackOverflow: https://stackoverflow.com/questions/tagged/chart.js