Skip to content

Commit 0ac20bd

Browse files
committed
fixed scattercarpet attributes
1 parent 95625a1 commit 0ac20bd

File tree

3 files changed

+98
-1
lines changed

3 files changed

+98
-1
lines changed

src/traces/scattercarpet/attributes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ module.exports = {
120120
hoveron: scatterAttrs.hoveron,
121121
hovertemplate: hovertemplateAttrs(),
122122
tooltip: scatterAttrs.tooltip,
123-
tooltiptemplate: scatterAttrs.tooltiptemplate,
123+
tooltiptemplate: extendFlat({}, scatterAttrs.tooltiptemplate, {
124+
flags: ['a', 'b', 'text', 'name']
125+
}),
124126
zorder: scatterAttrs.zorder
125127
};

src/traces/scattercarpet/defaults.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3838
coerce('texttemplate');
3939
coerce('hovertext');
4040

41+
coerce('tooltip');
42+
coerce('tooltiptemplate');
43+
4144
var defaultMode = len < constants.PTS_LINESONLY ? 'lines+markers' : 'lines';
4245
coerce('mode', defaultMode);
4346

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
"aaxis": {
9+
"tickprefix": "a = ",
10+
"ticksuffix": "m",
11+
"smoothing": 1,
12+
"minorgridcount": 9
13+
},
14+
"baxis": {
15+
"tickprefix": "b = ",
16+
"ticksuffix": "Pa",
17+
"smoothing": 1,
18+
"minorgridcount": 9
19+
},
20+
"carpet": "c0"
21+
},
22+
{
23+
"type": "carpet",
24+
"a": [ 4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6 ],
25+
"b": [ 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3 ],
26+
"y": [ 22, 23.5, 24, 23, 24.5, 25, 25.5, 26.5, 27.5, 28, 28.5, 30 ],
27+
"aaxis": {
28+
"tickprefix": "a = ",
29+
"ticksuffix": "m",
30+
"smoothing": 1,
31+
"minorgridcount": 9
32+
},
33+
"baxis": {
34+
"tickprefix": "b = ",
35+
"ticksuffix": "Pa",
36+
"smoothing": 1,
37+
"minorgridcount": 9
38+
},
39+
"carpet": "c1"
40+
},
41+
{
42+
"type": "scattercarpet",
43+
"a": [ 4, 4.5, 5, 6 ],
44+
"b": [ 2.5, 2.5, 2.5, 2.5 ],
45+
"line": {
46+
"shape": "spline",
47+
"smoothing": 1,
48+
"color": "blue"
49+
},
50+
"mode": "lines+markers",
51+
"marker": {
52+
"size": 15,
53+
"symbol": "arrow",
54+
"angleref": "previous"
55+
},
56+
"carpet": "c0",
57+
"tooltiptemplate": "a: %{a}<br>b: %{b}<br>y: %{y}",
58+
"tooltip": {"arrowcolor": "blue"}
59+
},
60+
{
61+
"type": "scattercarpet",
62+
"a": [ 4, 4.5, 5, 6 ],
63+
"b": [ 2.5, 2.5, 2.5, 2.5 ],
64+
"line": {
65+
"shape": "spline",
66+
"smoothing": 1,
67+
"color": "red"
68+
},
69+
"mode": "lines+markers",
70+
"marker": {
71+
"size": 15,
72+
"symbol": "arrow",
73+
"angle": 90,
74+
"angleref": "previous"
75+
},
76+
"carpet": "c1",
77+
"tooltiptemplate": "a: %{a}<br>b: %{b}<br>y: %{y}",
78+
"tooltip": {"arrowcolor": "blue"}
79+
}
80+
],
81+
"config": {
82+
"editable": true,
83+
"modeBarButtonsToAdd": [
84+
"tooltip",
85+
"hoverclosest",
86+
"hovercompare",
87+
"togglespikelines"
88+
],
89+
"displaylogo": false,
90+
"displayModeBar": true
91+
}
92+
}

0 commit comments

Comments
 (0)