Search code examples
dygraphs

How to draw tangents at a given point using dygraph over the present graph?


How can I draw tangents at a given point. Tangents should update on mouse move. I thought of drawing it in mousemove, but if I implement some code in mousemove, the zooming dosen't work. Which method should I call inside mousemove to make the default zooming functionality work?


Solution

  • You might get some inspiration from this linear regression demo, which draws straight lines on top of the chart. There's a highlightCallback which gets fired whenever a new point is moused over. You'd want to adjust the line being drawn in that.