Using rows as series
Hi,
How can I make the chart use rows as series and columns as categories (the chart should take data from a DataTable object)?
How can I make the chart use rows as series and columns as categories (the chart should take data from a DataTable object)?
SIGN IN To post a reply.
10 Replies
SB
Suresh Babu
Syncfusion Team
January 18, 2007 05:25 PM UTC
Hi,
It is easy to bind data from Data Table using Essential chart. Please have a look into the following sample code which will help you.
[C#]
ChartSeries series1 = this.chartControl1.Model.NewSeries("New", ChartSeriesType.Column);
//the DataTable bound to chart series
ChartDataBindModel dbm = new ChartDataBindModel(mDataTable, "XYPoints");
dbm.XName = "x"; // Column name
dbm.YNames = new string[] { "y" }; // Column Name
series1.SeriesModelImpl = dbm;
this.chartControl1.Series.Add(series1);
this.xAxisLabelModel = new ChartDataBindAxisLabelModel(mDataTable, "XYPoints");
this.xAxisLabelModel.LabelName = "z";
this.chartControl1.Indexed = true;
this.chartControl1.PrimaryXAxis.LabelsImpl = this.xAxisLabelModel;
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.Custom;
Please find the sample attached for more information.
Chart with Data Table sample
Please let me know if this helps.
Regards,
Sureshbabu
It is easy to bind data from Data Table using Essential chart. Please have a look into the following sample code which will help you.
[C#]
ChartSeries series1 = this.chartControl1.Model.NewSeries("New", ChartSeriesType.Column);
//the DataTable bound to chart series
ChartDataBindModel dbm = new ChartDataBindModel(mDataTable, "XYPoints");
dbm.XName = "x"; // Column name
dbm.YNames = new string[] { "y" }; // Column Name
series1.SeriesModelImpl = dbm;
this.chartControl1.Series.Add(series1);
this.xAxisLabelModel = new ChartDataBindAxisLabelModel(mDataTable, "XYPoints");
this.xAxisLabelModel.LabelName = "z";
this.chartControl1.Indexed = true;
this.chartControl1.PrimaryXAxis.LabelsImpl = this.xAxisLabelModel;
this.chartControl1.PrimaryXAxis.ValueType = ChartValueType.Custom;
Please find the sample attached for more information.
Chart with Data Table sample
Please let me know if this helps.
Regards,
Sureshbabu
AD
Administrator
Syncfusion Team
January 18, 2007 10:24 PM UTC
Thanks for the sample.
As I understood in the sample we have only one series and use 2 columns to get data for X and Y axes. Am I right?
The problem is that I need the following:
I have a table and want to show the data in a chart (using the 'Columns' style) using the table's rows for series (Series 0, Series 1,... Series).
And I want to have chart columns along the X axis.
It seems that your sample describes another situation: the number of elements along the X axis is table.Rows.Count but I want to use rows as series
As I understood in the sample we have only one series and use 2 columns to get data for X and Y axes. Am I right?
The problem is that I need the following:
I have a table and want to show the data in a chart (using the 'Columns' style) using the table's rows for series (Series 0, Series 1,... Series
And I want to have
It seems that your sample describes another situation: the number of elements along the X axis is table.Rows.Count but I want to use rows as series
AD
Administrator
Syncfusion Team
January 18, 2007 10:27 PM UTC
My previous post damaged because I've used some invalid symbols.
So the right text is:
Thanks for the sample.
As I understood in the sample we have only one series and use 2 columns to get data for X and Y axes. Am I right?
The problem is that I need the following:
I have a table and want to show the data in a chart (using the 'Columns' style) using the table's rows for series (Series 0, Series 1,... Series _table.Rows.Count_).
And I want to have _table.Columns.Count_ chart columns along the X axis.
It seems that your sample describes another situation: the number of elements along the X axis is table.Rows.Count but I want to use rows as series.
So the right text is:
Thanks for the sample.
As I understood in the sample we have only one series and use 2 columns to get data for X and Y axes. Am I right?
The problem is that I need the following:
I have a table and want to show the data in a chart (using the 'Columns' style) using the table's rows for series (Series 0, Series 1,... Series _table.Rows.Count_).
And I want to have _table.Columns.Count_ chart columns along the X axis.
It seems that your sample describes another situation: the number of elements along the X axis is table.Rows.Count but I want to use rows as series.
SB
Suresh Babu
Syncfusion Team
January 19, 2007 01:09 AM UTC
Hi,
Thank you for using Syncfusion products.
Please give me one day time to update you with required information.
Let me know if you have any further questions.
Thanks & Regards,
Sureshbabu
Thank you for using Syncfusion products.
Please give me one day time to update you with required information.
Let me know if you have any further questions.
Thanks & Regards,
Sureshbabu
AD
Administrator
Syncfusion Team
January 19, 2007 09:30 AM UTC
I'm looking forward.
Of course, I can 'rotate' the table to get the desired behaviour but I just want to know is it possible without converting the data.
Of course, I can 'rotate' the table to get the desired behaviour but I just want to know is it possible without converting the data.
SB
Suresh Babu
Syncfusion Team
January 20, 2007 12:54 AM UTC
Hi,
Yes. It is possible to get the desired behaviour without converting the data.
Currently i am working into this. Can you please send me the sample in which you got the desired behaviour?. It will be easy for us to provide more information shortly.
Please let me know if you have any more questions.
Regards,
Sureshbabu
Yes. It is possible to get the desired behaviour without converting the data.
Currently i am working into this. Can you please send me the sample in which you got the desired behaviour?. It will be easy for us to provide more information shortly.
Please let me know if you have any more questions.
Regards,
Sureshbabu
AD
Administrator
Syncfusion Team
February 2, 2007 11:06 PM UTC
Hello again,
Just would like to know if any progress in solving the issue?
Just would like to know if any progress in solving the issue?
AD
Administrator
Syncfusion Team
February 5, 2007 11:38 AM UTC
Hi,
Could please provide us with the a screenshot which depicts the requirement that you have mentioned here?
Also could please provide us with a sample of the DataTable that you have used to create the chart, so that it would help us to meet your requirement exactly.
Thanks & Regards,
Ramya.
Could please provide us with the a screenshot which depicts the requirement that you have mentioned here?
Also could please provide us with a sample of the DataTable that you have used to create the chart, so that it would help us to meet your requirement exactly.
Thanks & Regards,
Ramya.
AD
Administrator
Syncfusion Team
February 5, 2007 12:06 PM UTC
Hi,
Please find attached the screenshot.
Chart1 is 'standard' (it was created using the standard binding).
Chart2 was created by rotating the source table. As you can see the fields represent categories and rows represent series.
>Hi,
Could please provide us with the a screenshot which depicts the requirement that you have mentioned here?
Also could please provide us with a sample of the DataTable that you have used to create the chart, so that it would help us to meet your requirement exactly.
Thanks & Regards,
Ramya.
TablesAndCharts.zip
Please find attached the screenshot.
Chart1 is 'standard' (it was created using the standard binding).
Chart2 was created by rotating the source table. As you can see the fields represent categories and rows represent series.
>Hi,
Could please provide us with the a screenshot which depicts the requirement that you have mentioned here?
Also could please provide us with a sample of the DataTable that you have used to create the chart, so that it would help us to meet your requirement exactly.
Thanks & Regards,
Ramya.
TablesAndCharts.zip
AD
Administrator
Syncfusion Team
February 6, 2007 11:58 AM UTC
Hi,
Thanks a lot for the detailed explanation.
The row values in database can be utilized as Yvalue of Series as shown in the code snippet below,
for( int i=1;i<=dataSet.Tables[0].Rows.Count;i++ )
{
for( int j=0;j {
double y=Convert.ToDouble(dataSet.Tables[0].Rows[j]["Object"+i].ToString());
series1[j].Points.Add( x1+l-j, y );
l=l+3.9;
}
}
//Adds the series to the ChartSeriesCollection.
for ( int i=0;i {
this.chartControl1.Series.Add( series1[i] );
}
Also kindly take a look at the attached sample.
Let me know if you have any queries.
Thanks & Regards,
Ramya.
DataBindingAndChart.zip
Thanks a lot for the detailed explanation.
The row values in database can be utilized as Yvalue of Series as shown in the code snippet below,
for( int i=1;i<=dataSet.Tables[0].Rows.Count;i++ )
{
for( int j=0;j
double y=Convert.ToDouble(dataSet.Tables[0].Rows[j]["Object"+i].ToString());
series1[j].Points.Add( x1+l-j, y );
l=l+3.9;
}
}
//Adds the series to the ChartSeriesCollection.
for ( int i=0;i
this.chartControl1.Series.Add( series1[i] );
}
Also kindly take a look at the attached sample.
Let me know if you have any queries.
Thanks & Regards,
Ramya.
DataBindingAndChart.zip
SIGN IN To post a reply.
- 10 Replies
- 2 Participants
-
AD Administrator
- Jan 18, 2007 12:08 PM UTC
- Feb 6, 2007 11:58 AM UTC