Hello Tobias,
Each new Chart Serie added to the Chart Area creates new Pie Chart. To be able to show single Chart you should create one ChartSerie and add as much items as you need to be displayed - each ChartSeriesItem will be new Pie's slice.
The following code sample demonstrates how to create Pie Chart from a DataTable as datasource:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim table As New DataTable()
table.Columns.Add(New DataColumn("Value", GetType(Integer)))
table.Columns.Add(New DataColumn("Name", GetType(String)))
table.Rows.Add(New Object() { 10, "A" })
table.Rows.Add(New Object() { 20, "B"})
table.Rows.Add(New Object() { 30, "C"})
Dim chartSeries1 As New ChartSeries()
chartSeries1.DataYColumn = "Value"
chartSeries1.DefaultLabelValue = "#Y%"
chartSeries1.Type = Telerik.Charting.ChartSeriesType.Pie
chartSeries1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels
RadChart1.AddChartSeries(chartSeries1)
RadChart1.DataSource = table
RadChart1.DataBind()
End Sub
Protected Sub RadChart1_ItemDataBound(ByVal sender As Object, ByVal e As ChartItemDataBoundEventArgs)
e.SeriesItem.Name = (CType(e.DataItem, DataRowView))("Name").ToString()
End Sub
To set custom Name for the SeriesItems in Legend as in the
demo mentioned by you , the
ItemDataBound event of the Chart is handled and the "Name" property is set as SeriesItem.Name.
Greetings,
Evgenia
the Telerik team