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

A walktrough of how to configure a line Graph in report designer with data provided at runtime

3 Answers 358 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bartosz
Top achievements
Rank 1
Bartosz asked on 24 May 2018, 03:58 PM

Hi,

I have a hard time trying to configure a Graph with line series in the stand alone Report Designer.
I need a simple chart with one or more line series. The line series are Numerical on both axes (it's a temperature (X) vs value (Y) plot).

The data for the Graph will be provided at runtime.

My data source format is thus:

```
class Data

{
   List<double> Temperature {g;s;}
   List<double> Value {g;s}
}

```

I was able to 'import' the dll to the designer and the data source was set up correctly (I know this because I'm able to use other data sources to successfully populate other elements of the report).

----------------------------------

What I did so far?

* I inserted a new line graph into the report
* I tried setting the Category to Temperature and Value to Value in the Wizard
* I named the graph to be able to find it at runtime and set it's DataSource
* In various attempts to configure the graph I tried setting the X and Y axes of the Graph to Numerical type or X to Category and Y to Numerical (I get the legend and axes preview in the designer)
* At runtime I set the DataSource of the Graph the same way as DataSource of a Table (which works ok for the table): `((Graph)(report.Items.Find("nameOfGraph", true)[0])).DataSource = dataSourceObject;`

 

The problem I have is that there are no series in the generated report in the Graph while other parts of the report are populated correctly.

 

Could you please provide me with a walktrough of how to configure a line Graph in Report Designer with the assumption that the data will be provided at runtime?

 

Thanks!

3 Answers, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 29 May 2018, 12:01 PM
Hi Bartosz,

The issue might be related to the structure of the Data class. Currently it has two fields each of which is a collection.
Each of those fields can be a data source itself. However, they cannot be used together as X and Y value for a single graph series.

I have attached a sample project based on the approach you have described. Note that the Data class is a List of DataModel and DataModel exposes the two properties that are used as Fields for the Graph.
In the sample the DataSource of the Table and the Graph can be set runtime choosing between two approaches - with and without an ObjectDataSource component. The first approach allows for setting the count of displayed items through a Report Parameter.

Regards,
Todor
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
murali
Top achievements
Rank 1
answered on 30 Oct 2019, 08:36 AM

Hi ,

Can you please send one example code like this to for bar with line chart combination. I have tried with same. the marker only visible  but the line is not visible. I do not know where i have missed. Please send on example code with bar and line graph.

Thanks,

Murali K

 

0
Todor
Telerik team
answered on 04 Nov 2019, 08:19 AM

Hello Murali,

I have attached the sample with an added Column chart. Note that I have upgraded it to version 13.2.19.918.

Basically, you need to add a new Bar series and set its CoordinateSystem, CategoryGroup, SeriesGroup and Y properties, as indicated on the attached screenshot. Here is a tutorial on How to: Create Graph with Column and Line Series.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Bartosz
Top achievements
Rank 1
Answers by
Todor
Telerik team
murali
Top achievements
Rank 1
Share this question
or