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.
Syncfusion Feedback

re: Binding a datasource to Chart

Thread ID:

Created:

Updated:

Platform:

Replies:

50452 Oct 11,2006 07:42 PM UTC Oct 18,2006 10:12 AM UTC ASP.NET Web Forms (Classic) 5
loading
Tags: Chart
Melissa
Asked On October 11, 2006 07:42 PM UTC

I have a SQLDataSource that is returning the name of a column and the count. How can I bind the chart to a this datasource?

For example the data source will return
A 5
B 6
C 7

Administrator [Syncfusion]
Replied On October 14, 2006 12:24 PM UTC

Hi Melissa,

Thanks for using Syncfusion products.

Here is the sample, which explains:
1. Connecting SqlDataBase with Chart using ConnectionString.
2. Object for ChartDataBindModel is created to access the DataTable.
3. Assigning fields to X and Y Axis.
4. Setting the labels.

And then appearance can be changed as you like.

I hope this sample will help you.

Let me know if you have any more queries.

Thanks,
Sureshbabu


ChartDataBinding.zip

Melissa
Replied On October 16, 2006 12:28 PM UTC

That's doing everything in the code behind. Is it possible to bind to the chart using a SqlDatasource:

< a s p:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
SelectCommand="spQ_MarketingCounts" SelectCommandType="StoredProcedure">


>Hi Melissa,

Thanks for using Syncfusion products.

Here is the sample, which explains:
1. Connecting SqlDataBase with Chart using ConnectionString.
2. Object for ChartDataBindModel is created to access the DataTable.
3. Assigning fields to X and Y Axis.
4. Setting the labels.

And then appearance can be changed as you like.

I hope this sample will help you.

Let me know if you have any more queries.

Thanks,
Sureshbabu


ChartDataBinding.zip

Melissa
Replied On October 16, 2006 04:41 PM UTC

I still want to know if I can bind directly to a SQL Datasource, but I tried to bind using the way in the zip file and that doesn't work either. It seems as if it is pulling the values for the x series, but I can only see one and a half of them and there is no data being displayed in the column.

I've attached the code behind. The stored procedure spQ_MarketingCounts returns 2 columns- MarketingSource which has a list of sources for marketing and MarketingCounts which is the count for each source.


>That's doing everything in the code behind. Is it possible to bind to the chart using a SqlDatasource:

< a s p:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
SelectCommand="spQ_MarketingCounts" SelectCommandType="StoredProcedure">


>Hi Melissa,

Thanks for using Syncfusion products.

Here is the sample, which explains:
1. Connecting SqlDataBase with Chart using ConnectionString.
2. Object for ChartDataBindModel is created to access the DataTable.
3. Assigning fields to X and Y Axis.
4. Setting the labels.

And then appearance can be changed as you like.

I hope this sample will help you.

Let me know if you have any more queries.

Thanks,
Sureshbabu


ChartDataBinding.zip

MarketingCounts.ascx.zip

Melissa
Replied On October 16, 2006 05:53 PM UTC

I figured out what I was doing wrong with the datasource. I wasn't selecting an ID and binding to it and it couldn't bind to the text.

>I still want to know if I can bind directly to a SQL Datasource, but I tried to bind using the way in the zip file and that doesn't work either. It seems as if it is pulling the values for the x series, but I can only see one and a half of them and there is no data being displayed in the column.

I've attached the code behind. The stored procedure spQ_MarketingCounts returns 2 columns- MarketingSource which has a list of sources for marketing and MarketingCounts which is the count for each source.


>That's doing everything in the code behind. Is it possible to bind to the chart using a SqlDatasource:

< a s p:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
SelectCommand="spQ_MarketingCounts" SelectCommandType="StoredProcedure">


>Hi Melissa,

Thanks for using Syncfusion products.

Here is the sample, which explains:
1. Connecting SqlDataBase with Chart using ConnectionString.
2. Object for ChartDataBindModel is created to access the DataTable.
3. Assigning fields to X and Y Axis.
4. Setting the labels.

And then appearance can be changed as you like.

I hope this sample will help you.

Let me know if you have any more queries.

Thanks,
Sureshbabu


ChartDataBinding.zip

MarketingCounts.ascx.zip

Administrator [Syncfusion]
Replied On October 18, 2006 10:12 AM UTC

Hi Melissa,

Thanks for using Syncfusion products.

I am able to reproduce this issue.

‘ChartValueType’ property set to any one of Custom, Double, DateTime, Logarithmic.

To work with string datatype, you can have the ChartValueType property set to Custom. This property helps in implementing user-defined datatypes.

Please take a look at the sample. Let me know if this helps.

Thanks,
Sureshbabu


stringDataBinding.zip

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

;