I was tasked with prototyping a new Telerik report using version 2018 R3 SP1 in Visual Studio 2017. I've searched the forum and the web but so far have not found a definitive answer to this question.
The report is somewhat complicated, with several sections, but the main section was best implemented as a banded report with a Graph in the detail section. Our existing reports use ObjectDataSource objects for the DataSource and this new report will follow suit. I tried passing the banded report a C# List<PrototypeItem> instance where the classes are:
public class PrototypeItem
{
public int Id { get; set; }
public string Location { get; set; }
public string Name { get; set; }
public string Type { get; set; }
public List<NumItem> Items { get; set; }
}
public class NumItem
{
public DateTime X { get; set; }
public double Y { get; set; }
}
PrototypeItem.Id is used as the group property (= Fields.Id) to distinguish the report bands. I found I could create a DataSource binding for the detail Graph, which I set to = Fields.Items. I set the Graph to have a LineSeries linked to a CartesianCoordinateSystem, a SeriesGroup and a CategoryGroup. The latter group I set to have Groupings = Fields.X and Sortings = Fields.X Asc expressions. The series had X = Fields.X and Y = Fields.Y.
When I run the report, it appears to give me the information I expect, with individual graphs having the X/Y data for the Id item in each band.
What I would like to do now is extend this report to provide more information in the graphs. In particular, I am interested in adding a straight horizontal line (possibly several) at a value that indicates to the user when the X/Y data has exceeded a certain "alert" level. However, I can't figure out how best to do this.
One approach I tried and found to work (albeit with limitations) was to add a another property to the NumItem class to define the "alert level". I added a second LineSeries to the Graph, linked it to the same category and series groups and defined the series X = Fields.X and Y = Fields.AlertLevel. The problem I have with this approach is that the horizontal line does not span the graph's entire X range if the main graph data does not also do so. I found that I could add two data points to the Items data list, one for the start date and another for the end date. While the alert level line spans the graph, unfortunately, this also introduces odd discontinuities in the raw data line between the end points of the graph and the first or last data points.
Ideally, it would be best to pass two line series, one for the raw X/Y data and a second for the alert level with just two data points: start date and end date as X values and the Y values as the alert level. I cannot determine if reporting supports this sort of operation. The main problem involves the DataSource binding for the Graph. How would one define classes to and set properties to make the Graph object "aware" of two (or more) line series?
I attempted one modification to my classes above. I changed PrototypeItem to replace List<NumItem> with a GraphData class property where:
public class GraphData { List<NumItem> Items { get; set; } }
and changed the Graph binding expression to be = GD.Items (instead of = Items). When I ran the report this "sort of" worked but behaved strangely: each graph displayed a data line but all the graphs were identical (rather than the individual data for each Id). This also gave no indication how to bind a second List of NumItems in GraphData to a second line series.
I also occurred to me that I could try to create a separate report ObjectDataSource to retrieve the Graph data. However, I could not determine how to link the banded property Id to the function call so I did not attempt this.
Any thoughts about how to extend my report graphs?
Thanks.