views:

428

answers:

2

I am using ZedGraph's master pane to display two graphs that have synchronized X axes. I am running into a problem when I zoom in on one of the graphs. As I zoom in, the Y axis will show an increasing number of decimal places, eventually causing the zoomed-in graph to be narrower than the other graph, preventing their X axes from lining up exactly.

The workarounds I have tried:

  • Set the YAxis.MinSpace and Y2Axis.MinSpace on both subpanes larger
  • Make YAxis.Scale.FontSpect.Size smaller

Both of these will help but do not fix the problem. Eventually, I'll zoom in enough that one graph is showing enough decimal places on the scale that the two graphs are no longer the same width.

I think I can solve the problem by restricting the number of decimal places displayed, but I can't find a way to do this.

A: 

For a fixed number of decimal places, you can do

GraphPane.YAxis.Scale.Format = "F0"; // 0 decimal places

Or if you wanted to have a chance to examine the current visible range before deciding on the number of decimal places, you can add an event handler for

GraphPane.YAxis.ScaleFormatEvent
frou
A: 

Hi, I am alos having same kind of project where I have a MasterPane which has synchronized GraphPanes sharing same x-Axis. i.e X-Axis of the top GraphPane made invisible. I am also facing a same problem with respect to zooming, i.e I want to zoom/pan in one chart should also effect other chart, since these two charts lies in single MasterPane sharing same X-axis logically.

Thanks in advance.

sanjeev