@@ -226,27 +226,27 @@ <h3 class="chart-title">各国累计确诊占比</h3>
226
226
}
227
227
} ,
228
228
itemStyle : {
229
- normal : {
230
- color : new echarts . graphic . LinearGradient (
231
- 0 , 1 , 1 , 1 ,
232
- [
233
- { offset : 0 , color : '#b0c2f9' } ,
234
- { offset : 0.5 , color : '#188df0' } ,
235
- { offset : 1 , color : '#185bff' }
236
- ]
237
- )
238
- } ,
239
- emphasis : {
240
- color : new echarts . graphic . LinearGradient (
241
- 0 , 1 , 1 , 1 ,
242
- [
243
- { offset : 0 , color : '#b0c2f9' } ,
244
- { offset : 0.7 , color : '#e6b600' } ,
245
- { offset : 1 , color : '#ceac09' }
246
- ]
247
- )
248
- }
249
- }
229
+ normal : {
230
+ color : new echarts . graphic . LinearGradient (
231
+ 0 , 1 , 1 , 1 ,
232
+ [
233
+ { offset : 0 , color : '#b0c2f9' } ,
234
+ { offset : 0.5 , color : '#188df0' } ,
235
+ { offset : 1 , color : '#185bff' }
236
+ ]
237
+ )
238
+ } ,
239
+ emphasis : {
240
+ color : new echarts . graphic . LinearGradient (
241
+ 0 , 1 , 1 , 1 ,
242
+ [
243
+ { offset : 0 , color : '#b0c2f9' } ,
244
+ { offset : 0.7 , color : '#e6b600' } ,
245
+ { offset : 1 , color : '#ceac09' }
246
+ ]
247
+ )
248
+ }
249
+ }
250
250
} ]
251
251
} ;
252
252
rankChart . setOption ( rankChartOpt ) ;
@@ -277,7 +277,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
277
277
data : yData
278
278
} ,
279
279
series : [ {
280
- name : "现存确认排行 " ,
280
+ name : "现存确诊排行 " ,
281
281
data : xData
282
282
} ]
283
283
} ) ;
@@ -364,7 +364,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
364
364
} ) ;
365
365
}
366
366
367
- //获取月度股票情况数据
367
+ //获取美国疫情发展情况
368
368
const trendChart = echarts . init ( document . getElementById ( "trendChart" ) , "shine" ) ;
369
369
const trendChartOpt = {
370
370
tooltip : {
@@ -375,7 +375,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
375
375
} ,
376
376
legend : {
377
377
left : "center" ,
378
- bottom : 3 ,
378
+ top : 3 ,
379
379
itemWidth : 15 ,
380
380
itemHeight : 10 ,
381
381
textStyle : {
@@ -386,10 +386,16 @@ <h3 class="chart-title">各国累计确诊占比</h3>
386
386
} ,
387
387
grid : {
388
388
top : 40 ,
389
- bottom : 50 ,
389
+ bottom : 70 ,
390
390
left : 60 ,
391
391
right : 60
392
392
} ,
393
+
394
+ dataZoom : [ {
395
+ startValue : 20200123
396
+ } , {
397
+ type : 'inside'
398
+ } ] ,
393
399
xAxis : {
394
400
type : "category" ,
395
401
axisLine : {
@@ -417,22 +423,10 @@ <h3 class="chart-title">各国累计确诊占比</h3>
417
423
}
418
424
}
419
425
} ] ,
420
- visualMap : {
421
- show : false ,
422
- seriesIndex : 2 ,
423
- dimension : 0 ,
424
- pieces : [ {
425
- lte : 9 ,
426
- color : "rgba(176, 58, 91, 1)"
427
- } , {
428
- gt : 9 ,
429
- lte : 11 ,
430
- color : "rgba(176, 58, 91, 0.5)"
431
- } ]
432
- } ,
433
426
series : [ {
434
427
name : "现存确诊" ,
435
428
type : "line" ,
429
+ smooth : true ,
436
430
markPoint : {
437
431
itemStyle : {
438
432
color : "rgba(119, 96, 246, 1)"
@@ -445,6 +439,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
445
439
} , {
446
440
name : "累计确诊" ,
447
441
type : "line" ,
442
+ smooth : true ,
448
443
itemStyle : {
449
444
color : function ( params ) {
450
445
if ( params . dataIndex >= 10 ) {
@@ -456,6 +451,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
456
451
} , {
457
452
name : "死亡人数" ,
458
453
type : "line" ,
454
+ smooth : true ,
459
455
markPoint : {
460
456
itemStyle : {
461
457
color : "rgba(230, 182, 0, 1)"
@@ -512,7 +508,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
512
508
const countrysChartOpt = {
513
509
tooltip : {
514
510
trigger : "item" ,
515
- formatter : "{b0}<br />累计确诊:{c0}人<br />占比 :{d0}%"
511
+ formatter : "{b0}<br />累计确诊:{c0}人<br />全球占比 :{d0}%"
516
512
} ,
517
513
legend : {
518
514
type : "scroll" ,
@@ -531,8 +527,23 @@ <h3 class="chart-title">各国累计确诊占比</h3>
531
527
series : [ {
532
528
name : "各国累计确诊占比" ,
533
529
type : "pie" ,
534
- center : [ "47%" , "55%" ] ,
535
- radius : [ "30%" , "85%" ]
530
+ center : [ "30%" , "55%" ] ,
531
+ radius : [ '50%' , '80%' ] ,
532
+ avoidLabelOverlap : true ,
533
+ label : {
534
+ show : false ,
535
+ position : 'center'
536
+ } ,
537
+ labelLine : {
538
+ show : false
539
+ } ,
540
+ emphasis : {
541
+ label : {
542
+ show : true ,
543
+ fontSize : '30' ,
544
+ fontWeight : 'bold'
545
+ }
546
+ } ,
536
547
} ]
537
548
} ;
538
549
countrysChart . setOption ( countrysChartOpt ) ;
@@ -544,11 +555,18 @@ <h3 class="chart-title">各国累计确诊占比</h3>
544
555
} ) . done ( function ( ) {
545
556
$ ( "#countrysChart" ) . addClass ( "chart-done" ) ;
546
557
} ) . done ( function ( data ) {
558
+ var sortable = [ ] ;
559
+ for ( var i in data ) {
560
+ sortable . push ( [ data [ i ] , data [ i ] . confirmedCount ] ) ;
561
+ }
562
+ data = sortable . sort ( function ( a , b ) {
563
+ return b [ 1 ] - a [ 1 ] ;
564
+ } ) ;
547
565
const chartData = [ ] ;
548
566
for ( let i in data ) {
549
567
chartData . push ( {
550
- name : data [ i ] . countryName ,
551
- value : data [ i ] . confirmedCount
568
+ name : data [ i ] [ 0 ] . countryName ,
569
+ value : data [ i ] [ 0 ] . confirmedCount
552
570
} ) ;
553
571
}
554
572
countrysChart . setOption ( {
@@ -608,9 +626,9 @@ <h3 class="chart-title">各国累计确诊占比</h3>
608
626
decimal : '.'
609
627
} ) ;
610
628
if ( ! countUp . error ) {
611
- countUp . start ( ) ;
629
+ countUp . start ( ) ;
612
630
} else {
613
- console . error ( countUp . error ) ;
631
+ console . error ( countUp . error ) ;
614
632
}
615
633
}
616
634
</ script >
0 commit comments