Amrita Thakur
Amrita Thakur

Reputation: 21

Display percentage on piechart in WPF

Hii

Can anyone tell me how can I show percentage on the piechart.... The percentage is seen on mouseover event but I dont know how to show the percentage on the piechart's slices....

Upvotes: 2

Views: 3941

Answers (4)

Kamran Aslam
Kamran Aslam

Reputation: 123

You can use labelFunction in mx:PieSeries, and lableFunction look like that

private function pieSeries_labelFunc(item:Object, field:String, index:Number, percentValue:Number):String 
{
    return StringUtil.substitute("{0} ({1}%)",item.description,percentValue.toFixed(1));
}

Where description is the label that you want to see. feel free to ask any question.

Upvotes: 0

Alan Mendelevich
Alan Mendelevich

Reputation: 3611

Take a look at amCharts Bundle for WPF. Pie chart supports labels on the slices, outside connected labels and includes an algorithm to prevent label overlapping.

Upvotes: 1

Wonko the Sane
Wonko the Sane

Reputation: 10823

If you are looking to put labels on the chart itself (instead of tooltip), take a look at this great blog post by WPF guru Bea Stollnitz.

It shows how to do this, in many different modes, and explains not only how, but why.

Upvotes: 1

ChrisF
ChrisF

Reputation: 137188

I've just followed this tutorial (just to make sure) and I get the percentages of each slice as tooltip on mouse over by default.

If you post your code we might be able to spot if there's a problem with it.

Upvotes: 0

Related Questions