thumb.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE html>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <html lang="en">
  19. <head>
  20. <meta charset="UTF-8">
  21. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  22. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  23. <script src="../../dist/echarts.js"></script>
  24. <script src="../../map/js/china.js"></script>
  25. </head>
  26. <body>
  27. <style>
  28. body {
  29. margin: 0;
  30. }
  31. </style>
  32. <div id="main"></div>
  33. <script type="module">
  34. import bar from './option/bar';
  35. import area from './option/area';
  36. import scatter from './option/scatter';
  37. import pie from './option/pie';
  38. import graph from './option/graph';
  39. import map from './option/map';
  40. let options = [bar, area, scatter, pie, graph, map];
  41. let mainDiv = document.querySelector('#main');
  42. let theme = window.location.hash.slice(1);
  43. let scriptTag = document.createElement('script');
  44. scriptTag.src = '../' + theme + '.js';
  45. scriptTag.onload = function () {
  46. options.forEach(option => {
  47. let div = document.createElement('div');
  48. mainDiv.appendChild(div);
  49. div.style.cssText = 'float:left;width:50%;height:400px';
  50. let chart = echarts.init(div, theme);
  51. option.animation = false;
  52. chart.setOption(option);
  53. });
  54. }
  55. document.body.appendChild(scriptTag);
  56. </script>
  57. </body>
  58. </html>