PDA

View Full Version : Does extjs chart renderer have any information about hidden sprite?



usavahe
21 Jul 2014, 10:06 AM
I am working with chart series to customize my mixed type chart colors.

I know that I can do the following to set the color of my chart:


{
type: 'some_type',
axis: 'left',
xField: xfield,
yField: yfield.
renderer: function(sprite, rec, attr, ind, s)
{
// some logic to show for different color codes?
// i.e. 2 columns i want one red another blue
var ccol = ['#f00', '#0f0'];
var each = ind % ccol.length;


return Ext.apply(attr, { fill: ccol[each] });
}
}


When I have i.e. 2 columns in my column series based on index in the renderer I know which color exactly to set to which column.

NOW, the issue appears when I use legend to hide one of the columns. Even though now there is only one column showing, I still see to different colors on the chart. This happens because the renderer still gives me data for 2 columns :-?

I NEED A WAY OF KNOWING IN THE RENDERER that one series is hidden or certain sprites are hidden, so that I can apply only one color.

slemmon
29 Jul 2014, 10:34 AM
Hi,

There aren't any public properties / getters to see if the series is hidden, to get a list of its sprites, or to see if the sprite is hidden.

If you're comfortable going down the private properties route:
The second param of the renderer has a 'series' key which returns the current series and that may have a private seriesIsHidden property. Series also has an items array which has the sprites. Each sprite has a hidden attr property which may contain a 'hidden' property when hidden from view.