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

Thread is closed for posting
4 posts, 0 answers
  1. Frank
    Frank avatar
    2 posts
    Member since:
    Aug 2010

    Posted 12 Aug 2010 Link to this post

    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.
  2. Frank
    Frank avatar
    2 posts
    Member since:
    Aug 2010

    Posted 12 Aug 2010 Link to this post

    I found a way to solve that problem. Just remove the seriespalette (set it to ""). Then it will work. Or using colorblend instead.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yu
    Yu avatar
    18 posts
    Member since:
    Aug 2011

    Posted 16 Aug 2011 Link to this post

    How to Remove it? thanks
  5. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 22 Aug 2011 Link to this post

    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 >>

Back to Top