PDA

View Full Version : Column and Area Chart color and legend problem



rebeccapeltz
20 May 2011, 1:57 PM
The column and area chart are using the first color in the color array instead of the colors corresponding to their position in the series. This is reflected in both the fill color of the series and the color of the series in the legend. I stepped through the source and could see that for column and area, the index use to color the legend is always 0 for column and area charts.

If I modified source for create legend to use the index of the series instead of 0, it messes up the colors of the legend for the stacked chart.
I think the problem is farther up though because the series colors are incorrect too.

from line 40877



chart.series.each(function(series, i) {
if (series.showInLegend) {
Ext.each([].concat(series.yField), function(field, j) {
item = Ext.create('Ext.chart.LegendItem', {
legend: this,
series: series,
surface: chart.surface,
yFieldIndex: i //j IF I SUB I for J it corrects column legend but ruin stacked legend
});




chart.series.each(function(series, i) {
if (series.showInLegend) {
Ext.each([].concat(series.yField), function(field, j) {
item = Ext.create('Ext.chart.LegendItem', {
legend: this,
series: series,
surface: chart.surface,
yFieldIndex: j //j BECKY
});

elian83
13 Jul 2011, 10:53 AM
I found a workaround to the legend color problem. I don't know if it is the best but it works.

In ext-all.js you have to replace:
fill:l.getLegendColor(i)

To:
fill:g("style")['fill']

You also have to apply a fill style to your column:
style: {
fill: '#456d9f'
}

I hope this solve your problem.

Elian.