I would like a chart that autoscales the x axis according to the data size and shows only specific numbers, and for the rest of data points only show the tick lines without numbers. Something like this:
In this example the length of the data is between 75 and 155, so it shows the numbers multiple of 20. Then for each interval there are 5 equally spaced tick lines.
Until now I've been able to edit the ticks with the cleanAxis function suggested here: How do you reduce the number of Y-axis ticks in dimple.js?. I did something like this for scaling the axis:
if (data.length < 10) {
cleanAxis(myAxis, 2);
}
if (data.length >= 10 && data.length < 75) {
cleanAxis(myAxis, 10);
}
if (data.length >= 75 && data.length < 155) {
cleanAxis(myAxis, 20);
}
if (data.length >= 155) {
cleanAxis(myAxis, 50);
}
This shows the number the way I want but also erased the ticks lines. Is it possible to do what I want in dimple.js?
Copyright Notice:Content Author:「Javier Cárdenas」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/25187816/autoscale-and-format-x-axis-in-dimple-js