logScale.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <html>
  2. <head>
  3. <meta charset='utf-8'>
  4. <script src='esl.js'></script>
  5. <script src='config.js'></script>
  6. </head>
  7. <body>
  8. <style>
  9. html, body, #main {
  10. width: 100%;
  11. height: 100%;
  12. }
  13. </style>
  14. <div id='main'></div>
  15. <script>
  16. require([
  17. 'echarts',
  18. 'echarts/chart/line',
  19. 'echarts/component/legend',
  20. 'echarts/component/grid',
  21. 'echarts/component/tooltip',
  22. 'echarts/component/title',
  23. 'echarts/component/dataZoom',
  24. 'echarts/scale/Log'
  25. ], function (echarts) {
  26. var chart = echarts.init(document.getElementById('main'));
  27. chart.setOption({
  28. title: {
  29. text: '对数轴示例',
  30. x: 'center'
  31. },
  32. tooltip: {
  33. trigger: 'item',
  34. formatter: '{a} <br/>{b} : {c}'
  35. },
  36. legend: {
  37. left: 'left',
  38. data: ['2的指数', '3的指数']
  39. },
  40. xAxis: [{
  41. type: 'category',
  42. name: 'x',
  43. splitLine: {show: false},
  44. data: ['一', '二', '三', '四', '五', '六', '七', '八', '九']
  45. }],
  46. yAxis: [{
  47. type: 'log',
  48. name: 'y'
  49. }],
  50. series: [
  51. {
  52. name: '3的指数',
  53. type: 'line',
  54. data: [1, 3, 9, 27, 81, 247, 741, 2223, 6669]
  55. },
  56. {
  57. name: '2的指数',
  58. type: 'line',
  59. data: [1, 2, 4, 8, 16, 32, 64, 128, 256]
  60. },
  61. {
  62. name: '0.1 的指数',
  63. type: 'line',
  64. data: [1, 0.1, 0.01, 1e-3, 1e-4, 1e-5, 1e-6, 1e-7, 1e-8]
  65. }]
  66. });
  67. });
  68. </script>
  69. </body>
  70. </html>