6

Is is possible to have an X Axis display hours (HH:MM)
and another (or the same) displaying Days (YYYY-MM-DD)
at different intervals so it look like


 |               |               |               |               |

09:00                      10:00                     11:00                          12:00                       01:00


                                                  |            
                                              2010/04/20         


Or Ideally :


 |               |               |               |               |

09:00                     10:00                         11:00                   2010/04/20                   01:00


Off Topic Advice
The more I use MS Chart Control the more I regret my decision switching from ZedGraph. I am really getting angry and frustrated I've lost long hours on meaningless details like these and circumventing through very ugly workarounds (like creating many duplicate "ghost" charts to "handle" different scaled series , -What the Heck!!?-, aligning data MANUALLY adding empty points because the default code use case is extremely unflexible). It seems very fancy at first glance, but from the moment you want to tweak and do serious stuff rather than displaying an ultra basic pie chart or bar histogram you enter a World of Hell. So I basically advice NOT to use it, unless you are already stuck with it (but it's never too late to reconsider moving to something that isn't that wonky and time-consuming)

EDIT : I could use "Keywords" as adviced here. Seems very funky and tedious though...
Besides, this violates the separation between Logic and Presentation
(this should never happen! Sign of Poor Design...)

For another example of such annoying similar (clueless) issues see this post

Community
  • 1
  • 1
Mehdi LAMRANI
  • 11,289
  • 14
  • 88
  • 130
  • Can't answer your question, but I had looked into switching from ZedGraph to MSCharts myself. I ended up not doing it because I didn't have time to learn MSCharts, but with the idea that I would switch one day. From your "Off Topic Advice," I may consider sticking with ZedGraph for a while longer. – Eric Jun 22 '11 at 01:25
  • @Eric : Glad to spare you a considerable loss of time and headbanging against the wall :-) There is still a long way to go before having a satisfying comprehensive scientific graph tool (without paying ridiculously expensive licenses). As of now, Zedgraph is intelligently implemented and very open to write your own extensions (easily expandable). On the contrary, MSCharts is a load of ugly workarounds and badly put-together in a quick'n'dity manner when you look closer to the code behind the fancy scenes. Peace. – Mehdi LAMRANI Jul 04 '11 at 09:19

1 Answers1

1

You can use a single X axis, and you can customize the "12:00" labels to display the "date". See CustomLabel and CustomLabelsCollection in namespace System.Windows.Forms.DataVisualization.Charting. You could use the freeware ILSpy to see what's inside MSChart dll.

There are several constructors for CustomLabel, I used this one:

public CustomLabel(double fromPosition, double toPosition, string text, int labelRow, LabelMarkStyle markStyle, GridTickTypes gridTick)

Basically, it goes something like this:

CustomLabel label1 = new CustomLabel(...);
mychart.ChartAreas[0].AxisX.CustomLabels.Add(label1);

Hope this helps.

scrat.squirrel
  • 3,607
  • 26
  • 31