Flot:堆积折线图错误 - 点重叠

时间:2014-01-28 21:16:29

标签: charts flot stacked-area-chart

创建面积图(堆叠+填充折线图)时,点与填充颜色重叠。

我创建了一个示例来演示此错误:http://jsfiddle.net/d3bpD/

绘制图表选项:

var options = {
    series: { stack: true },
    lines: {
        fill: 1,
        show: true
    },
    points: { show: true }
};

这可能是一种可行的解决方法吗?

1 个答案:

答案 0 :(得分:1)

看起来像flot如何填充堆栈插件的错误。我可以想到的唯一快速解决方案是在不深入挖掘源代码的情况下,将数据复制到每组数据的两个系列中。第一个绘制线条并填充,第二个绘制顶部的点:

someData = [[1, 3],
            [2, 16],
            [3, 3],
            [4, 3],
            [5, 8],
            [6, 12],
            [7, 3]];

var dataset = [
    {color: "#edc240", data: someData, stack: 1, lines: {fill: 1, show: true}, points: {show: false}}, 
    {color: "#afd8f8", data: someData, stack: 1, lines: {fill: 1, show: true}, points: {show: false}},
    {color: "#cb4b4b", data: someData, stack: 1, lines: {fill: 1, show: true}, points: {show: false}},
    {color: "#4da74d", data: someData, stack: 1, lines: {fill: 1, show: true}, points: {show: false}},
    {color: "#edc240", data: someData, stack: 2, lines: {show: false}, points: {show: true}}, 
    {color: "#afd8f8", data: someData, stack: 2, lines: {show: false}, points: {show: true}},
    {color: "#cb4b4b", data: someData, stack: 2, lines: {show: false}, points: {show: true}},
    {color: "#4da74d", data: someData, stack: 2, lines: {show: false}, points: {show: true}}
];

$.plot("#flot", dataset, {});

小提琴here

产地:

enter image description here