2

我有一个非常简单的样条图,我试图在每个工具提示上显示所选点与前一个点的值之间的变化,以百分比变化衡量。基本上是我要展示的工具提示格式

我一直在寻找解决方案,但我想出的唯一方法就是这个

希望能帮助到你。

这是我的图表选项:

GeneralChartOptions = {

    chart: {
        renderTo: 'dummycontainer',
        type: 'spline',
        zoomType: 'x',
        spacingRight: 20
    },
    credits: {
        enabled: false
    },
    title: {
        text: ''
    },
    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            month: '%b \'%y',
            year: '%b'
        }
    },
    yAxis: {
        title: {
            text: ''
        },
        plotLines: []
    },
    tooltip: {
        xDateFormat: '%m-%Y',
        shared: true, 
        crosshairs: true,
    },
    exporting: {
        enabled: false
    },
    labels: {
       formatter: function() {
          return Highcharts.numberFormat(this.value, 2,".",",");

       }
    },
    series: []
}

感谢您的帮助,我真的很感激。

4

1 回答 1

0

看看他们是怎么做的然后试试怎么样?

tooltip: {
    pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.change}%)<br/>',
    valueDecimals: 2
},

plotOptions: {
    series: {
        compare: 'percent'
    }
}

演示

于 2012-12-11T23:34:49.807 回答