Skip to content

Commit 207910e

Browse files
committed
Add mock chart for legend title click feature
1 parent 089fa73 commit 207910e

1 file changed

Lines changed: 210 additions & 0 deletions

File tree

Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
{
2+
"config": {
3+
"editable": false
4+
},
5+
"data": [
6+
{
7+
"name": "Series A1",
8+
"y": [1, 2, 3],
9+
"xaxis": "x",
10+
"yaxis": "y",
11+
"legendgroup": "Group A",
12+
"legendgrouptitle": { "text": "Group A" }
13+
},
14+
{
15+
"name": "Series A2",
16+
"y": [2, 3, 4],
17+
"xaxis": "x",
18+
"yaxis": "y",
19+
"legendgroup": "Group A"
20+
},
21+
{
22+
"name": "Series B1",
23+
"y": [3, 4, 5],
24+
"xaxis": "x",
25+
"yaxis": "y",
26+
"legendgroup": "Group B",
27+
"legendgrouptitle": { "text": "Group B" }
28+
},
29+
{
30+
"name": "Series C1",
31+
"y": [5, 6, 7],
32+
"xaxis": "x2",
33+
"yaxis": "y2",
34+
"legend": "legend2",
35+
"legendgroup": "Group C",
36+
"legendgrouptitle": { "text": "Group C" }
37+
},
38+
{
39+
"name": "Series C2",
40+
"y": [6, 7, 8],
41+
"xaxis": "x2",
42+
"yaxis": "y2",
43+
"legend": "legend2",
44+
"legendgroup": "Group C"
45+
},
46+
{
47+
"name": "Series D1",
48+
"y": [7, 8, 9],
49+
"xaxis": "x3",
50+
"yaxis": "y3",
51+
"legend": "legend3"
52+
},
53+
{
54+
"name": "Series D2",
55+
"y": [8, 9, 10],
56+
"xaxis": "x3",
57+
"yaxis": "y3",
58+
"legend": "legend3"
59+
},
60+
{
61+
"name": "Series E1",
62+
"y": [9, 10, 11],
63+
"xaxis": "x4",
64+
"yaxis": "y4",
65+
"legend": "legend4"
66+
},
67+
{
68+
"name": "Series E2",
69+
"y": [10, 11, 12],
70+
"xaxis": "x4",
71+
"yaxis": "y4",
72+
"legend": "legend4"
73+
},
74+
{
75+
"name": "Series F1",
76+
"y": [2, 4, 3],
77+
"xaxis": "x",
78+
"yaxis": "y",
79+
"legend": "legend5"
80+
},
81+
{
82+
"name": "Series F2",
83+
"y": [3, 5, 4],
84+
"xaxis": "x",
85+
"yaxis": "y",
86+
"legend": "legend5"
87+
}
88+
],
89+
"layout": {
90+
"title": { "text": "Legend Title Click Behaviors" },
91+
"width": 900,
92+
"height": 700,
93+
"grid": { "rows": 2, "columns": 2, "pattern": "independent" },
94+
"xaxis": { "domain": [0, 0.35] },
95+
"yaxis": { "domain": [0.55, 1] },
96+
"xaxis2": { "domain": [0, 0.35] },
97+
"yaxis2": { "domain": [0, 0.45] },
98+
"xaxis3": { "domain": [0.45, 0.8] },
99+
"yaxis3": { "domain": [0.55, 1] },
100+
"xaxis4": { "domain": [0.45, 0.8] },
101+
"yaxis4": { "domain": [0, 0.45] },
102+
"legend": {
103+
"bgcolor": "rgba(200, 230, 255, 0.8)",
104+
"title": { "text": "Default" },
105+
"x": 1.02,
106+
"y": 1,
107+
"xanchor": "left",
108+
"titleclick": "toggle",
109+
"titledoubleclick": "toggleothers",
110+
"groupclick": "toggleitem"
111+
},
112+
"legend2": {
113+
"bgcolor": "rgba(255, 230, 200, 0.8)",
114+
"title": { "text": "Swapped" },
115+
"x": 1.02,
116+
"y": 0.7,
117+
"xanchor": "left",
118+
"titleclick": "toggleothers",
119+
"titledoubleclick": "toggle"
120+
},
121+
"legend3": {
122+
"bgcolor": "rgba(230, 255, 200, 0.8)",
123+
"title": { "text": "Single click disabled" },
124+
"x": 1.02,
125+
"y": 0.4,
126+
"xanchor": "left",
127+
"titleclick": false,
128+
"titledoubleclick": "toggleothers"
129+
},
130+
"legend4": {
131+
"bgcolor": "rgba(255, 200, 230, 0.8)",
132+
"title": { "text": "Double click disabled" },
133+
"x": 1.02,
134+
"y": 0.15,
135+
"xanchor": "left",
136+
"titleclick": "toggle",
137+
"titledoubleclick": false
138+
},
139+
"legend5": {
140+
"bgcolor": "rgba(200, 200, 200, 0.8)",
141+
"title": { "text": "Both disabled" },
142+
"x": 1.02,
143+
"y": 0,
144+
"xanchor": "left",
145+
"yanchor": "bottom",
146+
"titleclick": false,
147+
"titledoubleclick": false
148+
},
149+
"shapes": [
150+
{
151+
"type": "rect",
152+
"xref": "x",
153+
"yref": "y",
154+
"x0": 0.5,
155+
"y0": 1.5,
156+
"x1": 1.5,
157+
"y1": 2.5,
158+
"fillcolor": "rgba(100, 150, 255, 0.4)",
159+
"line": { "color": "blue" },
160+
"name": "Shape A",
161+
"showlegend": true,
162+
"legend": "legend",
163+
"legendgroup": "Group A"
164+
},
165+
{
166+
"type": "rect",
167+
"xref": "x2",
168+
"yref": "y2",
169+
"x0": 0.5,
170+
"y0": 5.5,
171+
"x1": 1.5,
172+
"y1": 6.5,
173+
"fillcolor": "rgba(255, 180, 100, 0.4)",
174+
"line": { "color": "orange" },
175+
"name": "Shape C",
176+
"showlegend": true,
177+
"legend": "legend2",
178+
"legendgroup": "Group C"
179+
},
180+
{
181+
"type": "rect",
182+
"xref": "x3",
183+
"yref": "y3",
184+
"x0": 0.5,
185+
"y0": 7.5,
186+
"x1": 1.5,
187+
"y1": 8.5,
188+
"fillcolor": "rgba(150, 255, 100, 0.4)",
189+
"line": { "color": "green" },
190+
"name": "Shape D",
191+
"showlegend": true,
192+
"legend": "legend3"
193+
},
194+
{
195+
"type": "rect",
196+
"xref": "x4",
197+
"yref": "y4",
198+
"x0": 0.5,
199+
"y0": 9.5,
200+
"x1": 1.5,
201+
"y1": 10.5,
202+
"fillcolor": "rgba(255, 100, 180, 0.4)",
203+
"line": { "color": "magenta" },
204+
"name": "Shape E",
205+
"showlegend": true,
206+
"legend": "legend4"
207+
}
208+
]
209+
}
210+
}

0 commit comments

Comments
 (0)