diff --git a/src/views/counter/components/humiture.vue b/src/views/counter/components/humiture.vue index 26a5068..8bddb0c 100644 --- a/src/views/counter/components/humiture.vue +++ b/src/views/counter/components/humiture.vue @@ -143,10 +143,10 @@ export default { } }, legend: { - data: [title] + data: title }, series: [{ - name: title, itemStyle: { + name: title[0], itemStyle: { normal: { color: '#FF005A', lineStyle: { @@ -157,7 +157,23 @@ export default { }, smooth: true, type: 'line', - data: historyData, + data: historyData.temperature, + animationDuration: 2800, + animationEasing: 'cubicInOut' + }, + { + name: title[1], itemStyle: { + normal: { + color: '#3888fa', + lineStyle: { + color: '#3888fa', + width: 2 + } + } + }, + smooth: true, + type: 'line', + data: historyData.humidity, animationDuration: 2800, animationEasing: 'cubicInOut' }] diff --git a/src/views/counter/detail.vue b/src/views/counter/detail.vue index 24477c3..6e7eef5 100644 --- a/src/views/counter/detail.vue +++ b/src/views/counter/detail.vue @@ -96,9 +96,12 @@ export default { }, HumitureData: { total: { - historyData: [], + historyData: { + temperature: [], + humidity: [] + }, xAxis: [], - title: 'Humiture' + title: ['temperature', 'humidity'] } }, listLoading: true, @@ -142,7 +145,8 @@ export default { this.deviceTempLogs = response.data.results this.deviceTempLogs.forEach((item, index) => { if (index % 2 === 0) { - this.HumitureData.total.historyData.push(item.temperature) + this.HumitureData.total.historyData.temperature.push(item.temperature) + this.HumitureData.total.historyData.humidity.push(item.humidity) dateList.push(item.last_time.substr(11, 5)) } })