-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathaxis_defaults.js
60 lines (46 loc) · 1.57 KB
/
axis_defaults.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
* Copyright 2012-2016, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var Lib = require('../../../lib');
var layoutAttributes = require('./axis_attributes');
var handleAxisDefaults = require('../../cartesian/axis_defaults');
var axesNames = ['xaxis', 'yaxis', 'zaxis'];
var noop = function() {};
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, options) {
var containerIn, containerOut;
function coerce(attr, dflt) {
return Lib.coerce(containerIn, containerOut, layoutAttributes, attr, dflt);
}
for(var j = 0; j < axesNames.length; j++) {
var axName = axesNames[j];
containerIn = layoutIn[axName] || {};
containerOut = {
_id: axName[0] + options.scene,
_name: axName
};
layoutOut[axName] = containerOut = handleAxisDefaults(
containerIn,
containerOut,
coerce, {
font: options.font,
letter: axName[0],
data: options.data,
showGrid: true
});
coerce('gridcolor');
coerce('title', axName[0]); // shouldn't this be on-par with 2D?
containerOut.setScale = noop;
if(coerce('showspikes')) {
coerce('spikesides');
coerce('spikethickness');
coerce('spikecolor');
}
if(coerce('showbackground')) coerce('backgroundcolor');
coerce('showaxeslabels');
}
};