PDA

View Full Version : Adding renderer to pie chart obliterates shadow



michaelsanford
5 Jul 2013, 8:01 AM
Our back-end reporting mechanism generates data series that often contain zero values. To prevent showing dangling slice labels in pie charts, I've implemented scottmartin's solution of defining a custom renderer (http://www.sencha.com/forum/showthread.php?218651-hide-pie-chart-slices-with-0-value), within our series generator, like so:

renderer: function(sprite, record, attributes, index, store) {
// Remove labels for pie slices with zero values
if (this.type == "pie" && record.data.value === 0) { record.data.label = ''; }
}

This has, however, obliterated the pie chart contours and shadow. Before and after as attachments.

I have tried adding the shadow: true property to the chart configuration to no avail.

How can I get these back? Using ExtJS 4.1.0

slemmon
8 Jul 2013, 11:54 AM
You'll need to return the attributes object from the renderer.



renderer: function (sprite, record, attributes, index, store) {
if (record.data.data === 0) {
record.data.name = '';
}
return attributes;
}

ithompson
7 Sep 2018, 2:15 PM
You'll need to return the attributes object from the renderer.



renderer: function (sprite, record, attributes, index, store) {
if (record.data.data === 0) {
record.data.name = '';
}
return attributes;
}


Lifesaver!