Hello,
I'm trying to use a custom palette for the series in my bar chart because the Telerik-skin seems to contain only 6 default colors.
But when I create a custom palette the way shown below, the first 7 bar series are getting the default colors. Only series 8 and 9 are in the colors I created.
With a pie chart (1 series with 9 items) everything works fine.
Does anybody know this problem?
Best regards
Rayko
I'm trying to use a custom palette for the series in my bar chart because the Telerik-skin seems to contain only 6 default colors.
But when I create a custom palette the way shown below, the first 7 bar series are getting the default colors. Only series 8 and 9 are in the colors I created.
With a pie chart (1 series with 9 items) everything works fine.
Does anybody know this problem?
Best regards
Rayko
<body> |
<form id="form1" runat="server"> |
<telerik:RadChart ID="RadChart1" runat="server" Skin="DeepBlue" Width="700px" EnableViewState="false"/> |
</form> |
</body> |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!Page.IsPostBack) |
{ |
CreateChart(); |
} |
} |
private void CreateChart() |
{ |
RadChart1.Clear(); |
RadChart1.PlotArea.XAxis.Clear(); |
//CreatePie(); |
CreateBar(); |
SetSeriesColors(); |
} |
private void CreatePie() |
{ |
ChartSeries series = new ChartSeries("PieSeries", ChartSeriesType.Pie); |
for (int i = 1; i < 10; i++) |
{ |
ChartSeriesItem newItem = new ChartSeriesItem(); |
newItem.Name = "test"+i; |
newItem.YValue = i; |
series.Items.Add(newItem); |
} |
series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels; |
RadChart1.Series.Add(series); |
} |
private void CreateBar() |
{ |
for (int i = 1; i < 10; i++) |
{ |
ChartSeries series = new ChartSeries("test" + i, ChartSeriesType.Bar); |
ChartSeriesItem newItem = new ChartSeriesItem(); |
series.Name = "test" + i; |
newItem.Name = "test" + i; |
newItem.YValue = i; |
series.Items.Add(newItem); |
series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.SeriesName; |
RadChart1.AddChartSeries(series); |
} |
} |
private void SetSeriesColors() |
{ |
Color[] seriesColors = new[] |
{ |
Color.Red, |
Color.Yellow, |
Color.Black, |
Color.Blue, |
Color.White, |
Color.Green, |
Color.MediumPurple, |
Color.Brown, |
Color.Orange, |
Color.Gray |
}; |
Palette seriesPalette = new Palette("seriesPalette", seriesColors, true); |
RadChart1.CustomPalettes.Add(seriesPalette); |
RadChart1.SeriesPalette = "seriesPalette"; |
} |