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

Monthly X Axis for Daily Series Data

1 Answer 83 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 28 Sep 2011, 07:05 PM

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

 

1 Answer, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 03 Oct 2011, 01:54 PM
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 >>
Tags
Chart (obsolete as of Q1 2013)
Asked by
Michael
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Share this question
or