SoilMoisture.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div style="display: inline-block;float:left ;height: 190rem;width: 350rem;">
  3. <jt-echarts style="width: 100%;height: 100%;margin-top:20rem" :chartData="option"></jt-echarts>
  4. </div>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. option: {}
  11. }
  12. },
  13. created() {},
  14. mounted() {
  15. this.typeCharts()
  16. let _this = this
  17. var t1=setTimeout(function() {
  18. _this.option.series = [{
  19. data: [200, 600, 219, 264, 500, 340, 250]
  20. },
  21. {
  22. data: [320, 400, 201, 334, 190, 350, 220]
  23. },
  24. {
  25. data: [120, 400, 350, 500, 220, 340, 310]
  26. },
  27. {
  28. data: [220, 402, 231, 134, 190, 230, 120]
  29. },
  30. {
  31. data: [220, 302, 181, 234, 210, 290, 150]
  32. },
  33. ]
  34. }, 1000);
  35. },
  36. methods: {
  37. typeCharts() {
  38. this.option = this.getOption();
  39. // var chartDom = document.getElementById('echarts');
  40. // var myChart = echarts.init(chartDom);
  41. // myChart.setOption(option, true);
  42. },
  43. getOption(data) {
  44. let option = {
  45. color: ['#39e07f', '#1581ff', '#2ed0e7', '#ff9a9a', '#ffad31'],
  46. /* title: {
  47. text: 'Gradient Stacked Area Chart'
  48. }, */
  49. tooltip: {
  50. trigger: 'axis',
  51. axisPointer: {
  52. type: 'cross',
  53. label: {
  54. backgroundColor: '#6a7985'
  55. }
  56. }
  57. },
  58. legend: {
  59. data: ['土壤温度(℃)', '土壤湿度(%RH)', '土壤PH', '土壤水势(kpa)', '电导率(us/cm)'],
  60. // 图例
  61. textStyle: {
  62. color: 'rgb(200,255,255)' //字体颜色
  63. },
  64. padding: 0,
  65. },
  66. toolbox: {
  67. },
  68. grid: {
  69. left: '3%',
  70. right: '4%',
  71. bottom: '3%',
  72. containLabel: true
  73. },
  74. xAxis: [{
  75. type: 'category',
  76. boundaryGap: false,
  77. data: ['1:00', '5:00', '9:00', '13:00', '17:00', '21:00', '24:00']
  78. },
  79. ],
  80. yAxis: [{
  81. type: 'value'
  82. }],
  83. series: [{
  84. name: '土壤温度(℃)',
  85. type: 'line',
  86. smooth: true,
  87. lineStyle: {
  88. width: 2
  89. },
  90. lable: {
  91. show: true,
  92. position: 'top'
  93. },
  94. showSymbol: false,
  95. areaStyle: {
  96. opacity: 0.4,
  97. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  98. offset: 0,
  99. color: 'rgb(128, 255, 165)'
  100. },
  101. {
  102. offset: 1,
  103. color: 'rgb(1, 191, 236)'
  104. }
  105. ])
  106. },
  107. emphasis: {
  108. focus: 'series'
  109. },
  110. data: [200, 2000, 219, 264, 500, 340, 250]
  111. },
  112. {
  113. name: '土壤湿度(%RH)',
  114. type: 'line',
  115. smooth: true,
  116. lineStyle: {
  117. width: 2
  118. },
  119. lable: {
  120. show: true,
  121. position: 'top'
  122. },
  123. showSymbol: false,
  124. areaStyle: {
  125. opacity: 0.4,
  126. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  127. offset: 0,
  128. color: 'rgb(0, 221, 255)'
  129. },
  130. {
  131. offset: 1,
  132. color: 'rgb(77, 119, 255)'
  133. }
  134. ])
  135. },
  136. emphasis: {
  137. focus: 'series'
  138. },
  139. data: [120, 400, 350, 500, 220, 340, 310]
  140. },
  141. {
  142. name: '土壤水势(kpa)',
  143. type: 'line',
  144. smooth: true,
  145. lable: {
  146. show: true,
  147. position: 'top'
  148. },
  149. lineStyle: {
  150. width: 2
  151. },
  152. showSymbol: false,
  153. areaStyle: {
  154. opacity: 0.4,
  155. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  156. offset: 0,
  157. color: 'rgb(55, 162, 255)'
  158. },
  159. {
  160. offset: 1,
  161. color: 'rgb(116, 21, 219)'
  162. }
  163. ])
  164. },
  165. emphasis: {
  166. focus: 'series'
  167. },
  168. data: [320, 400, 201, 334, 190, 350, 220]
  169. },
  170. {
  171. name: '土壤PH',
  172. type: 'line',
  173. smooth: true,
  174. lable: {
  175. show: true,
  176. position: 'top'
  177. },
  178. lineStyle: {
  179. width: 2
  180. },
  181. showSymbol: false,
  182. areaStyle: {
  183. opacity: 0.4,
  184. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  185. offset: 0,
  186. color: '#ff9a9a'
  187. },
  188. {
  189. offset: 1,
  190. color: '#ff9a9a'
  191. }
  192. ])
  193. },
  194. emphasis: {
  195. focus: 'series'
  196. },
  197. data: [220, 402, 231, 134, 190, 230, 120]
  198. },
  199. {
  200. name: '电导率(us/cm)',
  201. type: 'line',
  202. lable: {
  203. show: true,
  204. position: 'top'
  205. },
  206. smooth: true,
  207. lineStyle: {
  208. width: 2
  209. },
  210. showSymbol: false,
  211. label: {
  212. show: true,
  213. position: 'top'
  214. },
  215. areaStyle: {
  216. opacity: 0.4,
  217. color: new this.$echarts.graphic.LinearGradient(0, 0, 0, 1, [{
  218. offset: 0,
  219. color: 'rgb(255, 191, 0)'
  220. },
  221. {
  222. offset: 1,
  223. color: 'rgb(255, 191, 0)'
  224. }
  225. ])
  226. },
  227. emphasis: {
  228. focus: 'series'
  229. },
  230. data: [220, 302, 181, 234, 210, 290, 150]
  231. }
  232. ]
  233. };
  234. return option;
  235. }
  236. },
  237. }
  238. </script>
  239. <style>
  240. </style>