But those label items are positioned by using the Style methods setTop() and setLeft() using hardcoded numbers.
Now, whenever those texts change (eg. other language, other percentage with only 1 or 3 digits) how do I keep those LabelItems centered?
Can I use some setting to keep those label items centered?
If not, can I at least determine how long (in pixels) a word (eg. "Communication") will be in that font and font size?
To be able to calculate the parameter I need to pass to setLeft() that is.
Another question I have about the same pie chart:
when the percentage value changes, I perform this:
myChart.removeAllSeries(false);
Series series = createSeries().setPoints(createPoints());
myChart.addSeries(series);
The chart then shows the new percentage, but in completely other/random colors than the ones I set previously.
adding
myChart.setColors(mainColor, secondColor);
after
myChart.removeAllSeries(false);
doesn't help.
Why are my initial colors no more used? How to apply them again?
Also, I have to update the LabelItem showing the percentage value.
How do I do that?
Apparently, calling setLabelItems() again with the updated LabelItems doesn't seem to work...
Thanks in advance.
Last edit: zzynx 2012-09-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi(gh),
I'm using a PieChart to draw some kind of percentage gauge:
http://s17.postimage.org/shbx1bufj/SC_Screenshot_12_09_25_001.png
The texts in the center are the results of four LabelItem's:
But those label items are positioned by using the Style methods setTop() and setLeft() using hardcoded numbers.
Now, whenever those texts change (eg. other language, other percentage with only 1 or 3 digits) how do I keep those LabelItems centered?
Can I use some setting to keep those label items centered?
If not, can I at least determine how long (in pixels) a word (eg. "Communication") will be in that font and font size?
To be able to calculate the parameter I need to pass to setLeft() that is.
Another question I have about the same pie chart:
when the percentage value changes, I perform this:
with
The chart then shows the new percentage, but in completely other/random colors than the ones I set previously.
adding
myChart.setColors(mainColor, secondColor);
after
myChart.removeAllSeries(false);
doesn't help.
Why are my initial colors no more used? How to apply them again?
Also, I have to update the LabelItem showing the percentage value.
How do I do that?
Apparently, calling setLabelItems() again with the updated LabelItems doesn't seem to work...
Thanks in advance.
Last edit: zzynx 2012-09-26