How to create custom colors for DonutChart ?

2 posts, 0 answers
  1. Aravind
    Aravind avatar
    41 posts
    Member since:
    Jun 2013

    Posted 02 Jul 2013 Link to this post

      How to give custom colors in donut chart series ? my donut client side code is 
     <telerik:RadHtmlChart runat="server" ID="DonutChart" Width="500" Height="300" Transitions="true"
                                                                                                <FillStyle BackgroundColor="White"></FillStyle>
                                                                                            <ChartTitle Text="Total Files According to Department ">
                                                                                                <Appearance Align="Center" BackgroundColor="White" Position="Top"><TextStyle />
                                                                                                <Appearance BackgroundColor="White" Position="Right" Visible="true">
                                                                                                    <FillStyle BackgroundColor="White"></FillStyle>
                                                                                                    <telerik:DonutSeries StartAngle="90">
                                                                                                        <LabelsAppearance Visible="false">
                                                                                                        <TooltipsAppearance DataFormatString="{0}%"></TooltipsAppearance>
                                                                                                            <telerik:PieSeriesItem />

    in that i use telerik predefined skin " Default"
    and my server side code is 

                    Dim col As New DonutSeries()
                     For Each row1 As DataRow In dt1.Rows

                            Dim se As New SeriesItem()
                             Dim pi As New PieSeriesItem()
                             se.YValue = row1(1).ToString()
                        se.Name = row1(0)

    Here how to give custom skin
            like red,yellow,blue,green,black,pink..... upto 10 colors
  2. Danail Vasilev
    Danail Vasilev avatar
    1502 posts

    Posted 03 Jul 2013 Link to this post

    Hi Aravind,

    For a non-databound chart you can use the Background property, exposed by the series items, in order to specify the color for the particular series item:
    PieSeriesItem piesSeriesItem1 = new PieSeriesItem();
    piesSeriesItem1.BackgroundColor = System.Drawing.Color.Red;

    For a databound chart you can use the ColorField property exposed by the particular series, in order to reference the color field from the datasource:
    <telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="850" Height="500">
                <telerik:DonutSeries ColorField="columnWithColors"></telerik:DonutSeries>

    Please find an example with these properties in HtmlChart - Chart Element Customization and HtmlChart - Conditional Item Colorization online demos.

    Danail Vasilev
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top