Snap to ticks mode for the selection #129

dnschnur opened this Issue Sep 28, 2012 · 5 comments


None yet

1 participant


Original author: (July 22, 2008 17:23:24)

This is an enhancement rather than a issue. The attached code is simply proof of concept and
should be considered incomplete.

Selecting ranges (selection-mode-x) is great but I wanted to make it easier to select the entire
region between ticks. I wanted when I click the mouse and move for the current region to be
selected and then as I cross over each tick the next region is selected in whole, rather than pixel
by pixel.

The patch as I said is little more than a proof, it doesn't work correctly going from right to left.
There's a variable glob that's simply a placeholder, ideally this would be replaced by some
configuration. I figured it was best to simply do a proof of concept to illustrate what I wanted,
then as you guys have time/interest you can come up with a clean/proper implementation.

Attached is an example screenshot and a patch.

Original issue:


From on August 01, 2008 20:42:48
This is a good idea, I think, but the problem is that it's a lot of processing going
on in the background to always look-ahead to the next point. Also, as you no-doubt
noticed, going the other way adds even more processing to determine which direction
you're selecting, etc.

Interesting, though. I'll keep my eye out for efficient ways to implement this in my
flot fork (


From on August 18, 2008 16:02:26
I've got it working in my forked version now. I realized we're only talking about
snapping to TICKS not datapoints so it really wasn't a processing problem. There is a
wierd issue that only sometimes shows up where the selection loses the tick you
started on... Working on it :)


From on September 18, 2008 09:56:35
Sounds simple enough although at little complication is that API-wise we need to
take dual-axis support into account. Maybe snapToTicks in selection which could be
an array of "x" or "y" or "x2" or "y2". I'd be happy to review a patch.


From on July 07, 2009 22:29:59
Does this now work for dual-axis?


From on October 27, 2009 13:16:32
The selection is now a plugin. So this should be easy to hack in, if someone's
interested in making patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment