繁体   English   中英

工具提示中y轴值之间的高位图变化(%)

[英]Highcharts variation (%) between yaxis values in tooltip

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

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

希望能帮助到你。

这是我的图表选项:

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: []
}

感谢您的帮助,我非常感谢。

看他们如何做然后尝试?

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

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

演示

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM