Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Commit 07efa0e

Browse files
committed
Merge branch 'develop'
2 parents 243f13a + e4dea1f commit 07efa0e

File tree

1 file changed

+63
-45
lines changed

1 file changed

+63
-45
lines changed

demo/index.html

+63-45
Original file line numberDiff line numberDiff line change
@@ -226,27 +226,27 @@ <h3 class="chart-title">各国累计确诊占比</h3>
226226
}
227227
},
228228
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+
}
250250
}]
251251
};
252252
rankChart.setOption(rankChartOpt);
@@ -277,7 +277,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
277277
data: yData
278278
},
279279
series: [{
280-
name: "现存确认排行",
280+
name: "现存确诊排行",
281281
data: xData
282282
}]
283283
});
@@ -364,7 +364,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
364364
});
365365
}
366366

367-
//获取月度股票情况数据
367+
//获取美国疫情发展情况
368368
const trendChart = echarts.init(document.getElementById("trendChart"), "shine");
369369
const trendChartOpt = {
370370
tooltip: {
@@ -375,7 +375,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
375375
},
376376
legend: {
377377
left: "center",
378-
bottom: 3,
378+
top: 3,
379379
itemWidth: 15,
380380
itemHeight: 10,
381381
textStyle: {
@@ -386,10 +386,16 @@ <h3 class="chart-title">各国累计确诊占比</h3>
386386
},
387387
grid: {
388388
top: 40,
389-
bottom: 50,
389+
bottom: 70,
390390
left: 60,
391391
right: 60
392392
},
393+
394+
dataZoom: [{
395+
startValue: 20200123
396+
}, {
397+
type: 'inside'
398+
}],
393399
xAxis: {
394400
type: "category",
395401
axisLine: {
@@ -417,22 +423,10 @@ <h3 class="chart-title">各国累计确诊占比</h3>
417423
}
418424
}
419425
}],
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-
},
433426
series: [{
434427
name: "现存确诊",
435428
type: "line",
429+
smooth: true,
436430
markPoint: {
437431
itemStyle: {
438432
color: "rgba(119, 96, 246, 1)"
@@ -445,6 +439,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
445439
}, {
446440
name: "累计确诊",
447441
type: "line",
442+
smooth: true,
448443
itemStyle: {
449444
color: function(params) {
450445
if(params.dataIndex >= 10) {
@@ -456,6 +451,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
456451
}, {
457452
name: "死亡人数",
458453
type: "line",
454+
smooth: true,
459455
markPoint: {
460456
itemStyle: {
461457
color: "rgba(230, 182, 0, 1)"
@@ -512,7 +508,7 @@ <h3 class="chart-title">各国累计确诊占比</h3>
512508
const countrysChartOpt = {
513509
tooltip: {
514510
trigger: "item",
515-
formatter: "{b0}<br />累计确诊:{c0}人<br />占比:{d0}%"
511+
formatter: "{b0}<br />累计确诊:{c0}人<br />全球占比:{d0}%"
516512
},
517513
legend: {
518514
type: "scroll",
@@ -531,8 +527,23 @@ <h3 class="chart-title">各国累计确诊占比</h3>
531527
series: [{
532528
name: "各国累计确诊占比",
533529
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+
},
536547
}]
537548
};
538549
countrysChart.setOption(countrysChartOpt);
@@ -544,11 +555,18 @@ <h3 class="chart-title">各国累计确诊占比</h3>
544555
}).done(function() {
545556
$("#countrysChart").addClass("chart-done");
546557
}).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+
});
547565
const chartData = [];
548566
for(let i in data) {
549567
chartData.push({
550-
name: data[i].countryName,
551-
value: data[i].confirmedCount
568+
name: data[i][0].countryName,
569+
value: data[i][0].confirmedCount
552570
});
553571
}
554572
countrysChart.setOption({
@@ -608,9 +626,9 @@ <h3 class="chart-title">各国累计确诊占比</h3>
608626
decimal: '.'
609627
});
610628
if(!countUp.error) {
611-
countUp.start();
629+
countUp.start();
612630
}else {
613-
console.error(countUp.error);
631+
console.error(countUp.error);
614632
}
615633
}
616634
</script>

0 commit comments

Comments
 (0)