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

Crosstab with chart

1 Answer 117 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 02 Mar 2012, 01:09 PM
Hi,

I've succesfully got a crosstab working where each row contains the date and number of log-on's for that date which is taken for a dataset containing a single table, e.g.
Date, LogOns
01/01/2012, 500
02/01/2012, 541
03,01,2012, 234



I'm now trying to expand this so that I now have an addition dataset which contains number of tables where each table contains a breakdown for each day
//Breakdown table for 01/01/2012
Time, Count
1am, 30
2am, 50
and so forth

//Breakdown table for 02/01/2012
Time, Count
1am, 90
2am, 10
and so forth

// same for Breakdown table for 03/01/2012

The problem I'm having is that all of my bar charts only use the first table in my new datasource rather than the chart in row 1 using the first table, chart in row 2 using the 2nd table and so forth.  Is there a way to automatically specify that each new row uses the next table in the datasource?  Or am i going to have to create the crosstab and all of its comments manually in code by iterting through each table and adding new rows each time?

many thanks,

1 Answer, 1 is accepted

Sort by
0
Accepted
Elian
Telerik team
answered on 05 Mar 2012, 10:52 AM
Hi Andrew,

When you use a DataSet as DataSource, it always gets data from the first table. 
If you have some enumeration, you can create a User Function that will return the appropriate DataTable and assign it as DataSource using Bindings. For example, you can Bind the chart's DataSource property like this:

DataSource = "= MyUserFunction(Fields.Date)"
//and the function would be something like this:
public static DataTable MyUserFunction(DateTime date)
{
   int i;
   //some logic for choosing a table here...
   return dataSet.Tables[i];
}
There are other ways this can be done, but to give you an adequate advice we must know the structure of your data and of your report.  Regards,
Elian
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or