提交 | 用户 | 时间
|
820397
|
1 |
import { EChartsOption } from 'echarts' |
H |
2 |
|
|
3 |
const { t } = useI18n() |
|
4 |
|
|
5 |
export const lineOptions: EChartsOption = { |
|
6 |
title: { |
|
7 |
text: t('analysis.monthlySales'), |
|
8 |
left: 'center' |
|
9 |
}, |
|
10 |
xAxis: { |
|
11 |
data: [ |
|
12 |
t('analysis.january'), |
|
13 |
t('analysis.february'), |
|
14 |
t('analysis.march'), |
|
15 |
t('analysis.april'), |
|
16 |
t('analysis.may'), |
|
17 |
t('analysis.june'), |
|
18 |
t('analysis.july'), |
|
19 |
t('analysis.august'), |
|
20 |
t('analysis.september'), |
|
21 |
t('analysis.october'), |
|
22 |
t('analysis.november'), |
|
23 |
t('analysis.december') |
|
24 |
], |
|
25 |
boundaryGap: false, |
|
26 |
axisTick: { |
|
27 |
show: false |
|
28 |
} |
|
29 |
}, |
|
30 |
grid: { |
|
31 |
left: 20, |
|
32 |
right: 20, |
|
33 |
bottom: 20, |
|
34 |
top: 80, |
|
35 |
containLabel: true |
|
36 |
}, |
|
37 |
tooltip: { |
|
38 |
trigger: 'axis', |
|
39 |
axisPointer: { |
|
40 |
type: 'cross' |
|
41 |
}, |
|
42 |
padding: [5, 10] |
|
43 |
}, |
|
44 |
yAxis: { |
|
45 |
axisTick: { |
|
46 |
show: false |
|
47 |
} |
|
48 |
}, |
|
49 |
legend: { |
|
50 |
data: [t('analysis.estimate'), t('analysis.actual')], |
|
51 |
top: 50 |
|
52 |
}, |
|
53 |
series: [ |
|
54 |
{ |
|
55 |
name: t('analysis.estimate'), |
|
56 |
smooth: true, |
|
57 |
type: 'line', |
|
58 |
data: [100, 120, 161, 134, 105, 160, 165, 114, 163, 185, 118, 123], |
|
59 |
animationDuration: 2800, |
|
60 |
animationEasing: 'cubicInOut' |
|
61 |
}, |
|
62 |
{ |
|
63 |
name: t('analysis.actual'), |
|
64 |
smooth: true, |
|
65 |
type: 'line', |
|
66 |
itemStyle: {}, |
|
67 |
data: [120, 82, 91, 154, 162, 140, 145, 250, 134, 56, 99, 123], |
|
68 |
animationDuration: 2800, |
|
69 |
animationEasing: 'quadraticOut' |
|
70 |
} |
|
71 |
] |
|
72 |
} |
|
73 |
|
|
74 |
export const pieOptions: EChartsOption = { |
|
75 |
title: { |
|
76 |
text: t('analysis.userAccessSource'), |
|
77 |
left: 'center' |
|
78 |
}, |
|
79 |
tooltip: { |
|
80 |
trigger: 'item', |
|
81 |
formatter: '{a} <br/>{b} : {c} ({d}%)' |
|
82 |
}, |
|
83 |
legend: { |
|
84 |
orient: 'vertical', |
|
85 |
left: 'left', |
|
86 |
data: [ |
|
87 |
t('analysis.directAccess'), |
|
88 |
t('analysis.mailMarketing'), |
|
89 |
t('analysis.allianceAdvertising'), |
|
90 |
t('analysis.videoAdvertising'), |
|
91 |
t('analysis.searchEngines') |
|
92 |
] |
|
93 |
}, |
|
94 |
series: [ |
|
95 |
{ |
|
96 |
name: t('analysis.userAccessSource'), |
|
97 |
type: 'pie', |
|
98 |
radius: '55%', |
|
99 |
center: ['50%', '60%'], |
|
100 |
data: [ |
|
101 |
{ value: 335, name: t('analysis.directAccess') }, |
|
102 |
{ value: 310, name: t('analysis.mailMarketing') }, |
|
103 |
{ value: 234, name: t('analysis.allianceAdvertising') }, |
|
104 |
{ value: 135, name: t('analysis.videoAdvertising') }, |
|
105 |
{ value: 1548, name: t('analysis.searchEngines') } |
|
106 |
] |
|
107 |
} |
|
108 |
] |
|
109 |
} |
|
110 |
|
|
111 |
export const barOptions: EChartsOption = { |
|
112 |
title: { |
|
113 |
text: t('analysis.weeklyUserActivity'), |
|
114 |
left: 'center' |
|
115 |
}, |
|
116 |
tooltip: { |
|
117 |
trigger: 'axis', |
|
118 |
axisPointer: { |
|
119 |
type: 'shadow' |
|
120 |
} |
|
121 |
}, |
|
122 |
grid: { |
|
123 |
left: 50, |
|
124 |
right: 20, |
|
125 |
bottom: 20 |
|
126 |
}, |
|
127 |
xAxis: { |
|
128 |
type: 'category', |
|
129 |
data: [ |
|
130 |
t('analysis.monday'), |
|
131 |
t('analysis.tuesday'), |
|
132 |
t('analysis.wednesday'), |
|
133 |
t('analysis.thursday'), |
|
134 |
t('analysis.friday'), |
|
135 |
t('analysis.saturday'), |
|
136 |
t('analysis.sunday') |
|
137 |
], |
|
138 |
axisTick: { |
|
139 |
alignWithLabel: true |
|
140 |
} |
|
141 |
}, |
|
142 |
yAxis: { |
|
143 |
type: 'value' |
|
144 |
}, |
|
145 |
series: [ |
|
146 |
{ |
|
147 |
name: t('analysis.activeQuantity'), |
|
148 |
data: [13253, 34235, 26321, 12340, 24643, 1322, 1324], |
|
149 |
type: 'bar' |
|
150 |
} |
|
151 |
] |
|
152 |
} |
|
153 |
|
|
154 |
export const radarOption: EChartsOption = { |
|
155 |
legend: { |
|
156 |
data: [t('workplace.personal'), t('workplace.team')] |
|
157 |
}, |
|
158 |
radar: { |
|
159 |
// shape: 'circle', |
|
160 |
indicator: [ |
|
161 |
{ name: t('workplace.quote'), max: 65 }, |
|
162 |
{ name: t('workplace.contribution'), max: 160 }, |
|
163 |
{ name: t('workplace.hot'), max: 300 }, |
|
164 |
{ name: t('workplace.yield'), max: 130 }, |
|
165 |
{ name: t('workplace.follow'), max: 100 } |
|
166 |
] |
|
167 |
}, |
|
168 |
series: [ |
|
169 |
{ |
|
170 |
name: `xxx${t('workplace.index')}`, |
|
171 |
type: 'radar', |
|
172 |
data: [ |
|
173 |
{ |
|
174 |
value: [42, 30, 20, 35, 80], |
|
175 |
name: t('workplace.personal') |
|
176 |
}, |
|
177 |
{ |
|
178 |
value: [50, 140, 290, 100, 90], |
|
179 |
name: t('workplace.team') |
|
180 |
} |
|
181 |
] |
|
182 |
} |
|
183 |
] |
|
184 |
} |
|
185 |
|
|
186 |
export const wordOptions = { |
|
187 |
series: [ |
|
188 |
{ |
|
189 |
type: 'wordCloud', |
|
190 |
gridSize: 2, |
|
191 |
sizeRange: [12, 50], |
|
192 |
rotationRange: [-90, 90], |
|
193 |
shape: 'pentagon', |
|
194 |
width: 600, |
|
195 |
height: 400, |
|
196 |
drawOutOfBound: true, |
|
197 |
textStyle: { |
|
198 |
color: function () { |
|
199 |
return ( |
|
200 |
'rgb(' + |
|
201 |
[ |
|
202 |
Math.round(Math.random() * 160), |
|
203 |
Math.round(Math.random() * 160), |
|
204 |
Math.round(Math.random() * 160) |
|
205 |
].join(',') + |
|
206 |
')' |
|
207 |
) |
|
208 |
} |
|
209 |
}, |
|
210 |
emphasis: { |
|
211 |
textStyle: { |
|
212 |
shadowBlur: 10, |
|
213 |
shadowColor: '#333' |
|
214 |
} |
|
215 |
}, |
|
216 |
data: [ |
|
217 |
{ |
|
218 |
name: 'Sam S Club', |
|
219 |
value: 10000, |
|
220 |
textStyle: { |
|
221 |
color: 'black' |
|
222 |
}, |
|
223 |
emphasis: { |
|
224 |
textStyle: { |
|
225 |
color: 'red' |
|
226 |
} |
|
227 |
} |
|
228 |
}, |
|
229 |
{ |
|
230 |
name: 'Macys', |
|
231 |
value: 6181 |
|
232 |
}, |
|
233 |
{ |
|
234 |
name: 'Amy Schumer', |
|
235 |
value: 4386 |
|
236 |
}, |
|
237 |
{ |
|
238 |
name: 'Jurassic World', |
|
239 |
value: 4055 |
|
240 |
}, |
|
241 |
{ |
|
242 |
name: 'Charter Communications', |
|
243 |
value: 2467 |
|
244 |
}, |
|
245 |
{ |
|
246 |
name: 'Chick Fil A', |
|
247 |
value: 2244 |
|
248 |
}, |
|
249 |
{ |
|
250 |
name: 'Planet Fitness', |
|
251 |
value: 1898 |
|
252 |
}, |
|
253 |
{ |
|
254 |
name: 'Pitch Perfect', |
|
255 |
value: 1484 |
|
256 |
}, |
|
257 |
{ |
|
258 |
name: 'Express', |
|
259 |
value: 1112 |
|
260 |
}, |
|
261 |
{ |
|
262 |
name: 'Home', |
|
263 |
value: 965 |
|
264 |
}, |
|
265 |
{ |
|
266 |
name: 'Johnny Depp', |
|
267 |
value: 847 |
|
268 |
}, |
|
269 |
{ |
|
270 |
name: 'Lena Dunham', |
|
271 |
value: 582 |
|
272 |
}, |
|
273 |
{ |
|
274 |
name: 'Lewis Hamilton', |
|
275 |
value: 555 |
|
276 |
}, |
|
277 |
{ |
|
278 |
name: 'KXAN', |
|
279 |
value: 550 |
|
280 |
}, |
|
281 |
{ |
|
282 |
name: 'Mary Ellen Mark', |
|
283 |
value: 462 |
|
284 |
}, |
|
285 |
{ |
|
286 |
name: 'Farrah Abraham', |
|
287 |
value: 366 |
|
288 |
}, |
|
289 |
{ |
|
290 |
name: 'Rita Ora', |
|
291 |
value: 360 |
|
292 |
}, |
|
293 |
{ |
|
294 |
name: 'Serena Williams', |
|
295 |
value: 282 |
|
296 |
}, |
|
297 |
{ |
|
298 |
name: 'NCAA baseball tournament', |
|
299 |
value: 273 |
|
300 |
}, |
|
301 |
{ |
|
302 |
name: 'Point Break', |
|
303 |
value: 265 |
|
304 |
} |
|
305 |
] |
|
306 |
} |
|
307 |
] |
|
308 |
} |