We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Pie Chart Data Points

Thread ID:

Created:

Updated:

Platform:

Replies:

93180 Mar 1,2010 09:56 AM Mar 19,2010 02:09 AM ASP.NET Web Forms (Classic) 5
loading
Tags: Chart
erdem eralsan
Asked On March 1, 2010 09:56 AM

Hello,
I have downloaded the trial version of your product. My question is about Essential Chart.

My code snippet is as follow:
ChartSeries series = this.ChartWebControl1.Model.NewSeries("Series Name", ChartSeriesType.Pie);


series.Points.Add(0, 1);

series.Points.Add(1, 3);

series.Points.Add(2, 4);
series.Points.Add(3, 4);

how can add labels for each data point? I mean I wanna put these labels (1,3,4,4....) on a pie chart slices.

Senthil Ganesh K [Syncfusion]
Replied On March 2, 2010 10:07 AM

Hi,

Thanks for showing interest on syncfusion products.

We suggest you the below code snippet to show the datapoint labels.

Code Snippet:

this.ChartWebControl1.Series[0].Style.DisplayText = true;


Please let me know if this helps.

Regards,
Senthil Ganesh K.

erdem eralsan
Replied On March 17, 2010 07:48 AM

Thank you for your reply. Your code snippet did not work for may case.
I really wonder if is really too difficult to show labels on data points?
My code is like below:

ChartSeries series1 = this.ChartWebControl1.Model.NewSeries("Costs",ChartSeriesType.Pie);

this.ChartWebControl1.Series3D = true;

series1.Points.Add(0, double.Parse(GridView1.FooterRow.Cells[2].Text));
series1.Points.Add(1, double.Parse(GridView1.FooterRow.Cells[3].Text));


this.ChartWebControl1.Series[0].Style.DisplayText = true;
this.ChartWebControl1.Series[0].Style.TextColor = System.Drawing.Color.LightSlateGray;

this.ChartWebControl1.Series.Add(series1);


this.ChartWebControl1.Series[0].ConfigItems.PieItem.LabelStyle = ChartAccumulationLabelStyle.Inside;





erdem eralsan
Replied On March 17, 2010 07:58 AM

I have tried everything which inside your online documentation.. But I could not put a basic point label text into grapgh data points!!

erdem eralsan
Replied On March 17, 2010 10:27 AM

Hello Again,
Finally I am very closer to the solution. I have modified my code as follow:
Now, the only issue is the put gridview column headers to the chart legend items..
Any idea?

private void SetGraphFeature()
{

ChartSeries series1 = this.ChartWebControl1.Model.NewSeries("İlave Maliyetler",ChartSeriesType.Pie);

this.ChartWebControl1.Text= "İlave Maliyetler";

this.ChartWebControl1.Series3D = true;

series1.Points.Add(0, double.Parse(GridView1.FooterRow.Cells[2].Text));
series1.Points.Add(1, double.Parse(GridView1.FooterRow.Cells[3].Text));
series1.Points.Add(2, double.Parse(GridView1.FooterRow.Cells[4].Text));
series1.Points.Add(3, double.Parse(GridView1.FooterRow.Cells[5].Text));
series1.Points.Add(4, double.Parse(GridView1.FooterRow.Cells[6].Text));
series1.Points.Add(5, double.Parse(GridView1.FooterRow.Cells[7].Text));
series1.Points.Add(6, double.Parse(GridView1.FooterRow.Cells[8].Text));
series1.Points.Add(7, double.Parse(GridView1.FooterRow.Cells[9].Text));
series1.Points.Add(8, double.Parse(GridView1.FooterRow.Cells[10].Text));



this.ChartWebControl1.Series[0].Style.TextColor = System.Drawing.Color.LightSlateGray;




this.ChartWebControl1.Series.Add(series1);
this.ChartWebControl1.Series[0].Style.DisplayText = true;

this.ChartWebControl1.Series[0].Styles[0].Text = GridView1.FooterRow.Cells[2].Text;
this.ChartWebControl1.Series[0].Styles[1].Text = GridView1.FooterRow.Cells[3].Text;
this.ChartWebControl1.Series[0].Styles[2].Text = GridView1.FooterRow.Cells[4].Text;
this.ChartWebControl1.Series[0].Styles[3].Text = GridView1.FooterRow.Cells[5].Text;
this.ChartWebControl1.Series[0].Styles[4].Text = GridView1.FooterRow.Cells[6].Text;
this.ChartWebControl1.Series[0].Styles[5].Text = GridView1.FooterRow.Cells[7].Text;
this.ChartWebControl1.Series[0].Styles[6].Text = GridView1.FooterRow.Cells[8].Text;
this.ChartWebControl1.Series[0].Styles[7].Text = GridView1.FooterRow.Cells[9].Text;
this.ChartWebControl1.Series[0].Styles[8].Text = GridView1.FooterRow.Cells[10].Text;



// Adding some custom items into the 2nd custom Legend

}



screen_983af9be.rar

Jaffersathick B [Syncfusion]
Replied On March 19, 2010 02:09 AM

Hi Erdem,


Thank you for your interest in Syncfusion products.


We suggest you to use Legend filter items event to set the legend text. We suggest you to get the Grid Column header and set that value in the legend event.

Please refer the below code snippet:

[CS]
//Event
this.chartControl1.Legend.FilterItems += new Syncfusion.Windows.Forms.Chart.LegendFilterItemsEventHandler(this.chartControl1_Legend_FilterItems);
//Event definition
private void chartControl1_Legend_FilterItems(object sender, ChartLegendFilterItemsEventArgs e)
{
ChartSeries series = this.chartControl1.Series[0];
if (series.Type == ChartSeriesType.Pie)
{
// Setting Custom text.
for (int i = 0; i < series.Points.Count; i++)
e.Items[i].Text = "Custom text";
}
}



Please Let me know if you have any other concerns.


Regards,
Jaffer.B

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;