Set Bar Color

Thread is closed for posting
2 posts, 0 answers
  1. Stephanie
    Stephanie avatar
    8 posts
    Member since:
    Dec 2013

    Posted 23 Dec 2013 Link to this post

    Is there a way to set the color of the bars based on the text in a textbox?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Dec 2013 Link to this post

    Hi Stephanie,

    Please have a look into the following code snippet to change the Bar color based on the Text in the RadTextBox.

    <telerik:RadTextBox ID="RadTextBox1" AutoPostBack="true" runat="server" EmptyMessage="Enter R or B to chnage the Bar color"
    <telerik:RadChart runat="server" ID="RadChart2">
            <telerik:ChartSeries Name="series 1" Type="Bar">
                    <telerik:ChartSeriesItem YValue="50">
                    <telerik:ChartSeriesItem YValue="250">
                    <telerik:ChartSeriesItem YValue="500">
                    <telerik:ChartSeriesItem YValue="5000">

    protected void RadTextBox1_TextChanged(object sender, EventArgs e)
        string Text=RadTextBox1.Text;
        foreach (ChartSeriesItem item in RadChart2.Series[0].Items)
            if (Text == "R")
                item.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
                item.Appearance.FillStyle.MainColor = System.Drawing.Color.Blue;

  3. DevCraft R3 2016 release webinar banner
Back to Top