Skip to content

Commit abb79ac

Browse files
committed
use Template.newContainer is polar axis defaults
1 parent 5c4094f commit abb79ac

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

src/plots/polar/layout_defaults.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
var Lib = require('../../lib');
1212
var Color = require('../../components/color');
13+
var Template = require('../../plot_api/plot_template');
14+
1315
var handleSubplotDefaults = require('../subplot_defaults');
1416
var getSubplotData = require('../get_data').getSubplotData;
1517

@@ -49,11 +51,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
4951
}
5052

5153
var axIn = contIn[axName];
52-
// Note: does not need template propagation, since coerceAxis is still
53-
// based on the subplot-wide coerce function. Though it may be more
54-
// efficient to make a new coerce function, then we *would* need to
55-
// propagate the template.
56-
var axOut = contOut[axName] = {};
54+
var axOut = contOut[axName] = Template.newContainer(contOut, axName);
5755
axOut._id = axOut._name = axName;
5856
axOut._traceIndices = subplotData.map(function(t) { return t._expandedIndex; });
5957

49.2 KB
Loading

test/image/mocks/polar_template.json

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"data": [
3+
{
4+
"r": [1, 2, 3],
5+
"theta": [4, 1, 2],
6+
"type": "scatterpolar"
7+
}
8+
],
9+
"layout": {
10+
"template": {
11+
"data": {
12+
"scatterpolar": [
13+
{
14+
"thetaunit": "radians",
15+
"marker": {
16+
"color": "hotpink",
17+
"size": 20
18+
},
19+
"line": {
20+
"color": "cyan"
21+
}
22+
}
23+
]
24+
},
25+
"layout": {
26+
"polar": {
27+
"bgcolor": "black",
28+
"radialaxis": {
29+
"gridcolor": "white",
30+
"linecolor": "white"
31+
},
32+
"angularaxis": {
33+
"gridcolor": "white",
34+
"linecolor": "white"
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)