Telerik Report Graph

3 posts, 0 answers
  1. Richard S. Kunath
    Richard S. Kunath avatar
    4 posts
    Member since:
    Feb 2009

    Posted 21 Sep 2016 Link to this post

    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;

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

    lineSeries1.CoordinateSystem = cartesianCoordinateSystem1;
    lineSeries1.LegendItem.Value = "= Fields.Date";
    lineSeries1.SeriesGroup = countDateGroup;
    lineSeries1.Y = "=Fields.Count";
    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. Lalitha
    Lalitha avatar
    2 posts
    Member since:
    May 2015

    Posted 22 Sep 2016 Link to this post

    I am having the same trouble. Graph doesnt even show up for me. My code almost looks the same.
  3. Nasko
    Nasko avatar
    1094 posts

    Posted 26 Sep 2016 Link to this post

    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 report's .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.

    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
Back to Top