7 Answers, 1 is accepted
0
Hello tica,
You can define the chart series, their appearance and the data binding information for them at design time and then at run-time supply the necessary data source through the NeedDataSource event. You will find all the necessary information how to work with the Chart report item in the documentation articles. Let us know if you are experiencing any particular problems.
Best wishes,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
You can define the chart series, their appearance and the data binding information for them at design time and then at run-time supply the necessary data source through the NeedDataSource event. You will find all the necessary information how to work with the Chart report item in the documentation articles. Let us know if you are experiencing any particular problems.
Best wishes,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

tica
Top achievements
Rank 1
answered on 09 Jul 2009, 08:47 AM
hi
i've seen those items that you said but my problem is that i can't add a data source. is anything in here who teachs how to make a report with a chart step by step like this: http://www.telerik.com/help/reporting/quick-start-create-simple-report.html .
i've already have in the report:
thank you.
i've seen those items that you said but my problem is that i can't add a data source. is anything in here who teachs how to make a report with a chart step by step like this: http://www.telerik.com/help/reporting/quick-start-create-simple-report.html .
i've already have in the report:
private void chart1_NeedDataSource(object sender, EventArgs e)
{
Telerik.Reporting.Processing.
Chart procChart = (Telerik.Reporting.Processing.Chart)sender;
procChart.DataSource = datasourcegraph;
}
thank you.
0

tica
Top achievements
Rank 1
answered on 10 Jul 2009, 10:08 AM
when i want to add a data source to chart i go to the Data and appears a message: to dynamically populate the chart with data use the NeedDataSource event.
i´ve got the event and in the graph.Designer.cs is the line:
this.chart1.NeedDataSource += new System.EventHandler(this.chart1_NeedDataSource);
i don't understand why in chart doesn't appear the data source to make a connection and get the values.
thank you
i´ve got the event and in the graph.Designer.cs is the line:
this.chart1.NeedDataSource += new System.EventHandler(this.chart1_NeedDataSource);
i don't understand why in chart doesn't appear the data source to make a connection and get the values.
thank you
0
Hi tica,
The code you've used so far is correct, but note that the chart would only show data if there is a numeric column to bind to. Additionally if you want to specify where the XAxis and YAxis get their values from, you should create chart series and set their DataYColumn and DataXColumn. Here is a sample code:
private void chart1_NeedDataSource(object sender, EventArgs e)
{
string sql =
@"SELECT TOP 20 Production.Product.ListPrice, Production.Product.Name, Production.Product.ProductID FROM Production.Product";
string connectionString =
"Data Source=(local)\\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True";
SqlDataAdapter adapter = new SqlDataAdapter(sql, connectionString);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
ChartSeries series = new ChartSeries();
series.DataYColumn = "ProductID";
series.DataLabelsColumn = "Name";
chart1.Series.Add(series);
(sender as Telerik.Reporting.Processing.Chart).DataSource = dataSet.Tables[0].DefaultView;
}
Greetings,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
The code you've used so far is correct, but note that the chart would only show data if there is a numeric column to bind to. Additionally if you want to specify where the XAxis and YAxis get their values from, you should create chart series and set their DataYColumn and DataXColumn. Here is a sample code:
private void chart1_NeedDataSource(object sender, EventArgs e)
{
string sql =
@"SELECT TOP 20 Production.Product.ListPrice, Production.Product.Name, Production.Product.ProductID FROM Production.Product";
string connectionString =
"Data Source=(local)\\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True";
SqlDataAdapter adapter = new SqlDataAdapter(sql, connectionString);
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
ChartSeries series = new ChartSeries();
series.DataYColumn = "ProductID";
series.DataLabelsColumn = "Name";
chart1.Series.Add(series);
(sender as Telerik.Reporting.Processing.Chart).DataSource = dataSet.Tables[0].DefaultView;
}
Greetings,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

tica
Top achievements
Rank 1
answered on 14 Jul 2009, 11:43 AM
hi
i've already tried that but didin't work.
i was expecting to appear something like chart Data in chart properties so i may choose the datasource.
thank you
i've already tried that but didin't work.
i was expecting to appear something like chart Data in chart properties so i may choose the datasource.
thank you
0
Hi tica,
As explained in the Chart overview page, the chart report item can be bound through the NeedDataSource event only. You cannot set a datasource through the chart properties for the time being.
Greetings,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
As explained in the Chart overview page, the chart report item can be bound through the NeedDataSource event only. You cannot set a datasource through the chart properties for the time being.
Greetings,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0

tica
Top achievements
Rank 1
answered on 14 Jul 2009, 12:02 PM
I understand that isn't possible but is was easier if it was possible.
thank you anyway.
I'm going to try another ways to make this works.
thank you.
thank you anyway.
I'm going to try another ways to make this works.
thank you.