Highcharts上的FillColor工作方式不同

时间:2013-05-14 17:13:32

标签: javascript highcharts

我要做的是根据某个颜色的特定颜色来填充它们的目标。它曾经工作,但由于某种原因不再是。我试图找出问题所在,但无法弄清楚:

    var seriesColor = "#000";
    preprocessData = function (divId, data, last, goal) {
        var nData = []; var symbol = "diamond"; var radius = 5;
        var colorGood = '#348017'; var colorBad = '#E42217'; var colorUse;
        for (var i = 0; i < data.length; i++) {
            if (data[i] <= goal[i]) { colorUse = colorGood; }
            else if (data[i] > goal[1] * 1.17) { colorUse = colorBad; }
            else { colorUse = '#FFE303'; }
            if((divId == "WebServItRun" || divId == "ISOServicesRun") && i == 9 ){
                symbol = "circle";
                radius = 10;
            }
            else if((divId == "WebServItRun" || divId == "ISOServicesRun") && i != 7){
                symbol = "diamond";
                radius = 5;
            }
            nData.push({
                y: data[i],
                x: i,
                color: colorUse,
                fillColor: colorUse,
                marker: {
                    symbol: symbol,
                    radius: radius
                }
            });
        }
        seriesColor = colorUse;
        return nData;
    };

然后在系列电话中:

    {
            type: 'spline',
            name: series2,
            data: preprocessData(divId, current, last, goal),
            color: seriesColor,
            marker: {
                symbol: 'diamond'
            }
        }

任何想法

1 个答案:

答案 0 :(得分:1)

如果您尝试设置标记的填充颜色,则fillColor声明需要位于标记对象内。

所以,这个:

        fillColor: colorUse,
        marker: {
            symbol: symbol,
            radius: radius
        }

应该是这样的:

    marker: {
        fillColor: colorUse,
        symbol: symbol,
        radius: radius
    }