diff.html 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <html>
  2. <head>
  3. <meta charset="utf-8">
  4. <script src="lib/esl.js"></script>
  5. <script src="lib/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. });
  30. chart.setOption({
  31. toolbox: {
  32. show : true,
  33. feature : {
  34. dataZoom: {show: true},
  35. restore: {show: true}
  36. }
  37. },
  38. animationDurationUpdate: 4000,
  39. xAxis: [
  40. {
  41. type: 'category',
  42. data: ['a', 'b', 'c', 'd']
  43. }
  44. ],
  45. yAxis: [
  46. {
  47. type: 'value'
  48. }
  49. ],
  50. series: [
  51. {
  52. type:'line',
  53. data: [
  54. 200, 100, 500, 300
  55. ]
  56. }
  57. ]
  58. });
  59. })
  60. // setTimeout(function () {
  61. // chart.setOption({
  62. // xAxis: {
  63. // data: ['b', 'c', 'd', 'e']
  64. // },
  65. // series: [
  66. // {
  67. // data: [
  68. // 100, 500, 300, 900
  69. // ]
  70. // }
  71. // ]
  72. // })
  73. // }, 3000);
  74. setTimeout(function () {
  75. chart.setOption({
  76. xAxis: {
  77. data: ['a', 'd', 'c', 'b']
  78. },
  79. series: [
  80. {
  81. data: [
  82. 200, 300, 500, 100
  83. ]
  84. }
  85. ]
  86. })
  87. }, 3000);
  88. </script>
  89. </body>
  90. </html>