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

Display Quantity on Pie Chart and Name on Label

2 Answers 70 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Iris
Top achievements
Rank 1
Iris asked on 05 Jun 2013, 08:05 AM
I would like to create a pie chart just like the one here: http://demos.telerik.com/reporting/product-line-sales/demo.aspx
However, disappointingly, the video tutorial decided to skip the pie chart.

I want to display a pie chart with ProductName listed on the series, while Quantity is displayed on the chart. I am using a sqldatasource.

This is a sample of my data:

===============================
ProductName                      Quantity
===============================
Crips                                     12
Coke                                      7
Candy Bar                              57

I've got so far as displaying the chart and listing ProductName on legend. However, instead of having the Quantity displayed on the chart like in the demo sample above, the ProductName was displayed instead.

This is the code for my chart:

this.chart3.BitmapResolution = 96F;
this.chart3.ChartTitle.Appearance.Visible = false;
this.chart3.ChartTitle.Visible = false;
this.chart3.DataSource = this.sqlDataSource1;
this.chart3.DefaultType = Telerik.Reporting.Charting.ChartSeriesType.Pie;
this.chart3.ImageFormat = System.Drawing.Imaging.ImageFormat.Emf;
this.chart3.IntelligentLabelsEnabled = true;
this.chart3.Legend.Appearance.Border.Visible = false;
this.chart3.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.1000000610947609D), Telerik.Reporting.Drawing.Unit.Inch(0.20000012218952179D));
this.chart3.Name = "chart3";
this.chart3.PlotArea.XAxis.MinValue = 1D;
chartSeries1.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
chartSeries1.DataLabelsColumn = "ProductName";
chartSeries1.DataYColumn = "Quantity";
chartSeries1.Name = "Series 1";
chartSeries1.Type = Telerik.Reporting.Charting.ChartSeriesType.Pie;
this.chart3.Series.AddRange(new Telerik.Reporting.Charting.ChartSeries[] {
chartSeries1});
this.chart3.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(5.0000004768371582D), Telerik.Reporting.Drawing.Unit.Inch(2.8999998569488525D));


Can anyone tell me how to produce the pie chart like the one in the demo sample?

I refuse to believe that I'll have to data bind the chart to generic object list as mentioned by the last reply in this thread (http://www.telerik.com/community/forums/reporting/telerik-reporting/pie-chart-with-value-displayed.aspx) just to achieve this simple functionality.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Squall
Top achievements
Rank 1
answered on 07 Jun 2013, 04:50 PM
The demo is created with graph item not with a chart item.  For this requirement you have to use the graph item.

SN
0
Iris
Top achievements
Rank 1
answered on 11 Jun 2013, 07:30 AM
Thank you Squall.

I'm such an idiot!
Tags
General Discussions
Asked by
Iris
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Iris
Top achievements
Rank 1
Share this question
or