Adding legend for conditional coloring

Answered

Comments

1 comment

  • Avatar
    Lidor Rosencovich

    Hi Alina,

    In order to do so, you can use the following widget script example and apply it to your chart.

    It basically adds 3 more invisible series with a name and a color - the legend will be shown with the same names and colors and you won't see additional series on your chart.

    widget.on('beforeviewloaded', function(sender, ev){ 
    // define your titles and colors to be added to the legend
    var legends = [
    {name:"LAGS STANDARD", color:"#fc7570"},
    {name:"MEETS STANDARD", color: "#00a808"},
    {name:"LEADS STANDARD", color: "#ffff01"}
    ]

    _.each(legends, function(val){
    ev.options.series.push(
    {
    name: val.name,
    color: val.color,
    visible: false
    }
    );
    });
    });

    Regards,

    Lidor

Please sign in to leave a comment.