chartOption.js
9.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
// 雷达图
const radarChartOption = {
tooltip: {},
radar: {
// 初始指示器
indicator: [],
name: {
rich: {
star: {
fontSize: 12,
backgroundColor: {
image: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/aiCheck/star-1.png'
}
},
halfStar: {
fontSize: 12,
backgroundColor: {
image: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/aiCheck/pc-star-2.png'
}
},
emptyStar: {
fontSize: 12,
backgroundColor: {
image: 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/aiCheck/pc-star-0.png'
}
},
name: {
color: '#333',
fontSize: 12,
align: 'center'
}
},
formatter: function (v, indicator) {
const createStarRating = (rating) => {
const fullStars = Math.floor(rating)
const halfStar = (rating) % 1 === 0.5
const emptyStars = 5 - fullStars - (halfStar ? 1 : 0)
let stars = ''
for (let i = 0; i < fullStars; i++) {
stars += '{star|}'
}
if (halfStar) {
stars += '{halfStar|}'
}
for (let i = 0; i < emptyStars; i++) {
stars += '{emptyStar|}'
}
return stars
}
return `{name|${v}}\n${createStarRating(indicator.score)}`
},
width: 65,
height: 28
},
nameGap: 0,
shape: 'polygon',
axisLine: {
show: false
},
splitLine: {
lineStyle: {
color: '#EDEDED'
}
},
splitArea: {
areaStyle: {
color: ['#fff', '#fff', '#fff', '#fff', '#fff']
}
},
startAngle: 90
},
series: [{
type: 'radar',
silent: false,
// 数据
data: [
{
value: [50, 60, 70, 20, 60],
name: '雷达图',
symbol: 'none',
lineStyle: {
color: "#3F64B0",
width: 1,
},
areaStyle: {
color: "#496CB5",
opacity: 0.2
},
blur: {
lineStyle: {
color: "#3F64B0",
width: 1,
}
}
}
]
}],
tooltip: {
show: false
}
}
// 流利度
const waveChartOption = {
title: {
text: '语速变化曲线',
left: 'left',
textStyle: {
color: '#333333',
fontSize: 14,
height: 20,
fontWeight: 400
},
padding: [0, 0, 0, 15]
},
grid: {
left: 20,
right: 20,
bottom: 20,
top: 40
},
legend: {
data: ['目标范围'],
right: 'right',
top: 'top',
itemWidth: 0,
itemHeight: 0,
formatter: function(name) {
return '{name|} ' + name
},
textStyle: {
rich: {
name: {
width: 12,
height: 6,
backgroundColor: '#E5EDFE',
}
}
},
selectedMode: false
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [],
axisLabel: {
color: '#999EA8',
},
axisTick: {
show: false, // 隐藏x轴刻度
},
axisLine: {
lineStyle: {
color: '#F2F1FF',
width: 1
}
}
},
yAxis: {
type: 'value',
show: true, // 隐藏y轴
axisLine: {
show: false
},
// min: 0,
axisTick: {
show: false
},
axisLabel: {
show: false
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#E5E5EF',
width: 1
}
},
},
series: [
{
name: '语速',
type: 'line',
data: [], // 设置语速数据的y轴数据
symbol: 'none', // 隐藏数据点
smooth: true, // 使线条平滑
lineStyle: {
color: '#496CB5',
width: 1,
},
markArea: {
silent: true,
data: [],
itemStyle: {
color: '#3275FA',
opacity: 0.1
}
}
},
{
name: '目标范围',
type: 'line'
}
]
}
// 冗余词
const pieChartOption = {
title: {
text: '冗余词统计',
left: 'left',
textStyle: {
color: '#333333',
fontSize: 14
}
},
tooltip: {
trigger: 'item'
},
legend: {
orient: 'vertical',
top: 'middle',
right: 40,
formatter: function(name) {
const data = pieChartOption.series[0].data;
let value = 0;
for (let i = 0; i < data.length; i++) {
if (data[i].name === name) {
value = data[i].value;
}
}
return `${name}\u2003\u2003\u2003\u2003${value}`;
},
width: 60,
itemWidth: 10,
itemHeight: 10
},
graphic: {
type: 'text',
left: 180,
top: 'center',
style: {
text: '冗余词',
textAlign: 'center',
fill: '#292D33',
fontSize: 14,
}
},
series: [
{
name: '冗余词',
type: 'pie',
radius: ['50%', '70%'],
center: [200, '50%'],
avoidLabelOverlap: true,
itemStyle: {
borderColor: '#fff',
borderWidth: 2
},
label: {
show: true,
position: 'inside',
formatter: '{c}',
color: '#fff',
rich: {
align: 'center',
verticalAlign: 'middle',
fontSize: 12,
}
},
labelLine: {
show: false
},
data: []
}
]
}
// 语音表达-清晰度
const waveChartOption1 = {
title: {
text: '清晰度变化曲线',
left: 'left',
textStyle: {
color: '#333333',
fontSize: 14,
height: 20,
fontWeight: 400
},
padding: [0, 0, 0, 15]
},
grid: {
left: 20,
right: 20,
bottom: 20,
top: 40
},
legend: {
data: ['目标范围'],
right: 'right',
top: 'top',
itemWidth: 0,
itemHeight: 0,
formatter: function(name) {
return '{name|} ' + name
},
textStyle: {
rich: {
name: {
width: 12,
height: 6,
backgroundColor: '#E5EDFE',
}
}
},
selectedMode: false
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [],
axisLabel: {
color: '#999EA8',
},
axisTick: {
show: false, // 隐藏x轴刻度
},
axisLine: {
lineStyle: {
color: '#F2F1FF',
width: 1
}
}
},
yAxis: {
type: 'value',
show: true, // 隐藏y轴
axisLine: {
show: false
},
// min: 0,
axisTick: {
show: false
},
axisLabel: {
show: false
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#E5E5EF',
width: 1
}
},
},
series: [
{
name: '清晰度',
type: 'line',
data: [], // 设置清晰度数据的y轴数据
symbol: 'none', // 隐藏数据点
smooth: true, // 使线条平滑
lineStyle: {
color: '#496CB5',
width: 1,
},
markArea: {
silent: true,
data: [],
itemStyle: {
color: '#3275FA',
opacity: 0.1
}
}
},
{
name: '目标范围',
type: 'line'
}
]
}
// 语音表达-语调
const waveChartOption2 = {
title: {
text: '语调变化曲线',
left: 'left',
textStyle: {
color: '#333333',
fontSize: 14,
height: 20,
fontWeight: 400
},
padding: [0, 0, 0, 15]
},
grid: {
left: 20,
right: 20,
bottom: 20,
top: 40
},
legend: {
data: ['目标范围'],
right: 'right',
top: 'top',
itemWidth: 0,
itemHeight: 0,
formatter: function(name) {
return '{name|} ' + name
},
textStyle: {
rich: {
name: {
width: 12,
height: 6,
backgroundColor: '#E5EDFE',
}
}
},
selectedMode: false
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [],
axisLabel: {
color: '#999EA8',
},
axisTick: {
show: false, // 隐藏x轴刻度
},
axisLine: {
lineStyle: {
color: '#F2F1FF',
width: 1
}
}
},
yAxis: {
type: 'value',
show: true, // 隐藏y轴
axisLine: {
show: false
},
// min: 0,
axisLabel: {
show: false
},
axisTick: {
show: false
},
splitLine: {
show: true,
lineStyle: {
type: 'dashed',
color: '#E5E5EF',
width: 1
}
},
},
series: [
{
name: '语调',
type: 'line',
data: [],
symbol: 'none', // 隐藏数据点
smooth: true, // 使线条平滑
lineStyle: {
color: '#496CB5',
width: 1,
},
markArea: {
silent: true,
data: [],
itemStyle: {
color: '#3275FA',
opacity: 0.1
}
}
},
{
name: '目标范围',
type: 'line'
}
]
}
export default {
radarChartOption: radarChartOption,
waveChartOption: waveChartOption,
pieChartOption: pieChartOption,
waveChartOption1: waveChartOption1,
waveChartOption2: waveChartOption2
}