0

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 seeing it - how can I set the background colour to stripe vertically in line with the X axis columns?

In the article mentioned the "AlternateStripLineStyle" is located here: RadChart1.DefaultView.ChartArea.AxisY.AxisStyles.AlternateStripLineStyle

However the Ajax control does not have an AxisStyles property.

Thanks.

UPDATE: I think this may be possible using the MarkedZones property of the PlotArea but that's not a very elegant solution if indeed it does work.

1 Answer 1

0

Telerik themselves provided the following solution which as I suspected uses MarkedZones:

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);
   }           
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.