Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow controlling pan/zoom range entry. #1389

Merged
merged 3 commits into from
Feb 24, 2017

Conversation

rpaskowitz
Copy link
Contributor

For either UI appearance reasons, or because the range entry doesn't work as one might expect (for example, on http://localhost:3000/devtools/test_dashboard/#axes_category_categoryarray , which should maybe be addressed in addition), allow people to disable the entry. Default to on so that introduction of the option is backwards compatible.

For either UI appearance reasons, or because the range entry doesn't work as one might expect (for example, on http://localhost:3000/devtools/test_dashboard/#axes_category_categoryarray, which should maybe be addressed in addition), allow people to disable the entry. Default to on so that introduction of the option is backwards compatible.
@etpinard
Copy link
Contributor

Ha, yeah that's probably plotly.js' most hidden feature. Good 👁️

First, can you elaborate on the bug you're seeing? At first glance, those range entry input boxes handlers behave as expected (i.e. as what a plain relayout call would), though the way to set axis range for categorical axes isn't fabulous.

I'm open to adding a config argument, but I'm not convinced range entry is best at describing this feature. Maybe showAxisRangeEntryBoxes?

Moreover, we should make sure that the drag corners

gifrecord_2017-02-20_114205

can also be optionally taken out.

@rpaskowitz
Copy link
Contributor Author

Here's the type of thing I see happing with a category axis:
rangeentry

Providing a way to disable pan/zoom on the chart area may make sense. I suppose the options would need to be named explicitly with reference to the drag handles since there would still be pan/zoom in the toolbar. Hopefully it wouldn't be necessary to distinguish between the corners (which do zoom), and the mid-axis (which do pan)?

@rpaskowitz
Copy link
Contributor Author

Oh, and you may be right, what I see for a category axis isn't necessarily a bug, but still isn't what people would expect. (It's almost an argument for it being disabled all the time on category axes since while it works the same way it would via an API, I don't think there's any way for an end-user to understand the behavior). A larger discussion I'm sure, and doesn't necessarily need to be tied up in providing an ad-hoc method to disabling the range entry.

Also renamed the range entry option as per PR.
@rpaskowitz
Copy link
Contributor Author

Range entry option renamed and controlling whether the drag handles are shown to be begin with is added.

There is a dependency between the option now (noted in comment). If you disable the drag handles, even if range entry is enabled you won't be able to use it.

// enable/disable direct range entry at the pan/zoom drag points
enableRangeEntry: true,
// enable axis pan/zoom drag handles
showAxisDragHandles: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A straight-up boolean is fine for now.

I'm thinking down the road, we could allow users to specify which drag handles to show for example:

showAxisDragHandles: 'n+s'

would only show the north (or top) and south (or bottom) dragger.

But that's for another day. 👍

DRAGGERSIZE, ya._length * 0.1, 's', '');
dragBox(gd, plotinfo, x0, 0,
DRAGGERSIZE, ya._length * 0.1, 'n', '');
if(gd._context.showAxisDragHandles) {
Copy link
Contributor

@etpinard etpinard Feb 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Before merging, we'll need to add a few test cases to 🔒 this down.

In test/jasmine/config_test.js, call Plotly.plot with the a config object that set both new options to false and make sure that the corresponding handle and range entry boxes don't show up in the DOM. The showLink test case should serve as a good example.

Let me know if you have any questions!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got some tests added.

click(cornerX, cornerY);

var editBox = document.getElementsByClassName('plugin-editable editable')[0];
expect(editBox).toBeUndefined();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Very nicely done!

@etpinard
Copy link
Contributor

@rpaskowitz amazing work! Thanks for your efforts 🍻

This patch will part of the new release 1.24.0, set to be published early next week.

@etpinard etpinard merged commit 9ebefd7 into plotly:master Feb 24, 2017
@rpaskowitz rpaskowitz deleted the control_range_entry branch April 14, 2017 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants