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

Dynamic Series

2 Answers 72 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Veteran
Michael asked on 11 May 2020, 05:07 AM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 13 May 2020, 09:31 AM

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.
0
Michael
Top achievements
Rank 1
Veteran
answered on 19 May 2020, 04:50 PM
Thanks Dess. I ended up doing it like you explained.
Tags
ChartView
Asked by
Michael
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Michael
Top achievements
Rank 1
Veteran
Share this question
or