Chartjs-Cannot zoom in Chart.js

0👍

I fixed my issue when I chaged the way to display the labels. I replace the insertion from

for (var j = 0; j < timeSpan.length; j++) {
    timeSpan[j] = j / sensorsFrequency;
}
data.labels = timeSpan;

to:

for (var j = 0; j < timeSpan.length; j++) {
     timeSpan[j] = j;
}
data.labels = timeSpan;

Then in the config I replace:

callback: function (value, index, values) {
    return parseFloat(value).toFixed(0);
},
autoSkip: true,

By:

userCallback: function (item, index) {
    if ((index) % sensorsFrequency === 0)
         return item / sensorsFrequency;
},
autoSkip: false,

Not sure why but it works for me.

Leave a comment