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

Pie Chart labels

8 Answers 487 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Renaud
Top achievements
Rank 1
Renaud asked on 08 Nov 2011, 03:58 PM
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.

8 Answers, 1 is accepted

Sort by
0
Renaud
Top achievements
Rank 1
answered on 10 Nov 2011, 09:51 AM
Up ;)
0
SOFIE
Top achievements
Rank 1
answered on 10 Nov 2011, 11:36 AM
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,

0
Giuseppe
Telerik team
answered on 10 Nov 2011, 12:49 PM
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 >>

0
SOFIE
Top achievements
Rank 1
answered on 10 Nov 2011, 01:10 PM
Thank you very much !
0
Brian
Top achievements
Rank 1
answered on 29 Mar 2012, 04:15 PM

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.

0
Bartholomeo Rocca
Top achievements
Rank 1
answered on 03 Apr 2012, 08:15 AM
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.
0
Nikituki
Top achievements
Rank 1
answered on 10 Apr 2012, 09:10 AM
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?

0
Giuseppe
Telerik team
answered on 12 Apr 2012, 11:57 AM
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 >>

Tags
ChartView
Asked by
Renaud
Top achievements
Rank 1
Answers by
Renaud
Top achievements
Rank 1
SOFIE
Top achievements
Rank 1
Giuseppe
Telerik team
Brian
Top achievements
Rank 1
Bartholomeo Rocca
Top achievements
Rank 1
Nikituki
Top achievements
Rank 1
Share this question
or