03-08-2018 05:40 PM
I want to restrict panning of scattergraph after user scrolls to the end of the graph. Currently even after reaching the end, user can still continue dragging the white area.
Full graph:
User scrolls to white area:
03-09-2018 03:53 PM
Hi arunkumar.s,
One way to go about this would be to disable panning altogether and instead add a horizontal scrollbar. This scrollbar could control the X Axis for the graph, and restrict the user to only scrolling through the "allowed" range for the graph.
03-09-2018 04:02 PM
Hi NickelsAndDimes,
I allow pan only if user zooms the graph. So, panning is necessary here. As you suggest, if I want to disable the panning and add scroll bar, I don't see an inbuilt scroll facility in scattergraph. Do you have a sample code to achieve this?
03-12-2018 02:36 PM
I don't have any sample code available, but there's a class called "HScrollBar" under "All Windows Forms" that's essentially just a numeric control. You could set this to have a minimum of 0, and a maximum of ([last x value]-[x width displayed]). Your chart can then read from this scrollbar to set its X scale from [HScrollBar.value] to [HScrollBar.value+x width].
03-19-2018 03:04 PM
In which event of graph should I set X scale from [HScrollBar.value] to [HScrollBar.value+x width]? The graph does not have a onscroll event.
03-20-2018 01:15 PM
You'll want to use the hScrollBar_Scroll or hScrollBar_ValueChanged event to detect when a change is made, and then edit the graph's X range from that method.