Highcharts => Getting the id of a point when clicking on a line chart

后端 未结 6 1420
既然无缘
既然无缘 2020-12-29 07:25

I am building a line chart and I would like, when I click on a point of the line, to display a popup containing some data about this point. The issue I try to resolve is to

6条回答
  •  别那么骄傲
    2020-12-29 07:50

    According to the docs, event.point holds a pointer to the nearest point on the graph.

    So I'd write the event.point to the console, and see what's available.

    console.log(event.point);
    

    From the docs:

    click: Fires when the series is clicked. The this keyword refers to the series object itself. One parameter, event, is passed to the function. This contains common event information based on jQuery or MooTools depending on which library is used as the base for Highcharts. Additionally, event.point holds a pointer to the nearest point on the graph.

    Example based on the example from the docs: http://jsfiddle.net/5nTYd/

    Click a point, and check the console.

提交回复
热议问题