env.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. {%include '../inc/header.html'%}
  5. <link href="{{static_url('mobile/css/imgs.css')}}" rel="stylesheet">
  6. </head>
  7. <body>
  8. <section class="m-wrapper">
  9. {%include 'menu.html'%}
  10. </section>
  11. <section class="m-wrapper charts">
  12. {% for v in data['list'] %}
  13. <section class="img-wrap">
  14. <div class="box" id="main_{{v['id']}}" style="width: 100%;height:400px;"></div>
  15. <p>{{v['name']}}</p>
  16. </section>
  17. {% end %}
  18. </section>
  19. {%include '../inc/script.html'%}
  20. <script type="text/javascript" src="{{static_url('js/echarts.common.min.js')}}"></script>
  21. <script>
  22. {% for v in data['list'] %}
  23. var myChart = echarts.init(document.getElementById('main_{{v['id']}}'));
  24. var date = {% for key,value in enumerate(v['stat']) %}{% if key == 0 %}{% raw value['data']['time'] %}{% end %}{% end %};
  25. var series = [
  26. {% for key,value in enumerate(v['stat']) %}
  27. {% if key > 0 %},{% end %}
  28. {
  29. name:'{{value['name']}}',
  30. type:'line',
  31. data:{% raw value['data']['value'] %},
  32. markPoint: {
  33. data: [
  34. {type: 'max', name: '最大值'},
  35. {type: 'min', name: '最小值'}
  36. ]
  37. },
  38. markLine: {
  39. data: [
  40. {type: 'average', name: '平均值'}
  41. ]
  42. }
  43. }
  44. {% end %}
  45. ];
  46. // 指定图表的配置项和数据
  47. var option = {
  48. tooltip: {
  49. trigger: 'axis'
  50. },
  51. xAxis: {
  52. type: 'category',
  53. data: date
  54. },
  55. yAxis: {
  56. type: 'value',
  57. axisLabel: {
  58. formatter: '{value} {{v['type']['unit']}}'
  59. }
  60. },
  61. series: series
  62. };
  63. myChart.setOption(option, true);
  64. {% end %}
  65. </script>
  66. </body>
  67. </html>