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

How to use the Graph report item.

1 Answer 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 04 Dec 2014, 09:00 AM
I have a report that shows a table of data, and I'd like to add a line graph showing 2 bits of data over time, I've been able to get the graph to show on the page (using the VS integrated editor), but I'm having issues getting it to actually pick up the data from my reports datasource. I am using a List of Objects as the data source, the structure of which is here:

01.public class OrderTotalContainer
02.{
03.    public List<OrderTotal> OrderTotals { get; set; }
04.}
05. 
06.public class OrderTotal
07.{
08.    public DateTime Date { get; set; }
09.    public Int64 ImportedCount { get; set; }
10.    public List<DispatchCount> DispatchCounts { get; set; }
11.    public Int64 TotalDispatches { get; set; }
12.}
13. 
14.public class DispatchCount{
15.    public string Courier { get; set; }
16.    public Int64 Count { get; set; }
17.}


The reports datasource is set to an instance of OrderTotalContainer, OrderTotalContainer.OrderTotals is a list of OrderTotal types one entry for each day the report covers.

I'd like a line graph with two series, X axis being the date stored in OrderTotal.Date, Y axis being a simple numerical axis, one series using OrderTotal.ImportedCount, the other using OrderTotal.TotalDispatches.

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 08 Dec 2014, 01:18 PM
Hello Mark,

When there is another business object property within your business object we do not drill down into the hierarchy. To use the inner object you have to bind a Data Item (Graph) to it using expressions and Bindings. For more detailed information, please follow the Use DataObject as a datasource for nested data items (Table, List, Crosstab, Graph) section of the How to use ReportItem.DataObject property in expressions help article. This way you can bind the DataSource property of a data item to a given object/collection property from your business object and the data item will display all the inner items.

Note that when you add a binding to the Graph.DataSource property, the data fields will not be available during design-time and you will need to write them manually based on the business object structure.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Mark
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or