2012-12-11 73 views
2

我有一個非常簡單的樣條圖,我試圖在每個工具提示上顯示選定點與先前點的值之間的變化,以百分比變化度量。基本上this是提示格式我想要展示工具提示中的yaxis值之間的高度變化(%)

我一直在尋找一個解決方案,但我想出的唯一的事情就是this

希望它有幫助。

這是我的圖表選項:

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

感謝您的幫助,我真的很感激。

+0

有什麼錯誤? –

回答

0

怎麼樣看他們如何做,然後嘗試?

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

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

demo