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

Pie chart issue

6 Answers 226 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Priya Priya
Top achievements
Rank 1
Priya Priya asked on 30 Sep 2009, 07:45 AM
hi!
      I have write below code in chart need datasource event for displaying pie chart..In pie chart I have get the data from xml...In pie chart each legend items  labels present in the format of item1, item2,item3...but I want description column  from xml as a label of each legend item...And also I want exploded a single slice from pie chart....can anyone help me? thanks....


 

string fileName = @"D:\text\jccantera\jccantera\jcc.xml";

 

 

var reader = new StreamReader(fileName);

 

 

XmlSerializer serializer = new XmlSerializer(typeof(NewDataSet));

 

 

var report = (NewDataSet)serializer.Deserialize(reader);

 

Telerik.Reporting.Processing.

Chart procChart = (Telerik.Reporting.Processing.Chart)sender;

 

 

DataSet ds = report;

 

procChart.DataSource = ds.Tables[

"BillItemLine"];

 

 

ChartSeries series = new ChartSeries();

 

 

series.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;

 

 

series.DataYColumn =

"ItemLineAmount";

 

 

series.Appearance.ShowLabelConnectors =

true;

 

 

series.DefaultLabelValue =

"#%";

 

 

 

series.Appearance.LabelAppearance.Distance =10;

series.Appearance.LabelAppearance.LabelConnectorStyle.Color = System.Drawing.

Color.CadetBlue;

 

series.Appearance.TextAppearance.TextProperties.Color = System.Drawing.

Color.Brown;

 

 

 

JCChart.Legend.Add(d);

 

JCChart.Series.Add(series);

 

procChart.DataSource = ds.Tables["BillItemLine"].DefaultView;

 

JCChart.DefaultType = Telerik.Reporting.Charting.

ChartSeriesType.Pie;

 

6 Answers, 1 is accepted

Sort by
0
Accepted
Steve
Telerik team
answered on 30 Sep 2009, 12:02 PM
Hi Priya Priya,

Please review the Chart documentation section which explains how to configure the legend items and set exploded property to a series item. Let us know if you are experiencing any specific problems during the implementation.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Priya Priya
Top achievements
Rank 1
answered on 01 Oct 2009, 04:20 AM
hi steve,

            thanks...I want any one of the single slice exploded from the pie chart  in telerik reporting need data source event. I did set exploded property is true..but I didn't get exploded pie chart....and also I want each description column value as a label of each legend item..but i get item1,item2....description column value is in xml file..can u help me?
0
Steve
Telerik team
answered on 05 Oct 2009, 02:13 PM
Hello Priya,

I believe the problem is coming from the fact that you set the DataSource property, which means that the items you've set in the report designer would be wiped out. You would have to manually traverse the data and set the needed properties in the NeedDataSource event, e.g.:

......
            ChartSeries s = chartDef.Series[0];
            s.Clear();
            s.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.ChartSeriesLegendDisplayMode.ItemLabels;
            foreach (DataRow row in table.Rows)
            {
                ChartSeriesItem item = new ChartSeriesItem();
                item.YValue = (double)row["Value"];
                item.Name = (string)row["DescriptionCol"];
                item.Appearance.Exploded = true;                
                s.Items.Add(item);
            }

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Priya Priya
Top achievements
Rank 1
answered on 07 Oct 2009, 04:02 AM
hi steve!

thank you very much..It is very helpful to me....




0
Mugdha Aditya
Top achievements
Rank 1
answered on 10 Mar 2010, 08:01 AM
Hello Can any 1 tell me which dll i need to download, to use pie chart in my simple asp.net web application.
and where i will get tht dll.
0
Branden
Top achievements
Rank 1
answered on 18 Jun 2012, 10:52 PM
I'm using the 2012 Q2 version of the standalone telerik report designer, and I'm trying to accomplish a similar task. Is it possible to set the labels of a pie chart legend to a property from my datasource?

I've seen people link to the Binding to generic lists , but this only offers a solution which programmatically sets the label in the code-behind. I need to do this in XML (aka the report designer). 


EDIT:

Answered my own question. Thanks to the great example that gets installed with reporting, I found that setting the "DataLabelsColumn" to my property fixed the issue. Just remember to have the "LegendDisplayMode=ItemLabels".

Thanks!
Tags
General Discussions
Asked by
Priya Priya
Top achievements
Rank 1
Answers by
Steve
Telerik team
Priya Priya
Top achievements
Rank 1
Mugdha Aditya
Top achievements
Rank 1
Branden
Top achievements
Rank 1
Share this question
or