echarts_部分圖表配置_地圖的配置


 

 1 function echarts_map (thisId,data){
 2     $.get('map/json/henan.json', function (chinaJson) {
 3         echarts.registerMap('henan', chinaJson);
 4         var chart = echarts.init(document.getElementById(thisId));
 5         chart.setOption({
 6 
 7             visualMap: {
 8                 show:false,//不顯示也有顏色區分的效果
 9                 min: 0,
10                 max: 50000,
11                 left: 'left',
12                 top: 'bottom',
13                 text: ['高','低'], // 文本,默認為數值文本
14                 calculable: false,//是否顯示可拖動的句柄
15                 inRange: {
16                     color: ['rgba(15,220,150,.5)','#00415a',]
17                 }
18             },
19             tooltip: {
20                 trigger: 'item',
21                 showDelay: 0,
22                 backgroundColor: '#c6e8e9',//浮框背景色
23                 transitionDuration: 0.2,
24                 formatter: function (params) {//設置提示框內的文字
25                     var p = '<h3 style="color:#29667b;text-align:center;font-size:14px;font-weight:bold;line-height:20px;">['+params.name+']</h3>'+
26                         '<p style="color:#26677b;font-size:12px;">今日累計用戶數:'+params.data.uv+'</p>'+
27                         '<p style="color:#26677b;font-size:12px;">當前活躍用戶數:'+params.data.iuv+'</p>'
28                     return p;
29                 }
30             },           
31             series: [{
32                 type: 'map',
33                 map: 'henan',
34                 roam: false,//標識是否可以縮放和拖動
35                 aspectScale:1.1,//設置地圖的長寬比 數值越大 高度越小 數值越小 寬度越小
36                 zoom:1.25,//定義當前視角的縮放比
37                 label: {
38                     normal: {
39                         show: false,//標示是否顯示提示文字
40                     },
41                     emphasis: {
42                         show: false
43                     }
44                 },
45                 itemStyle:{
46                     normal:{
47                         areaColor:'rgba(15,220,150,.5)'
48                     }
49                 },
50                 data:data
51             }]
52         });
53         chart.on('mouseover', function (e) {
54             e.event.target.style.fill = '#00415a';
55         });
56     });
57 };

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM