简体   繁体   English

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

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

I have a really simple spline chart and I'm trying to show on each tooltip the variation between the selected point and the previous point's value, measured in percentage variation. 我有一个非常简单的样条图,我试图在每个工具提示上显示所选点和上一个点的值之间的变化(以百分比变化表示)。 Basically this is the tooltip format I want to show 基本上, 是我要显示的工具提示格式

I've been looking for a solution but the only thing I came up with was this . 我一直在寻找解决方案,但我唯一想到的就是这个

Hope it helps. 希望能帮助到你。

This are my chart options: 这是我的图表选项:

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

Thanks for the help, I really appreciate it. 感谢您的帮助,我非常感谢。

How about look how they do and then try ? 看他们如何做然后尝试?

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

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

demo 演示

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

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