簡體   English   中英

Highcharts 流圖 Y 軸標簽

[英]Highcharts streamgraph Y Axis Labels

我正在使用 Highcharts Stream 圖,一切正常,除了 yaxis 標簽出錯。 即使在示例頁面中,Y 軸也被平均分為兩部分,中點為零,所有其他標簽都相對於此。

我希望標簽呈現圖表上的實際值。

 Highcharts.chart('container', { chart: { type: 'streamgraph' }, legend: { enabled: false }, // Data parsed with olympic-medals.node.js series: [{ name: "Finland", data: [ 0, 11, 4, 3, 6, 0, 0, 6, 9, 7, 8, 10, 5, 5, 7, 9, 13, 7, 7, 6, 12, 7, 9, 5, 5 ] }, { name: "Austria", data: [ 0, 3, 4, 2, 4, 0, 0, 8, 8, 11, 6, 12, 11, 5, 6, 7, 1, 10, 21, 9, 17, 17, 23, 16, 17 ] }, { name: "Sweden", data: [ 0, 2, 5, 3, 7, 0, 0, 10, 4, 10, 7, 7, 8, 4, 2, 4, 8, 6, 4, 3, 3, 7, 14, 11, 15 ] }, { name: "Norway", data: [ 0, 17, 15, 10, 15, 0, 0, 10, 16, 4, 6, 15, 14, 12, 7, 10, 9, 5, 20, 26, 25, 25, 19, 23, 26 ] }] });
 <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/streamgraph.js"></script> <script src="https://code.highcharts.com/modules/series-label.js"></script> <script src="https://code.highcharts.com/modules/annotations.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/export-data.js"></script> <script src="https://code.highcharts.com/modules/accessibility.js"></script> <div id="container"></div>

這就是streamgraph系列的工作原理,請查看官方示例: https://www.highcharts.com/demo/streamgraph - 區域圍繞中心軸移位,y 軸不相關。

另請查看模塊源碼中的streamStacker function: https://code.highcharts.com/modules/streamgraph.src.js

如果您想使用 y 軸,我建議您使用帶有堆疊的areaspline系列。

    chart: {
        type: 'areaspline'
    },

    plotOptions: {
        series: {
            stacking: 'normal'
        }
    },

現場示例: http://jsfiddle.net/BlackLabel/o4drspjq/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM