PDA

View Full Version : Change legend color in chart



AlbertoMD
12 Sep 2013, 7:21 AM
I am using a renderer to change the series color, this.seriesColor is a variable where I assign the color I want for a series:


renderer: function (sprite, record, attr, index, store) {
return Ext.apply(attr, {
fill: this.seriesColor
});
}


Is it possible to change the legend color to show the same color as the series?

This is how the chart is shown

45779

Gary Schlosberg
14 Sep 2013, 11:55 AM
Yes, the legend should do that automatically. Here's an example:
http://docs.sencha.com/extjs/4.2.1/#!/example/charts/StackedBar.html

Looks like you are updating the series without updating the legend. Unfortunately putting a renderer on the legend isn't currently supported. I suppose you could override or rework how you are doing things. Why are you needing to set the series color yourself?

riku351
28 Oct 2013, 12:30 AM
Hi All,

I am facing the same issue of changing the color of legend items to that of series colors.

I need to change the renderer of each series and there I am putting my custom color as it is coming from service layer.

Each series is associated with a specific color code, which has some importance to business users.So changing the default color code to the color code coming from service layer is needed.

But there should be some other way of changing the legend color as well.


Please provide some idea/suggestions to accomplish this.


Thanks
Prasanna

riku351
28 Oct 2013, 12:33 AM
Forgot to attach screen-shot46586