Skip to content

Commit 56c8058

Browse files
committed
add transform and point-selection mocks of scattergl traces
1 parent 187a155 commit 56c8058

File tree

4 files changed

+149
-0
lines changed

4 files changed

+149
-0
lines changed
21.3 KB
Loading
27.5 KB
Loading
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"data": [{
3+
"type": "scattergl",
4+
"mode": "lines+markers+text",
5+
"x": [1, 2, 3, 4, 5, 6],
6+
"y": [1, 3, 2, 4, 5, 7],
7+
"ids": ["a", "b", "c", "d", "e", "f"],
8+
"text": ["a", "b", "c", "d", "e", "f"],
9+
"marker": {
10+
"color": "#67353E",
11+
"size": 12
12+
},
13+
"textposition": "top left",
14+
"selectedpoints": [1, 2, 3],
15+
"selected": {
16+
"marker": {
17+
"color": "blue",
18+
"size": 20
19+
}
20+
},
21+
"unselected": {
22+
"marker": {
23+
"color": "green",
24+
"opacity": 0.5
25+
}
26+
},
27+
"transforms": [{
28+
"type": "filter",
29+
"target": "x",
30+
"operation": "][",
31+
"value": [3.5, 4.5]
32+
}]
33+
}, {
34+
"type": "scattergl",
35+
"mode": "lines+markers+text",
36+
"x": [1, 2, 3, 4, 5, 6],
37+
"y": [6, 5, 6, 5, 4, 3],
38+
"ids": ["a", "b", "c", "d", "e", "f"],
39+
"text": ["a", "b", "c", "d", "e", "f"],
40+
"marker": {
41+
"color": "#34ABA2",
42+
"size": 12
43+
},
44+
"textposition": "top left",
45+
"selectedpoints": [],
46+
"selected": {
47+
"marker": {
48+
"color": "green"
49+
}
50+
},
51+
"unselected": {
52+
"marker": {
53+
"color": "blue",
54+
"opacity": 0.5
55+
}
56+
},
57+
"transforms": [{
58+
"type": "filter",
59+
"target": "x",
60+
"operation": "][",
61+
"value": [3.5, 4.5]
62+
}]
63+
}],
64+
"layout": {
65+
"dragmode": "lasso",
66+
"legend": {
67+
"x": 0,
68+
"y": 1,
69+
"xanchor": "left",
70+
"yanchor": "bottom"
71+
},
72+
"width": 600
73+
}
74+
}

test/image/mocks/gl2d_transforms.json

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"data": [{
3+
"type": "scattergl",
4+
"mode": "lines+markers",
5+
"x": [1, -1, -2, 0, 1, 3, 3],
6+
"y": [2, 1, 0, 1, 3, 4, 3],
7+
"transforms": [{
8+
"type": "groupby",
9+
"groups": ["a", "a", "b", "a", "b", "b", "a"],
10+
"styles": [
11+
{"target": "a", "value": {"marker": {"color": "orange"}}},
12+
{"target": "b", "value": {"marker": {"color": "blue"}}}
13+
]
14+
}, {
15+
"type": "filter",
16+
"target": "x",
17+
"operation": ">=",
18+
"value": 0,
19+
"preservegaps": true
20+
}],
21+
"name": "Groupby+filter"
22+
},
23+
{
24+
"type": "scattergl",
25+
"x": [1, 2, 3, 4, -3],
26+
"y": [1.1, 2.2, 3.3, 4.4, 5.5],
27+
"marker": {
28+
"size": [0.3, 0.2, 0.1, 0.4, 0.5],
29+
"sizeref": 0.01,
30+
"color": [2, 4, 6, 10, 8],
31+
"opacity": [0.9, 0.6, 0.2, 0.8, 1.0],
32+
"line": {
33+
"color": [2.2, 3.3, 4.4, 5.5, 1.1]
34+
}
35+
},
36+
"transforms": [{
37+
"type": "aggregate",
38+
"groups": ["a", "b", "a", "a", "a"],
39+
"aggregations": [
40+
{"target": "x", "func": "sum"},
41+
{"target": "y", "func": "avg"},
42+
{"target": "marker.size", "func": "min"},
43+
{"target": "marker.color", "func": "max"},
44+
{"target": "marker.line.color", "func": "last"},
45+
{"target": "marker.line.width", "func": "count"}
46+
]
47+
}],
48+
"name": "Aggregate"
49+
},
50+
{
51+
"type": "scattergl",
52+
"x": [1, 2, 3, 4, 5, 6],
53+
"y": [1, 4, 2, 6, 5, 3],
54+
"transforms": [{
55+
"type": "sort",
56+
"target": [1, 6, 2, 5, 3, 4]
57+
}],
58+
"name": "Sort"
59+
},
60+
{
61+
"type": "scattergl",
62+
"x":[4, 5, 6, 4, 5, 6],
63+
"y": [1, 1, 1, 2, 2, 2],
64+
"marker": {"color": [1, 2, 3, -1, -2, -3], "size": 20},
65+
"mode": "lines+markers",
66+
"transforms": [
67+
{"type": "groupby", "groups": [1, 1, 1, 2, 2, 2]}
68+
]
69+
}],
70+
"layout": {
71+
"width": 600,
72+
"height": 400,
73+
"title": "Transforms on scattergl traces"
74+
}
75+
}

0 commit comments

Comments
 (0)