Skip to content

Commit 0ea1d9b

Browse files
committed
move some axis constant to constants file
1 parent 473016c commit 0ea1d9b

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/plots/cartesian/axes.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ var axes = module.exports = {};
1717

1818
axes.layoutAttributes = require('./layout_attributes');
1919

20-
var xAxisMatch = /^xaxis[0-9]*$/,
21-
yAxisMatch = /^yaxis[0-9]*$/;
2220

2321
axes.supplyLayoutDefaults = function(layoutIn, layoutOut, fullData) {
2422
// get the full list of axes already defined
@@ -371,8 +369,6 @@ axes.clearTypes = function(gd, traces) {
371369
// convert between axis names (xaxis, xaxis2, etc, elements of td.layout)
372370
// and axis id's (x, x2, etc). Would probably have ditched 'xaxis'
373371
// completely in favor of just 'x' if it weren't ingrained in the API etc.
374-
var AX_ID_PATTERN = /^[xyz][0-9]*$/,
375-
AX_NAME_PATTERN = /^[xyz]axis[0-9]*$/;
376372
axes.id2name = function(id) {
377373
if(typeof id !== 'string' || !id.match(AX_ID_PATTERN)) return;
378374
var axNum = id.substr(1);
@@ -583,14 +579,6 @@ axes.cleanDatum = function(c){
583579
return c;
584580
};
585581

586-
/**
587-
* standardize all missing data in calcdata to use undefined
588-
* never null or NaN.
589-
* that way we can use !==undefined, or !==axes.BADNUM,
590-
* to test for real data
591-
*/
592-
axes.BADNUM = undefined;
593-
594582
// setConvert: define the conversion functions for an axis
595583
// data is used in 4 ways:
596584
// d: data, in whatever form it's provided

src/plots/cartesian/constants.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@
1010

1111

1212
module.exports = {
13+
/**
14+
* standardize all missing data in calcdata to use undefined
15+
* never null or NaN.
16+
* that way we can use !==undefined, or !== BADNUM,
17+
* to test for real data
18+
*/
19+
BADNUM: undefined,
20+
21+
// axis match regular expression
22+
xAxisMatch: /^xaxis[0-9]*$/,
23+
yAxisMatch: /^yaxis[0-9]*$/,
24+
25+
// pattern matching axis ids and names
26+
AX_ID_PATTERN: /^[xyz][0-9]*$/,
27+
AX_NAME_PATTERN: /^[xyz]axis[0-9]*$/,
28+
1329
// ms between first mousedown and 2nd mouseup to constitute dblclick...
1430
// we don't seem to have access to the system setting
1531
DBLCLICKDELAY: 600,

0 commit comments

Comments
 (0)