RadHTMLChart

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

    Posted 20 May Link to this post

    Hi,

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

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


    DataTable dt = new DataTable();
    dt=Cls.GetAllData(id);
    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;

    RadHtmlChart5.DataBind();
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 24 May Link to this post

    Hi,

    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.


    Regards,

    Marin Bratanov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top