ZedGraph showing range in all of the diagram

99 Views Asked by At

I am using ZedGraph to show a workprocess. For this process I also have to show the range of a temperature. It should look kind of like this ZedGraph example.

For my application I need the range to be shown in the whole diagram even after I dragged the shown area to the left or right with the mouse wheel. If I just change the startpoint and the width of the box it is showed outside the axis like this which is not what I´m looking for.

Is there a way to show the range box always inside the border of the graph even after scrolling in the grapharea by using the mousewheel?

1

There are 1 best solutions below

0
stil_e On

Use MouseMoveEvent and ZoomEvent where you set the start of BoxObj's X axis to ZG.GraphPane.XAxis.Scale.Min and the width to ZG.GraphPane.XAxis.Scale.Max - ZG.GraphPane.XAxis.Scale.Min.

On MouseMoveEvent you have to put this code inside if (e.Button == MouseButtons.Middle || (e.Button == MouseButtons.Left && (ModifierKeys & Keys.Control) == Keys.Control)) to do this only if panning is started. Return false to allow pan function to still work.