This is a migrated thread and some comments may be shown as answers.

Chart with Multivalue parameter SqlDataSource

2 Answers 165 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Carsten Koster
Top achievements
Rank 2
Carsten Koster asked on 28 Jul 2011, 11:58 AM
Dear Telerik Support Team,

would it be possible for you to provide with a sample solution on how to generate a report containing a Chart (Lines) that is filled with a SqlDataSource with a multi valued parameter using  the datagroupcolumn value.

I have tried for hours to achieve this but cannot get it to work. The chart does not split the selected values into series or the datasource does not select multiple data.

To recreate the problem the steps would be as follows:

- Create a report with a multi value parameter that accepts instance ids e.g. person ids
- Create a SqlDataSource with the same parameter and pass the reports parameter value to it
- Create a chart and set the DataGroupColumn to the persons id to get a series for each person contained in the datasource
- Execute the preview and select two or more persons via the report parameter
- The chart will only display one series, independant of what is selected as a parameter whereas a crosstable set to the same datasource with column grouping set to the person id will display multiple rows.

I did not add any series explicitly. If I add some series explicitly the legend text will be the explicitly specified name. What I need would be the value of the DataGroupColumn as a Legend entry. The workaround you provide in your example with #NAME:#VALUE does not work as it references the Series name.

Is there a way to tell the Chart which DataSource Columns to use for X,Y, LEGEND if no Series have been defined explicitly?
I have found the PlotArea.XAxis.DataLabelsColumn but nothing for Y or Legend. Is it mandatory to specify series explicitly?

I'd appreciate a quick response,
thank you for your time.

2 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 02 Aug 2011, 04:08 PM
Hi Carsten Koster,

When the Chart.DataGroupColumn property is used with parameterized data source you have to clear the previously created series in chart's ItemDataBindinding event as shown in the attached code snippet:
private void chart1_ItemDataBinding(object sender, System.EventArgs e)
{
    var processingChart = (Telerik.Reporting.Processing.Chart)sender;
    var chart = (Telerik.Reporting.Chart)processingChart.ItemDefinition;
    chart.Series.Clear();
}
Additionally I have attached a sample runnable project to demonstrate the suggested approach. Just to note that you will need the Scott schema to run the sample project.
 
Greetings,
Peter
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Muhammad
Top achievements
Rank 1
answered on 09 Aug 2012, 12:09 PM
Cool this worked!
Tags
General Discussions
Asked by
Carsten Koster
Top achievements
Rank 2
Answers by
Peter
Telerik team
Muhammad
Top achievements
Rank 1
Share this question
or