This is a migrated thread and some comments may be shown as answers.

PieChart Examples

9 Answers 638 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 06 Aug 2012, 01:42 PM
Hey there,

I'm replacing your old Chart component with the new ChartView components. One of them is a pie chart and when I started replacing it a question appeared: How can I format the Label (I know of LabelFormat, but what are my options?). I have also found this site here (http://www.telerik.com/help/wpf/radchartview-series-pieseries.html) but the mentioned LabelTemplate is no longer there. I just want to give the Chart a ItemsSource where each object contains a count and a label, so that I can bind the Chart to it. I do not want to specify each datapoint in code, as you did in all your examples. I'm looking for a way to do this via databinding. Could you please provide an example of this? Perhaps you could extend the WPF Demos or the documentation too.

Best Regards,
Peter

9 Answers, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 09 Aug 2012, 07:58 AM
Hi Peter,

You find an attached project which demonstrates how to populate the pie chart through binding and how to retrieve the label from the underlying object. I hope this will meet your requirements. Regarding the documentation - our technical writers will do their best to make the the necessary changes to the topic.

Kind regards,
Rosko
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Peter
Top achievements
Rank 1
answered on 15 Aug 2012, 11:32 AM
Hi Rosko,

thank you for your example. I was able to recreate the Label-functionality. But some questions remain: Is there a way to use TrackBall with PieChart? I enabled it but there is just a small grey-bordered box in the upper left of my chart. All modifications to the series TrackBallTemplate and TrackBallInfoTemplate did not result in a change. I would really like to display a description of the currently selected slice of the chart there. How can I get the TrackBall to display data and how can I bind to - let's say ToolTip - property of my DataItem?

Thanks in advance,
Peter Schmidt
0
Petar Marchev
Telerik team
answered on 20 Aug 2012, 08:37 AM
Hello Peter,

We have not developed the TrackBall to work with PieSeries, because with the pie series there is no notion of a track. I suggest you consider using the ChartTooltipBehavior for this purpose. I have attached a modified version of the previous attachment to demonstrate how this can be done. 

Regards,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mike
Top achievements
Rank 2
answered on 27 Aug 2012, 12:59 PM
Hello, 



just found this thread after looking for a way to bind the Label to a dataitems property. Now this works great, but i was wondering if there is a way to have the Label showing my custom value AND the percentage.



Currently my XAML Looks like this:

<telerik:PieSeries ShowLabels="True" ItemsSource="{Binding ConsumptionByService}" ValueBinding="Summe" AllowSelect="True">

<telerik:PieSeries.LabelDefinitions>

<telerik:ChartSeriesLabelDefinition Margin="-8,0,0,0" Binding="FullName" />

</telerik:PieSeries.LabelDefinitions>

</telerik:PieSeries>



And the Label Display my property FullName. But i Need a Label in the Format "FullName" + xx%. How can i achieve this?

0
Petar Marchev
Telerik team
answered on 27 Aug 2012, 03:59 PM
Hello Michael,

The only way to achieve this is to introduce a new property in your underlying business object which formats the full name and the percentage:
public string ComplexLabel
{
 get { return string.Format("{0} {1:P2}", this.FullName, this.Value); }
}

Now you need to update the label definition binding:
<telerik:ChartSeriesLabelDefinition Binding="ComplexLabel" />

Greetings,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Mike
Top achievements
Rank 2
answered on 27 Aug 2012, 04:10 PM
Hi!



That way i have to calculate the percentage on my own. I just hoped, that there is an easier way.



But thanks a lot for the quick reponse!

0
Ricardo
Top achievements
Rank 2
answered on 14 Nov 2013, 01:41 AM
Perfect ! For who doesn't have legend
0
Darran
Top achievements
Rank 2
answered on 18 Mar 2015, 04:28 PM
Hi Rosko,

This still isn't available within the documentation or SDK browser - it's pretty fundamental so it would be good to get it added.

Cheers,
Darran
0
Martin Ivanov
Telerik team
answered on 20 Mar 2015, 09:56 AM
Hi Darran,

Thank you for your feedback. 

Actually the label's approach is applicable for all chartview's series and this is why we included a common article in the chat's help documentation called LabelDefinition where the the definition is described. However, we will consider including an SDK example that demonstrates the LabelDefinitions of the series. 

Regards,
Martin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ChartView
Asked by
Peter
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Peter
Top achievements
Rank 1
Petar Marchev
Telerik team
Mike
Top achievements
Rank 2
Ricardo
Top achievements
Rank 2
Darran
Top achievements
Rank 2
Martin Ivanov
Telerik team
Share this question
or