How to use the Graph report item.

2 posts, 0 answers
  1. Mark
    Mark avatar
    4 posts
    Member since:
    Oct 2014

    Posted 04 Dec 2014 Link to this post

    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.
  2. Nasko
    Admin
    Nasko avatar
    1049 posts

    Posted 08 Dec 2014 Link to this post

    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.

     
Back to Top