Highchart HighStock Angular 2改变PlotOptions系列从百分比到价值比较

时间:2017-09-15 17:09:45

标签: angular typescript highcharts highstock

在HighStock中尝试添加切换按钮以查看绝对值和百分比变化。但是,this.chart.update似乎没有更新图表。

saveInstance(chartInstance) {
    this.chart = chartInstance;
    }
  prcentchg(){
    if(this.chart.options.plotOptions.series.compare !== 'percent'){
       this.chart.options.title.text = '====> Percent <===='
        this.chart.options.plotOptions.series.compare = 'percent';
        this.chart.options.tooltip.pointFormat = '<span style="color:
     {series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>'
        this.chart.update(this.chart.options)
        console.log(this.chart.series[0])
    }else {
        this.chart.options.title.text = '====> Absolute Value <===='
        this.chart.options.plotOptions.series.compare = 'value';
        this.chart.options.tooltip.pointFormat = '<span style="color:{series.color}">{point.y}</span>'
        this.chart.update(this.chart.options)
        console.log(this.chart)
    }

请参阅Plunker链接PLUNKER LINK

0 个答案:

没有答案