dataZoomHighPrecision.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <meta name="viewport" content="width=device-width, initial-scale=1" />
  5. <script src="esl.js"></script>
  6. <script src="config.js"></script>
  7. <link ref="stylesheet" href="reset.css" />
  8. </head>
  9. <body>
  10. <style>
  11. .split {
  12. line-height: 60px;
  13. height: 60px;
  14. background: #ddd;
  15. text-align: center;
  16. font-weight: bold;
  17. font-size: 20px;
  18. }
  19. .main {
  20. height: 80%;
  21. }
  22. </style>
  23. <div id="info"></div>
  24. <div id="main"></div>
  25. <div class="split">Check toolbox dataZoom normal</div>
  26. <div id="main1" class="main"></div>
  27. <div class="split">y max min should not be excluded, dataZoom label should be accurately right</div>
  28. <div id="main2" class="main"></div>
  29. <div class="split">y max min should not be excluded, dataZoom label should be accurately right</div>
  30. <div id="main3" class="main"></div>
  31. <script>
  32. require([
  33. 'echarts',
  34. 'echarts/chart/line',
  35. 'echarts/component/legend',
  36. 'echarts/component/grid',
  37. 'echarts/component/tooltip',
  38. 'echarts/component/dataZoomInside',
  39. 'echarts/component/toolbox'
  40. ], function (echarts) {
  41. var main = document.getElementById('main1');
  42. if (!main) {
  43. return;
  44. }
  45. var chart = echarts.init(main);
  46. chart.setOption({
  47. "title": {
  48. "text": ""
  49. },
  50. "tooltip": {
  51. "trigger": "axis"
  52. },
  53. "legend": {
  54. "data": [
  55. "PV维度订阅转化率"
  56. ]
  57. },
  58. "toolbox": {
  59. "show": true,
  60. "feature": {
  61. "dataZoom": {},
  62. "dataView": {
  63. "readOnly": true
  64. },
  65. "restore": {},
  66. "saveAsImage": {}
  67. }
  68. },
  69. "calculable": true,
  70. "xAxis": [
  71. {
  72. "type": "category",
  73. "boundaryGap": false,
  74. "data": [
  75. "20160401",
  76. "20160402",
  77. "20160403",
  78. "20160404",
  79. "20160405",
  80. "20160406",
  81. "20160407",
  82. "20160408",
  83. "20160409",
  84. "20160410"
  85. ]
  86. }
  87. ],
  88. "yAxis": [
  89. {
  90. "type": "value",
  91. "axisLabel": {
  92. "formatter": "{value}%"
  93. }
  94. }
  95. ],
  96. "series": [
  97. {
  98. "type": "line",
  99. "name": "PV维度订阅转化率",
  100. "data": [
  101. 46.646153846153844,
  102. 48.75454799888049,
  103. 49.122247047558254,
  104. 47.80918727915194,
  105. 50.140845070422536,
  106. 51.89201877934272,
  107. 52.307692307692314,
  108. 48.93327280980481,
  109. 46.012832263978005,
  110. 42.89077212806026
  111. ]
  112. }
  113. ]
  114. });
  115. });
  116. </script>
  117. <script>
  118. require([
  119. 'echarts',
  120. 'echarts/chart/line',
  121. 'echarts/chart/bar',
  122. 'echarts/component/legend',
  123. 'echarts/component/grid',
  124. 'echarts/component/tooltip',
  125. 'echarts/component/dataZoom'
  126. ], function (echarts) {
  127. var main = document.getElementById('main2');
  128. if (!main) {
  129. return;
  130. }
  131. var chart = echarts.init(main);
  132. var option = {
  133. "title": {
  134. "text": "1个月数据",
  135. "left": "center"
  136. },
  137. "tooltip": {
  138. "trigger": "axis"
  139. },
  140. "dataZoom": [
  141. {
  142. "show": true,
  143. "yAxisIndex": 0,
  144. "filterMode": "empty",
  145. "width": 12,
  146. "handleSize": 8,
  147. labelPrecision: 7,
  148. "showDataShadow": false,
  149. "right": 42
  150. }
  151. ],
  152. "legend": [
  153. {
  154. "data": [
  155. "重量"
  156. ],
  157. "top": 36,
  158. "left": "center"
  159. }
  160. ],
  161. "grid": [
  162. {
  163. "left": 80,
  164. "top": 90,
  165. "right": 58,
  166. "height": 350
  167. }
  168. ],
  169. "xAxis": [
  170. {
  171. "boundaryGap": false,
  172. "data": [
  173. "2016-02-17",
  174. "2016-02-18",
  175. "2016-02-19",
  176. "2016-02-20",
  177. "2016-02-21",
  178. "2016-02-22",
  179. "2016-02-23",
  180. "2016-02-24",
  181. "2016-02-25",
  182. "2016-02-26",
  183. "2016-02-27",
  184. "2016-02-28",
  185. "2016-02-29",
  186. "2016-03-01",
  187. "2016-03-02",
  188. "2016-03-03",
  189. "2016-03-04"
  190. ]
  191. }
  192. ],
  193. "yAxis": [
  194. {
  195. "name": "重量(g)"
  196. }
  197. ],
  198. "series": [
  199. {
  200. "type": "line",
  201. "data": [
  202. "241.68",
  203. "12703.10",
  204. "17724.90",
  205. "17722.60",
  206. "12326.70",
  207. "12703.10",
  208. "17724.90",
  209. // "17755.13984",
  210. "17722.60",
  211. "12326.70",
  212. "-290.01",
  213. "-12736.80",
  214. "-12361.40",
  215. "-0.00",
  216. "-290.01",
  217. "-12736.80",
  218. "-8525.49",
  219. "-15918.30"
  220. ],
  221. "name": "重量"
  222. }
  223. ]
  224. };
  225. chart.setOption(option);
  226. });
  227. </script>
  228. <script>
  229. require([
  230. 'echarts',
  231. 'echarts/chart/line',
  232. 'echarts/chart/bar',
  233. 'echarts/component/legend',
  234. 'echarts/component/grid',
  235. 'echarts/component/tooltip',
  236. 'echarts/component/dataZoom'
  237. ], function (echarts) {
  238. var main = document.getElementById('main3');
  239. if (!main) {
  240. return;
  241. }
  242. var chart = echarts.init(main);
  243. option = {
  244. "title": {
  245. "text": "1个月温度",
  246. "left": "center"
  247. },
  248. "tooltip": {
  249. "trigger": "axis"
  250. },
  251. "dataZoom": [
  252. {
  253. "show": true,
  254. "yAxisIndex": 0,
  255. //endValue:83.57,
  256. "filterMode": "empty",
  257. labelPrecision: 4,
  258. "showDataShadow": false
  259. }
  260. ],
  261. "legend": [
  262. {
  263. "data": [
  264. "温度"
  265. ],
  266. "top": 31,
  267. "left": "center"
  268. }
  269. ],
  270. "grid": {},
  271. "xAxis": [
  272. {
  273. "data": [
  274. "2015-12-08",
  275. "2015-12-09",
  276. "2015-12-10",
  277. "2015-12-11",
  278. "2015-12-12"
  279. ]
  280. }
  281. ],
  282. "yAxis": [
  283. {
  284. "name": "温度(℃)"
  285. }
  286. ],
  287. "series": [
  288. {
  289. "type": "line",
  290. "data": [
  291. "83.56",
  292. "83.39",
  293. "55.10",
  294. "-5.47",
  295. "-62.83"
  296. ],
  297. "name": "温度"
  298. }
  299. ]
  300. };
  301. chart.setOption(option);
  302. });
  303. </script>
  304. </body>
  305. </html>