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

Use of JObject as data source

1 Answer 163 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 2
Stefan asked on 13 Mar 2017, 11:16 AM

Does anyone know if its possible to use Json.NET's JObject as a source for graphs? I need to bind a dynamically typed objects in runtime.

In C#, I'm doing this as a POC:

 

var d = new { Missing = 60D, Flagged = 10D, Valid = 30D };        

var s = JsonConvert.SerializeObject(d);        

var j = JsonConvert.DeserializeObject(s);

var ds = new ObjectDataSource();             

ds.DataSource = data;             

var report = new Report1();             

report.MyPieGraph.DataSource = ds;

 

The report renders the graph, but only the legend, not the actual pie graph.

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 13 Mar 2017, 01:32 PM
Hi Stefan,

Reports are 'strongly-typed'. Data must have a flatten tabular representation, where the report uses the discovered fields for design purposes. The object set as data source must contain the fields used in the report.

On processing a report the whole data must be available. You can use a data service and load data in a custom .NET business object as in Connecting Telerik Reporting to OData feeds. Then you can use an ObjectDataSource that will retrieve the data via data-access layer.

Please note that already instantiated data objects do not have to be wrapped in data source components - Do I need to use a Data Source component?


Let us know if you need further help.

Regards,
Stef
Telerik by Progress
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
Stefan
Top achievements
Rank 2
Answers by
Stef
Telerik team
Share this question
or