|
|
|
@ -35,7 +35,7 @@ |
|
|
|
|
<div class="mid1-1"> |
|
|
|
|
当前功率 |
|
|
|
|
</div> |
|
|
|
|
<div id="myEcharts" style="width: 100%; height: 88.6%"></div> |
|
|
|
|
<div id="myEcharts1" style="width: 100%; height: 88.6%"></div> |
|
|
|
|
</div> |
|
|
|
|
<div class="mid2"> |
|
|
|
|
<div class="mid2-1"> |
|
|
|
@ -56,17 +56,16 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script name="Index"> |
|
|
|
|
import { onMounted } from "vue"; |
|
|
|
|
import { onMounted ,onUnmounted } from "vue"; |
|
|
|
|
import * as echarts from 'echarts'; |
|
|
|
|
export default { |
|
|
|
|
name: "db", |
|
|
|
|
setup() { |
|
|
|
|
|
|
|
|
|
onMounted(() => {//需要获取到element,所以是onMounted的Hook |
|
|
|
|
let myChart = echarts.init(document.getElementById("myEcharts")); |
|
|
|
|
let myChart2 = echarts.init(document.getElementById("myEcharts2")); |
|
|
|
|
let myChart3 = echarts.init(document.getElementById("myEcharts3")); |
|
|
|
|
// 绘制图表 |
|
|
|
|
myChart.setOption({ |
|
|
|
|
echarts.init(document.getElementById("myEcharts1")).dispose() |
|
|
|
|
let myChart1 = echarts.init(document.getElementById("myEcharts1")); |
|
|
|
|
let option1 = { |
|
|
|
|
series: [ |
|
|
|
|
{ |
|
|
|
|
type: 'gauge', |
|
|
|
@ -118,11 +117,16 @@ export default { |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
myChart1.setOption(option1); |
|
|
|
|
window.onresize = function () {//自适应大小 |
|
|
|
|
myChart.resize(); |
|
|
|
|
myChart1.resize(); |
|
|
|
|
}; |
|
|
|
|
myChart3.setOption({ |
|
|
|
|
|
|
|
|
|
echarts.init(document.getElementById("myEcharts2")).dispose() |
|
|
|
|
let myChart2 = echarts.init(document.getElementById("myEcharts2")); |
|
|
|
|
// 绘制图表 |
|
|
|
|
myChart2.setOption({ |
|
|
|
|
title: {}, |
|
|
|
|
tooltip: {}, |
|
|
|
|
textStyle:{ |
|
|
|
@ -139,7 +143,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
yAxis: { |
|
|
|
|
type: 'value', |
|
|
|
|
name: "kWh", |
|
|
|
|
name: "kW", |
|
|
|
|
splitLine:{ |
|
|
|
|
show:true, |
|
|
|
|
lineStyle:{ |
|
|
|
@ -157,8 +161,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
series: [ |
|
|
|
|
{ |
|
|
|
|
name: "今日用电量", |
|
|
|
|
type: "bar", |
|
|
|
|
name: "当前功率", |
|
|
|
|
type: "line", |
|
|
|
|
data: [5, 20, 36, 10, 10, 20], |
|
|
|
|
itemStyle:{ |
|
|
|
|
color:'#2F8EE0' |
|
|
|
@ -167,9 +171,12 @@ export default { |
|
|
|
|
], |
|
|
|
|
}); |
|
|
|
|
window.onresize = function () {//自适应大小 |
|
|
|
|
myChart3.resize(); |
|
|
|
|
myChart2.resize(); |
|
|
|
|
}; |
|
|
|
|
myChart2.setOption({ |
|
|
|
|
|
|
|
|
|
echarts.init(document.getElementById("myEcharts3")).dispose() |
|
|
|
|
let myChart3 = echarts.init(document.getElementById("myEcharts3")); |
|
|
|
|
myChart3.setOption({ |
|
|
|
|
title: {}, |
|
|
|
|
tooltip: {}, |
|
|
|
|
textStyle:{ |
|
|
|
@ -186,7 +193,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
yAxis: { |
|
|
|
|
type: 'value', |
|
|
|
|
name: "kW", |
|
|
|
|
name: "kWh", |
|
|
|
|
splitLine:{ |
|
|
|
|
show:true, |
|
|
|
|
lineStyle:{ |
|
|
|
@ -204,8 +211,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
series: [ |
|
|
|
|
{ |
|
|
|
|
name: "当前功率", |
|
|
|
|
type: "line", |
|
|
|
|
name: "今日用电量", |
|
|
|
|
type: "bar", |
|
|
|
|
data: [5, 20, 36, 10, 10, 20], |
|
|
|
|
itemStyle:{ |
|
|
|
|
color:'#2F8EE0' |
|
|
|
@ -214,8 +221,9 @@ export default { |
|
|
|
|
], |
|
|
|
|
}); |
|
|
|
|
window.onresize = function () {//自适应大小 |
|
|
|
|
myChart2.resize(); |
|
|
|
|
myChart3.resize(); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
components: {}, |
|
|
|
|