mobileBench.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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="width=device-width, initial-scale=1" />
  7. </head>
  8. <body>
  9. <style>
  10. html, body {
  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/bar',
  21. 'echarts/component/legend',
  22. 'echarts/component/grid',
  23. 'echarts/component/tooltip'
  24. ], function (echarts) {
  25. var itemStyle = {
  26. normal: {
  27. label: {
  28. show: false,
  29. position: 'outside'
  30. }
  31. },
  32. emphasis: {
  33. shadowBlur: 10,
  34. shadowOffsetX: 0,
  35. shadowOffsetY: 0,
  36. shadowColor: 'rgba(0,0,0,0.5)'
  37. }
  38. };
  39. console.profile('setOption');
  40. var main = document.getElementById('main');
  41. for (var i = 0; i < 100; i++) {
  42. var div = document.createElement('div');
  43. div.style.cssText = 'width: 400px; height:200px;';
  44. main.appendChild(div);
  45. var chart = echarts.init(div, null, {
  46. renderer: 'canvas'
  47. });
  48. var xAxisData = [];
  49. var data1 = [];
  50. var data2 = [];
  51. var data3 = [];
  52. var data4 = [];
  53. for (var j = 0; j < 10; j++) {
  54. xAxisData.push('类目' + j);
  55. data1.push((Math.random() * 5).toFixed(2));
  56. data2.push(-Math.random().toFixed(2));
  57. data3.push((Math.random() + 0.5).toFixed(2));
  58. data4.push((Math.random() + 0.3).toFixed(2));
  59. }
  60. chart.setOption({
  61. animation: false,
  62. // legend: {
  63. // data: [{
  64. // name: 'bar'
  65. // }, 'bar2', 'bar3', 'bar4'],
  66. // selected: {
  67. // // 'bar': false
  68. // },
  69. // orient: 'vertical',
  70. // x: 'right',
  71. // y: 'bottom',
  72. // align: 'right'
  73. // },
  74. tooltip: {},
  75. xAxis: {
  76. data: xAxisData,
  77. axisLine: {
  78. onZero: true
  79. },
  80. splitLine: {
  81. show: false
  82. },
  83. splitArea: {
  84. show: false
  85. }
  86. },
  87. yAxis: {
  88. inverse: true,
  89. splitArea: {
  90. show: false
  91. }
  92. },
  93. series: [{
  94. name: 'bar',
  95. type: 'bar',
  96. stack: 'one',
  97. itemStyle: itemStyle,
  98. data: data1
  99. }, {
  100. name: 'bar2',
  101. type: 'bar',
  102. stack: 'one',
  103. itemStyle: itemStyle,
  104. data: data2
  105. }, {
  106. name: 'bar3',
  107. type: 'bar',
  108. stack: 'two',
  109. itemStyle: itemStyle,
  110. data: data3
  111. }, {
  112. name: 'bar4',
  113. type: 'bar',
  114. stack: 'two',
  115. itemStyle: itemStyle,
  116. data: data4
  117. }]
  118. });
  119. }
  120. console.profileEnd('setOption');
  121. })
  122. </script>
  123. </body>
  124. </html>