areaLineUpdate.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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. <script src="lib/facePrint.js"></script>
  8. </head>
  9. <body>
  10. <style>
  11. html, body, .main {
  12. padding: 0;
  13. margin: 0;
  14. width: 100%;
  15. height: 300px;
  16. }
  17. .label {
  18. background: rgba(00, 200, 00, 0.4);
  19. padding: 10px;
  20. text-align: center;
  21. }
  22. </style>
  23. <div class="label">different category value | with ainmation | 3 times setOption</div>
  24. <div class="main" id="main0"></div>
  25. <div class="label">different category value | with ainmation | 3 times setOption | step</div>
  26. <div class="main" id="main1"></div>
  27. <div class="label">same category value | with ainmation | 2 times setOption</div>
  28. <div class="main" id="main2"></div>
  29. <!-- ==================== -->
  30. <!-- Test Case 1 -->
  31. <script>
  32. var option0 = {"tooltip":{"trigger":"axis","enterable":true,"padding":[10],"showDelay":100,"hideDelay":100,"z":0,"axisPointer":{"lineStyle":{"color":"#999"}},"textStyle":{"color":"#333"},"borderColor":"#ececec","borderWidth":1,"backgroundColor":"rgb(255,255,255)","extraCssText":"width: 200px;height: 80px;border-radius: 3px;z-index: 100;"},"grid":{"left":72,"right":77},"xAxis":{"type":"category","boundaryGap":false,"axisLine":{"show":true,"lineStyle":{"color":"#f2f2f2","width":1}},"z":0,"axisTick":false,"splitLine":{"show":false},"axisLabel":{"textStyle":{"color":"#ccc"}},"data":
  33. ["2016-07-23","2016-07-25","2016-07-26","2016-07-27","2016-07-28","2016-07-29","2016-07-30","2016-08-01","2016-08-02","2016-08-03","2016-08-05","2016-08-06","2016-08-08","2016-08-09","2016-08-10","2016-08-11","2016-08-12","2016-08-15","2016-08-16","2016-08-17","2016-08-18","2016-08-19","2016-08-20","2016-08-22"]
  34. },"yAxis":{"type":"value","z":0,"min":0,"max":100,"interval":20,"positon":"right","boundaryGap":false,"axisLine":{"show":true,"lineStyle":{"color":"#f2f2f2","width":1}},"axisTick":false,"splitLine":{"lineStyle":{"color":"#f2f2f2"}},"axisLabel":{"textStyle":{"color":"#ccc"}}},"dataZoom":[{"show":false},{"show":true,"z":0,"type":"slider","fillerColor":"rgba(230,230,230,.3)","dataBackground":{"areaStyle":{"color":"rgb(210,210,210)"}}}],"series":[{"type":"line","smooth":true,"symbol":"emptyCircle","itemStyle":{"normal":{"color":"rgb(255, 223, 190)"}},"z":0,"areaStyle":{"normal":{"color":"rgb(255, 242, 230)"}},"showAllSymbol":true,"data":
  35. ["69","65","65","64","63","69","66","67","66","66","63","62","68","66","65","70","70","71","70","58","66","68","67","62"]
  36. }]}
  37. var option1 = {"tooltip":{"trigger":"axis","enterable":true,"padding":[10],"showDelay":100,"hideDelay":100,"z":0,"axisPointer":{"lineStyle":{"color":"#999"}},"textStyle":{"color":"#333"},"borderColor":"#ececec","borderWidth":1,"backgroundColor":"rgb(255,255,255)","extraCssText":"width: 200px;height: 80px;border-radius: 3px;z-index: 100;"},"grid":{"left":72,"right":77},"xAxis":{"type":"category","boundaryGap":false,"axisLine":{"show":true,"lineStyle":{"color":"#f2f2f2","width":1}},"z":0,"axisTick":false,"splitLine":{"show":false},"axisLabel":{"textStyle":{"color":"#ccc"}},"data":
  38. ["2016-05-24","2016-05-25","2016-05-26","2016-05-27","2016-05-30","2016-06-01","2016-06-02","2016-06-03","2016-06-06","2016-06-13","2016-06-14","2016-06-15","2016-06-16","2016-06-17","2016-06-23","2016-06-24","2016-06-27","2016-06-28","2016-06-29","2016-06-30","2016-07-01","2016-07-04","2016-07-05","2016-07-06","2016-07-07","2016-07-11","2016-07-13","2016-07-14","2016-07-15","2016-07-18","2016-07-20","2016-07-21","2016-07-22","2016-07-23","2016-07-25","2016-07-26","2016-07-27","2016-07-28","2016-07-29","2016-07-30","2016-08-01","2016-08-02","2016-08-03","2016-08-05","2016-08-06","2016-08-08","2016-08-09","2016-08-10","2016-08-11","2016-08-12","2016-08-15","2016-08-16","2016-08-17","2016-08-18","2016-08-19","2016-08-20","2016-08-22"]
  39. },"yAxis":{"type":"value","z":0,"min":0,"max":100,"interval":20,"positon":"right","boundaryGap":false,"axisLine":{"show":true,"lineStyle":{"color":"#f2f2f2","width":1}},"axisTick":false,"splitLine":{"lineStyle":{"color":"#f2f2f2"}},"axisLabel":{"textStyle":{"color":"#ccc"}}},"dataZoom":[{"show":false},{"show":true,"z":0,"type":"slider","fillerColor":"rgba(230,230,230,.3)","dataBackground":{"areaStyle":{"color":"rgb(210,210,210)"}}}],"series":[{"type":"line","smooth":true,"symbol":"emptyCircle","itemStyle":{"normal":{"color":"rgb(255, 223, 190)"}},"z":0,"areaStyle":{"normal":{"color":"rgb(255, 242, 230)"}},"showAllSymbol":true,"data":
  40. ["66","66","61","59","59","57","61","63","61","65","65","65","66","70","60","62","66","66","66","70","64","66","68","69","71","67","69","71","68","69","68","69","67","69","65","65","64","63","69","66","67","66","66","63","62","68","66","65","70","70","71","70","58","66","68","67","62"]
  41. }]}
  42. var option2 = {"tooltip":{"trigger":"axis","enterable":true,"padding":[10],"showDelay":100,"hideDelay":100,"z":0,"axisPointer":{"lineStyle":{"color":"#999"}},"textStyle":{"color":"#333"},"borderColor":"#ececec","borderWidth":1,"backgroundColor":"rgb(255,255,255)","extraCssText":"width: 200px;height: 80px;border-radius: 3px;z-index: 100;"},"grid":{"left":72,"right":77},"xAxis":{"type":"category","boundaryGap":false,"axisLine":{"show":true,"lineStyle":{"color":"#f2f2f2","width":1}},"z":0,"axisTick":false,"splitLine":{"show":false},"axisLabel":{"textStyle":{"color":"#ccc"}},"data":
  43. ["2016-02-24","2016-02-25","2016-02-26","2016-02-29","2016-03-01","2016-03-02","2016-03-03","2016-03-04","2016-03-07","2016-03-08","2016-03-09","2016-03-10","2016-03-11","2016-03-15","2016-03-16","2016-03-17","2016-03-18","2016-03-21","2016-03-22","2016-03-23","2016-03-24","2016-03-25","2016-03-28","2016-03-29","2016-03-30","2016-03-31","2016-04-01","2016-04-06","2016-04-07","2016-04-08","2016-04-11","2016-04-12","2016-04-13","2016-04-14","2016-04-18","2016-04-20","2016-04-21","2016-04-22","2016-04-26","2016-04-27","2016-04-28","2016-05-05","2016-05-06","2016-05-09","2016-05-10","2016-05-12","2016-05-13","2016-05-16","2016-05-17","2016-05-19","2016-05-20","2016-05-24","2016-05-25","2016-05-26","2016-05-27","2016-05-30","2016-06-01","2016-06-02","2016-06-03","2016-06-06","2016-06-13","2016-06-14","2016-06-15","2016-06-16","2016-06-17","2016-06-23","2016-06-24","2016-06-27","2016-06-28","2016-06-29","2016-06-30","2016-07-01","2016-07-04","2016-07-05","2016-07-06","2016-07-07","2016-07-11","2016-07-13","2016-07-14","2016-07-15","2016-07-18","2016-07-20","2016-07-21","2016-07-22","2016-07-23","2016-07-25","2016-07-26","2016-07-27","2016-07-28","2016-07-29","2016-07-30","2016-08-01","2016-08-02","2016-08-03","2016-08-05","2016-08-06","2016-08-08","2016-08-09","2016-08-10","2016-08-11","2016-08-12","2016-08-15","2016-08-16","2016-08-17","2016-08-18","2016-08-19","2016-08-20","2016-08-22"]
  44. },"yAxis":{"type":"value","z":0,"min":0,"max":100,"interval":20,"positon":"right","boundaryGap":false,"axisLine":{"show":true,"lineStyle":{"color":"#f2f2f2","width":1}},"axisTick":false,"splitLine":{"lineStyle":{"color":"#f2f2f2"}},"axisLabel":{"textStyle":{"color":"#ccc"}}},"dataZoom":[{"show":false},{"show":true,"z":0,"type":"slider","fillerColor":"rgba(230,230,230,.3)","dataBackground":{"areaStyle":{"color":"rgb(210,210,210)"}}}],"series":[{"type":"line","smooth":true,"symbol":"emptyCircle","itemStyle":{"normal":{"color":"rgb(255, 223, 190)"}},"z":0,"areaStyle":{"normal":{"color":"rgb(255, 242, 230)"}},"showAllSymbol":true,"data":
  45. ["61","57","62","65","65","67","65","68","68","65","67","69","66","67","66","70","67","72","73","73","71","69","72","73","72","74","77","75","74","74","68","70","69","70","70","72","74","71","71","70","72","74","76","72","76","73","67","60","59","64","64","66","66","61","59","59","57","61","63","61","65","65","65","66","70","60","62","66","66","66","70","64","66","68","69","71","67","69","71","68","69","68","69","67","69","65","65","64","63","69","66","67","66","66","63","62","68","66","65","70","70","71","70","58","66","68","67","62"]
  46. }]}
  47. require([
  48. 'echarts',
  49. 'echarts/chart/line',
  50. 'echarts/component/legend',
  51. 'echarts/component/grid',
  52. 'echarts/component/tooltip',
  53. 'echarts/component/dataZoom'
  54. ], function (echarts) {
  55. var main = document.getElementById('main0');
  56. if (!main) {
  57. return;
  58. }
  59. var chart = echarts.init(main);
  60. chart.setOption(option0);
  61. setTimeout(() => {
  62. chart.setOption(option1);
  63. setTimeout(() => {
  64. chart.setOption(option2);
  65. }, 2000)
  66. }, 2000)
  67. })
  68. </script>
  69. <!-- ==================== -->
  70. <!-- Test Case 2 -->
  71. <script>
  72. require([
  73. 'echarts',
  74. 'echarts/chart/line',
  75. 'echarts/component/legend',
  76. 'echarts/component/grid',
  77. 'echarts/component/tooltip',
  78. 'echarts/component/dataZoom'
  79. ], function (echarts) {
  80. var main = document.getElementById('main1');
  81. if (!main) {
  82. return;
  83. }
  84. var chart = echarts.init(main);
  85. var option = {
  86. "grid": {
  87. "left": 72,
  88. "right": 77
  89. },
  90. "xAxis": {
  91. "type": "category",
  92. "data": ["2016-07-23","2016-08-22"]
  93. },
  94. "yAxis": {
  95. "type": "value"
  96. },
  97. "series": [
  98. {
  99. "type": "line",
  100. // step: true,
  101. "areaStyle": {
  102. "normal": {
  103. "color": "rgb(255, 242, 230)"
  104. }
  105. },
  106. step: true,
  107. stack: 'a',
  108. "showAllSymbol": true,
  109. "data": ["69","62"]
  110. },
  111. {
  112. "type": "line",
  113. step: true,
  114. "areaStyle": {
  115. "normal": {
  116. "color": "rgb(155, 242, 230)"
  117. }
  118. },
  119. stack: 'a',
  120. "showAllSymbol": true,
  121. "data": ["19","12"]
  122. }
  123. ]
  124. };
  125. var option1 = {
  126. xAxis: {data: ["2016-05-24","2016-07-23","2016-08-22"]},
  127. series: [{
  128. data: ["66","67","62"]
  129. }, {
  130. data: ["26","27","22"]
  131. }]
  132. };
  133. var option2 = {
  134. xAxis: {data: ["2016-02-24","2016-05-24","2016-07-23","2016-08-22"]},
  135. series: [
  136. {data: ["61","57","62","65"]},
  137. {data: ["31","37","32","35"]}
  138. ]
  139. };
  140. chart.setOption(option);
  141. setTimeout(function () {
  142. chart.setOption(option1);
  143. setTimeout(function () {
  144. chart.setOption(option2);
  145. }, 2000)
  146. }, 2000)
  147. });
  148. </script>
  149. <!-- ==================== -->
  150. <!-- Test Case 3 -->
  151. <script>
  152. require([
  153. 'echarts',
  154. 'echarts/chart/line',
  155. // 'echarts/component/legend',
  156. 'echarts/component/grid',
  157. 'echarts/component/tooltip',
  158. // 'zrender/vml/vml'
  159. ], function (echarts) {
  160. var main = document.getElementById('main2');
  161. if (!main) {
  162. return;
  163. }
  164. var chart = echarts.init(main);
  165. var xAxisData = [];
  166. var data1 = [];
  167. var data2 = [];
  168. var data3 = [];
  169. var data4 = [];
  170. xAxisData.push('类目' + -1);
  171. data1.push('-');
  172. data2.push('-');
  173. data3.push('-');
  174. data4.push('-');
  175. for (var i = 0; i < 5; i++) {
  176. xAxisData.push('类目' + i);
  177. data1.push((-Math.random() - 0.2).toFixed(3));
  178. data2.push((Math.random() + 0.3).toFixed(3));
  179. data3.push((Math.random() + 0.2).toFixed(3));
  180. data4.push((Math.random() + 0.2).toFixed(3));
  181. }
  182. xAxisData.push('类目' + i);
  183. data1.push('-');
  184. data2.push('-');
  185. data3.push('-');
  186. data4.push('-');
  187. for (; i < 10; i++) {
  188. xAxisData.push('类目' + i);
  189. data1.push((-Math.random() - 0.2).toFixed(3));
  190. data2.push((Math.random() + 0.3).toFixed(3));
  191. data3.push((Math.random() + 0.2).toFixed(3));
  192. data4.push((Math.random() + 0.2).toFixed(3));
  193. }
  194. xAxisData.push('类目' + i);
  195. data1.push('-');
  196. data2.push('-');
  197. data3.push('-');
  198. data4.push('-');
  199. var itemStyle = {
  200. normal: {
  201. // borderColor: 'white',
  202. // borderWidth: 3,
  203. // shadowBlur: 10,
  204. // shadowOffsetX: 0,
  205. // shadowOffsetY: 5,
  206. // shadowColor: 'rgba(0, 0, 0, 0.4)',
  207. lineStyle: {
  208. width: 2
  209. // shadowBlur: 10,
  210. // shadowOffsetX: 0,
  211. // shadowOffsetY: 5,
  212. // shadowColor: 'rgba(0, 0, 0, 0.4)'
  213. },
  214. areaStyle: {
  215. }
  216. }
  217. };
  218. chart.setOption({
  219. legend: {
  220. data: ['line', 'line2', 'line3']
  221. },
  222. tooltip: {
  223. trigger: 'axis',
  224. position: function (point) {
  225. return [point[0], '10%'];
  226. },
  227. axisPointer: {
  228. type: 'line'
  229. }
  230. },
  231. xAxis: {
  232. // data: ['类目1', '类目2', '类目3', '类目4', '类目5',]
  233. data: xAxisData,
  234. boundaryGap: false,
  235. // inverse: true,
  236. splitArea: {
  237. show: true
  238. }
  239. },
  240. yAxis: {
  241. },
  242. series: [{
  243. id: 'aaa',
  244. name: 'line33333',
  245. type: 'line',
  246. stack: 'all',
  247. symbolSize: 10,
  248. data: data3,
  249. itemStyle: itemStyle,
  250. label: {
  251. normal: {
  252. show: true
  253. }
  254. },
  255. connectNulls: true,
  256. smooth: true
  257. }]
  258. });
  259. setTimeout(function () {
  260. chart.setOption({
  261. series: [
  262. {
  263. id: 'aaa',
  264. name: 'xxxxxxxxxxxxxxxx',
  265. data: data4,
  266. }
  267. ]
  268. });
  269. }, 1000);
  270. })
  271. </script>
  272. </body>
  273. </html>