PieChart Examples

10 posts, 0 answers
  1. Peter
    Peter avatar
    28 posts
    Member since:
    Oct 2006

    Posted 06 Aug 2012 Link to this post

    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
  2. Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 09 Aug 2012 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Peter
    Peter avatar
    28 posts
    Member since:
    Oct 2006

    Posted 15 Aug 2012 Link to this post

    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
  5. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 20 Aug 2012 Link to this post

    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.

  6. Mike
    Mike avatar
    39 posts
    Member since:
    May 2011

    Posted 27 Aug 2012 Link to this post

    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?

  7. Petar Marchev
    Admin
    Petar Marchev avatar
    968 posts

    Posted 27 Aug 2012 Link to this post

    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.

  8. Mike
    Mike avatar
    39 posts
    Member since:
    May 2011

    Posted 27 Aug 2012 Link to this post

    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!

  9. Ricardo
    Ricardo avatar
    1 posts
    Member since:
    Jan 2013

    Posted 13 Nov 2013 Link to this post

    Perfect ! For who doesn't have legend
  10. Darran
    Darran avatar
    5 posts
    Member since:
    Mar 2015

    Posted 18 Mar 2015 in reply to Rosko Link to this post

    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
  11. Martin
    Admin
    Martin avatar
    1101 posts

    Posted 20 Mar 2015 Link to this post

    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.

     
Back to Top
UI for WPF is Visual Studio 2017 Ready