Tutorial :In Flex, is it possible to place a label on a chart



Question:

In flex, how to add a label on a chart? I need to display some thing on the chart.


Solution:1

Yes, you can.

We might need to know what kind of label you want to put and what type of chart you are using.

If you look at the Language Reference for Pie Chart (for example) you will find an example at the bottom of the screen where you can see labels.

The "labelFunction" property is used to define the string to display for each value.
The "labelPosition" allows you to choose where the labels should be placed. As you can see in the documentation of PieSeries, the different values are the following :

"none" - Do not draw labels.
"outside" - Draw labels around the boundary of the pie.
"callout" - Draw labels in two vertical stacks on either side of the pie. The pie is shrunk if necessary to make room for the labels (see maxLabelRadius). Draw key lines from each label to the associated wedge. Shrink labels as necessary to fit the space provided.
"inside" - Draw labels inside the chart, centered approximately seven tenths of the way along each wedge. Shrink labels to ensure that they do not interfere with each other. If labels are shrunk below the calloutPointSize property, remove them. When two labels overlap, Flex gives priority to labels for larger slices.
"insideWithCallout" - Draw labels inside the pie, but if labels are shrunk below a legible size, Flex converts them to callouts.

Of course, this example is only for PieChart, I can't be more helpful unless you tell us what you exactly want to do.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »