在highchart列上标记特定点

时间:2014-09-16 04:56:30

标签: javascript highcharts

我正在为营销团队创建高图,请查看:

http://jsfiddle.net/jyotipuri/kh5jY/5124/

$(function () {
    $('#container').highcharts({
        chart: {
          renderTo: 'container',
          events: {
            load: function () {
              Highcharts.updateMarketMarkers(this);
            },
            redraw: function () {
              Highcharts.updateMarketMarkers(this);
            }
          }
        },
        title: {
          text: null
        },
        xAxis: [
          {
            categories: ['North','South','East', 'West']
          }
        ],
        yAxis: [
          {
            title: null,
            labels: {enabled: false},
            stackLabels: {
              enabled: true,
              style: {
                fontWeight: 'bold',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
              }
            }
          },
          {
            title: null,
            labels: {enabled: false}
          }
        ],
        tooltip: false,
        plotOptions: {
          column: {
            pointPadding: 0,
            borderWidth: 0
          },
          series: {
            point: {
              events: {
                click: function () {
                  $scope.drillChart(this.category);
                }
              }
            }
          }
        },
        series: [
          {
            name: 'Jan',
            data: [23, 45, 24, 30],
            type: 'column'
          },
          {
            name: 'Feb',
            data: [50, 40, 25, 10],
            type: 'column'
          }
        ]
      });
});

此处的列显示了各个地区的销售情况,我需要能够在将作为销售目标的列上标出特定点,并且它将显示销售额达到目标。对于所有4个区域(NORTH,SOUTH,WEST,EAST),必须对两个列(1月,2月)进行标记。

1 个答案:

答案 0 :(得分:3)

你会如何标出这些分数?我认为你可以通过两种方式实现这一目标:

  • 使用包含low选项(或columnrange系列)的列系列:http://jsfiddle.net/kh5jY/5132/
  • 使用分散只是将标记放在这样的点上:http://jsfiddle.net/kh5jY/5133/

    {
        name: 'South target',
        data: [20, 20, 20, 20],
        zIndex: 10,
        pointPlacement: 0.15,
        type: 'scatter'
    }, {
        name: 'North target',
        data: [20, 20, 20, 20],
        zIndex: 10,
        pointPlacement: -0.15,
        type: 'scatter'
    }