I need to programmatically create my barseries and assign a different color of my choosing for each series. In Line series, it is easy. I set the Stroke color. I couldn't find anything equivalent for the bar series.
1 Answer, 1 is accepted
0
Giuseppe
Telerik team
answered on 03 Apr 2012, 03:35 PM
Hello Louay,
You can achieve the desired appearance by setting the BarSeries.DefaultVisualStyle property like this:
BarSeries series = new BarSeries();
series.DataPoints.Add(new CategoricalDataPoint() { Category = "C1", Value = 11 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = "C2", Value = 5 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = "C3", Value = 7 });
series.DataPoints.Add(new CategoricalDataPoint() { Category = "C4", Value = 17 });
Style style = new Style(typeof(Border));
style.Setters.Add(new Setter(Border.BackgroundProperty, new SolidColorBrush(Colors.LightGray)));
series.DefaultVisualStyle = style;
RadChart1.Series.Add(series);
Hope this helps.
Regards,
Giuseppe
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>