如何在 Highcharts 中以编程方式 select 多个点或标记?

How to select multiple points or markers programmatically in Highcharts?

如何在 Highcharts 的默认情况下以编程方式 select 多个点或标记,如 Shift + 单击图表?

您可以使用 Point.select 函数以编程方式 select 多个点,并将 accumulate 设置为 true。函数签名是 (API):

select ([Boolean select], [Boolean accumulate])

select: Boolean. When true, the point is selected. When false, the point is unselected. When null or undefined, the selection state is toggled.

accumulate: Boolean. When true, the selection is added to other selected points. When false, other selected points are deselected. Internally in Highcharts,selected points are accumulated on Control, Shift or Cmd clicking the point.

您的代码示例如下:

chart.series[0].data[0].select(true, true);
chart.series[0].data[1].select(true, true);
// ...

参见 this JSFiddle demonstration 它如何 select 几点。