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

Cannot change the bar colors in one series ---- waiting online

3 Answers 54 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 12 Aug 2010, 11:11 AM
Hi,

if (rcPieBudgetItems.Series[0].Type == ChartSeriesType.Bar)
        {
            isPieChart = false;
            for (int i = 0; i < rcPieBudgetItems.Series[0].Items.Count; i++)
            {
                rcPieBudgetItems.Series[0].Items[i].Appearance.FillStyle.MainColor = rcPieBudgetItems.CustomPalettes[0].Items[i].MainColor;
                rcPieBudgetItems.Series[0].Items[i].Appearance.FillStyle.SecondColor = rcPieBudgetItems.CustomPalettes[0].Items[i].SecondColor;
            }
            (rgLegend.MasterTableView.GetColumn("gncValueColumn") as GridNumericColumn).DataFormatString = "{0:C}";
        }
        else
        {
            isPieChart = true;
           
            if (rcPieBudgetItems.CustomPalettes.Count == 0 && rcPieBudgetItems.Series[0].Items.Count > 0)
            {
                rcPieBudgetItems.CustomPalettes.Add(MyColorPalette.CustomPalettesHelper(rcPieBudgetItems.Series[0].Items.Count));
                rcPieBudgetItems.SeriesPalette = rcPieBudgetItems.CustomPalettes[0].Name;
            }
           
            (rgLegend.MasterTableView.GetColumn("gncValueColumn") as GridNumericColumn).DataFormatString = "{0:0.00}%";
        }

MyColorPalette.CustomPalettesHelper will return a Palette based on a number. When I click on the image it will change the chart type from pie to chart or chart to pie and call the code above. The problem is the colors in pie chart is fine, but in bar chart they always have the same color as the first color in the CustomPalette even though I set the color values manually. By the way, if I set filltype in the code above then it will pick up the new fill type but not the color.
Will really appreciate if anyone can give me some suggestions based on that. I'll wait online.

Thanks a mill.

3 Answers, 1 is accepted

Sort by
0
Frank
Top achievements
Rank 1
answered on 12 Aug 2010, 12:27 PM
I found a way to solve that problem. Just remove the seriespalette (set it to ""). Then it will work. Or using colorblend instead.
0
Yu
Top achievements
Rank 1
answered on 17 Aug 2011, 04:11 AM
How to Remove it? thanks
0
Evgenia
Telerik team
answered on 22 Aug 2011, 12:03 PM
Hello,

You may review this thread where a similar issue was discussed.

Best wishes,
Evgenia
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Chart (Obsolete)
Asked by
Frank
Top achievements
Rank 1
Answers by
Frank
Top achievements
Rank 1
Yu
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or