map6.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="ECharts">
  8. <meta name="author" content="kener.linfeng@gmail.com">
  9. <title>ECharts · Example</title>
  10. <link rel="shortcut icon" href="../asset/ico/favicon.png">
  11. <link href="../asset/css/font-awesome.min.css" rel="stylesheet">
  12. <link href="../asset/css/bootstrap.css" rel="stylesheet">
  13. <link href="../asset/css/carousel.css" rel="stylesheet">
  14. <link href="../asset/css/echartsHome.css" rel="stylesheet">
  15. <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
  16. <!--[if lt IE 9]>
  17. <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
  18. <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  19. <![endif]-->
  20. <script src="./www/js/echarts.js"></script>
  21. <script src="../asset/js/codemirror.js"></script>
  22. <script src="../asset/js/javascript.js"></script>
  23. <link href="../asset/css/codemirror.css" rel="stylesheet">
  24. <link href="../asset/css/monokai.css" rel="stylesheet">
  25. <style type="text/css">
  26. .CodeMirror {
  27. height: 550px;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <!-- Fixed navbar -->
  33. <div class="navbar navbar-default navbar-fixed-top" role="navigation" id="head"></div>
  34. <div class="container-fluid">
  35. <div class="row-fluid example">
  36. <div id="sidebar-code" class="col-md-4">
  37. <div class="well sidebar-nav">
  38. <div class="nav-header"><a href="#" onclick="autoResize()" class="glyphicon glyphicon-resize-full" id ="icon-resize" ></a>option</div>
  39. <textarea id="code" name="code">
  40. // 自定义扩展图表类型:mapType = HK
  41. require('echarts/util/mapData/params').params.HK = {
  42. getGeoJson: function (callback) {
  43. $.getJSON('geoJson/HK_geo.json',callback);
  44. }
  45. }
  46. option = {
  47. title : {
  48. text : '香港18区人口密度 (2011)',
  49. subtext: '人口密度数据来自Wikipedia',
  50. sublink: 'http://zh.wikipedia.org/wiki/%E9%A6%99%E6%B8%AF%E8%A1%8C%E6%94%BF%E5%8D%80%E5%8A%83#cite_note-12'
  51. },
  52. tooltip : {
  53. trigger: 'item',
  54. formatter: '{b}<br/>{c} (p / km2)'
  55. },
  56. toolbox: {
  57. show : true,
  58. orient : 'vertical',
  59. x: 'right',
  60. y: 'center',
  61. feature : {
  62. mark : {show: true},
  63. dataView : {show: true, readOnly: false},
  64. restore : {show: true},
  65. saveAsImage : {show: true}
  66. }
  67. },
  68. dataRange: {
  69. min: 800,
  70. max: 50000,
  71. text:['High','Low'],
  72. realtime: false,
  73. calculable : true,
  74. color: ['orangered','yellow','lightskyblue']
  75. },
  76. series : [
  77. {
  78. name: '香港18区人口密度',
  79. type: 'map',
  80. mapType: 'HK', // 自定义扩展图表类型
  81. itemStyle:{
  82. normal:{label:{show:true}},
  83. emphasis:{label:{show:true}}
  84. },
  85. data:[
  86. {name: '中西区', value: 20057.34},
  87. {name: '湾仔', value: 15477.48},
  88. {name: '东区', value: 31686.1},
  89. {name: '南区', value: 6992.6},
  90. {name: '油尖旺', value: 44045.49},
  91. {name: '深水埗', value: 40689.64},
  92. {name: '九龙城', value: 37659.78},
  93. {name: '黄大仙', value: 45180.97},
  94. {name: '观塘', value: 55204.26},
  95. {name: '葵青', value: 21900.9},
  96. {name: '荃湾', value: 4918.26},
  97. {name: '屯门', value: 5881.84},
  98. {name: '元朗', value: 4178.01},
  99. {name: '北区', value: 2227.92},
  100. {name: '大埔', value: 2180.98},
  101. {name: '沙田', value: 9172.94},
  102. {name: '西贡', value: 3368},
  103. {name: '离岛', value: 806.98}
  104. ],
  105. // 自定义名称映射
  106. nameMap: {
  107. 'Central and Western':'中西区',
  108. 'Eastern':'东区',
  109. 'Islands':'离岛',
  110. 'Kowloon City':'九龙城',
  111. 'Kwai Tsing':'葵青',
  112. 'Kwun Tong':'观塘',
  113. 'North':'北区',
  114. 'Sai Kung':'西贡',
  115. 'Sha Tin':'沙田',
  116. 'Sham Shui Po':'深水埗',
  117. 'Southern':'南区',
  118. 'Tai Po':'大埔',
  119. 'Tsuen Wan':'荃湾',
  120. 'Tuen Mun':'屯门',
  121. 'Wan Chai':'湾仔',
  122. 'Wong Tai Sin':'黄大仙',
  123. 'Yau Tsim Mong':'油尖旺',
  124. 'Yuen Long':'元朗'
  125. },
  126. // 文本位置修正
  127. textFixed : {
  128. 'Yau Tsim Mong' : [-10, 0]
  129. },
  130. // 文本直接经纬度定位
  131. geoCoord : {
  132. 'Islands' : [113.95, 22.26]
  133. }
  134. }
  135. ]
  136. };
  137. </textarea>
  138. </div><!--/.well -->
  139. </div><!--/span-->
  140. <div id="graphic" class="col-md-8">
  141. <div id="main" class="main" style="height: 530px;"></div>
  142. <div>
  143. <button type="button" class="btn btn-sm btn-success" onclick="refresh(true)">刷 新</button>
  144. <span class="text-primary">切换主题</span>
  145. <select id="theme-select"></select>
  146. <span id='wrong-message' style="color:red"></span>
  147. </div>
  148. </div><!--/span-->
  149. </div><!--/row-->
  150. </div><!--/.fluid-container-->
  151. <footer id="footer"></footer>
  152. <!-- Le javascript
  153. ================================================== -->
  154. <!-- Placed at the end of the document so the pages load faster -->
  155. <script src="../asset/js/jquery.min.js"></script>
  156. <script type="text/javascript" src="../asset/js/echartsHome.js"></script>
  157. <script src="../asset/js/bootstrap.min.js"></script>
  158. <script src="../asset/js/echartsExample.js"></script>
  159. </body>
  160. </html>