0

我正在尝试做的是根据它对目标的执行情况,用某种颜色填充单个符号。它曾经有效,但由于某种原因不再有效。我试图找出问题所在,但无法弄清楚:

    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'
            }
        }

任何想法

4

1 回答 1

1

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

所以这:

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

应该是这样的:

    marker: {
        fillColor: colorUse,
        symbol: symbol,
        radius: radius
    }
于 2013-05-14T18:43:56.690 回答