如何在Highcharts中使用plotOptions?

时间:2015-08-04 16:26:12

标签: javascript highcharts

我遇到的问题是我们传递的所有json都来自python,我们不能通过javascript发送这些东西。例如',我需要包含the tech from this question但显然在plotOptions中。我只是不确定如何做参考系列等等。所以上面这个系列的例子会很棒。我试过以下但是它没有用,因为this不是我所期望的那样。

     options.plotOptions = options.plotOptions || {};
    options.plotOptions.series = options.plotOptions.series || {};
    options.plotOptions.series.point =
        options.plotOptions.series.point || {};
    options.plotOptions.series.point.events =
        options.plotOptions.series.point.events || {};
    options.plotOptions.tooltip = {formatter: function() {
    var text = '';
    if(this.series.name == 'MSFT') {
        text = this.x + ': ' + this.series.name +
               '<br> $' + Highcharts.numberFormat(this.y, 0);
    } else {
        text = 'In ' + this.x + ' the median value was' + this.median +
               'and the total $' + Highcharts.numberFormat(this.y, 0);
    }
    return text;
    }
    options.plotOptions.series.point.events.click = function() {
        if (this.options.url){
           window.open(this.options.url);
        }
    }

0 个答案:

没有答案