How Do I Assign Individual Colors to Bars?
i want to do something like that
http://www.telerik.com/help/aspnet-ajax/chart-how-to-assign-individual-colors-to-bars.html
from code behind in silverlight
there is my sample code
Telerik.Windows.Controls.RadChart chart = new Telerik.Windows.Controls.RadChart();
chart.PaletteBrushes = new BrushCollection();
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.Orange });
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.Green });
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.Orange });
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.DarkGray });
DataSeries barSeries=new DataSeries();
foreach (Indicator ind in cd.Indicators)
{
barSeries.Add(new DataPoint() { YValue = double.Parse(ind.value), XCategory = ind.Name });
barSeries.LegendLabel = ind.Name;
}
int colorindex = 0;
foreach (var bar in barSeries)
{
BarSeriesDefinition bardef = new BarSeriesDefinition();
bardef.Appearance.Fill = chart.PaletteBrushes[colorindex];
bar.DataItem = bardef;
colorindex++;
}
chart.DefaultView.ChartArea.DataSeries.Add(barSeries);
i want to do something like that
http://www.telerik.com/help/aspnet-ajax/chart-how-to-assign-individual-colors-to-bars.html
from code behind in silverlight
there is my sample code
Telerik.Windows.Controls.RadChart chart = new Telerik.Windows.Controls.RadChart();
chart.PaletteBrushes = new BrushCollection();
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.Orange });
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.Green });
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.Orange });
chart.PaletteBrushes.Add(new SolidColorBrush() { Color = Colors.DarkGray });
DataSeries barSeries=new DataSeries();
foreach (Indicator ind in cd.Indicators)
{
barSeries.Add(new DataPoint() { YValue = double.Parse(ind.value), XCategory = ind.Name });
barSeries.LegendLabel = ind.Name;
}
int colorindex = 0;
foreach (var bar in barSeries)
{
BarSeriesDefinition bardef = new BarSeriesDefinition();
bardef.Appearance.Fill = chart.PaletteBrushes[colorindex];
bar.DataItem = bardef;
colorindex++;
}
chart.DefaultView.ChartArea.DataSeries.Add(barSeries);