Chart Series not centered when ChartXAxis.LabelStep > 1

Thread is closed for posting
2 posts, 0 answers
  1. Siddhesh
    Siddhesh avatar
    1 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2012 Link to this post

    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;
  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 01 Oct 2012 Link to this post

    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.
Back to Top