【问题标题】:Color plots depending of value取决于值的颜色图
【发布时间】:2014-04-26 05:51:24
【问题描述】:

如果您在 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'
    }]

【问题讨论】:

    标签: plot highcharts


    【解决方案1】:

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

        $.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/

    【讨论】:

      猜你喜欢
      • 2021-05-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多