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

Smart Label on Pie Chart

1 Answer 83 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Rupert Henson
Top achievements
Rank 1
Rupert Henson asked on 15 Mar 2010, 12:21 PM
Hi,

I'm using the latest release version (Q1 2010) but I'm having no luck in getting the item labels to avoid overlapping each other in the Pie Chart.

I notice that the telerik demo application does not really demonstrate Smart Labels for the piechart, as all the data items are nicely spaced numerically.....

I've included my simple example code (with just a plain RadChart named "RadChart1" in the XAML side of this).

The pie chart produced has the values for years 2005 and 2006 overlapping each other, but I thought that the new Smart Labels Enabled option would try its best to avoid this.

Regards,

Rupert.

Partial

 

Public Class MainPage

 

 

Inherits UserControl

 

 

Public Sub New()

 

InitializeComponent()

RadChart1.DefaultSeriesDefinition =

New PieSeriesDefinition()

 

RadChart1.DefaultView.ChartArea.SmartLabelsEnabled =

True

 

 

Dim s As New SeriesMapping()

 

s.ItemMappings.Add(

New ItemMapping("ValueY", DataPointMember.YValue))

 

s.ItemMappings.Add(

New ItemMapping("Category", DataPointMember.LegendLabel))

 

s.ItemMappings.Add(

New ItemMapping("Category", DataPointMember.Label))

 

RadChart1.SeriesMappings.Add(s)

 

Dim objDataSource As New List(Of CategoryValue)

 

objDataSource.Add(

New CategoryValue() With {.Category = "2005", .ValueY = 2})

 

objDataSource.Add(

New CategoryValue() With {.Category = "2006", .ValueY = 2})

 

objDataSource.Add(

New CategoryValue() With {.Category = "2007", .ValueY = 500})

 

RadChart1.ItemsSource = objDataSource

 

End Sub

 

End

 

Class

 

Public

 

Class CategoryValue

 

 

Private _Category As String

 

 

Private _ValueY As Double

 

 

Public Property Category() As String

 

 

Get

 

 

Return _Category

 

 

End Get

 

 

Set(ByVal value As String)

 

_Category = value

 

End Set

 

 

End Property

 

 

Public Property ValueY() As Double

 

 

Get

 

 

Return _ValueY

 

 

End Get

 

 

Set(ByVal value As Double)

 

_ValueY = value

 

End Set

 

 

End Property

 

End

 

Class

 

1 Answer, 1 is accepted

Sort by
0
Velin
Telerik team
answered on 17 Mar 2010, 10:55 AM
Hi Rupert Henson,

Currently, the automatic label positioning algorithm works with radial series only when spider mode is enabled. This behavior will probably be improved in the upcoming versions of the control.

Best wishes,
Velin
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items.
Tags
Chart
Asked by
Rupert Henson
Top achievements
Rank 1
Answers by
Velin
Telerik team
Share this question
or