EMiddleMap.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="container">
  3. <div id="EMiddleMap" style="height:100%;"></div>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. name: "EMiddleMap",
  9. data() {
  10. return {
  11. data: [40, 38.5, 48.2, 43.6, 42.8, 55.6, 44.6],
  12. };
  13. },
  14. mounted() {
  15. this.drawChart();
  16. },
  17. methods: {
  18. drawChart() {
  19. // 基于准备好的dom,初始化echarts实例
  20. let myChart = this.$echarts.init(
  21. document.getElementById("EMiddleMap")
  22. );
  23. // 指定图表的配置项和数据
  24. // let option =
  25. // {
  26. // tooltip: {},
  27. // visualMap: {
  28. // min: 200,
  29. // max: 1500,
  30. // left: "left",
  31. // top: "bottom",
  32. // text: ["High", "Low"],
  33. // seriesIndex: [1],
  34. // inRange: {
  35. // color: [
  36. // "#45DE92",
  37. // "#E0C740",
  38. // "#46DF3C",
  39. // "#4038E0",
  40. // "#4038E0",
  41. // ],
  42. // },
  43. // calculable: true,
  44. // },
  45. // geo: {
  46. // map: "湖州市",
  47. // type: "map3D",
  48. // roam: true,
  49. // label: {
  50. // normal: {
  51. // show: true,
  52. // textStyle: {
  53. // color: "#FF5A74",
  54. // fontSize: 25,
  55. // },
  56. // },
  57. // },
  58. // itemStyle: {
  59. // normal: {
  60. // borderColor: "rgba(0, 0, 0, 0.2)",
  61. // },
  62. // emphasis: {
  63. // areaColor: null,
  64. // shadowOffsetX: 0,
  65. // shadowOffsetY: 0,
  66. // shadowBlur: 20,
  67. // borderWidth: 0,
  68. // shadowColor: "rgba(0, 0, 0, 0.5)",
  69. // },
  70. // },
  71. // },
  72. // series: [
  73. // {
  74. // type: "scatter",
  75. // coordinateSystem: "geo",
  76. // symbolSize: 20,
  77. // symbol: "none",
  78. // symbolRotate: 35,
  79. // label: {
  80. // normal: {
  81. // formatter: "{b}",
  82. // position: "right",
  83. // show: false,
  84. // },
  85. // emphasis: {
  86. // show: true,
  87. // },
  88. // },
  89. // itemStyle: {
  90. // normal: {
  91. // color: "#F06C00",
  92. // },
  93. // },
  94. // },
  95. // {
  96. // name: "categoryA",·
  97. // type: "map",
  98. // geoIndex: 0,
  99. // // tooltip: {show: false},
  100. // data: [
  101. // // { name: "长兴县", value: "0" },
  102. // // { name: "安吉县", value: "111" },
  103. // // { name: "上海", value: "222" },
  104. // ],
  105. // },
  106. // ],
  107. // };
  108. let option = {
  109. tooltip: {
  110. formatter: function (params) {
  111. if (params.value) {
  112. return (
  113. params.name +
  114. "<br>" +
  115. params.value[0] +
  116. params.value[1]
  117. );
  118. }
  119. },
  120. textStyle: {
  121. fontSize: 25,
  122. color: "#fff",
  123. },
  124. },
  125. visualMap: {
  126. show: false,
  127. min: 0,
  128. max: 600,
  129. inRange: {
  130. color: ["#e0ffff", "#006edd"],
  131. },
  132. calculable: true,
  133. },
  134. // geo3D: {
  135. // itemStyle: {
  136. // borderColor: "#333",
  137. // borderWidth:2
  138. // }
  139. // },
  140. series: [
  141. {
  142. name: "湖州市",
  143. type: "map3D",
  144. map: "湖州市",
  145. data: [{ name: "长兴县", value: ["数量:", 422290] }],
  146. regionHeight: 4,
  147. boxWidth: 120,
  148. // top: "10%",
  149. // bottom: "10%",
  150. boxDepth: 100,
  151. regionHeight: 5,
  152. // environment: new this.$echarts.graphic.LinearGradient(
  153. // 0,
  154. // 0,
  155. // 0,
  156. // 1,
  157. // [
  158. // {
  159. // offset: 0,
  160. // color: "#547EE0",
  161. // },
  162. // {
  163. // offset: 0.5,
  164. // color: "#57AEE0",
  165. // },
  166. // {
  167. // offset: 0.7,
  168. // color: "#162661",
  169. // },
  170. // {
  171. // offset: 1,
  172. // color: "#162661",
  173. // },
  174. // ],
  175. // false
  176. // ),
  177. label: {
  178. show: true,
  179. formatter: function (params) {
  180. var content = "",
  181. content = params.name;
  182. return content;
  183. },
  184. textStyle: {
  185. color: "#FFFFFF",
  186. fontWeight: "normal",
  187. fontSize: 25,
  188. backgroundColor: "rgba(0, 0, 0, 0)",
  189. },
  190. emphasis: {
  191. //鼠标悬浮效果
  192. show: true,
  193. textStyle: { color: "#f00" },
  194. },
  195. },
  196. itemStyle: {
  197. // normal: { borWidth: 15 },
  198. emphasis: {
  199. color: "#F5D747",
  200. color: "#54FAF0",
  201. // borderType: "solid",
  202. // borderColor: "#f00",
  203. // borderWidth: 10,
  204. areaColor: '#f00',
  205. shadowOffsetX: 50,
  206. shadowOffsetY: 0,
  207. // shadowBlur: 20,
  208. // borderWidth: 0,
  209. // shadowColor: "rgba(0, 0, 0, 0.5)",
  210. }, //地图板块鼠标悬浮颜色
  211. color: "#04438C",
  212. opacity: 1,
  213. borderWidth: 5,
  214. borderColor: "#0393C0",
  215. },
  216. viewControl: {
  217. autoRotate: false, // 自动旋转
  218. // distance: 115,
  219. distance: 140,
  220. },
  221. },
  222. ],
  223. };
  224. // 使用刚指定的配置项和数据显示图表。
  225. myChart.setOption(option);
  226. },
  227. },
  228. };
  229. </script>
  230. <style lang="scss" scoped>
  231. </style>