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

Telerik Report Graph

2 Answers 133 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Richard S. Kunath
Top achievements
Rank 1
Richard S. Kunath asked on 21 Sep 2016, 09:01 PM
Hello all,
I have a reportviewer on aspx page to which i m getting a login report. 
On the report i have a graph named graph_LoginByDate. I have a dataset coming from a stored procedure.
DataSet ds_LoginsCount = Sql.GetDataset("[SP_LoginsByDate]");
graph_LoginByDate_ImpactsByDate.DataSource = ds_LoginsCount ; This dataset has just two columns "Date" and the "count". Can some one explain how i an assign date to the X-axis and Count to the Y-axis. 
I have tried this: (there is not category. All i am trying to to just plot the date vs logins count)
var countDateGroup = new Telerik.Reporting.GraphGroup();
countDateGroup .Name = "seriesGroup1";
countDateGroup.Groupings.Add(new Telerik.Reporting.Grouping("=Fields.Date"));
countDateGroup.Sortings.Add(new Telerik.Reporting.Sorting("=Fields.Date", Telerik.Reporting.SortDirection.Asc));
graph_LoginByDate.SeriesGroups.Add(countDateGroup );


var graphAxisNumericScale = new Telerik.Reporting.GraphAxis();
graphAxisNumericScale.Name = "GraphAxis2";                    
graphAxisNumericScale.Scale = new Telerik.Reporting.NumericalScale();

var cartesianCoordinateSystem1 = new Telerik.Reporting.CartesianCoordinateSystem();
cartesianCoordinateSystem1.Name = "cartesianCoordinateSystem1";
cartesianCoordinateSystem1.XAxis = graphAxisNumericScale;
cartesianCoordinateSystem1.YAxis = graphAxisNumericScale;
graph_LoginByDate.CoordinateSystems.Add(cartesianCoordinateSystem1);

var lineSeries1 = new Telerik.Reporting.LineSeries();

lineSeries1.CoordinateSystem = cartesianCoordinateSystem1;
lineSeries1.LegendItem.Value = "= Fields.Date";
lineSeries1.SeriesGroup = countDateGroup;
lineSeries1.Y = "=Fields.Count";
graph_LoginByDate.Series.Add(lineSeries1);
I cant do this through properties. It has to be done programatically. Please let me know where i m doing the mistake.
Thank you,

2 Answers, 1 is accepted

Sort by
0
Lalitha
Top achievements
Rank 1
answered on 22 Sep 2016, 01:24 PM
I am having the same trouble. Graph doesnt even show up for me. My code almost looks the same.
0
Nasko
Telerik team
answered on 26 Sep 2016, 01:20 PM
Hello Richard,

In your scenario, the recommended approach to create and configure the graph is using the Visual Studio Report Designer and the Graph Wizard. After you finish the wizard and you are happy with how the graph looks, open the .Designer.cs file. There you will find automatically generated code for the graph item which you can reuse in your application.

You might also find useful the How to: Create Chart Programmatically help article.

Regards,
Nasko
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
Report Designer (standalone)
Asked by
Richard S. Kunath
Top achievements
Rank 1
Answers by
Lalitha
Top achievements
Rank 1
Nasko
Telerik team
Share this question
or