Dynamically calculate data between points

98 views Asked by At

I'm creating a chart with 2 series. The series share the same axis but have different Ys for different Xs. For example:

  • Axis A: [{ x: 2, y: 5}, { x: 4, y: 10}]
  • Axis B: [{ x: 1, y: 2}, { x: 3, y: 6}, { x: 3, y: 9}]

I want to show a tooltip for each X value that appears in axis A (so in this case, for x = 2, 4) and in the tooltip show the value that both axis would have there.

So the problem is that for axis B I don't have a point for x = 2 and x = 4. Is there a way to calculate dinamically the Y value that the axis B would have in those Xs?

This is an example: the tooltip shows info of the blue point, but also calculates what the corresponding green point would be and shows it in the tooltip. enter image description here

Thank you!

0

There are 0 answers