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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Charting a simple table

Thread ID:

Created:

Updated:

Platform:

Replies:

55475 Jan 30,2007 10:57 PM UTC Feb 5,2007 09:23 AM UTC ASP.NET Web Forms (Classic) 5
loading
Tags: Chart
John Penn
Asked On January 30, 2007 10:57 PM UTC

Hello,

I am new to the Syncfusion package and I was hoping someone could help me.

I am trying to render a column chart (no AJAX, no postbacks, just an image) from a very simple data set like this:

Fred 300
Joe 234
Bob 177
Steve 123
Mary 95

When I run my code (cobbled together from the various samples) all I get is a narrow blue-background image with the chart title but no chart.

How can I do this with the Syncfusion chart web control? The data table is coming from a SQL Server stored procedure which I know works because I'm using it elsewhere in my application.


Thanks-
John

John Penn
Replied On January 31, 2007 02:30 AM UTC

OK... I figured out why I was getting the narrow image (note to self - don't use percentage-unit widths for these graphs) but I can't get the column chart to unstack... what I'd like to see is a column for each name in my table.

How can I do this?

>Hello,

I am new to the Syncfusion package and I was hoping someone could help me.

I am trying to render a column chart (no AJAX, no postbacks, just an image) from a very simple data set like this:

Fred 300
Joe 234
Bob 177
Steve 123
Mary 95

When I run my code (cobbled together from the various samples) all I get is a narrow blue-background image with the chart title but no chart.

How can I do this with the Syncfusion chart web control? The data table is coming from a SQL Server stored procedure which I know works because I'm using it elsewhere in my application.


Thanks-
John

Administrator [Syncfusion]
Replied On January 31, 2007 03:22 PM UTC

Hi John,

Thank You for your interest in Syncfusion Products.

If your intention is to create a ColumnChart and have the name from the database for each column then it can done by creating a series of Type Column and binding the values in the database to the ChartDataBindAxisLabelModel and then to the ChartAxisLabelModel(i.e to the LabelModel of corresponding ChartAxis).
Kindly take a look at the code snippet below,

ChartSeries series = this.ChartWebControl1.Model.NewSeries("Data Bound Series");
series.Text = series.Name;
series.Type = ChartSeriesType.Column;
series.Points.Add(2001, 10);
series.Points.Add(2002, 13.5);
series.Points.Add(2003, 14.6);
series.Points.Add(2004, 16.5);
series.Points.Add(2005, 18);

this.ChartWebControl1.Series.Add(series);
this.xAxisLabelModel = new ChartDataBindAxisLabelModel(this.ds, "");

this.xAxisLabelModel.LabelName = "Client";//LabelName should assigned the ColumnName of the table in database whose value should be displayed for each column

this.ChartWebControl1.ChartWebArea.PrimaryXAxis.LabelsImpl = this.xAxisLabelModel;
this.ChartWebControl1.ChartWebArea.PrimaryXAxis.ValueType = ChartValueType.Custom;

Let me know whether this helps you.

Thanks & Regards,
Ramya.

Administrator [Syncfusion]
Replied On January 31, 2007 03:27 PM UTC

Hi John,

Thank You for your interest in Syncfusion Products.

If your intention is to create a ColumnChart and have the name from the database for each column then it can done by creating a series of Type Column and binding the values in the database to the ChartDataBindAxisLabelModel and then to the ChartAxisLabelModel(i.e to the LabelModel of corresponding ChartAxis).
Kindly take a look at the code snippet below,

ChartSeries series = this.ChartWebControl1.Model.NewSeries("Data Bound Series");
series.Text = series.Name;
series.Type = ChartSeriesType.Column;
series.Points.Add(2001, 10);
series.Points.Add(2002, 13.5);
series.Points.Add(2003, 14.6);
series.Points.Add(2004, 16.5);
series.Points.Add(2005, 18);

this.ChartWebControl1.Series.Add(series);
this.xAxisLabelModel = new ChartDataBindAxisLabelModel(this.ds, "tablename");//tablename->name of table in database

this.xAxisLabelModel.LabelName = "Client";//LabelName should assigned the ColumnName of the table in database whose value should be displayed for each column

this.ChartWebControl1.ChartWebArea.PrimaryXAxis.LabelsImpl = this.xAxisLabelModel;
this.ChartWebControl1.ChartWebArea.PrimaryXAxis.ValueType = ChartValueType.Custom;

Let me know whether this helps you.

Thanks & Regards,
Ramya.

John Penn
Replied On January 31, 2007 04:23 PM UTC

Hi Ramya,

Thanks for getting back to me on this. I pasted your code into my ASP page, and now the names are appearing underneath the columns as I expected. Now I need to configure the Y-axis to correspond to the 2nd column in my table. How do I do this?

Thanks again-
John

>Hi John,

Thank You for your interest in Syncfusion Products.

If your intention is to create a ColumnChart and have the name from the database for each column then it can done by creating a series of Type Column and binding the values in the database to the ChartDataBindAxisLabelModel and then to the ChartAxisLabelModel(i.e to the LabelModel of corresponding ChartAxis).
Kindly take a look at the code snippet below,

ChartSeries series = this.ChartWebControl1.Model.NewSeries("Data Bound Series");
series.Text = series.Name;
series.Type = ChartSeriesType.Column;
series.Points.Add(2001, 10);
series.Points.Add(2002, 13.5);
series.Points.Add(2003, 14.6);
series.Points.Add(2004, 16.5);
series.Points.Add(2005, 18);

this.ChartWebControl1.Series.Add(series);
this.xAxisLabelModel = new ChartDataBindAxisLabelModel(this.ds, "tablename");//tablename->name of table in database

this.xAxisLabelModel.LabelName = "Client";//LabelName should assigned the ColumnName of the table in database whose value should be displayed for each column

this.ChartWebControl1.ChartWebArea.PrimaryXAxis.LabelsImpl = this.xAxisLabelModel;
this.ChartWebControl1.ChartWebArea.PrimaryXAxis.ValueType = ChartValueType.Custom;

Let me know whether this helps you.

Thanks & Regards,
Ramya.

Administrator [Syncfusion]
Replied On February 5, 2007 09:23 AM UTC

Hi John,

If your intention is to display the names of the second column in the database along the Y- Axis then it can be done by binding the values in the database to the ChartDataBindAxisLabelModel. Kindly take a look at the code snippet below,

this.yAxisLabelModel = new ChartDataBindAxisLabelModel(this.ds, "Sheet");
this.yAxisLabelModel.LabelName = "SecondColumn";//Name of second column in database
this.ChartWebControl1.ChartWebArea.PrimaryYAxis.LabelsImpl = this.yAxisLabelModel;
this.ChartWebControl1.ChartWebArea.PrimaryYAxis.ValueType = ChartValueType.Custom;

Let me know if I am wrong in getting your requirement.

Thanks & Regards,
Ramya.

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.

Warning Icon 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.Close Icon

;