Gareth McNicol
Top achievements
Rank 1
Gareth McNicol
asked on 27 Feb 2012, 04:25 PM
Is there a way of dynamically adding series to the chart view at runtime? Ideally within an MVVM implementation although that's not strictly necessary.
Thanks,
Gareth.
Thanks,
Gareth.
5 Answers, 1 is accepted
0
Gareth McNicol
Top achievements
Rank 1
answered on 29 Feb 2012, 09:20 AM
It's stupendously easy it's just a shame that the online html help is so damned clunky.
0
Lars
Top achievements
Rank 1
answered on 23 May 2012, 07:59 AM
Can you give a brief hint how to do it ?
Lars
0
Hi Lars,
I am not sure about Gareth's scenario, but generally adding series to RadChartView would involve adding a CartesianSeries (Bar, Line, Area, Spline, SplineArea, ScatterPoint, ScatterLine, ScatterArea, Ohlc, Candlestick) to the RadCartesianChart.Series collection, adding a PieSeries to RadPieChart or adding PolarSeries (PolarPoint, PolarLine, PolarArea, RadarPoint, RadarLine, RadarArea) to RadPolarChart.
Best regards,
Ves
the Telerik team
I am not sure about Gareth's scenario, but generally adding series to RadChartView would involve adding a CartesianSeries (Bar, Line, Area, Spline, SplineArea, ScatterPoint, ScatterLine, ScatterArea, Ohlc, Candlestick) to the RadCartesianChart.Series collection, adding a PieSeries to RadPieChart or adding PolarSeries (PolarPoint, PolarLine, PolarArea, RadarPoint, RadarLine, RadarArea) to RadPolarChart.
BarSeries ser = new BarSeries();
ser.ValueBinding = new PropertyNameDataPointBinding("Value");
ser.CategoryBinding = new PropertyNameDataPointBinding("Category");
chart.Series.Add(ser);
ser.ItemsSource = mySource;
Best regards,
Ves
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Gareth McNicol
Top achievements
Rank 1
answered on 28 May 2012, 10:24 AM
Yes,
That's pretty much how I did it. Worked first time.
One suggestion I'd make is to have some sort of lambda to setup the propertyname binding, rather than using magic strings.
so
That's pretty much how I did it. Worked first time.
One suggestion I'd make is to have some sort of lambda to setup the propertyname binding, rather than using magic strings.
so
new
PropertyNameDatapointBinding(() => boundObj.PropertyName);
0
Lars
Top achievements
Rank 1
answered on 29 May 2012, 12:21 PM
Ok, thanks a lot. We started out with binding to the SeriesMappingCollection of the RadChart which seems to work for now. Unfortunately, RadChartView does not support inverse axis which is essential for us in some scenarios.
Lars
Lars