How can I set period units in an x-axis showing DateTime values, according to a particular rule?For example, if the datapoints are 365 (one year) I would like to show axis label every end of month, or quarterly, and so on.
If no unit is set, line chart will show every day in the axis label, but the chart is not readable anymore.
famproject,
Please test this code in your implementation and let me know how this works for you:
axis.AutoRange = false;
axis.Minimum = aDateTime.ToOADate();
axis.Maximum = aDateTime.ToOADate();
axis.Unit = anInterval.TotalMilliseconds;
Thanks,
Thanks a lot: it's OKNow I have another question.I have three line charts on the same page and I need to show multiple series for each chart.Series are known only at runtime so I have to add series in code behind.
I need to show (it's a graphical requirement) YAxis line labels at the SAME position for every chart:I suppose I have to manage the interval along with max and min values. The formula should be: (max -min) / desired interval.I tried to hard code, for example, a max value at 100, a min value at 1, and an interval at 20 for every chart: the three charts have Y lines layed on the same position correctly.The problem is that the range of the series may differ a lot; so if a chart, for example, has a max value of 1.5 and a min value of 0.5, and the other chart as a max value of 100, the line series of the first chart are compressed in an unreadable minimal space.The question is: how can I set a fixed interval for every chart so that Y lines can appear on the same position? Setting a global max value for every chart doesn't work because of the above problem.
ThanksVALERIO
Valerio,
Can you please provide a screenshot of your charts demonstrating the issue? If I understand your requirement correctly, you want to have the same interval (and range?) for each Y-axis. This implies to me that you would naturally run the risk of some series becoming unreadable as you mentioned, so I am not sure what can be done.
Either way, a screenshot showing the issue, along with your own notes indicating what you WANT it to be, will be very helpful.