Highcharts会像选择一样选择

RaS*_*She 1 javascript jquery highcharts

我想进行自定义选择,选择我想让选择图层指向图像: 在此输入图像描述

chart: {
            events: {
                selection: function (event) {
                   event.preventDefault();
                   event.xAxis[0].axis.chart.series[0].points.forEach(function (point) {
                             point.select(true, true);
                   })
                }
            },
            zoomType: 'x'
        },
Run Code Online (Sandbox Code Playgroud)

示例在这里,但我刚刚选择了这些点.

mor*_*ree 5

您可以创建一个与选择填充完全相同的绘图带.

selection: function (e) {
               e.preventDefault();
               var axis = this.xAxis[0];

               axis.removePlotBand('selection-plot-band');

               axis.addPlotBand({
                color: Highcharts.color('#335cad').setOpacity(0.25).get() //use Highcharts.Color in version 4,
                from: e.xAxis[0].min,
                to: e.xAxis[0].max,
                id: 'selection-plot-band',
                zIndex: 6
               });
            }
Run Code Online (Sandbox Code Playgroud)

例如:http://jsfiddle.net/L8nbapeu/1/