2 posts, 0 answers
  1. Srivalli
    Srivalli avatar
    9 posts
    Member since:
    May 2016

    Posted 20 May 2016 Link to this post


    Im using radhmtl chart and binding the data using Dataset, I want to show the column series on different colors based on data, Can you please help how to add different colors for columnseries based on the condition I have, following is the code
    <telerik:RadHtmlChart runat="server" ID="RadHtmlChart5" Width="600px" Height="400px" Visible="false" OnDataBound="RadHtmlChart5_DataBound">

    <telerik:ColumnSeries Name="Hours" DataFieldY="TotalHours">
    <TooltipsAppearance Color="White"></TooltipsAppearance>
    <XAxis DataLabelsField="Service"></XAxis>
    <YAxis><MinorGridLines Visible="false"></MinorGridLines></YAxis>
    <Legend><Appearance Visible="false"></Appearance></Legend>
    <ChartTitle Text="Total Hours Per Service"></ChartTitle>

    DataTable dt = new DataTable();
    RadHtmlChart5.Visible = true;
    for(int i=0; i<dt.Rows.Count; i++)

    if (dt.Rows[0]["Service"].ToString() == "Employee")
    //I want to show columnserries color as red
    if (dt.Rows[0]["Service"].ToString() == "Vendor")
    //I want to show columnserries color as blue
    if (dt.Rows[0]["Service"].ToString() == "Contractor")
    //I want to show columnserries color as green}

    RadHtmlChart5.DataSource = dt;

  2. Marin Bratanov
    Marin Bratanov avatar
    3907 posts

    Posted 24 May 2016 Link to this post


    I advise you review the following resouces that explain how to do this:

    You can either add a field (column) in your data source that contains this information, or create SeriesItems programmatically based on your conditions.


    Marin Bratanov
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top