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

Different colors for each item in the same serie?

5 Answers 149 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
namhuan243
Top achievements
Rank 1
namhuan243 asked on 18 Jun 2008, 11:37 AM
Pls show me how to achieve that in Bar chart as all the bars in the same serie always have  the same color. It can be done automatically in Pie chart but I cannot figure out how to do that in Bar chart apart from manually assigned colors to every single item.

Thanks in advance

5 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 18 Jun 2008, 02:21 PM
Hello namhuan243,

This behavior is by design -- all bars within the same chart series are displayed in the same color and this behavior can be customized only manually by assigning different fill to the bar series items. The automatic behavior of the pie chart is special-cased in this respect (each slice displayed in different color automatically) as otherwise the pie chart would not display a meaningful graphic.


Regards,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
dargor
Top achievements
Rank 1
answered on 20 Jun 2008, 01:19 AM
Hello Manuel,

You are right Rad Chart will auto assign different colors for each item. However if there are many items then colors are repeated. Is there any way to avoid this? How can I manually change the color otherwise?

Thanks

Mario

0
Giuseppe
Telerik team
answered on 20 Jun 2008, 10:44 AM
Hi dargor,

You can create custom palettes and assign as many different colors to the pies as you wish like this:

<telerik:RadChart ID="RadChart1" runat="server" SeriesPalette="CustomPalette1"
    <CustomPalettes> 
        <telerik:Palette Name="CustomPalette1"
            <Items> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Red"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Aqua"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Pink"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Green"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Yellow"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Gray"></telerik:PaletteItem> 
                <telerik:PaletteItem MainColor="Cyan"></telerik:PaletteItem> 
            </Items> 
        </telerik:Palette> 
    </CustomPalettes> 
    <Series> 
        <telerik:ChartSeries Type="Pie"
            <Items> 
                <telerik:ChartSeriesItem YValue="10" /> 
                <telerik:ChartSeriesItem YValue="10" /> 
                <telerik:ChartSeriesItem YValue="10" /> 
                <telerik:ChartSeriesItem YValue="20" /> 
                <telerik:ChartSeriesItem YValue="5" /> 
                <telerik:ChartSeriesItem YValue="5" /> 
                <telerik:ChartSeriesItem YValue="10" /> 
                <telerik:ChartSeriesItem YValue="5" /> 
                <telerik:ChartSeriesItem YValue="5" /> 
                <telerik:ChartSeriesItem YValue="5" /> 
                <telerik:ChartSeriesItem YValue="5" /> 
                <telerik:ChartSeriesItem YValue="10" /> 
            </Items> 
        </telerik:ChartSeries> 
    </Series> 
</telerik:RadChart> 


You can use the same approach from the code-behind as well.


Greetings,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jay
Top achievements
Rank 1
answered on 13 Aug 2014, 06:38 AM
hi,

can you tell me how to achieve this n Android platform.
i want to change different color  for each bar in bar series .

regards,
jay
0
Danail Vasilev
Telerik team
answered on 14 Aug 2014, 10:33 AM
Hello Jay,

The provided code is supposed to work in all of the supported browsers by Telerik UI controls. If you are having some issues on this regard please provide more details.

I can also suggest that you try the newer RadHtmlChart control and not the obsoleted RadChart one.


Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart (Obsolete)
Asked by
namhuan243
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
dargor
Top achievements
Rank 1
Jay
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or