颜色图取决于值

时间:2014-04-26 05:51:25

标签: plot highcharts

如果您在Highcharts中的值为<= 3,如何设置特定图表的颜色? I'm trying to apply here

jQuery("#container").highcharts({

    "chart": {
        "polar": true,
        "type": "line"
    },

    "title": {
        "text": "VIDA PESSOAL"          },

    "legend": {
        "enabled": false
    },

    "pane": {
        "size": "80%"
    },

    "xAxis": {
        "categories": ["fam\u00edlia\/amigos","moradia","sa\u00fade","dinheiro",
                       "crescimento pessoal","crescimento profissional","lazer"],
        "tickmarkPlacement": "on",
        "lineWidth": 0
    },

    "yAxis": {
        "tickInterval": 1,
        "min": 0,
        "max": 6
    },

    "plotOptions": {
        "line": {
            "lineWidth": 0
        },
        "series": {
            "animation": false,
            "color": "red"
        }
    },

    "series": [{
        "name": "Pontuação",
        "data": [2,1,5,3,1,3,3],
        "pointPlacement": 'on'
    }]

1 个答案:

答案 0 :(得分:0)

您可以迭代每个点并更新颜色。

    $.each(chart.series[0].data, function (i, data) {

        if (data.y < 3) data.update({
            color: 'green'
        }, false);

    });

    chart.isDirty = true;
    chart.redraw();

http://jsfiddle.net/6upMk/2/