Skip to content

Commit 76a4e65

Browse files
committed
use Template.newContainer in carpet axis defaults
1 parent f8addaa commit 76a4e65

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

src/traces/carpet/ab_defaults.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'use strict';
1010

1111
var handleAxisDefaults = require('./axis_defaults');
12+
var Template = require('../../plot_api/plot_template');
1213

1314
module.exports = function handleABDefaults(traceIn, traceOut, fullLayout, coerce, dfltColor) {
1415
var a = coerce('a');
@@ -34,7 +35,7 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
3435
axesList.forEach(function(axName) {
3536
var axLetter = axName.charAt(0);
3637
var axIn = traceIn[axName] || {};
37-
var axOut = {};
38+
var axOut = Template.newContainer(traceOut, axName);
3839

3940
var defaultOptions = {
4041
tickfont: 'x',
@@ -50,11 +51,8 @@ function mimickAxisDefaults(traceIn, traceOut, fullLayout, dfltColor) {
5051
};
5152

5253
handleAxisDefaults(axIn, axOut, defaultOptions);
53-
5454
axOut._categories = axOut._categories || [];
5555

56-
traceOut[axName] = axOut;
57-
5856
// so we don't have to repeat autotype unnecessarily,
5957
// copy an autotype back to traceIn
6058
if(!traceIn[axName] && axIn.type !== '-') {
23.8 KB
Loading

test/image/mocks/carpet_template.json

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"data": [
3+
{
4+
"type": "carpet",
5+
"a": [4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6],
6+
"b": [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3],
7+
"y": [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10]
8+
}
9+
],
10+
"layout": {
11+
"template": {
12+
"data": {
13+
"carpet": [
14+
{
15+
"aaxis": {
16+
"gridcolor": "cyan",
17+
"linecolor": "cyan",
18+
"tickcolor": "cyan",
19+
"minorgridcolor": "cyan",
20+
"startlinecolor": "cyan",
21+
"endlinecolor": "cyan"
22+
},
23+
"baxis": {
24+
"gridcolor": "cyan",
25+
"linecolor": "cyan",
26+
"tickcolor": "cyan",
27+
"minorgridcolor": "cyan",
28+
"startlinecolor": "cyan",
29+
"endlinecolor": "cyan"
30+
}
31+
}
32+
]
33+
},
34+
"layout": {
35+
"plot_bgcolor": "black"
36+
}
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)