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

Chart Series not centered when ChartXAxis.LabelStep > 1

1 Answer 48 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Siddhesh asked on 27 Sep 2012, 10:07 PM
When using LabelStep for ChartXAxis, the resulting image does not have the axis lines centered at the step interval.  Is there any way to override this behavior and make lines centered at the interval.

I am using the following code

// X Axis properties
chart.PlotArea.XAxis.VisibleValues = ChartAxisVisibleValues.Positive;
chart.PlotArea.XAxis.Step = 1;
chart.PlotArea.XAxis.LabelStep = 2;
chart.PlotArea.XAxis.IsZeroBased = false;
chart.PlotArea.XAxis.AutoScale = false;
chart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.General;

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 01 Oct 2012, 11:40 AM
Hi Siddhesh,

I suggest that you tweak the LayoutMode of the XAxis in order to achive better visualization.  Let me know whether this works for you and if not please provide some more information on your scenario - whether you have used a DataLabelsColumn for the XAxis dates or you have added the series items manually similar to this way :

ChartSeries serie = new ChartSeries();
 serie.Type = ChartSeriesType.Line;
      foreach (Product product in products)
          ChartSeriesItem item = new ChartSeriesItem();
          item.YValue = (double)product.QuantityInStock;
          item.XValue = product.Date.ToOADate();
          item.Name = (string)product.Name;

Kind regards,
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.
Chart (Obsolete)
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question