drawing a line on linegraph on mouseover?

后端 未结 2 1967
难免孤独
难免孤独 2021-02-06 05:31

I am building a line graph with D3.js. When the user mouses over the graph, I would like to draw a vertical line on the graph, highlight its intersection with the chart lines, a

2条回答
  •  星月不相逢
    2021-02-06 05:58

    This might help you to get a bit further (I have no experience with D3 at all):

    1. For some reason your events are bound to the paths, not the base svg element. If you do d3.select(".air-quality").on(..) it seems to work as you would expect.

提交回复
热议问题