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

RadChart Alternating Background StripLines On ASP Ajax control

1 Answer 50 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 11 Jul 2012, 02:12 PM
I want to show an alternating background colour for the X axis on a line chart on the ASP.Net Ajax RadChart control.
I have found this article that shows the StripLine property for Silverlight and WPF chart control but I cannot find this property on the Ajax control. Maybe I'm just not finding it  - how can I set the background colour to stripe vertically in  line with the X axis columns.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosko
Telerik team
answered on 16 Jul 2012, 07:53 AM
Hello Chris,

I regreto to tell you that there is no out-of-the-box stripline feature in the ASP.NET RadChart. But I can offer you a workaround using marked zones. Please, refer to the code snippet below for further details. I hope this will help you achieve the desired results.

public void GenerateStripLines(RadChart chart, int minValue, int maxValue, int step)
{
   for (int i = minValue; i <= maxValue + step; i+=step)
   {
      Color zoneColor;
 
      if (i % 2 == 0)
         zoneColor = Color.White;
      else
         zoneColor = Color.WhiteSmoke;
 
      var item = new ChartMarkedZone() { ValueStartY = i, ValueEndY = i + step };
      item.Appearance.FillStyle.MainColor = zoneColor;
      chart.PlotArea.MarkedZones.Add(item);
   }           
}


Kind regards,
Rosko
the Telerik team
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 their blog feed now.
Tags
Chart (Obsolete)
Asked by
Chris
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Share this question
or