visualMap-pieces.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <!DOCTYPE>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1" />
  6. <script src="lib/esl.js"></script>
  7. <script src="lib/config.js"></script>
  8. <script src="lib/jquery.min.js"></script>
  9. <script src="lib/facePrint.js"></script>
  10. <script src="lib/testHelper.js"></script>
  11. <link rel="stylesheet" href="lib/reset.css">
  12. </head>
  13. <body>
  14. <style>
  15. h1 {
  16. line-height: 60px;
  17. height: 60px;
  18. background: #a60;
  19. text-align: center;
  20. font-weight: bold;
  21. color: #eee;
  22. font-size: 14px;
  23. }
  24. .chart {
  25. height: 500px;
  26. }
  27. </style>
  28. <h1>map</h1>
  29. <div class="chart" id="map"></div>
  30. <h1>line symbol (check toggle normally)</h1>
  31. <div class="chart" id="line-symbol"></div>
  32. <script>
  33. require([
  34. 'echarts',
  35. // 'echarts/chart/map',
  36. // 'echarts/component/legend',
  37. // 'echarts/component/grid',
  38. // 'echarts/component/visualMap',
  39. // 'echarts/component/tooltip',
  40. 'map/js/china'
  41. ], function (echarts) {
  42. var option = {
  43. title : {
  44. text: '订单量',
  45. subtext: '纯属虚构',
  46. x:'center'
  47. },
  48. tooltip : {
  49. trigger: 'item'
  50. },
  51. legend: {
  52. orient: 'vertical',
  53. x:'left',
  54. data:['订单量']
  55. },
  56. visualMap: {
  57. // selectedMode: 'single',
  58. text: ['Map Result'],
  59. showLabel: true,
  60. right: 20,
  61. pieces: [
  62. {min: 1500},
  63. {min: 900, max: 1500},
  64. {min: 310, max: 1000},
  65. {min: 200, max: 400},
  66. {min: 10, max: 200, label: '10 到 200(自定义label)'},
  67. {value: 123, label: '123(自定义特殊颜色)', color: 'grey'},
  68. {min: 5, max: 5, label: '5(自定义特殊颜色)', color: 'black'},
  69. {max: 5}
  70. ],
  71. color: ['#E0022B', '#E09107', '#A3E00B']
  72. },
  73. toolbox: {
  74. show: true,
  75. orient : 'vertical',
  76. x: 'right',
  77. y: 'center',
  78. feature : {
  79. mark : {show: true},
  80. dataView : {show: true, readOnly: false},
  81. restore : {show: true},
  82. saveAsImage : {show: true}
  83. }
  84. },
  85. roamController: {
  86. show: true,
  87. x: 'right',
  88. mapTypeControl: {
  89. 'china': true
  90. }
  91. },
  92. series : [
  93. {
  94. name: '订单量',
  95. type: 'map',
  96. mapType: 'china',
  97. roam: false,
  98. itemStyle:{
  99. normal:{
  100. label:{
  101. show:true,
  102. // textStyle: {
  103. // color: "red"
  104. // }
  105. }
  106. },
  107. emphasis:{label:{show:true}}
  108. },
  109. data:[
  110. {name: '北京',value: 5},
  111. {name: '天津',value: Math.round(Math.random()*2000)},
  112. {name: '上海',value: Math.round(Math.random()*2000)},
  113. {name: '重庆',value: Math.round(Math.random()*2000)},
  114. {name: '河北',value: 0},
  115. {name: '河南',value: Math.round(Math.random()*2000)},
  116. {name: '云南',value: 123},
  117. {name: '辽宁',value: 305},
  118. {name: '黑龙江',value: Math.round(Math.random()*2000), visualMap: false},
  119. {name: '湖南',value: 200},
  120. {name: '安徽',value: Math.round(Math.random()*2000)},
  121. {name: '山东',value: Math.round(Math.random()*2000)},
  122. {name: '新疆',value: Math.round(Math.random()*2000)},
  123. {name: '江苏',value: Math.round(Math.random()*2000)},
  124. {name: '浙江',value: Math.round(Math.random()*2000)},
  125. {name: '江西',value: Math.round(Math.random()*2000)},
  126. {name: '湖北',value: Math.round(Math.random()*2000)},
  127. {name: '广西',value: Math.round(Math.random()*2000)},
  128. {name: '甘肃',value: Math.round(Math.random()*2000)},
  129. {name: '山西',value: Math.round(Math.random()*2000)},
  130. {name: '内蒙古',value: Math.round(Math.random()*2000)},
  131. {name: '陕西',value: Math.round(Math.random()*2000)},
  132. {name: '吉林',value: Math.round(Math.random()*2000)},
  133. {name: '福建',value: Math.round(Math.random()*2000)},
  134. {name: '贵州',value: Math.round(Math.random()*2000)},
  135. {name: '广东',value: Math.round(Math.random()*2000)},
  136. {name: '青海',value: Math.round(Math.random()*2000)},
  137. {name: '西藏',value: Math.round(Math.random()*2000)},
  138. {name: '四川',value: Math.round(Math.random()*2000)},
  139. {name: '宁夏',value: Math.round(Math.random()*2000)},
  140. {name: '海南',value: Math.round(Math.random()*2000)},
  141. {name: '台湾',value: Math.round(Math.random()*2000)},
  142. {name: '香港',value: Math.round(Math.random()*2000)},
  143. {name: '澳门',value: Math.round(Math.random()*2000)}
  144. ]
  145. }
  146. ]
  147. };
  148. testHelper.createChart(echarts, 'map', option);
  149. })
  150. </script>
  151. <script>
  152. var echarts;
  153. var colorTool;
  154. var chart;
  155. var myChart;
  156. var groupCategories = [];
  157. var groupColors = [];
  158. require([
  159. 'echarts'
  160. // 'echarts/chart/line',
  161. // 'echarts/chart/parallel',
  162. // 'echarts/component/grid',
  163. // 'echarts/component/legend',
  164. // 'echarts/component/tooltip',
  165. // 'echarts/component/toolbox',
  166. // 'echarts/component/visualMap'
  167. ], function (echarts) {
  168. var option = {
  169. title: {
  170. text: '未来一周气温变化',
  171. subtext: '纯属虚构'
  172. },
  173. tooltip: {
  174. trigger: 'axis'
  175. },
  176. legend: {
  177. data:['最高气温','最低气温']
  178. },
  179. toolbox: {
  180. show: true,
  181. feature: {
  182. dataZoom: {
  183. yAxisIndex: 'none'
  184. },
  185. dataView: {readOnly: false},
  186. magicType: {type: ['line', 'bar']},
  187. restore: {},
  188. saveAsImage: {}
  189. }
  190. },
  191. visualMap: {
  192. type: 'piecewise',
  193. orient: 'horizontal',
  194. left: 'center',
  195. pieces: [
  196. {gt: 10, lte: 15, label: 'weixian', symbol: 'emptyCircle', color: 'red'},
  197. {gt: 5, lte: 10, label: 'weixian', symbol: 'emptyCircle', color: 'green'}
  198. ],
  199. outOfRange: {
  200. color: '#ccc',
  201. symbol: 'emptyCircle'
  202. }
  203. },
  204. xAxis: {
  205. type: 'category',
  206. boundaryGap: false,
  207. data: ['周一','周二','周三','周四','周五','周六','周日']
  208. },
  209. yAxis: {
  210. type: 'value',
  211. axisLabel: {
  212. formatter: '{value} °C'
  213. }
  214. },
  215. series: [
  216. {
  217. name:'最高气温',
  218. type:'line',
  219. data:[11, 11, 15, 13, 12, 13, 10]
  220. }
  221. ]
  222. };
  223. testHelper.createChart(echarts, 'line-symbol', option);
  224. });
  225. </script>
  226. </body>
  227. </html>