当前位置:网站首页>Echars dynamically realizes the scatter diagram and customizes the information prompt box
Echars dynamically realizes the scatter diagram and customizes the information prompt box
2022-04-22 08:02:00 【weixin_ forty-five million four hundred and eleven thousand sev】
echars Dynamically implement the scatter chart and customize the information prompt box
First step . Get the of the current city json file
dependent js Everyone should have the documents , I won't do that here
var i="";
var s="https://geo.datav.aliyun.com/areas_v2/bound/"+i+"_full.json"// This i Is the number of the current map I got from the background , obtain json The address for http://datav.aliyun.com/tools/atlas/#&lat=30.316551722910077&lng=106.68898666525287&zoom=3.5,

It just needs to be modified code You can get maps of different regions by numbering json
The second step . Custom scatter address , And the value of the prompt , Of course , You can also get it from the background , As long as the corresponding format is set, the dynamic map can be realized
var data= [
{ name: ' Jiexiu City ', coord: [111.925687,37.024147], value: '78',value2: '32' },
{ name: ' Taigu District ', coord: [112.595903,37.439316], value: '92',value2: '33' },
{ name: ' Shouyang railway station ', coord: [113.194911,37.894017], value: '55',value2: '24' },
{ name: ' Pingyao Ancient City ', coord: [112.158312,37.167077], value: '33',value2: '20' },
]// The specific values here can be added all the time , Continue writing after the array value3,value4, That's all right. , Of course, you can also customize the field name , Coordinates, you can from Baidu
Coordinate picker acquisition https://api.map.baidu.com/lbsapi/getpoint/index.html, Post the address to everyone
The third step . Initialize map
$.get(s, function (chinaJson) {
echarts.registerMap('city', chinaJson); // Name data , I understand
var chart1 = echarts.init(document.getElementById('main8'));
chart1.setOption({
title: {
text: ' China Shanxi Province '+city,
left: 'center',
textStyle: {
color: 'white',
fontStyle: 'normal',
fontWeight: 'bold',
fontSize: 32,
lineHeight: 80,
textBorderColor: 'green',
textBorderWidth: 1,
textShadowColor: 'green',
textShadowBlur: 10,
textShadowOffsetX: 2,
textShadowOffsetY: 2
}
},
tooltip: { // Custom prompt box information
trigger: 'item',
formatter:function(params){
console.log(params)// Here you can take a look at the printed data format , Then assign it to the following
let text=params.name+"<br> Outlet water temperature :"+params.value+"<br> Return water temperature :"+params.data.value2// This is actually a paragraph html Code ,div, The background color , Font size can be set , Setting method and css equally
return text
}
},
series: [{
name: 'city',
type: 'map',
mapType: 'city',
markPoint: { // Chart labels .
label: {
normal: {
show: false,
},
emphasis: {
show: false,
}
},
itemStyle: {
normal: {
color: 'red'
}
},
data:data// Custom scatter , Here, just put the defined array or the array passed from the background here
},
roam:true,
selectedMode: false,//single According to the radio ;multiple Multiple choice Default flase No election
label: {
normal: {
textStyle: { fontSize: 12,
fontWeight: 'bold',
color: '#0090FF' }
}
},
itemStyle: {
normal: {
borderWidth:3,
areaColor:'#0C2452',
label: {
show: true,// Whether to display the province name by default
},
areaStyle: {
color: '#0655B7',// Default map plate color
},
borderWidth:3,
borderColor:'#0655B7',
},
emphasis: {
borderColor: '#2378f7', // The stroke color of the figure #2378f7
borderWidth: '1',
areaColor: '#233F53', // Shadow color #233F53
label: {
show: false,
textStyle: {
color: '#fff',
fontSize: 14,
}
},
},
},
// This is the loaded data
}]
});
});
It's done here
Step four . Let's go over the result map


版权声明
本文为[weixin_ forty-five million four hundred and eleven thousand sev]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220626278918.html
边栏推荐
猜你喜欢

Quartz.net在.Net Core中使用

js动态合并单元格

Charles使用之修改请求和响应的三种方式

Industry application | understand the bank's sensitive data security protection ideas from practice

Supersocket is Used in net5 - appsession and supersocketservice
![[Shiping information] solutions for confidentiality inspection and compliance control of recorded content](/img/45/bb2cc00e6d61c7c18268336d00101f.png)
[Shiping information] solutions for confidentiality inspection and compliance control of recorded content

Read SAE J1939 protocol data stream

Wireshark在流量分析中的使用

Autoware displays user interface details

JWT realizes the whole process of login authentication, password encryption and token verification (with source code)
随机推荐
[site building notes]: insert code snippets in wordpress blog posts and highlight them
Winform让Form窗体切换前置及活动状态
Continue raspberry pie 4B + OLED: automatically display the IP address after startup
行业应用 |从实践中读懂银行的敏感数据安全防护思路
【世平信息】刻录内容保密检查与合规管控解决方案
2021-10-08 selenium headless mode open browser
Login interface - infiltrate you thousands of times
Autoware Demo测试
MySQL queries the attributes of all fields in the database
.NetCore设置API post方式可以直接括号内接受参数
SuperSocket在.Net5中使用——WebSocket Server篇
An alternative method of sending fixed format Chinese short message in Arduino: taking dht22 + GSM module as an example
朴素的CSRF漏洞
flask 数据Model迁移报错
Focus on scientific and technological innovation 𞓜 Shiping information appears in the technology roadshow of science and innovation China - special session on information technology and security
行业应用 | 政务大数据平台数据安全合规建设之道
文件上传漏洞小结与Upload-labs 靶场纪实
China network security industry panorama of ccsip 2021 listed by Shiping information
Shiping information was listed in the panorama of China's network security market in 2021
.net WebAPI访问授权机制及流程设计(header token+redis)