diff.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="esl.js"></script>
  5. <script src="config.js"></script>
  6. <meta name="viewport" content="user-scalable=no,width=device-width,height=device-height">
  7. </head>
  8. <body>
  9. <style>
  10. html, body, #main {
  11. width: 100%;
  12. height: 100%;
  13. margin: 0;
  14. }
  15. </style>
  16. <div id="main"></div>
  17. <script>
  18. require([
  19. 'echarts',
  20. 'echarts/chart/line',
  21. 'echarts/component/legend',
  22. 'echarts/component/grid',
  23. 'echarts/component/tooltip',
  24. 'echarts/component/toolbox',
  25. 'echarts/component/title',
  26. 'echarts/component/dataZoom'
  27. ], function (echarts) {
  28. chart = echarts.init(document.getElementById('main'), null, {
  29. renderer: 'canvas'
  30. });
  31. chart.setOption({
  32. toolbox: {
  33. show : true,
  34. feature : {
  35. dataZoom: {show: true},
  36. restore: {show: true}
  37. }
  38. },
  39. animationDurationUpdate: 4000,
  40. xAxis: [
  41. {
  42. type: 'category',
  43. data: ['a', 'b', 'c', 'd']
  44. }
  45. ],
  46. yAxis: [
  47. {
  48. type: 'value'
  49. }
  50. ],
  51. series: [
  52. {
  53. type:'line',
  54. data: [
  55. 200, 100, 500, 300
  56. ]
  57. }
  58. ]
  59. });
  60. })
  61. // setTimeout(function () {
  62. // chart.setOption({
  63. // xAxis: {
  64. // data: ['b', 'c', 'd', 'e']
  65. // },
  66. // series: [
  67. // {
  68. // data: [
  69. // 100, 500, 300, 900
  70. // ]
  71. // }
  72. // ]
  73. // })
  74. // }, 3000);
  75. setTimeout(function () {
  76. chart.setOption({
  77. xAxis: {
  78. data: ['a', 'd', 'c', 'b']
  79. },
  80. series: [
  81. {
  82. data: [
  83. 200, 300, 500, 100
  84. ]
  85. }
  86. ]
  87. })
  88. }, 3000);
  89. </script>
  90. </body>
  91. </html>