Adding legend for conditional coloring
AnsweredHi,
I'd like to be able to add a legend for the conditional coloring I am using in my widget i.e. something like this:
Where I can specify what every color means.
Does anyone know how to implement this?
-
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.
Comments
4 comments