Binding data to graph programatically

2 posts, 0 answers
  1. Adrian
    Adrian avatar
    4 posts
    Member since:
    May 2018

    Posted 09 May 2018 Link to this post

    I've read many posts regarding this but I still can't find a solution to my problem.

    I currently have a graph (stacked bar) in a report created with Visual Studio designer.


    I then try to bind some data to the graph, but the graph always appears empty in the previews:

    public GraphReport()

                var h1 = new Person
                    Name = "John",
                    Age = 28

                var h2 = new Human
                    Name = "Carl",
                    Age = 31
                var list = new List<Human> { h1, h2 };
                graph1.DataSource = list;

  2. Katia
    Katia avatar
    760 posts

    Posted 14 May 2018 Link to this post

    Hello Adrian,

    I am not certain which preview is used. If you are referring to design-time preview it will not be available when the data for the Graph item is set in code-behind. To enable design-time preview you can configure ObjectDataSource component to retrieve the collection of Human objects and set it as Graph.DataSource property in the report designer.

    In case, the Graph is empty when run-time preview is used my suggestion is to check if Category and Series groupings for the Graph item and the properties of the series are set correctly. Check this example as a reference.

    In case the issue persists send us the problematic report in a support ticket so we can check the settings of the Graph item and provide you further suggestions.

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