Dynamic Series

3 posts, 1 answers
  1. Michael
    Michael avatar
    10 posts
    Member since:
    Dec 2012

    Posted 11 May 2020 Link to this post

    Hello,

    I have a small amount of data that's already been grouped and sorted by sql. It looks something like this:

     

    value - category name

    25 - Cat1
    15 - Cat2
    5  - Cat3

    Each time I run the query, I may receive different categories with different names and different values. These categories, if I understand how the ChartView works correctly, are represented via Series. Since my data is dynamic, how should I go about creating these series on the fly? Most of the examples I've seen use hard coded series. I'm sure I can hack it together, but I'd rather ask first in case there's a better way. Btw, I did search the forums and found a post where someone is using VB and Linq to get a list of categories. That may work, but its from 2012 so I thought I'd ask.

     

    Thanks!

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4086 posts

    Posted 13 May 2020 Link to this post

    Hello, Michael, 

    Indeed, if your data is represented by a value and category, it is suitable to a use a series that uses CategoricalDataPoint, e.g. BarSeries, LineSeries, etc. 

    Every time you extract new data, feel free to clear the RadChartView.Series collection and add a new series with the new CategoricalDataPoints. Please refer to the following help articles demonstrating how to setup BarSeries or LineSeries with categorical data:
    https://docs.telerik.com/devtools/winforms/controls/chartview/series-types/bar 
    https://docs.telerik.com/devtools/winforms/controls/chartview/series-types/line

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  3. Michael
    Michael avatar
    10 posts
    Member since:
    Dec 2012

    Posted 19 May 2020 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thanks Dess. I ended up doing it like you explained.
Back to Top