Pie Chart labels

9 posts, 0 answers
  1. Renaud
    Renaud avatar
    4 posts
    Member since:
    Aug 2010

    Posted 08 Nov 2011 Link to this post

    Hi,

    First of all, I would like to congratule you on this decision to redo the charting system. We are developing on several plateform using your framework and we have done quite some work using your RadChart control. We have tested the new charting kit and we are already impressed by the easyness + performance of it. Good job already.

    Alright my question is simple:

    I have an object with two properties:
    - int Count
    - string Label

    I am binding a list of these objects to a pie chart and it works perfectly. Now, the only problem is that I see a purcentage (%) value as label in the pie. How can I tell the chart to use the string Label instead of displaying the % value ?

    Thanks,

    R.
  2. Renaud
    Renaud avatar
    4 posts
    Member since:
    Aug 2010

    Posted 10 Nov 2011 Link to this post

    Up ;)
  3. DevCraft banner
  4. SOFIE
    SOFIE avatar
    4 posts
    Member since:
    Mar 2011

    Posted 10 Nov 2011 Link to this post

    Hi telerik,

    As Renaud said, we are enjoying as well that charting kit for its easy to use approach ... It promises a lot of good things !

    Regarding the pie chart problem from the previous post, we experienced the same issue: how can we replace these numbers by a label ? We could live with a legend too but I guess this is not implemented yet ?

    Regards,

  5. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 10 Nov 2011 Link to this post

    Hello there,

    Indeed built-in ChartLegend has not been implemented yet but you can achieve the desired effect like this:
    <telerik:RadPieChart Palette="Metro">
        <telerik:PieSeries ValueBinding="Value" ItemsSource="{Binding Data}">
            <telerik:PieSeries.LabelDefinitions>
                <telerik:ChartSeriesLabelDefinition>
                    <telerik:ChartSeriesLabelDefinition.Binding>
                        <telerik:PropertyNameDataPointBinding PropertyName="Label" />
                    </telerik:ChartSeriesLabelDefinition.Binding>
                </telerik:ChartSeriesLabelDefinition>
            </telerik:PieSeries.LabelDefinitions>
     
            <!-- This equivalent syntax will work for Q3 (added TypeConverter) -->
            <!--<telerik:PieSeries.LabelDefinitions>
                <telerik:ChartSeriesLabelDefinition Binding="Label" />
            </telerik:PieSeries.LabelDefinitions>-->
        </telerik:PieSeries>
    </telerik:RadPieChart>

    Hope this helps.


    Kind regards,
    Giuseppe
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. SOFIE
    SOFIE avatar
    4 posts
    Member since:
    Mar 2011

    Posted 10 Nov 2011 Link to this post

    Thank you very much !
  7. Brian
    Brian avatar
    73 posts
    Member since:
    Sep 2010

    Posted 29 Mar 2012 Link to this post

    Is it possible to set the LabelDefinitions programmatically?  There is not setter for the property.

    I am adding a ScatterLineSeries in the code behind and need to set the LabelDefinitions property to a ChartSeriesLabelDefinition with a property binding.

    Tks.

  8. Bartholomeo Rocca
    Bartholomeo Rocca avatar
    247 posts
    Member since:
    May 2006

    Posted 03 Apr 2012 Link to this post

    Hello Brian,

    You can set LabelDefinition programmatically like this:
    var vm = new ViewModel();
     
    PieSeries series = new PieSeries();
     
    ChartSeriesLabelDefinition labelDefinition = new ChartSeriesLabelDefinition();
    labelDefinition.Binding = new PropertyNameDataPointBinding("Category");
    series.LabelDefinitions.Add(labelDefinition);
     
    series.ValueBinding = new PropertyNameDataPointBinding("Value");
    series.ItemsSource = vm.Data;
     
    RadPieChart chart = new RadPieChart();
    chart.Series.Add(series);
     
    this.LayoutRoot.Children.Add(chart);


    Greetings,
    Bart.
  9. Nikituki
    Nikituki avatar
    34 posts
    Member since:
    Nov 2011

    Posted 10 Apr 2012 Link to this post

    Hello,

    I'm using RadPieChart with xaml like this
    <telerik:RadPieChart x:Name="PieChart" Palette="Metro" Loaded="PieChart_Loaded" Unloaded="PieChart_Unloaded"  >
                <telerik:PieSeries RadiusFactor="0.77">
                    <telerik:PieSeries.LabelDefinitions>
                        <telerik:ChartSeriesLabelDefinition Margin="-30,0,0,0" />
                    </telerik:PieSeries.LabelDefinitions>
                    <telerik:PieSeries.AngleRange>
                        <telerik:AngleRange StartAngle="270" SweepAngle="360" />
                    </telerik:PieSeries.AngleRange>
                </telerik:PieSeries>
            </telerik:RadPieChart>

    And fill it with PieDataPoints. But when the values ​​are close, I have a labels overlap, like at attached image.
    How can I escape this?

  10. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 12 Apr 2012 Link to this post

    Hello Nikituki,

    The current version of RadChartView does not provide support for "smart" series item labels feature (i.e. automatic arrangement of the item labels so that none of them overlap) -- we have logged this feature request in our public issue tracking system here and will forward your feedback to our developers for further consideration.

    One possible option and extension point (albeit quite complex) is to use the approach outlined in response to your forum thread here i.e. implement custom ChartSeriesLabelStrategy on your own with the respective algorithm for arranging the pie labels so that they do not overlap.


    Kind regards,
    Giuseppe
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner