Highstock Flags系列与堆叠数据

时间:2015-06-25 17:55:52

标签: highcharts highstock

如果您尝试将堆叠系列与旗帜系列组合在一起,则会出现奇怪的行为,其中仅绘制旗帜系列。如果您在图例中切换它,则所有内容都会正确绘制。

http://jsfiddle.net/x9gaca75/

$("#container").highcharts({plotOptions: {series: {stacking: "normal"}}, ...});

我缺少哪些配置才能使其正常运行?

1 个答案:

答案 0 :(得分:1)

There is a bug in Highstock, where setting plotOptions.series.stacking will set the same for flags. Of course, stacking won't work for flags since those don't have values. In other words, workaround is to set stacking = false for flags:

    options.series.push({
        "stacking": false,  // disable stacking
        "show_in_legend": false,
        "name": "Flags",
        "type": "flags",
        "data": [{
            "x": 1432215000000.0,
            "title": "AM"
        }, {
            "x": 1432229400000.0,
            "title": "Midday"
        }, {
            "x": 1432245600000.0,
            "title": "Peak Hour"
        }, {
            "x": 1432247400000.0,
            "title": "Rolling, PM"
        }]
    });

Demo: http://jsfiddle.net/x9gaca75/1/