Flotr2 两组数据的不同颜色

Flotr2 different colors for two sets of data

我已将正面和负面数据合并到一个名为 yAxis 的数据集(正面和负面的多列)。这是代码:

//...

var yAxis = [wololoTotalValues];
var xAxis = wololoTotalKeys;

window.onload = function () {
    Flotr.draw(document.getElementById("chart"), yAxis, {
        title: "wololo",
        bars: {
            show: true,
            barWidth: 0.8
        },
        yaxis: {
            min: 0,
            max: wololoMaxValue + 10,
            tickDecimals: 0
        },
        xaxis: {
            ticks: xAxis
        }
    });
};  

//...
<div id='chart' style="width:1200px;height:500px;"></div>

我希望 'bad' 和 'ble' 是红色的。我找到了一些手册如何用 flot 处理这个问题,但没有找到 flotr(flotr2)。

有什么方法可以像下面这样吗?或者我必须像 here?

这样拆分数据
colors: (yAxis[0-lastGood] : "#0000FF"), (yAxis[lastGood+1-lastBad] : "#FF0000")

好的,找到解决方案,将数据拆分为两个数组很有帮助。代码如下:

            var gud = [];
            for(i=0; i<wololoLengthGood; i++){
                gud.push([i, wololoValuesGood[i]]);
            }

            var bad = [];
            for(i=wololoLengthGood; i<wololoLengthGood+wololoLengthBad; i++){
                bad.push([i, wololoValuesBad[i-wololoLengthGood]]);
            }

            window.onload = function () {
                Flotr.draw(document.getElementById("chart"), 
                [{                         // replacement of 'yAxis' from here
                    data: gud,
                    color: "#0000FF"
                },{
                    data: bad,
                    color: "#FF0000"
                }],                        // till here.
                //...