Flot 0.8.2折线图 - 颜色错误 [英] Flot 0.8.2 Line Chart - Color Bug

查看:318
本文介绍了Flot 0.8.2折线图 - 颜色错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Flot折线图并设置其颜色。我发现一个奇怪的bug。在前3种颜色之后,绘图使用所有其他线的最后一种颜色。这不是正确的行为。

I was working with Flot line charts and setting their colors. I found an odd bug. After the first 3 colors, the plot uses the last color for all of the other lines. This is not the correct behavior.

更令人感兴趣的是图例显示的颜色正确。这是已知的错误?

What makes this even more interesting is that the legend displays the correct colors. Is this a known bug?

var dataSet = [
        {label: "d1", data: demand},
        {label: "d2", data: demand2},
        {label: "d3", data: demand3},
        {label: "d4", data: demand4},
        {label: "d5", data: demand5},
        {label: "d6", data: demand6}
    ]

$.plot(placeholder2, dataSet, {
    series: { 

    },
    legend: {
        noColumns: 0,
        position: "nw"
    },
    colors:["#2980B9","#D35400","#F39C12","#7F8CFF","#C0392B","#7F8C8D"]
});

只是为了确保我不会疯了, ,但删除了颜色规格。你会看到,即使使用Flot的默认颜色,最后一个颜色stick。

Just to make sure that I wasn't going crazy, and to confirm, I tried the code again, but removed the colors specification. You'll see that even with Flot's default colors, the last color "sticks".

推荐答案

>

看起来这个错误是我设置代码的结果。当我删除系列:{}代码,它似乎工作正常。

Looks like the bug was a result of how I had the code setup. When I removed the series:{} code, it seems to work correctly.

错误可能是我的错,但这种重复的行为可能需要调查

The bug may be my fault, but that kind of repetitive behavior might need to be looked into.

$.plot(placeholder2, dataSet, {
    legend: {
        noColumns: 0,
        position: "nw"
    },
    colors:["#2980B9","#D35400","#F39C12","#7F8CFF","#C0392B","#7F8C8D"]
});

这篇关于Flot 0.8.2折线图 - 颜色错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