Search code examples
c#zedgraph

How to sync three GraphPane's in ZedGraph?


While using ZedGraph to display six graphs on three GraphPane's as shown in first pic, all graphs are in sync. However when i try to display the date for the first pane the graph are out of sync as shown in the second pic. Its important that all six graphs remain in sync for the user to make sense of the whole chart.

I have tried XAxis.Type = AxisType.Date as suggested by tmwoods here and was able to show the dates along X axis. The DateTime along X axis can be in minutes/seconds say from 9:00 AM to 4:00 PM could also be in days say form 28/1/2009 to 25/11/2012

Picture-1

Picture-2


Solution

  • OK, I think I got it. Try adding this to your code:

    pane1.Chart.Rect = new RectangleF (pane2.Chart.Rect.X,
                pane2.Chart.Rect.Y,
                pane2.Chart.Rect.Width,
                pane2.Chart.Rect.Height);
    

    I've been peeking around and Zedgraph supports something called Graph Align but I can't find source on it anywhere. The closest I have found is here; check out the bottom-most example. It describes how to align multiple charts of varyng sizing vertically. But I haven't tested it out.