0

I'm trying to apply the zooming function on a chart I have on my website. More or less, the actual code of the chart is the one I added in the following CodePen: https://codepen.io/leonardodaga/pen/eYNZdVV

This example works, but I'm trying to use a different xAxis type (not "time") and to format the xAxis ticks with a callback (now commented in the CodePen):

callback: function (value, index, values) {
    return Math.floor(value).toFixed(0) + '.' + (((value - Math.floor(value)) * 12).toFixed(0));
},

Removing type: "time" the zoom ends to work. Is there something wrong with what I'm doing?

Leonardo Daga
  • 135
  • 1
  • 12

1 Answers1

0

It was my mistake, I was passing the data with a wrong format.

In codepen code above, X and Y data were passed using two different array (the first as labels). I should have passed the XY data as a single, two components array. There is another codepen in my dashboard (Chart.js Linear Zoom example) that shows the way to beginners like me :-)

Callback for ticks was definitely not the problem.

Leonardo Daga
  • 135
  • 1
  • 12