echart6.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. var myChart = echarts.init(document.querySelector(".data"));
  2. option = {
  3. color: ['green'],
  4. tooltip: {
  5. trigger: 'axis',
  6. axisPointer: {
  7. type: 'cross',
  8. crossStyle: {
  9. color: '#999'
  10. }
  11. }
  12. },
  13. legend: {
  14. data: ['蒸发量', '平均温度']
  15. },
  16. xAxis: [{
  17. type: 'category',
  18. color: "#fff",
  19. data: ['方案一', '方案二', '方案三', '方案四', '方案五', '方案六', '方案七', ],
  20. axisPointer: {
  21. type: 'shadow'
  22. },
  23. axisLine: {
  24. lineStyle: {
  25. color: "rgba(255,255,255,.2)"
  26. }
  27. },
  28. axisLabel: {
  29. textStyle: {
  30. color: "rgba(255,255,255,.6)", //改变字体颜色
  31. fontSize: 12
  32. },
  33. },
  34. }],
  35. yAxis: [{
  36. type: 'value',
  37. name: '次数',
  38. min: 0,
  39. max: 10,
  40. interval: 1,
  41. axisLine: {
  42. lineStyle: {
  43. color: "rgba(255,255,255,.2)"
  44. }
  45. },
  46. axisLabel: {
  47. textStyle: {
  48. color: "rgba(255,255,255,.6)",
  49. fontSize: 12
  50. },
  51. formatter: '{value}'
  52. }
  53. },
  54. {
  55. type: 'value',
  56. min: 0,
  57. max: 10,
  58. interval: 1,
  59. axisLine: {
  60. lineStyle: {
  61. color: "rgba(255,255,255,.2)"
  62. }
  63. },
  64. axisLabel: {
  65. textStyle: {
  66. color: "rgba(255,255,255,.6)",
  67. fontSize: 12
  68. },
  69. formatter: '{value}'
  70. }
  71. }
  72. ],
  73. series: [{
  74. type: 'bar',
  75. barWidth: 20,
  76. lineStyle: {
  77. color: "#0184d5",
  78. width: 2
  79. },
  80. data: [3, 5, 4, 2, 5.6, 6.7, 5.6, ]
  81. },
  82. {
  83. type: 'line',
  84. yAxisIndex: 1,
  85. data: [3, 5, 4, 2, 5.6, 6.7, 5.6, ]
  86. }
  87. ]
  88. };
  89. myChart.setOption(option);
  90. var hour, minute, second; //时 分 秒
  91. hour = minute = second = 0; //初始化
  92. var millisecond = 0; //毫秒
  93. var int;
  94. function Reset() //重置
  95. {
  96. window.clearInterval(int);
  97. millisecond = hour = minute = second = 0;
  98. document.getElementById('timetext').value = ' 00:00:00';
  99. }
  100. function start() //开始
  101. {
  102. int = setInterval(timer, 50);
  103. }
  104. function timer() //计时
  105. {
  106. millisecond = millisecond + 50;
  107. if (millisecond >= 1000) {
  108. millisecond = 0;
  109. second = second + 1;
  110. }
  111. if (second >= 60) {
  112. second = 0;
  113. minute = minute + 1;
  114. }
  115. if (minute >= 60) {
  116. minute = 0;
  117. hour = hour + 1;
  118. }
  119. document.getElementById('timetext').value = toDub(hour) + ':' + toDub(minute) + ':' + toDub(second);
  120. }
  121. timer();
  122. function stop() //暂停
  123. {
  124. window.clearInterval(int);
  125. }
  126. //补零
  127. function toDub(n) {
  128. return n < 10 ? "0" + n : "" + n;
  129. }
  130. $("#but").on("click", function() {
  131. top.location.href = "index.html"
  132. })
  133. var t = null;
  134. t = setTimeout(time, 1000); //开始运行
  135. function time() {
  136. clearTimeout(t); //清除定时器
  137. dt = new Date();
  138. var y = dt.getFullYear();
  139. var mt = dt.getMonth() + 1;
  140. var day = dt.getDate();
  141. var h = dt.getHours(); //获取时
  142. var m = dt.getMinutes(); //获取分
  143. var s = dt.getSeconds(); //获取秒
  144. document.querySelector(".show-time").innerHTML =
  145. "当前时间:" +
  146. y +
  147. "年" +
  148. mt +
  149. "月" +
  150. day +
  151. "日-" +
  152. h +
  153. "时" +
  154. m +
  155. "分" +
  156. s +
  157. "秒";
  158. t = setTimeout(time, 1000); //设定定时器,循环运行
  159. }