代码之家  ›  专栏  ›  技术社区  ›  void

Highcharts流图Y轴标签

  •  1
  • void  · 技术社区  · 4 年前

    我使用的是Highcharts流图,除了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>
    0 回复  |  直到 4 年前
        1
  •  1
  •   ppotaczek    4 年前

    就是这样 streamgraph 系列作品,请查看官方示例: https://www.highcharts.com/demo/streamgraph -区域围绕中心轴移动,y轴不相关。

    请同时检查 streamStacker 模块源代码中的函数: https://code.highcharts.com/modules/streamgraph.src.js

    我建议你使用 areaspline 如果要使用y轴,请使用堆叠序列。

        chart: {
            type: 'areaspline'
        },
    
        plotOptions: {
            series: {
                stacking: 'normal'
            }
        },
    

    实例: http://jsfiddle.net/BlackLabel/o4drspjq/