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

Individual colors to bars

1 Answer 59 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Vish
Top achievements
Rank 1
Vish asked on 12 Aug 2008, 04:27 AM
Hi,

I need to give individual color to each bars based on the Yvalue. I tried with the below mentioned code, but it does not work.

ID given to radchart is RadChartTest

foreach (Telerik.Charting.ChartSeriesItem item in RadChartTest.Series[0].Items)
        {
            double val = item.YValue;
            if (val >= -2 && val <=3)
            {
                item.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
            }
            else if (val < -2)
            {
               item.Appearance.FillStyle.MainColor = System.Drawing.Color.Blue
            }
        }

Regards
Vishwanath Y R

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 13 Aug 2008, 07:29 AM
Hi Vishwanath YR,

This code seems fine and it works as expected in my test page, which you can find attached to this forum thread. You might want to set the FillType property of the chart series items to solid in order to remove the gradients:

item.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

If that still does not seem to help, can you please elaborate on this issue? Can you show us a sample, which reproduces it? Thanks.

Best regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Vish
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or