EChars学习-2

上海的echars学习

 1 <html>
 2 <head>
 3 <meta charset="utf-8">
 4 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 5 </head>
 6 <body>
 7     <div id="main" style="100%; height: 100%;"></div>
 8 </body>
 9 <script src="js/echarts.min.js"></script>
10 <script src="js/shanghai.js"></script>
11 <script>
12     var myChart = echarts.init(document.getElementById('main'));
13     var option = {
14         title: {
15             text : '上海地图',
16             subtext : '-。-1234'
17         },
18         tooltip : {
19             trigger: 'item',
20             formatter: function(a){
21                 return a[2];
22             }
23         },
24         legend: {
25             orient: 'vertical',
26             x:'right',
27             data:['数据名称']
28         },
29         dataRange: {
30             min: 0,
31             max: 1000,
32             color:['orange','#CCCCCC'],
33             text:['',''],           // 文本,默认为数值文本
34             calculable : true
35         },
36         series : [
37             {
38                 name: '数据名称',
39                 type: 'map',
40                 mapType: '上海',
41                 selectedMode : 'single',
42                 itemStyle:{
43                     normal:{label:{show:true}},
44                     emphasis:{label:{show:true}}
45                 },
46                 data:[
47                     {name: '崇明县',value: Math.round(Math.random()*1000)},
48                     {name: '宝山区',value: Math.round(Math.random()*1000)},
49                     {name: '嘉定区',value: Math.round(Math.random()*1000)},
50                     {name: '青浦区',value: Math.round(Math.random()*1000)},
51                     {name: '杨浦区',value: Math.round(Math.random()*1000)},
52                     {name: '虹口区',value: Math.round(Math.random()*1000)},
53                     {name: '闸北区',value: Math.round(Math.random()*1000)},
54                     {name: '普陀区',value: Math.round(Math.random()*1000)},
55                     {name: '静安区',value: Math.round(Math.random()*1000)},
56                     {name: '黄浦区',value: Math.round(Math.random()*1000)},
57                     {name: '卢湾区',value: Math.round(Math.random()*1000)},
58                     {name: '长宁区',value: Math.round(Math.random()*1000)},
59                     {name: '徐汇区',value: Math.round(Math.random()*1000)},
60                     {name: '浦东新区',value: Math.round(Math.random()*1000)},
61                     {name: '松江区',value: Math.round(Math.random()*1000)},
62                     {name: '闵行区',value: Math.round(Math.random()*1000)},
63                     {name: '金山区',value: Math.round(Math.random()*1000)},
64                     {name: '奉贤区',value: Math.round(Math.random()*1000)},
65                     {name: '南汇区',value: Math.round(Math.random()*1000)}
66                 ]
67             }
68         ]
69     };
70     myChart.setOption(option);
71 
72 </script>
73 </html>
原文地址:https://www.cnblogs.com/hjt-7/p/5623652.html