PDA

View Full Version : how work renderer with Ext.chart.series.Bar and stacked = true



Francois Lecroart
9 Mar 2011, 2:44 AM
I try to customize color of background in a chart bar with stacked option to true.
But i don't understand how work.
i take "StackedBar" exemple and add a


renderer: function () {
console.log(arguments);
return arguments[2];
}

but i don't understand what is index (arguments[3]) or why some time they are no record

resulte of firebug:

[Object { id="ext-sprite-1066", transformations=, more...}, Object { phantom=true, internalId="ext-record-61", more...}, Object { stroke-width=6, stroke-opacity=0.05, more...}, 0, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1067", transformations=, more...}, Object { phantom=true, internalId="ext-record-61", more...}, Object { stroke-width=4, stroke-opacity=0.1, more...}, 0, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1068", transformations=, more...}, Object { phantom=true, internalId="ext-record-61", more...}, Object { stroke-width=2, stroke-opacity=0.15, more...}, 0, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1069", transformations=, more...}, Object { phantom=true, internalId="ext-record-61", more...}, Object { fill="#94ae0a", height=48, more...}, 0, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1071", transformations=, more...}, Object { phantom=true, internalId="ext-record-62", more...}, Object { fill="#115fa6", height=48, more...}, 1, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1073", transformations=, more...}, Object { phantom=true, internalId="ext-record-63", more...}, Object { fill="#a61120", height=48, more...}, 2, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1075", transformations=, more...}, Object { phantom=true, internalId="ext-record-64", more...}, Object { fill="#ff8809", height=48, more...}, 3, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1077", transformations=, more...}, Object { phantom=true, internalId="ext-record-62", more...}, Object { stroke-width=6, stroke-opacity=0.05, more...}, 4, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1078", transformations=, more...}, Object { phantom=true, internalId="ext-record-62", more...}, Object { stroke-width=4, stroke-opacity=0.1, more...}, 4, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1079", transformations=, more...}, Object { phantom=true, internalId="ext-record-62", more...}, Object { stroke-width=2, stroke-opacity=0.15, more...}, 4, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1080", transformations=, more...}, undefined, Object { fill="#94ae0a", height=48, more...}, 4, Object { data={...}, events={...}, more...}]

[Object { id="ext-sprite-1082", transformations=, more...}, undefined, Object { fill="#115fa6", height=48, more...}, 5, Object { data={...}, events={...}, more...}]

...

texasbrian
24 May 2012, 9:30 AM
Using stacked bar as well...
I was trying to set the height of the bar based on the record.
Let's say I have 40 records. In the renderer, it seems that the first 40 index, the bar heights are properly set, then the renderer continues to execute 200 times in all, with the last 160 executions (index 40-200) having the record empty.

What is happening?

texasbrian
8 Jun 2012, 7:13 AM
So, I want to change to height of bars based on data, currently using approach below which seems to loop too many times and results are not desired. Should I be using different approach to accomplish this?

In bar series...

renderer: function(sprite, record, barAttr, index, store) {
//barAttr.height = 6;
// TODO Sets correctly, then is overwritten
//Why is the renderer called so many times with a null record?
if (record) {
if (record.get('normal') == 0) {
barAttr.height = 6;
} else {
barAttr.height = 2;
}
}

return barAttr;
}

Daniil
24 Feb 2014, 10:48 PM
Maybe, this helps.
http://www.sencha.com/forum/showthread.php?132968&p=1030821&viewfull=1#post1030821