Skip to content

Commit fb67c82

Browse files
committed
revise new attribute names and val types
1 parent 01115cd commit fb67c82

21 files changed

+118
-91
lines changed

src/plots/cartesian/axes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ var getDataConversions = axes.getDataConversions = function(gd, trace, target, t
217217
if(Array.isArray(d2cTarget)) {
218218
ax = {
219219
type: autoType(targetArray, undefined, {
220-
convertNumeric: gd._fullLayout.axesconvertnumeric
220+
autotypenumbers: gd._fullLayout.autotypenumbers
221221
}),
222222
_categories: []
223223
};

src/plots/cartesian/axis_autotype.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ var Lib = require('../../lib');
1515
var BADNUM = require('../../constants/numerical').BADNUM;
1616

1717
module.exports = function autoType(array, calendar, opts) {
18-
var convertNumeric = opts.convertNumeric;
18+
var convertNumeric = opts.autotypenumbers !== 'strict'; // compare against strict, just in case autotypenumbers was not provided in opts
1919

2020
if(!opts.noMultiCategory && multiCategory(array)) return 'multicategory';
2121
if(convertNumeric && moreDates(array, calendar)) return 'date';
2222
if(category(array)) return 'category';
23-
if(linearOK(array, convertNumeric)) return 'linear';
23+
if(linearOK(array)) return 'linear';
2424
else return convertNumeric ? '-' : 'category';
2525
};
2626

src/plots/cartesian/layout_attributes.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,17 @@ module.exports = {
102102
'the axis in question.'
103103
].join(' ')
104104
},
105-
convertnumeric: {
106-
valType: 'boolean',
105+
autotypenumbers: {
106+
valType: 'enumerated',
107+
values: ['convert types', 'strict'],
108+
dflt: 'convert types',
107109
role: 'info',
108110
editType: 'calc',
109111
description: [
110-
'Determines whether or not a numeric string in data for this axis may be',
112+
'Using *strict* a numeric string in trace data is not converted to a number.',
113+
'Using *accept strings* a numeric string in trace data may be',
111114
'treated as a number during automatic axis `type` detection.',
112-
'Defaults to layout.axesconvertnumeric.'
115+
'Defaults to layout.autotypenumbers.'
113116
].join(' ')
114117
},
115118
autorange: {

src/plots/cartesian/layout_defaults.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function appendList(cont, k, item) {
3838
}
3939

4040
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
41-
var convertnumericDflt = layoutOut.axesconvertnumeric;
41+
var autotypenumbersDflt = layoutOut.autotypenumbers;
4242

4343
var ax2traces = {};
4444
var xaMayHide = {};
@@ -248,7 +248,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
248248
automargin: true,
249249
visibleDflt: visibleDflt,
250250
reverseDflt: reverseDflt,
251-
convertnumericDflt: convertnumericDflt,
251+
autotypenumbersDflt: autotypenumbersDflt,
252252
splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]
253253
};
254254

@@ -313,7 +313,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
313313
automargin: true,
314314
visibleDflt: false,
315315
reverseDflt: false,
316-
convertnumericDflt: convertnumericDflt,
316+
autotypenumbersDflt: autotypenumbersDflt,
317317
splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[axId]
318318
};
319319

