Allow panning in the past, but bounce back when panning past current date


#1

Hi there, is there a way to restrict panning past the max value in a data range, but allow panning past the min value in the data range for a date range?


#2

You could try locking/unlocking panning on your data axis within the sChartIsPanning: delegate method. Within the method, compare the axisRange of your date axis (obtainable via [chart xAxis] or [chart yAxis]) with the range you desire to be unrestricted and if it matches, you can either set the range of the data axis or unbind its movement. (And then if the date range is outside of the unbounded area, you would enforce panning restrictions again.)


#3

Hmm is there a way to update the default range without affecting the axisRange?


#4

Let’s ignore the technical aspect for a minute and think about the practical: how do you want this to behave when the user is panned further out of bounds then they’re allowed to be? Should they be allowed to remain there until they voluntarily move back within bounds, at which point they will not be permitted to leave them until they pan further along the date axis? I’m not sure what the merits of such an approach would be: I’d get confused initially being allowed to view an area of a chart and then (seemingly arbitrarily) not being able to return to the same exact area.


#5

Hey Samuel,

Think of this like a Facebook newsfeed. When you scroll down, if you hit the last loaded post, you will get more posts lazy-loaded that are farther back in time. The idea here is that we’re showing market data, and the ability to pan into the past is helpful in this case, but it also doesn’t make sense to load all the data for all time. It’s not helpful to pan into the future either, so that’s the inspiration for this type of functionality.