Pre-defined Set of XCategory Labels in DataBound Line Chart

2 posts, 0 answers
  1. Matt
    Matt avatar
    1 posts
    Member since:
    Sep 2011

    Posted 05 Oct 2011 Link to this post

    My data is structured such that I have 10 categories that I always want to display on the X axis, regardless of whether there are actually points in the bound collection for each of those 10 categories.  Is it possible to define a collection of categories that I want displayed on the X axis prior to binding to an actual data source?  Then, once the data source is bound, a line can be drawn between the YValues of the points in the categories that are actually present in the chart?

    As a simplified example, say I have categories A, B, C, D, and E.  My data has values B=10, D=15, E=12.  I want to display a chart where all 5 categories are listed along the X axis with a line drawn between the B->D->E values.  Is this even possible in a data bound scenario?
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 10 Oct 2011 Link to this post

    Hello Matt,

    You can use RadChart EmptyPointBehavior for displaying the empty categories. If you add your data with null values for your Y-values, RadChart will display the categories, but not the values. When the data comes you can just update your existing points which will update the line accordingly. I have created a small sample project for you that demonstrates this technique.

    Hope this helps!

    All the best,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top