PDA

View Full Version : Both slice's name and value in pie chart.



ElCondor1969
8 Mar 2013, 1:24 AM
Hello to all.
I have a pie chart and I would like, for each slice of the pie, that the label shows both the name of the slice and its value.
For example, in my case, the store that feeds the chart has two fields "Name" and "Value".
The amplitude of each slice is determined by the field "Value". The label of each slice is determined by the "Name" field.
In practice I have:


series:
[
{
type: 'pie',
angleField: 'Value',
...
label:
{
field: 'Name',
display: 'rotate',
contrast: true,
font: 'bold 14px Tahoma'
}
]


But doing so the label of each slice will only show the name of the slice, and I would like to have the value of the slice too (contained in the "Value").
From what I see, the field "field" in configuration object "label" may contain only the name of one field of the store.
How can I show both the name and value in slices?
Thank you in advance for your kind answers.
Bye!

mitchellsimoens
10 Mar 2013, 8:47 PM
Use the onCreateLabel method.

ElCondor1969
10 Mar 2013, 11:45 PM
Hi Mitchell!
Thank you very much for your kindly reply.
Ok, I'll use onCreateLabel method.
But I have still a little doubt. It is not a private method?
Can I rely on the existence of this method in the future?
Would not it be better that this method, or an equivalent, is at least protected?

Thank you very much in advance.
Bye.

Sergio.

mitchellsimoens
11 Mar 2013, 6:21 AM
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.chart.Label

Not private