How to change data point color of Birt line chart for those points which are below marker line through script

时间:2019-01-15 18:20:58

标签: charts birt

I am using Birt line chart where I want to achieve something like this How to format series labels of a BIRT chart by script I want to show the points which are below marker line in red color just like this link has mentioned.

1 个答案:

答案 0 :(得分:0)

修改fillColor中的marker。 代码段:

beforeGeneration: function(options)
{
    var throughTargetPercent = this.getReportVariable("through_target_percent"); 

    for(var i = 0 ; i < options.series.length ; i++){
        var data = options.series[i].data;
        var len = data.length;
        for (var j=0; j < len; j++){
             if(data[j].y < throughTargetPercent) {
                data[j]= {
                    y: data[j].y,
                    marker: {
                        fillColor: "yellow" 
                    }
                }
            }
        } 
    }
},

希望有帮助!