src/plots/cartesian/type_defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var autoType = require('./axis_autotype');
1616
* name: axis object name (ie 'xaxis') if one should be stored
1717
*/
1818
module.exports = function handleTypeDefaults(containerIn, containerOut, coerce, options) {
19-
coerce('convertnumeric', options.convertnumericDflt);
19+
coerce('autotypenumbers', options.autotypenumbersDflt);
2020
var axType = coerce('type', (options.splomStash || {}).type);
2121

2222
if(axType === '-') {
@@ -69,7 +69,7 @@ function setAutoType(ax, data) {
6969
opts.noMultiCategory = true;
7070
}
7171

72-
opts.convertNumeric = ax.convertnumeric;
72+
opts.autotypenumbers = ax.autotypenumbers;
7373

7474
// check all boxes on this x axis to see
7575
// if they're dates, numbers, or categories

src/plots/gl3d/layout/axis_attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ module.exports = overrideAll({
7878
type: extendFlat({}, axesAttrs.type, {
7979
values: ['-', 'linear', 'log', 'date', 'category']
8080
}),
81-
convertnumeric: axesAttrs.convertnumeric,
81+
autotypenumbers: axesAttrs.autotypenumbers,
8282
autorange: axesAttrs.autorange,
8383
rangemode: axesAttrs.rangemode,
8484
range: extendFlat({}, axesAttrs.range, {

src/plots/gl3d/layout/defaults.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
4040
font: layoutOut.font,
4141
fullData: fullData,
4242
getDfltFromLayout: getDfltFromLayout,
43-
convertnumericDflt: layoutOut.axesconvertnumeric,
43+
autotypenumbersDflt: layoutOut.autotypenumbers,
4444
paper_bgcolor: layoutOut.paper_bgcolor,
4545
calendar: layoutOut.calendar
4646
});
@@ -110,7 +110,7 @@ function handleGl3dDefaults(sceneLayoutIn, sceneLayoutOut, coerce, opts) {
110110
data: fullGl3dData,
111111
bgColor: bgColorCombined,
112112
calendar: opts.calendar,
113-
convertnumericDflt: opts.convertnumericDflt,
113+
autotypenumbersDflt: opts.autotypenumbersDflt,
114114
fullLayout: opts.fullLayout
115115
});
116116

src/plots/layout_attributes.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,17 @@ module.exports = {
292292
'Sets the background color of the plotting area in-between x and y axes.'
293293
].join(' ')
294294
},
295-
axesconvertnumeric: {
296-
valType: 'boolean',
297-
dflt: true,
295+
autotypenumbers: {
296+
valType: 'enumerated',
297+
values: ['convert types', 'strict'],
298+
dflt: 'convert types',
298299
role: 'info',
299300
editType: 'calc',
300301
description: [
301-
'Determines whether or not a numeric string in trace data may be',
302-
'treated as a number during automatic axis `type` detection.'
302+
'Using *strict* a numeric string in trace data is not converted to a number.',
303+
'Using *accept strings* a numeric string in trace data may be',
304+
'treated as a number during automatic axis `type` detection.',
305+
'This is the default value; however it could be overridden for individual axes.'
303306
].join(' ')
304307
},
305308
separators: {

src/plots/plots.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ plots.supplyLayoutGlobalDefaults = function(layoutIn, layoutOut, formatObj) {
14761476
layoutOut._dataTemplate = template.data;
14771477
}
14781478

1479-
coerce('axesconvertnumeric');
1479+
coerce('autotypenumbers');
14801480

14811481
var globalFont = Lib.coerceFont(coerce, 'font');
14821482

src/plots/polar/layout_attributes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var radialAxisAttrs = {
6161
type: extendFlat({}, axesAttrs.type, {
6262
values: ['-', 'linear', 'log', 'date', 'category']
6363
}),
64-
convertnumeric: axesAttrs.convertnumeric,
64+
autotypenumbers: axesAttrs.autotypenumbers,
6565

6666
autorange: extendFlat({}, axesAttrs.autorange, {editType: 'plot'}),
6767
rangemode: {
@@ -180,7 +180,7 @@ var angularAxisAttrs = {
180180
'If *category, use `period` to set the number of integer coordinates around polar axis.'
181181
].join(' ')
182182
},
183-
convertnumeric: axesAttrs.convertnumeric,
183+
autotypenumbers: axesAttrs.autotypenumbers,
184184

185185
categoryorder: axesAttrs.categoryorder,
186186
categoryarray: axesAttrs.categoryarray,

0 commit comments

Comments
 (0)