Hi Telerik team,
For the pie chart, I saw that Telerik tools that have smart labels(refer to the attachment with the red color box), there are few features like draw connecting line and labels border, sync labels border color and line color. But I can't find it in the property of visual studio for chartView, please advise. Is it need to write back end coding instead of using property to use those features?
Apart from that, the label(refer to left red color box of attachment) show in my pie chart is by percentage(%) but the label show in Telerik is in character for each categories, may I know how to set it?
Best regards,
Nicholas
For the pie chart, I saw that Telerik tools that have smart labels(refer to the attachment with the red color box), there are few features like draw connecting line and labels border, sync labels border color and line color. But I can't find it in the property of visual studio for chartView, please advise. Is it need to write back end coding instead of using property to use those features?
Apart from that, the label(refer to left red color box of attachment) show in my pie chart is by percentage(%) but the label show in Telerik is in character for each categories, may I know how to set it?
Best regards,
Nicholas
4 Answers, 1 is accepted
0
Hi Chai,
Thank you for writing.
You can use the properties of each series to enable the labels lines. You can use the Label property of each point to set the labels text. For example:
The borders and the labels text (in case you need to dynamically calculate a value used in the label) can be set in the LabelFormatting event.
In addition, the entire code of the SmartLabels example is available directly in the demo application (just click the tab with the desired language).
Please let me know if there is something else I can help you with.
Regards,
Dimitar
Telerik
Thank you for writing.
You can use the properties of each series to enable the labels lines. You can use the Label property of each point to set the labels text. For example:
this
.radChartView1.AreaType = ChartAreaType.Pie;
PieSeries series =
new
PieSeries();
series.DataPoints.Add(
new
PieDataPoint(50,
"Germany"
));
series.DataPoints.Add(
new
PieDataPoint(70,
"United States"
));
series.DataPoints.Add(
new
PieDataPoint(40,
"France"
));
series.DataPoints.Add(
new
PieDataPoint(25,
"United Kingdom"
) { Label =
"My Label"
});
series.ShowLabels =
true;
series.DrawLinesToLabels =
true
;
series.SyncLinesToLabelsColor =
true;
this
.radChartView1.ShowSmartLabels =
true
;
this
.radChartView1.Series.Add(series);
The borders and the labels text (in case you need to dynamically calculate a value used in the label) can be set in the LabelFormatting event.
In addition, the entire code of the SmartLabels example is available directly in the demo application (just click the tab with the desired language).
Please let me know if there is something else I can help you with.
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 05 Jan 2016, 02:27 PM
Dimitar, I've just tried to get the labels to display properly as you have described however I get the error attached?
0
Hello Jonh,
Thank for writing.
I am using C# in my previous post. The code, converted to Visual Basic looks like this:
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Thank for writing.
I am using C# in my previous post. The code, converted to Visual Basic looks like this:
Me
.RadChartView1.AreaType = ChartAreaType.Pie
Dim
series
As
New
PieSeries()
series.DataPoints.Add(
New
PieDataPoint(50,
"Germany"
))
series.DataPoints.Add(
New
PieDataPoint(70,
"United States"
))
series.DataPoints.Add(
New
PieDataPoint(40,
"France"
))
series.DataPoints.Add(
New PieDataPoint(25,
"United Kingdom"
)
With {.Label =
"My Label"
})
series.ShowLabels =
True
series.DrawLinesToLabels =
True
series.SyncLinesToLabelsColor =
True
Me
.RadChartView1.ShowSmartLabels =
True
Me
.RadChartView1.Series.Add(series)
Let me know if I can assist you further.
Regards,
Dimitar
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
John
Top achievements
Rank 1
answered on 06 Jan 2016, 05:42 PM
Thank you Dimitar, I should really start using C# :/