Android: Customize pie chart labels


#1
Is there any way to do the following with pie chart labels in v1.2 for Android:
- show value:
* as percentage of series total
* as explicit numeric value

- define label position: 
* inside/outside plot area

- define label format:
* only label
* only value
* label + value

This is one of my use cases (rendered using Flot 0.8)


#2

Basically I am interested at the same question. @ptashek Does your legend only shows the values too?


#3

No Sebastian, my legend actually shows just the series labels (series name, without value). Same goes for the labels displayed on the chart.


#4

Hi ptashek

The pie chart labels display the x values of your data points, rendered as strings. So the easiest way to control the text in the labels is to supply the strings you require in the data itself.

Best regards

Robin Sillem


#5

Hi Robin,

Is this a limitation of the current Android library version that will be expanded, or is this the default and only approach in both the Android and iOS libraries?

The point being that this doesn’t really make much sense as-is. Any charting product I have come across in the past two decades uses Y values to build slice labels, and many support custom label formatters (either via callback function support, or out-of-the-box). The ones I have used most recently would be HighCharts (sample: http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/pie-gradient/) or Flot (as in my first post).

I think it’s one of the most basic properties of a pie chart that labels displayed in the legend should be entirely independent from the labels displayed on the pie slices. Think of it as “legend label”, “data label” and “data value”, so technically speaking a pie slice data point should comprise of those three values, where the “data label” can be either provided or inferred from “data value”.

regards, 

Lucas


#6

Hi Lucas,

No, this is a limitiation of the current Android library version, and ther relevant API will be brought iup to functional compatibility with the iOS version in due course. 

The iOS version offers the option for you to supply custom UILabels for the pie/donut slices, and you can supply a format string used to render the y value as a label string, as you describe. The Android API is likely to be different in detail, as we favour drawing labels over using TextViews and favour providing formatter objects over format strings, but we intend to provide broadly similar functionality on the 2 platforms.

Best regards,

Robin sillem