File tree Expand file tree Collapse file tree 3 files changed +48
-35
lines changed Expand file tree Collapse file tree 3 files changed +48
-35
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ var constants = require ( './constants' ) ;
4+
35module . exports = {
46 editType : 'modebar' ,
57
@@ -43,7 +45,8 @@ module.exports = {
4345 'Determines which predefined modebar buttons to add.' ,
4446 'Please note that these buttons will only be shown if they are' ,
4547 'compatible with all trace types used in a graph.' ,
46- 'Similar to `config.modeBarButtonsToAdd` option'
48+ 'Similar to `config.modeBarButtonsToAdd` option.' ,
49+ 'This may include *' + constants . backButtons . join ( '*, *' ) + '*.'
4750 ] . join ( ' ' )
4851 } ,
4952 remove : {
@@ -53,7 +56,8 @@ module.exports = {
5356 editType : 'modebar' ,
5457 description : [
5558 'Determines which predefined modebar buttons to remove.' ,
56- 'Similar to `config.modeBarButtonsToRemove` option'
59+ 'Similar to `config.modeBarButtonsToRemove` option.' ,
60+ 'This may include *' + constants . foreButtons . join ( '*, *' ) + '*.'
5761 ] . join ( ' ' )
5862 }
5963} ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ var modeBarButtons = require ( './buttons' ) ;
4+ var buttonList = Object . keys ( modeBarButtons ) ;
5+
6+ var DRAW_MODES = [
7+ 'drawline' ,
8+ 'drawopenpath' ,
9+ 'drawclosedpath' ,
10+ 'drawcircle' ,
11+ 'drawrect' ,
12+ 'eraseshape'
13+ ] ;
14+
15+ var backButtons = [
16+ 'v1hovermode' ,
17+ 'hoverclosest' ,
18+ 'hovercompare' ,
19+ 'togglehover' ,
20+ 'togglespikelines'
21+ ] . concat ( DRAW_MODES ) ;
22+
23+ var foreButtons = [ ] ;
24+ var addToForeButtons = function ( b ) {
25+ if ( backButtons . indexOf ( b . _cat || b . name ) !== - 1 ) return ;
26+ // for convenience add lowercase shotname e.g. zoomin as well fullname zoomInGeo
27+ var name = b . name ;
28+ var _cat = ( b . _cat || b . name ) . toLowerCase ( ) ;
29+ if ( foreButtons . indexOf ( name ) === - 1 ) foreButtons . push ( name ) ;
30+ if ( foreButtons . indexOf ( _cat ) === - 1 ) foreButtons . push ( _cat ) ;
31+ } ;
32+ buttonList . forEach ( function ( k ) {
33+ addToForeButtons ( modeBarButtons [ k ] ) ;
34+ } ) ;
35+ foreButtons . sort ( ) ;
36+
37+ module . exports = {
38+ DRAW_MODES : DRAW_MODES ,
39+ backButtons : backButtons ,
40+ foreButtons : foreButtons
41+ } ;
Original file line number Diff line number Diff line change @@ -7,39 +7,7 @@ var isUnifiedHover = require('../fx/helpers').isUnifiedHover;
77
88var createModeBar = require ( './modebar' ) ;
99var modeBarButtons = require ( './buttons' ) ;
10- var buttonList = Object . keys ( modeBarButtons ) ;
11-
12- var DRAW_MODES = [
13- 'drawline' ,
14- 'drawopenpath' ,
15- 'drawclosedpath' ,
16- 'drawcircle' ,
17- 'drawrect' ,
18- 'eraseshape'
19- ] ;
20-
21- var backButtons = [
22- 'v1hovermode' ,
23- 'hoverclosest' ,
24- 'hovercompare' ,
25- 'togglehover' ,
26- 'togglespikelines'
27- ] . concat ( DRAW_MODES ) ;
28-
29- var foreButtons = [ ] ;
30- var addToForeButtons = function ( b ) {
31- if ( backButtons . indexOf ( b . _cat || b . name ) !== - 1 ) return ;
32- // for convenience add lowercase shotname e.g. zoomin as well fullname zoomInGeo
33- var name = b . name ;
34- var _cat = ( b . _cat || b . name ) . toLowerCase ( ) ;
35- if ( foreButtons . indexOf ( name ) === - 1 ) foreButtons . push ( name ) ;
36- if ( foreButtons . indexOf ( _cat ) === - 1 ) foreButtons . push ( _cat ) ;
37- } ;
38- buttonList . forEach ( function ( k ) {
39- addToForeButtons ( modeBarButtons [ k ] ) ;
40- } ) ;
41- foreButtons . sort ( ) ;
42-
10+ var DRAW_MODES = require ( './constants' ) . DRAW_MODES ;
4311
4412/**
4513 * ModeBar wrapper around 'create' and 'update',
You can’t perform that action at this time.
0 commit comments