PDA

View Full Version : [Charts] Two labels for a single series



Pomar1
5 Feb 2014, 4:06 AM
I am wondering if it is possible to apply two labels for a single series in a pie chart. Lets assume I've got a model:



Ext.define('Model', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'value', type: 'int'}
]
});


I put these into a Store and generate a 'pie' Chart upon this Store. Would that be possible to have the 'name' of Model written outsite ('outside') the chart, and 'value' written inside ('rotate') at the same moment?

I tried putting an array of objects as a label, like that:



label: [
{
field: 'name',
display: 'outside'
},
{
field: 'value',
display: 'rotate'
}
]


But that does not seem to work. Any ideas how I can combine two labels into a single chart series?

scottmartin
6 Feb 2014, 12:38 PM
So you want the normal label inside each slice and also a callout label on the outside of each slice?

Pomar1
6 Feb 2014, 12:44 PM
Exactly. The fact is - I managed to do this using two series, but it looks somehow untidy in the code.

scottmartin
6 Feb 2014, 12:59 PM
Yeah ... I think it would be easy to override the pie chart to allow an array of label objects, but your approach will suffice.

Scott.