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