Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Chart > Monthly X Axis for Daily Series Data

Not answered Monthly X Axis for Daily Series Data

Feed from this thread
  • Michael avatar

    Posted on Sep 28, 2011 (permalink)

    Hi, I am using RadControls for WinForms SP2 (Q2 2010) and trying to render a stock price line chart, of which each price is a daily price. The prices are rendering ok however I have an issue with the x axis which I believe is affecting how the data is ultimately rendered.

     

    Each item in the series is a daily price for the given stock, along with the date on which the price relates to.  On the X axis we want to just show monthly points, so for our example where we are rendering a chart of daily stock prices, each axis label on the x axis would show the month (Jan, Feb, Mar etc). The code we are using (VB.net) to set the x axis label is:

     

    chrtVBA.PlotArea.XAxis.AddRange(xMin, xMax, 30)

     

    …where xMin and xMax are the minimum and maximum dates in the series (converted using .ToOADate()).

     

    As you can see, we are specifying 30 as the step value, however I beleive that because there aren’t 30 days in every month the X axis labels becomes out of sync with the plotted points. Is there a specific method to call or property we can set so that the x axis correctly shows the correct month?

     

    I have attached an example of what the chart currently looks like, we have checked the stock prices and they do appear to be out of sync with the x axis, for example a price which appears to be for late August on the rendered chart should be showing for early September. For information; the xMin and xMax values used to render this chart were 09/12/2010 and 09/12/2011 respectively (not We did call .ToOADate() to convert.

    Thanks for you help.
    Michael

     

    Reply

  • Peshito Peshito admin's avatar

    Posted on Oct 3, 2011 (permalink)

    Hello Michael,

    Thank you for contacting Telerik Support and for the details provided.
    Since the months have different number of days it is practically impossible to set an intelligent accurate step of 1 month. You can set a step of 1 day and wire the BeforeLayout event where you can iterate through the XAxis.Items and show only the first day of a month.

    Regards,
    Peshito
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Chart > Monthly X Axis for Daily Series Data
Related resources for "Monthly X Axis for Daily Series Data"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]