console
let dom = $('#bar');
let rel_chart = echarts.init(document.getElementById('bar'));
let option = {};
var mapData = [];
var mapChart;
function formatDate(now) {
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
return year + "-" + getzf(month) + "-" + getzf(date) + " " + getzf(hour) + ":" + getzf(minute) + ":" + getzf(second);
}
function getzf(num) {
if (parseInt(num) < 10) {
num = '0' + num;
}
return num;
}
function getTotalData() {
let url = 'http://api.tianapi.com/txapi/ncov/index?key=698891ce03c51780f3433fa08e1b56d1';
$.get(url, res => {
if (res && res.code == 200) {
let desc = res.newslist[0].desc;
$('#qzbl').html(desc.confirmedCount);
$('#qzbl_pre').html(desc.confirmedIncr == undefined ? '待更新' :'+' + desc.confirmedIncr);
$('#ysbl').html(desc.suspectedCount);
$('#ysbl_pre').html(desc.suspectedIncr == undefined ? '待更新' : '+' + desc.suspectedIncr);
$('#zybl').html(desc.curedCount);
$('#zybl_pre').html(desc.curedIncr == undefined ? '待更新' : '+' + desc.curedIncr);
$('#swbl').html(desc.deadCount);
$('#swbl_pre').html(desc.deadIncr == undefined ? '待更新' : '+' + desc.deadIncr);
$('#updateTime').html('数据更新至 ' + formatDate(new Date(desc.modifyTime)));
$('#remark ul').html('');
$('#remark ul').append(`<li>${desc.note1}</li>`);
$('#remark ul').append(`<li>${desc.note2}</li>`);
$('#remark ul').append(`<li>${desc.note3}</li>`);
$('#remark ul').append(`<li>${desc.generalRemark}</li>`);
}
})
}
function getBarData() {
let url = 'http://api.tianapi.com/txapi/ncovcity/index?key=698891ce03c51780f3433fa08e1b56d1';
$.get(url, res => {
if (res && res.code == 200) {
let list = res.newslist;
let provinces = [];
let confirm = [];
let cured = [];
let suspected = [];
let dead = []
list = list.sort((a, b) => {
return b.confirmedCount - a.confirmedCount
});
list.forEach(d => {
provinces.push(d.provinceShortName);
confirm.push(d.confirmedCount);
cured.push(d.curedCount);
suspected.push(d.suspectedCount);
dead.push(d.deadCount);
$('#city_sel').append(`<option value='${d.provinceShortName}'>${d.provinceShortName}</option>`)
});
option = {
color: ['#4cabce', '#e5323e', '#003366', '#006699'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: [
{
type: 'category',
data: provinces,
axisLabel: {
interval:0,
formatter: function (value) {
return value.split("").join("\n");
}
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '确诊',
type: 'bar',
data: confirm
},
{
name: '死亡',
type: 'bar',
data: dead
},
{
name: '治愈',
type: 'bar',
data: cured
},
]
};
rel_chart.setOption(option);
}
})
}
$('#refresh').on('click', () => {
$('.total span').html('刷新中');
$('select').val('全国');
getBarData();
})
function jumpCity(val) {
if (val == '全国') {
getBarData();
return
}
let url = 'http://api.tianapi.com/txapi/ncovcity/index?key=698891ce03c51780f3433fa08e1b56d1';
$.get(url, res => {
if (res && res.code == 200) {
let news = res.newslist;
let cities = [];
let axios = [];
let confirm = [];
let cured = [];
let suspected = [];
let dead = []
let total = 0;
news.forEach(d => {
if (d.provinceShortName == val) {
cities = d.cities
}
});
cities.forEach(d => {
axios.push(d.cityName);
confirm.push(d.confirmedCount);
cured.push(d.curedCount);
dead.push(d.deadCount);
total += d.confirmedCount;
});
$('.total span').html('确诊总数 ' + total);
option = {
color: ['#4cabce', '#e5323e', '#003366', '#006699'],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
xAxis: [
{
type: 'category',
data: axios,
axisLabel: {
interval:0,
formatter: function (value) {
return value.split("").join("\n");
}
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '确诊',
type: 'bar',
data: confirm
},
{
name: '死亡',
type: 'bar',
data: dead
},
{
name: '治愈',
type: 'bar',
data: cured
},
]
};
rel_chart.setOption(option);
}
})
}
getTotalData();
getBarData();
var units = "%";
var margin = { top: 10, right: 10, bottom: 10, left: 10 },
width = 800 - margin.left - margin.right,
height = 1400 - margin.top - margin.bottom;
var formatNumber = d3.format(",.2f"),
format = function (d) {
return formatNumber(d) + " " + units;
},
color = d3.scale.category20();
var svg = d3.select("#chart").append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform",
"translate(" + margin.left + "," + margin.top + ")");
var sankey = d3.sankey()
.nodeWidth(36)
.nodePadding(10)
.size([width, height]);
var path = sankey.link();
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1,
"d+": this.getDate(),
"H+": this.getHours(),
"m+": this.getMinutes(),
"s+": this.getSeconds(),
"q+": Math.floor((this.getMonth() + 3) / 3),
"S": this.getMilliseconds()
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
};
function getPreData(day) {
var preDate = new Date(new Date().getTime() - 24 * 60 * 60 * 1000 * day);
return preDate.Format("yyyyMMdd");
}
function initDateSelect() {
var flag = true,
i = 1;
while (flag) {
var date = getPreData(i);
i++;
$('#date_sel').append(`<option value=${date}>${date}</option>`)
if (date == '20200120') {
flag = false;
}
}
}
function dateChange(date) {
loadData(date);
renderSankey();
}
var preDate = getPreData(1);
function loadData(date) {
var url = "http://huiyan.baidu.com/migration/cityrank.jsonp?dt=city&id=420100&type=move_out&date=" + date;
$.ajax({
url: url,
dataType: "jsonp",
jsonp: 'cb'
});
}
initDateSelect();
loadData(preDate);
var graph = {};
function cb(data) {
if (data.errmsg == 'SUCCESS') {
var datalist = data.data.list;
var nodeArr = [];
var linkArr = [];
var provinceMap = new Map();
nodeArr.push({'name':'武汉'});
datalist.forEach(function (d, i) {
var city = d['city_name'];
var province = d['province_name'];
var val = d['value'];
if(provinceMap.get(province) == null) {
nodeArr.push({ 'name': province });
provinceMap.set(province, val);
} else {
provinceMap.set(province, provinceMap.get(province) + val);
}
if (province == city) {
var c = city + " ";
nodeArr.push({ 'name': c });
linkArr.push({ 'source': province, 'target': c, 'value': d['value'] });
} else {
nodeArr.push({ 'name': city });
linkArr.push({ 'source': province, 'target': city, 'value': d['value'] });
}
});
provinceMap.forEach((v, k) =>{
linkArr.push({ 'source': '武汉', 'target': k, 'value': v });
});
graph.nodes = nodeArr;
graph.links = linkArr;
renderSankey();
}
}
function renderSankey() {
var nodeMap = {};
graph.nodes.forEach(function (x) { nodeMap[x.name] = x; });
graph.links = graph.links.map(function (x) {
return {
source: nodeMap[x.source],
target: nodeMap[x.target],
value: x.value
};
});
sankey
.nodes(graph.nodes)
.links(graph.links)
.layout(32);
$($('#chart svg').children().get(0)).empty();
var link = svg.append("g").selectAll(".link")
.data(graph.links)
.enter().append("path")
.attr("class", "link")
.attr("d", path)
.style("stroke-width", function (d) { return Math.max(1, d.dy); })
.sort(function (a, b) { return b.dy - a.dy; });
link.append("title")
.text(function (d) {
return d.source.name + " → " +
d.target.name + "\n" + format(d.value);
});
var node = svg.append("g").selectAll(".node")
.data(graph.nodes)
.enter().append("g")
.attr("class", "node")
.attr("transform", function (d) {
return "translate(" + d.x + "," + d.y + ")";
})
.call(d3.behavior.drag()
.origin(function (d) { return d; })
.on("dragstart", function () {
this.parentNode.appendChild(this);
})
.on("drag", dragmove));
node.append("rect")
.attr("height", function (d) {
return d.dy;
})
.attr("width", sankey.nodeWidth())
.style("fill", function (d) {
return d.color = color(d.name.replace(/ .*/, ""));
})
.style("stroke", function (d) {
return d3.rgb(d.color).darker(2);
})
.append("title")
.text(function (d) {
return d.name + "\n" + format(d.value);
});
node.append("text")
.attr("x", -6)
.attr("y", function (d) { return d.dy / 2; })
.attr("dy", ".35em")
.attr("text-anchor", "end")
.attr("transform", null)
.text(function (d) { return d.name; })
.filter(function (d) { return d.x < width / 2; })
.attr("x", 6 + sankey.nodeWidth())
.attr("text-anchor", "start");
function dragmove(d) {
d3.select(this).attr("transform",
"translate(" + d.x + "," + (
d.y = Math.max(0, Math.min(height - d.dy, d3.event.y))
) + ")");
sankey.relayout();
link.attr("d", path);
}
d3.selectAll('#chart svg path.link')
.style('stroke', function (d) {
return d.source.color;
})
}
var his_data = [
{
"key": "湖北",
"values": [['2020-01-20', 270], ['2020-01-21', 375], ['2020-01-22', 444], ['2020-01-23', 549], ['2020-01-24', 729], ['2020-01-25', 1052], ['2020-01-26', 1423], ['2020-01-27', 2714], ['2020-01-28', 3554], ['2020-01-29', 4586], ['2020-01-30', 4586], ['2020-01-31', 5806], ['2020-02-01', 7153], ['2020-02-02', 9074], ['2020-02-03', 11177], ['2020-02-04', 13522], ['2020-02-05', 16678], ['2020-02-06', 19665], ['2020-02-07', 22112], ['2020-02-08', 24953], ['2020-02-09', 27100], ['2020-02-10', 29631], ['2020-02-11',31728], ['2020-02-12',33366], ['2020-02-13',48206], ['2020-02-14',51986], ['2020-02-15',54406],["2020-02-16",56249],["2020-02-17",58182],["2020-02-18",59989],["2020-02-19",61682],["2020-02-20",62031],["2020-02-21",62662],["2020-02-22",63454],["2020-02-23",64084],["2020-02-24",64287],["2020-02-25",64786]]
},
{
"key": "广东",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 53 ],['2020-01-23', 78 ],['2020-01-24', 98 ],['2020-01-25', 133 ],['2020-01-26', 146 ],['2020-01-27', 207 ],['2020-01-28', 241 ],['2020-01-29', 311 ],['2020-01-30', 354 ],['2020-01-31', 393 ],['2020-02-01', 535 ], ['2020-02-02', 632], ['2020-02-03', 725], ['2020-02-04', 813], ['2020-02-05', 895], ['2020-02-06', 970], ['2020-02-07', 1034], ['2020-02-08', 1095], ['2020-02-09', 1131], ['2020-02-10', 1159], ['2020-02-11',1177], ['2020-02-12', 1219], ['2020-02-13',1241], ['2020-02-14',1261], ['2020-02-15',1294],["2020-02-16",1316],["2020-02-17",1322],["2020-02-18",1328],["2020-02-19",1331],["2020-02-20",1332],["2020-02-21",1333],["2020-02-22",1339],["2020-02-23",1342],["2020-02-24",1345],["2020-02-25",1347]]
},
{
"key": "浙江",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 26 ],['2020-01-23', 43 ],['2020-01-24', 62 ],['2020-01-25', 104 ],['2020-01-26', 128 ],['2020-01-27', 173 ],['2020-01-28', 296 ],['2020-01-29', 428 ],['2020-01-30', 428 ],['2020-01-31', 537 ],['2020-02-01', 599 ], ['2020-02-02', 661], ['2020-02-03', 724], ['2020-02-04', 829], ['2020-02-05', 895], ['2020-02-06', 954], ['2020-02-07', 1006], ['2020-02-08', 1048], ['2020-02-09', 1075], ['2020-02-10', 1092], ['2020-02-11',1117], ['2020-02-12', 1131], ['2020-02-13',1145], ['2020-02-14',1155], ['2020-02-15',1162],["2020-02-16",1167],["2020-02-17",1171],["2020-02-18",1172],["2020-02-19",1174],["2020-02-20",1175],["2020-02-21",1203],["2020-02-22",1205],["2020-02-23",1205],["2020-02-24",1205],["2020-02-25",1205]]
},
{
"key": "河南",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 9 ],['2020-01-24', 32 ],['2020-01-25', 83 ],['2020-01-26', 128 ],['2020-01-27', 168 ],['2020-01-28', 206 ],['2020-01-29', 278 ],['2020-01-30', 278 ],['2020-01-31', 352 ],['2020-02-01', 422 ], ['2020-02-02', 493], ['2020-02-03', 566], ['2020-02-04', 675], ['2020-02-05', 764], ['2020-02-06', 851], ['2020-02-07', 914], ['2020-02-08', 981], ['2020-02-09', 1033], ['2020-02-10', 1073], ['2020-02-11',1105], ['2020-02-12', 1135], ['2020-02-13',1169], ['2020-02-14',1184], ['2020-02-15',1212],["2020-02-16",1231],["2020-02-17",1246],["2020-02-18",1257],["2020-02-19",1262],["2020-02-20",1265],["2020-02-21",1267],["2020-02-22",1270],["2020-02-23",1271],["2020-02-24",1271],["2020-02-25",1271]]
},
{
"key": "重庆",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 9 ],['2020-01-23', 27 ],['2020-01-24', 57 ],['2020-01-25', 75 ],['2020-01-26', 110 ],['2020-01-27', 132 ],['2020-01-28', 147 ],['2020-01-29', 165 ],['2020-01-30', 182 ],['2020-01-31', 206 ],['2020-02-01', 247 ], ['2020-02-02', 275], ['2020-02-03', 312], ['2020-02-04', 344], ['2020-02-05', 376], ['2020-02-06', 400], ['2020-02-07', 415], ['2020-02-08', 428], ['2020-02-09', 450], ['2020-02-10', 473], ['2020-02-11',489], ['2020-02-12', 509], ['2020-02-13',525], ['2020-02-14',532], ['2020-02-15',538],["2020-02-16",547],["2020-02-17",552],["2020-02-18",553],["2020-02-19",555],["2020-02-20",560],["2020-02-21",567],["2020-02-22",572],["2020-02-23",573],["2020-02-24",575],["2020-02-25",576]]
},
{
"key": "湖南",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 9 ],['2020-01-23', 24 ],['2020-01-24', 43 ],['2020-01-25', 69 ],['2020-01-26', 100 ],['2020-01-27', 143 ],['2020-01-28', 221 ],['2020-01-29', 277 ],['2020-01-30', 277 ],['2020-01-31', 332 ],['2020-02-01', 389 ], ['2020-02-02', 463], ['2020-02-03', 521], ['2020-02-04', 593], ['2020-02-05', 661], ['2020-02-06', 711], ['2020-02-07', 772], ['2020-02-08', 803], ['2020-02-09', 838], ['2020-02-10', 879], ['2020-02-11',912], ['2020-02-12', 946], ['2020-02-13',968], ['2020-02-14',988], ['2020-02-15',1001],["2020-02-16",1004],["2020-02-17",1006],["2020-02-18",1007],["2020-02-19",1008],["2020-02-20",1010],["2020-02-21",1011],["2020-02-22",1013],["2020-02-23",1016],["2020-02-24",1016],["2020-02-25",1016]]
},
{
"key": "山东",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 21 ],['2020-01-24', 46 ],['2020-01-25', 63 ],['2020-01-26', 75 ],['2020-01-27', 95 ],['2020-01-28', 121 ],['2020-01-29', 145 ],['2020-01-30', 158 ],['2020-01-31', 178 ],['2020-02-01', 206 ], ['2020-02-02', 230], ['2020-02-03', 259], ['2020-02-04', 275], ['2020-02-05', 307], ['2020-02-06', 347], ['2020-02-07', 386], ['2020-02-08', 416], ['2020-02-09', 444], ['2020-02-10', 466], ['2020-02-11',487], ['2020-02-12', 497], ['2020-02-13',509], ['2020-02-14',523], ['2020-02-15',532],["2020-02-16",537],["2020-02-17",541],["2020-02-18",543],["2020-02-19",544],["2020-02-20",546],["2020-02-21",749],["2020-02-22",750],["2020-02-23",754],["2020-02-24",755],["2020-02-25",756]]
},
{
"key": "北京",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 36 ],['2020-01-24', 54 ],['2020-01-25', 68 ],['2020-01-26', 80 ],['2020-01-27', 91 ],['2020-01-28', 102 ],['2020-01-29', 114 ],['2020-01-30', 114 ],['2020-01-31', 132 ],['2020-02-01', 168 ], ['2020-02-02', 191], ['2020-02-03', 212], ['2020-02-04', 228], ['2020-02-05', 253], ['2020-02-06', 274], ['2020-02-07', 297], ['2020-02-08', 315], ['2020-02-09', 326], ['2020-02-10', 337], ['2020-02-11',342], ['2020-02-12', 352], ['2020-02-13',366], ['2020-02-14',372], ['2020-02-15',375],["2020-02-16",380],["2020-02-17",381],["2020-02-18",387],["2020-02-19",393],["2020-02-20",395],["2020-02-21",396],["2020-02-22",399],["2020-02-23",399],["2020-02-24",399],["2020-02-25",400]]
},
{
"key": "安徽",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 15 ],['2020-01-24', 39 ],['2020-01-25', 60 ],['2020-01-26', 70 ],['2020-01-27', 106 ],['2020-01-28', 152 ],['2020-01-29', 200 ],['2020-01-30', 200 ],['2020-01-31', 237 ],['2020-02-01', 297 ], ['2020-02-02', 340], ['2020-02-03', 408], ['2020-02-04', 480], ['2020-02-05', 530], ['2020-02-06', 591], ['2020-02-07', 665], ['2020-02-08', 733], ['2020-02-09', 779], ['2020-02-10', 830], ['2020-02-11',860], ['2020-02-12', 889], ['2020-02-13',910], ['2020-02-14',934], ['2020-02-15',950],["2020-02-16",962],["2020-02-17",973],["2020-02-18",982],["2020-02-19",986],["2020-02-20",987],["2020-02-21",988],["2020-02-22",989],["2020-02-23",989],["2020-02-24",989],["2020-02-25",989]]
},
{
"key": "四川",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 8 ],['2020-01-23', 15 ],['2020-01-24', 28 ],['2020-01-25', 44 ],['2020-01-26', 69 ],['2020-01-27', 90 ],['2020-01-28', 108 ],['2020-01-29', 142 ],['2020-01-30', 142 ],['2020-01-31', 177 ],['2020-02-01', 207 ], ['2020-02-02', 231], ['2020-02-03', 254], ['2020-02-04', 282], ['2020-02-05', 301], ['2020-02-06', 321], ['2020-02-07', 344], ['2020-02-08', 363], ['2020-02-09', 386], ['2020-02-10', 405], ['2020-02-11',417], ['2020-02-12', 436], ['2020-02-13',451], ['2020-02-14',463], ['2020-02-15',470],["2020-02-16",481],["2020-02-17",495],["2020-02-18",508],["2020-02-19",514],["2020-02-20",520],["2020-02-21",525],["2020-02-22",526],["2020-02-23",526],["2020-02-24",527],["2020-02-25",529]]
},
{
"key": "福建",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 10 ],['2020-01-24', 24 ],['2020-01-25', 35 ],['2020-01-26', 59 ],['2020-01-27', 73 ],['2020-01-28', 82 ],['2020-01-29', 101 ],['2020-01-30', 101 ],['2020-01-31', 120 ],['2020-02-01', 144 ], ['2020-02-02', 159], ['2020-02-03', 179], ['2020-02-04', 194], ['2020-02-05', 205], ['2020-02-06', 215], ['2020-02-07', 224], ['2020-02-08', 239], ['2020-02-09', 250], ['2020-02-10', 261], ['2020-02-11',267], ['2020-02-12', 272], ['2020-02-13',279], ['2020-02-14',281], ['2020-02-15',285],["2020-02-16",287],["2020-02-17",290],["2020-02-18",292],["2020-02-19",293],["2020-02-20",293],["2020-02-21",293],["2020-02-22",293],["2020-02-23",293],["2020-02-24",293],["2020-02-25",294]]
},
{
"key": "上海",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 16 ],['2020-01-23', 20 ],['2020-01-24', 33 ],['2020-01-25', 40 ],['2020-01-26', 53 ],['2020-01-27', 66 ],['2020-01-28', 80 ],['2020-01-29', 101 ],['2020-01-30', 112 ],['2020-01-31', 128 ],['2020-02-01', 169 ], ['2020-02-02', 182], ['2020-02-03', 203], ['2020-02-04', 219], ['2020-02-05', 243], ['2020-02-06', 257], ['2020-02-07', 277], ['2020-02-08', 286], ['2020-02-09', 293], ['2020-02-10', 299], ['2020-02-11',303], ['2020-02-12', 311], ['2020-02-13',315], ['2020-02-14',318], ['2020-02-15',326],["2020-02-16",328],["2020-02-17",332],["2020-02-18",333],["2020-02-19",333],["2020-02-20",334],["2020-02-21",334],["2020-02-22",335],["2020-02-23",335],["2020-02-24",335],["2020-02-25",336]]
},
{
"key": "江西",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 3 ],['2020-01-23', 7 ],['2020-01-24', 18 ],['2020-01-25', 36 ],['2020-01-26', 48 ],['2020-01-27', 72 ],['2020-01-28', 109 ],['2020-01-29', 162 ],['2020-01-30', 162 ],['2020-01-31', 240 ],['2020-02-01', 286 ], ['2020-02-02', 333], ['2020-02-03', 391], ['2020-02-04', 476], ['2020-02-05', 548], ['2020-02-06', 600], ['2020-02-07', 661], ['2020-02-08', 698], ['2020-02-09', 740], ['2020-02-10', 771], ['2020-02-11',804], ['2020-02-12', 844], ['2020-02-13',872], ['2020-02-14',900], ['2020-02-15',913],["2020-02-16",925],["2020-02-17",930],["2020-02-18",933],["2020-02-19",934],["2020-02-20",934],["2020-02-21",934],["2020-02-22",934],["2020-02-23",934],["2020-02-24",934],["2020-02-25",934]]
},
{
"key": "江苏",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 5 ],['2020-01-23', 9 ],['2020-01-24', 18 ],['2020-01-25', 31 ],['2020-01-26', 47 ],['2020-01-27', 70 ],['2020-01-28', 99 ],['2020-01-29', 129 ],['2020-01-30', 129 ],['2020-01-31', 168 ],['2020-02-01', 202 ], ['2020-02-02', 236], ['2020-02-03', 271], ['2020-02-04', 308], ['2020-02-05', 341], ['2020-02-06', 373], ['2020-02-07', 408], ['2020-02-08', 439], ['2020-02-09', 468], ['2020-02-10', 492], ['2020-02-11',515], ['2020-02-12', 543], ['2020-02-13',570], ['2020-02-14',593], ['2020-02-15',604],["2020-02-16",617],["2020-02-17",626],["2020-02-18",629],["2020-02-19",631],["2020-02-20",631],["2020-02-21",631],["2020-02-22",631],["2020-02-23",631],["2020-02-24",631],["2020-02-25",631]]
},
{
"key": "广西",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 5 ],['2020-01-23', 13 ],['2020-01-24', 23 ],['2020-01-25', 33 ],['2020-01-26', 46 ],['2020-01-27', 51 ],['2020-01-28', 58 ],['2020-01-29', 78 ],['2020-01-30', 78 ],['2020-01-31', 87 ],['2020-02-01', 100 ], ['2020-02-02', 111], ['2020-02-03', 127], ['2020-02-04', 139], ['2020-02-05', 150], ['2020-02-06', 168], ['2020-02-07', 172], ['2020-02-08', 183], ['2020-02-09', 195], ['2020-02-10', 210], ['2020-02-11',215], ['2020-02-12', 222], ['2020-02-13',222], ['2020-02-14',226], ['2020-02-15',235],["2020-02-16",237],["2020-02-17",238],["2020-02-18",242],["2020-02-19",244],["2020-02-20",245],["2020-02-21",246],["2020-02-22",249],["2020-02-23",249],["2020-02-24",251],["2020-02-25",252]]
},
{
"key": "陕西",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 3 ],['2020-01-23', 5 ],['2020-01-24', 15 ],['2020-01-25', 22 ],['2020-01-26', 35 ],['2020-01-27', 46 ],['2020-01-28', 56 ],['2020-01-29', 63 ],['2020-01-30', 63 ],['2020-01-31', 87 ],['2020-02-01', 101 ], ['2020-02-02', 116], ['2020-02-03', 128], ['2020-02-04', 142], ['2020-02-05', 165], ['2020-02-06', 173], ['2020-02-07', 184], ['2020-02-08', 195], ['2020-02-09', 208], ['2020-02-10', 213], ['2020-02-11',219], ['2020-02-12', 225], ['2020-02-13',229], ['2020-02-14',230], ['2020-02-15',232],["2020-02-16",236],["2020-02-17",240],["2020-02-18",240],["2020-02-19",242],["2020-02-20",245],["2020-02-21",245],["2020-02-22",245],["2020-02-23",245],["2020-02-24",245],["2020-02-25",245]]
},
{
"key": "海南",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 4 ],['2020-01-23', 8 ],['2020-01-24', 17 ],['2020-01-25', 22 ],['2020-01-26', 33 ],['2020-01-27', 40 ],['2020-01-28', 43 ],['2020-01-29', 46 ],['2020-01-30', 46 ],['2020-01-31', 51 ],['2020-02-01', 62 ], ['2020-02-02', 64], ['2020-02-03', 71], ['2020-02-04', 80], ['2020-02-05', 91], ['2020-02-06', 106], ['2020-02-07', 117], ['2020-02-08', 124], ['2020-02-09', 130], ['2020-02-10', 138], ['2020-02-11',142], ['2020-02-12', 157], ['2020-02-13',157], ['2020-02-14',158], ['2020-02-15',162],["2020-02-16",162],["2020-02-17",163],["2020-02-18",163],["2020-02-19",163],["2020-02-20",168],["2020-02-21",168],["2020-02-22",168],["2020-02-23",168],["2020-02-24",168],["2020-02-25",168]]
},
{
"key": "辽宁",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 3 ],['2020-01-23', 12 ],['2020-01-24', 19 ],['2020-01-25', 22 ],['2020-01-26', 27 ],['2020-01-27', 30 ],['2020-01-28', 37 ],['2020-01-29', 41 ],['2020-01-30', 41 ],['2020-01-31', 48 ],['2020-02-01', 64 ], ['2020-02-02', 69], ['2020-02-03', 73], ['2020-02-04', 77], ['2020-02-05', 88], ['2020-02-06', 91], ['2020-02-07', 96], ['2020-02-08', 105], ['2020-02-09', 107], ['2020-02-10', 108], ['2020-02-11',111], ['2020-02-12', 116], ['2020-02-13',116], ['2020-02-14',117], ['2020-02-15',119],["2020-02-16",121],["2020-02-17",121],["2020-02-18",121],["2020-02-19",121],["2020-02-20",121],["2020-02-21",121],["2020-02-22",121],["2020-02-23",121],["2020-02-24",121],["2020-02-25",121]]
},
{
"key": "云南",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 4 ],['2020-01-23', 7 ],['2020-01-24', 13 ],['2020-01-25', 19 ],['2020-01-26', 26 ],['2020-01-27', 44 ],['2020-01-28', 51 ],['2020-01-29', 70 ],['2020-01-30', 70 ],['2020-01-31', 80 ],['2020-02-01', 91 ], ['2020-02-02', 105], ['2020-02-03', 114], ['2020-02-04', 119], ['2020-02-05', 124], ['2020-02-06', 133], ['2020-02-07', 136], ['2020-02-08', 138], ['2020-02-09', 141], ['2020-02-10', 149], ['2020-02-11',153], ['2020-02-12', 154], ['2020-02-13',156], ['2020-02-14',162], ['2020-02-15',168],["2020-02-16",171],["2020-02-17",171],["2020-02-18",172],["2020-02-19",173],["2020-02-20",173],["2020-02-21",174],["2020-02-22",174],["2020-02-23",174],["2020-02-24",174],["2020-02-25",174]]
},
{
"key": "黑龙江",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 4 ],['2020-01-24', 9 ],['2020-01-25', 15 ],['2020-01-26', 21 ],['2020-01-27', 30 ],['2020-01-28', 37 ],['2020-01-29', 44 ],['2020-01-30', 44 ],['2020-01-31', 59 ],['2020-02-01', 80 ], ['2020-02-02', 95], ['2020-02-03', 121], ['2020-02-04', 155], ['2020-02-05', 190], ['2020-02-06', 227], ['2020-02-07', 277], ['2020-02-08', 295], ['2020-02-09', 307], ['2020-02-10', 331], ['2020-02-11',360], ['2020-02-12', 378], ['2020-02-13',395], ['2020-02-14',418], ['2020-02-15',425],["2020-02-16",445],["2020-02-17",457],["2020-02-18",464],["2020-02-19",470],["2020-02-20",476],["2020-02-21",479],["2020-02-22",479],["2020-02-23",480],["2020-02-24",480],["2020-02-25",480]]
},
{
"key": "天津",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 5 ],['2020-01-23', 8 ],['2020-01-24', 10 ],['2020-01-25', 14 ],['2020-01-26', 17 ],['2020-01-27', 24 ],['2020-01-28', 27 ],['2020-01-29', 29 ],['2020-01-30', 29 ],['2020-01-31', 32 ],['2020-02-01', 41 ], ['2020-02-02', 48], ['2020-02-03', 56], ['2020-02-04', 67], ['2020-02-05', 69], ['2020-02-06', 78], ['2020-02-07', 81], ['2020-02-08', 88], ['2020-02-09', 90], ['2020-02-10', 94], ['2020-02-11',104], ['2020-02-12', 110], ['2020-02-13',117], ['2020-02-14',120], ['2020-02-15',121],["2020-02-16",124],["2020-02-17",125],["2020-02-18",128],["2020-02-19",130],["2020-02-20",131],["2020-02-21",132],["2020-02-22",135],["2020-02-23",135],["2020-02-24",135],["2020-02-25",135]]
},
{
"key": "河北",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 2 ],['2020-01-24', 8 ],['2020-01-25', 13 ],['2020-01-26', 18 ],['2020-01-27', 33 ],['2020-01-28', 48 ],['2020-01-29', 65 ],['2020-01-30', 65 ],['2020-01-31', 82 ],['2020-02-01', 96 ], ['2020-02-02', 104], ['2020-02-03', 113], ['2020-02-04', 126], ['2020-02-05', 135], ['2020-02-06', 157], ['2020-02-07', 172], ['2020-02-08', 195], ['2020-02-09', 206], ['2020-02-10', 218], ['2020-02-11',239], ['2020-02-12', 251], ['2020-02-13',265], ['2020-02-14',283], ['2020-02-15',291],["2020-02-16",300],["2020-02-17",301],["2020-02-18",302],["2020-02-19",306],["2020-02-20",307],["2020-02-21",308],["2020-02-22",309],["2020-02-23",311],["2020-02-24",311],["2020-02-25",311]]
},
{
"key": "甘肃",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 2 ],['2020-01-24', 4 ],['2020-01-25', 7 ],['2020-01-26', 14 ],['2020-01-27', 19 ],['2020-01-28', 24 ],['2020-01-29', 26 ],['2020-01-30', 26 ],['2020-01-31', 39 ],['2020-02-01', 39 ], ['2020-02-02', 40], ['2020-02-03', 51], ['2020-02-04', 55], ['2020-02-05', 57], ['2020-02-06', 62], ['2020-02-07', 67], ['2020-02-08', 71], ['2020-02-09', 79], ['2020-02-10', 83], ['2020-02-11',86], ['2020-02-12', 86], ['2020-02-13',87], ['2020-02-14',90], ['2020-02-15',90],["2020-02-16",90],["2020-02-17",91],["2020-02-18",91],["2020-02-19",91],["2020-02-20",91],["2020-02-21",91],["2020-02-22",91],["2020-02-23",91],["2020-02-24",91],["2020-02-25",91]]
},
{
"key": "山西",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 1 ],['2020-01-24', 6 ],['2020-01-25', 9 ],['2020-01-26', 13 ],['2020-01-27', 20 ],['2020-01-28', 27 ],['2020-01-29', 35 ],['2020-01-30', 35 ],['2020-01-31', 39 ],['2020-02-01', 47 ], ['2020-02-02', 56], ['2020-02-03', 66], ['2020-02-04', 74], ['2020-02-05', 81], ['2020-02-06', 90], ['2020-02-07', 96], ['2020-02-08', 104], ['2020-02-09', 115], ['2020-02-10', 119], ['2020-02-11',122], ['2020-02-12', 124], ['2020-02-13',126], ['2020-02-14',126], ['2020-02-15',127],["2020-02-16",128],["2020-02-17",129],["2020-02-18",130],["2020-02-19",131],["2020-02-20",131],["2020-02-21",132],["2020-02-22",132],["2020-02-23",132],["2020-02-24",132],["2020-02-25",133]]
},
{
"key": "内蒙古",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 1 ],['2020-01-24', 2 ],['2020-01-25', 7 ],['2020-01-26', 11 ],['2020-01-27', 15 ],['2020-01-28', 16 ],['2020-01-29', 18 ],['2020-01-30', 18 ],['2020-01-31', 20 ],['2020-02-01', 23 ], ['2020-02-02', 27], ['2020-02-03', 34], ['2020-02-04', 35], ['2020-02-05', 42], ['2020-02-06', 46], ['2020-02-07', 50], ['2020-02-08', 52], ['2020-02-09', 54], ['2020-02-10', 58], ['2020-02-11',58], ['2020-02-12', 60], ['2020-02-13',61], ['2020-02-14',65], ['2020-02-15',68],["2020-02-16",70],["2020-02-17",72],["2020-02-18",73],["2020-02-19",75],["2020-02-20",75],["2020-02-21",75],["2020-02-22",75],["2020-02-23",75],["2020-02-24",75],["2020-02-25",75]]
},
{
"key": "贵州",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 3 ],['2020-01-24', 4 ],['2020-01-25', 5 ],['2020-01-26', 7 ],['2020-01-27', 9 ],['2020-01-28', 9 ],['2020-01-29', 12 ],['2020-01-30', 12 ],['2020-01-31', 15 ],['2020-02-01', 29 ], ['2020-02-02', 38], ['2020-02-03', 46], ['2020-02-04', 58], ['2020-02-05', 64], ['2020-02-06', 71], ['2020-02-07', 81], ['2020-02-08', 89], ['2020-02-09', 99], ['2020-02-10', 109], ['2020-02-11',127], ['2020-02-12', 133], ['2020-02-13',135], ['2020-02-14',140], ['2020-02-15',143],["2020-02-16",144],["2020-02-17",146],["2020-02-18",146],["2020-02-19",146],["2020-02-20",146],["2020-02-21",146],["2020-02-22",146],["2020-02-23",146],["2020-02-24",146],["2020-02-25",146]]
},
{
"key": "宁夏",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 2 ],['2020-01-24', 3 ],['2020-01-25', 4 ],['2020-01-26', 7 ],['2020-01-27', 11 ],['2020-01-28', 12 ],['2020-01-29', 17 ],['2020-01-30', 17 ],['2020-01-31', 21 ],['2020-02-01', 26 ], ['2020-02-02', 28], ['2020-02-03', 31], ['2020-02-04', 34], ['2020-02-05', 34], ['2020-02-06', 40], ['2020-02-07', 43], ['2020-02-08', 45], ['2020-02-09', 45], ['2020-02-10', 49], ['2020-02-11',53], ['2020-02-12', 58], ['2020-02-13',64], ['2020-02-14',67], ['2020-02-15',70],["2020-02-16",70],["2020-02-17",70],["2020-02-18",70],["2020-02-19",71],["2020-02-20",71],["2020-02-21",71],["2020-02-22",71],["2020-02-23",71],["2020-02-24",71],["2020-02-25",71]]
},
{
"key": "吉林",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 1 ],['2020-01-24', 3 ],['2020-01-25', 4 ],['2020-01-26', 6 ],['2020-01-27', 8 ],['2020-01-28', 9 ],['2020-01-29', 14 ],['2020-01-30', 14 ],['2020-01-31', 14 ],['2020-02-01', 17 ], ['2020-02-02', 23], ['2020-02-03', 31], ['2020-02-04', 42], ['2020-02-05', 54], ['2020-02-06', 59], ['2020-02-07', 65], ['2020-02-08', 69], ['2020-02-09', 78], ['2020-02-10', 80], ['2020-02-11',81], ['2020-02-12', 83], ['2020-02-13',84], ['2020-02-14',86], ['2020-02-15',88],["2020-02-16",89],["2020-02-17",89],["2020-02-18",89],["2020-02-19",90],["2020-02-20",91],["2020-02-21",91],["2020-02-22",91],["2020-02-23",91],["2020-02-24",93],["2020-02-25",93]]
},
{
"key": "新疆",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 1 ],['2020-01-24', 3 ],['2020-01-25', 4 ],['2020-01-26', 5 ],['2020-01-27', 10 ],['2020-01-28', 13 ],['2020-01-29', 14 ],['2020-01-30', 14 ],['2020-01-31', 17 ],['2020-02-01', 18 ], ['2020-02-02', 21], ['2020-02-03', 24], ['2020-02-04', 29], ['2020-02-05', 32], ['2020-02-06', 36], ['2020-02-07', 39], ['2020-02-08', 42], ['2020-02-09', 45], ['2020-02-10', 49], ['2020-02-11',55], ['2020-02-12', 59], ['2020-02-13',63], ['2020-02-14',65], ['2020-02-15',70],["2020-02-16",71],["2020-02-17",75],["2020-02-18",76],["2020-02-19",76],["2020-02-20",76],["2020-02-21",76],["2020-02-22",76],["2020-02-23",76],["2020-02-24",76],["2020-02-25",76]]
},
{
"key": "青海",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 0 ],['2020-01-24', 1 ],['2020-01-25', 3 ],['2020-01-26', 4 ],['2020-01-27', 6 ],['2020-01-28', 6 ],['2020-01-29', 6 ],['2020-01-30', 6 ],['2020-01-31', 8 ],['2020-02-01', 9 ], ['2020-02-02', 11], ['2020-02-03', 13], ['2020-02-04', 15], ['2020-02-05', 17], ['2020-02-06', 18], ['2020-02-07', 18], ['2020-02-08', 18], ['2020-02-09', 18], ['2020-02-10', 18], ['2020-02-11',18], ['2020-02-12', 18], ['2020-02-13',18], ['2020-02-14',18], ['2020-02-15',18],["2020-02-16",18],["2020-02-17",18],["2020-02-18",18],["2020-02-19",18],["2020-02-20",18],["2020-02-21",18],["2020-02-22",18],["2020-02-23",18],["2020-02-24",18],["2020-02-25",18]]
},
{
"key": "香港",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 2 ],['2020-01-23', 0 ],['2020-01-24', 5 ],['2020-01-25', 0 ],['2020-01-26', 8 ],['2020-01-27', 8 ],['2020-01-28', 8 ],['2020-01-29', 10 ],['2020-01-30', 10 ],['2020-01-31', 12 ],['2020-02-01', 13 ], ['2020-02-02', 14], ['2020-02-03', 15], ['2020-02-04', 17], ['2020-02-05', 18], ['2020-02-06', 21], ['2020-02-07', 25], ['2020-02-08', 26], ['2020-02-09', 29], ['2020-02-10', 38], ['2020-02-11',49], ['2020-02-12', 50], ['2020-02-13',51], ['2020-02-14',56], ['2020-02-15',56],["2020-02-16",57],["2020-02-17",58],["2020-02-18",61],["2020-02-19",63],["2020-02-20",67],["2020-02-21",68],["2020-02-22",69],["2020-02-23",74],["2020-02-24",79],["2020-02-25",87]]
},
{
"key": "澳门",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 0 ],['2020-01-24', 0 ],['2020-01-25', 0 ],['2020-01-26', 6 ],['2020-01-27', 7 ],['2020-01-28', 7 ],['2020-01-29', 7 ],['2020-01-30', 7 ],['2020-01-31', 7 ],['2020-02-01', 7 ], ['2020-02-02', 8], ['2020-02-03', 8], ['2020-02-04', 10], ['2020-02-05', 10], ['2020-02-06', 10], ['2020-02-07', 10], ['2020-02-08', 10], ['2020-02-09', 10], ['2020-02-10', 10], ['2020-02-11',10], ['2020-02-12', 10], ['2020-02-13',10], ['2020-02-14',10], ['2020-02-15',10],["2020-02-16",10],["2020-02-17",10],["2020-02-18",10],["2020-02-19",10],["2020-02-20",10],["2020-02-21",10],["2020-02-22",10],["2020-02-23",10],["2020-02-24",10],["2020-02-25",10]]
},
{
"key": "台湾",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 0 ],['2020-01-24', 0 ],['2020-01-25', 0 ],['2020-01-26', 5 ],['2020-01-27', 5 ],['2020-01-28', 8 ],['2020-01-29', 8 ],['2020-01-30', 9 ],['2020-01-31', 9 ],['2020-02-01', 10 ], ['2020-02-02', 10], ['2020-02-03', 10], ['2020-02-04', 10], ['2020-02-05', 11], ['2020-02-06', 13], ['2020-02-07', 16], ['2020-02-08', 17], ['2020-02-09', 18], ['2020-02-10', 18], ['2020-02-11',18], ['2020-02-12', 18], ['2020-02-13',18], ['2020-02-14',18], ['2020-02-15',18],["2020-02-16",20],["2020-02-17",22],["2020-02-18",22],["2020-02-19",23],["2020-02-20",24],["2020-02-21",26],["2020-02-22",26],["2020-02-23",28],["2020-02-24",30],["2020-02-25",31]]
},
{
"key": "西藏",
"values": [['2020-01-20', 0 ],['2020-01-21', 0 ],['2020-01-22', 0 ],['2020-01-23', 0 ],['2020-01-24', 0 ],['2020-01-25', 0 ],['2020-01-26', 0 ],['2020-01-27', 0 ],['2020-01-28', 0 ],['2020-01-29', 1 ],['2020-01-30', 1 ],['2020-01-31', 1 ],['2020-02-01', 1 ], ['2020-02-02', 1], ['2020-02-03', 1], ['2020-02-04', 1], ['2020-02-05', 1], ['2020-02-06', 1], ['2020-02-07', 1], ['2020-02-08', 1], ['2020-02-09', 1], ['2020-02-10', 1], ['2020-02-11',1], ['2020-02-12', 1], ['2020-02-13',1], ['2020-02-14',1], ['2020-02-15',1],["2020-02-16",1],["2020-02-17",1],["2020-02-18",1],["2020-02-19",1],["2020-02-20",1],["2020-02-21",1],["2020-02-22",1],["2020-02-23",1],["2020-02-24",1],["2020-02-25",1]]
}
];
var colors = d3.scale.category20();
var chart;
nv.addGraph(function() {
chart = nv.models.stackedAreaChart()
.useInteractiveGuideline(true)
.x(function(d) {
return new Date(d[0]) })
.y(function(d) { return d[1] })
.controlLabels({stacked: "Stacked"})
.duration(300);
chart.xAxis.tickFormat(function(d) {
return d3.time.format('%x')(new Date(d))
});
chart.legend.vers('furious');
d3.select('#chart1')
.datum(his_data)
.transition().duration(1000)
.call(chart)
.each('start', function() {
setTimeout(function() {
d3.selectAll('#chart1 *').each(function() {
if(this.__transition__)
this.__transition__.duration = 1;
})
}, 0)
});
nv.utils.windowResize(chart.update);
return chart;
});
let line_chart = echarts.init(document.getElementById('line'));
function loadLineData(date) {
var url = "http://huiyan.baidu.com/migration/historycurve.jsonp?dt=city&id=420100&type=move_out&startDate=20200101&endDate=" + date + "&callback=lineCallback";
$.ajax({
url: url,
dataType: "jsonp",
jsonp: 'lineCallback'
});
}
function lineCallback(data) {
data = data.data.list;
var dateList = [];
var valueList = [];
for (let i in data) {
dateList.push(i);
valueList.push(data[i]);
}
let lineOptions = {
tooltip: {
trigger: 'axis'
},
xAxis: [{
data: dateList,
axisLabel: {
rotate:60
}
}],
yAxis: [{
splitLine: {show: false}
}],
grid: [{
bottom: '40%'
}, {
top: '60%'
}],
series: [{
type: 'line',
smooth : true,
itemStyle: {
color: '#B7CCEB'
},
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#B7CCEB'
}, {
offset: 1,
color: '#EFF4FB'
}])
},
data: valueList
}]
};
line_chart.setOption(lineOptions);
}
loadLineData(preDate);
function getMapData() {
let url = 'http://api.tianapi.com/txapi/ncovcity/index?key=698891ce03c51780f3433fa08e1b56d1';
$.get(url, res => {
if (res && res.code == 200) {
let list = res.newslist;
list.forEach(d => {
mapData.push({name: d.provinceShortName, value: d.confirmedCount});
});
initMap();
}
});
}
getMapData();
function initMap() {
var optionMap = {
backgroundColor: '#FFFFFF',
tooltip : {
trigger: 'item',
formatter: function(params) {
var res = params.name+'<br/>';
var myseries = params.seriesName + ':' + params.value;
return res + myseries;
}
},
visualMap: {
show : true,
x: 'left',
y: 'center',
splitList: [
{start: 10000},{start: 1000, end: 9999},
{start: 500, end: 999},{start: 100, end: 499},
{start: 10, end: 99},{start: 1, end: 9},
],
color: ['#7F1100', '#BD1417', '#E64B45','#FF8C72', '#FDD29F', '#FAF1D1']
},
series: [{
name: '确诊人数',
type: 'map',
mapType: 'china',
zoom: 0.9,
roam: false,
label: {
normal: {
show: true
},
emphasis: {
show: false
}
},
data: mapData
}]
};
mapChart = echarts.init(document.getElementById('map'));
mapChart.setOption(optionMap);
}
window.onresize = function() {
rel_chart.resize();
mapChart.resize();
line_chart.resize();
}
<script src="http://code.jquery.com/jquery-2.1.4.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js">
</script>
<script src="https://timelyportfolio.github.io/rCharts_d3_sankey//js/sankey.js" type='text/javascript'>
</script>
<script src="https://bl.ocks.org/dukevis/raw/d494d1c73261dac2f8dd/09da3aaee847bf226fb3b291ea9a4fb6783fd8cf/nv.d3.js">
</script>
<script src="https://bl.ocks.org/dukevis/raw/d494d1c73261dac2f8dd/09da3aaee847bf226fb3b291ea9a4fb6783fd8cf/colorbrewer.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.3.0/echarts.min.js">
</script>
<script src="https://www.html5tricks.com/demo/echarts-html5-canvas-map/js/china.js">
</script>
<link rel='stylesheet' href="https://timelyportfolio.github.io/rCharts_d3_sankey//css/sankey.css">
<link href="https://bl.ocks.org/dukevis/raw/d494d1c73261dac2f8dd/09da3aaee847bf226fb3b291ea9a4fb6783fd8cf/nv.d3.css" rel="stylesheet"
type="text/css">
<body>
<div class="content">
<h1>疫情实时数据</h1>
<div class="updateTime">
<span id="updateTime"></span>
</div>
<div class="VirusSummary_total">
<table class="VirusSummary_table">
<tbody>
<tr>
<td>
<div class="VirusSummary_qzbl">
<div class="VirusSummary_num VirusSummary_fontWeight" id="qzbl"></div>
<div class="VirusSummary_txt">确诊病例</div>
<div class="VirusSummary_pre">昨日<span class="VirusSummary_fontWeight" id="qzbl_pre"></span></div>
</div>
</td>
<td>
<div class="VirusSummary_ysbl">
<div class="VirusSummary_num VirusSummary_fontWeight" id="ysbl"></div>
<div class="VirusSummary_txt">疑似病例</div>
<div class="VirusSummary_pre">昨日<span class="VirusSummary_fontWeight" id="ysbl_pre"></span></div>
</div>
</td>
<td>
<div class="VirusSummary_zybl">
<div class="VirusSummary_num VirusSummary_fontWeight" id="zybl"></div>
<div class="VirusSummary_txt">治愈病例</div>
<div class="VirusSummary_pre">昨日<span class="VirusSummary_fontWeight" id="zybl_pre"></span></div>
</div>
</td>
<td>
<div class="VirusSummary_swbl">
<div class="VirusSummary_num VirusSummary_fontWeight" id="swbl"></div>
<div class="VirusSummary_txt">死亡病例</div>
<div class="VirusSummary_pre">昨日<span class="VirusSummary_fontWeight" id="swbl_pre"></span></div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id='map'>
</div>
<div class='total'>
<select onchange='jumpCity(this.value)' id="city_sel">
<option value="全国" >全国</option>
</select>
</div>
<div id='bar'>
</div>
<div id="remark">
<ul>
</ul>
</div>
<div class='footer'>
(每十分钟更新,数据由丁香园整理, 天行数据接口)
</div>
<div style="clear:both;"></div>
<h1>各省确认人数历史记录</h1>
<svg id="chart1"></svg>
<h1>武汉人员迁徙到各地</h1>
<span style="margin-left: 12px;">日期:</span>
<select onchange='dateChange(this.value)' id="date_sel">
</select>
<p id="chart"></p>
<div>
<h1>武汉春运迁出趋势图</h1>
<div id="line"></div>
</div>
</div>
</body>
.content {
margin: 0 auto;
max-width: 768px;
}
#bar {
width: 100%;
height: 400px;
float: left;
}
#remark {
width: 100%;
float: left;
color: #3e3e3e;
}
.total {
margin-left: 50px;
margin-top: 40px;
float: left;
width: 100%;
}
.total span {
background: #4865f3;
color: #fff;
padding: 0 7px;
}
i {
cursor: pointer;
color: blue;
margin-left: 10px;
}
.footer {
width: 100%;
float: left;
font-size: 12px;
color: #8c8c8c;
}
select {
}
#chart1 {
height: 600px;
}
text {
font: 12px sans-serif;
}
svg {
display: block;
}
html,
body,
svg {
margin: 0px;
padding: 0px;
}
#line {
width: 100%;
height: 561px;
}
#map {
width:100%;
height:561px;
}
.VirusSummary_total {
position: relative;
margin-top: 1rem;
padding: .9375rem 0;
background: #f5f6f7;
border-radius: .31rem;
white-space: nowrap;
font-size: .938rem;
color: #333;
}
.VirusSummary_total .VirusSummary_table {
table-layout: fixed;
width: 100%;
}
.VirusSummary_total .VirusSummary_table td {
width: 25%;
text-align: center;
}
.VirusSummary_total .VirusSummary_num {
font-size: 1.25rem;
height: 1.25rem;
line-height: 1.25rem;
margin-bottom: .5rem;
}
.VirusSummary_total .VirusSummary_txt {
font-size: .9375rem;
height: .9375rem;
line-height: .9375rem;
}
.VirusSummary_total .VirusSummary_pre {
font-size: .75rem;
height: .75rem;
line-height: .75rem;
margin-top: .5rem;
color: #999;
}
.VirusSummary_total .VirusSummary_qzbl .VirusSummary_fontWeight {
color: #e83132;
}
.VirusSummary_total .VirusSummary_fontWeight {
font-weight: 700;
}
.VirusSummary_total .VirusSummary_ysbl .VirusSummary_fontWeight {
color: #ec9217;
}
.VirusSummary_total .VirusSummary_zybl .VirusSummary_fontWeight {
color: #10aeb5;
}
.VirusSummary_total .VirusSummary_swbl .VirusSummary_fontWeight {
color: #4d5054;
}
.updateTime {
text-align:right;
color: #999;
font-size: .8125rem;
}