Skip to content

Commit a075f81

Browse files
committed
place cartesian constants reused in attribute in sep. file
1 parent c53a00a commit a075f81

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

src/components/annotations/attributes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
'use strict';
1010

1111
var ARROWPATHS = require('./arrow_paths');
12-
var Cartesian = require('../../plots/cartesian');
1312
var fontAttrs = require('../../plots/font_attributes');
13+
var cartesianConstants = require('../../plots/cartesian/constants');
1414
var extendFlat = require('../../lib/extend').extendFlat;
1515

1616

@@ -156,7 +156,7 @@ module.exports = {
156156
valType: 'enumerated',
157157
values: [
158158
'paper',
159-
Cartesian.idRegex.x.toString()
159+
cartesianConstants.idRegex.x.toString()
160160
],
161161
role: 'info',
162162
description: [
@@ -199,7 +199,7 @@ module.exports = {
199199
valType: 'enumerated',
200200
values: [
201201
'paper',
202-
Cartesian.idRegex.y.toString()
202+
cartesianConstants.idRegex.y.toString()
203203
],
204204
role: 'info',
205205
description: [

src/plots/cartesian/constants.js

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

1111

1212
module.exports = {
13+
14+
idRegex: {
15+
x: /^x([2-9]|[1-9][0-9]+)?$/,
16+
y: /^y([2-9]|[1-9][0-9]+)?$/
17+
},
18+
19+
attrRegex: {
20+
x: /^xaxis([2-9]|[1-9][0-9]+)?$/,
21+
y: /^yaxis([2-9]|[1-9][0-9]+)?$/
22+
},
23+
1324
/**
1425
* standardize all missing data in calcdata to use undefined
1526
* never null or NaN.

src/plots/cartesian/index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,19 @@
1212
var Lib = require('../../lib');
1313
var Plots = require('../plots');
1414

15+
var constants = require('./constants');
16+
1517
exports.name = 'cartesian';
1618

1719
exports.attr = ['xaxis', 'yaxis'];
1820

1921
exports.idRoot = ['x', 'y'];
2022

21-
exports.attributes = require('./attributes');
23+
exports.idRegex = constants.idRegex;
2224

23-
exports.idRegex = {
24-
x: /^x([2-9]|[1-9][0-9]+)?$/,
25-
y: /^y([2-9]|[1-9][0-9]+)?$/
26-
};
25+
exports.attrRegex = constants.attrRegex;
2726

28-
exports.attrRegex = {
29-
x: /^xaxis([2-9]|[1-9][0-9]+)?$/,
30-
y: /^yaxis([2-9]|[1-9][0-9]+)?$/
31-
};
27+
exports.attributes = require('./attributes');
3228

3329
exports.plot = function(gd) {
3430
var fullLayout = gd._fullLayout,

src/plots/cartesian/layout_attributes.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
'use strict';
1010

11-
var Cartesian = require('./index');
1211
var fontAttrs = require('../font_attributes');
1312
var colorAttrs = require('../../components/color/attributes');
1413
var extendFlat = require('../../lib/extend').extendFlat;
1514
var rangeSliderAttrs = require('../../components/rangeslider/attributes');
1615
var rangeSelectorAttrs = require('../../components/rangeselector/attributes');
1716

17+
var constants = require('./constants');
18+
1819

1920
module.exports = {
2021
color: {
@@ -402,8 +403,8 @@ module.exports = {
402403
valType: 'enumerated',
403404
values: [
404405
'free',
405-
Cartesian.idRegex.x.toString(),
406-
Cartesian.idRegex.y.toString()
406+
constants.idRegex.x.toString(),
407+
constants.idRegex.y.toString()
407408
],
408409
role: 'info',
409410
description: [
@@ -431,8 +432,8 @@ module.exports = {
431432
valType: 'enumerated',
432433
values: [
433434
'free',
434-
Cartesian.idRegex.x.toString(),
435-
Cartesian.idRegex.y.toString()
435+
constants.idRegex.x.toString(),
436+
constants.idRegex.y.toString()
436437
],
437438
role: 'info',
438439
description: [

0 commit comments

Comments
 (0)