|
@@ -40,7 +40,7 @@ const handleResize = () => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
initChart();
|
|
initChart();
|
|
|
});
|
|
});
|
|
|
-const initChart = (dates, EPE, typeName) => {
|
|
|
|
|
|
|
+const initChart = (dates, EPE, typeName, unitType) => {
|
|
|
if (chartRef.value) {
|
|
if (chartRef.value) {
|
|
|
chart = echarts.init(chartRef.value);
|
|
chart = echarts.init(chartRef.value);
|
|
|
// 生成 24 小时的时间数据
|
|
// 生成 24 小时的时间数据
|
|
@@ -73,7 +73,7 @@ const initChart = (dates, EPE, typeName) => {
|
|
|
formatter: function (params) {
|
|
formatter: function (params) {
|
|
|
let result = params[0].axisValue + '<br/>';
|
|
let result = params[0].axisValue + '<br/>';
|
|
|
params.forEach(item => {
|
|
params.forEach(item => {
|
|
|
- result += item.marker + item.seriesName + ':' + item.data + ' m3<br/>';
|
|
|
|
|
|
|
+ result += item.marker + item.seriesName + ':' + item.data + `${unitType}<br/>`;
|
|
|
});
|
|
});
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
@@ -151,19 +151,24 @@ const getChartData = (electricityCount) => {
|
|
|
};
|
|
};
|
|
|
watch(() => props.resultData, (newVal) => {
|
|
watch(() => props.resultData, (newVal) => {
|
|
|
let typeName = ''
|
|
let typeName = ''
|
|
|
|
|
+ let unitType = ''
|
|
|
if (props.curveType === 'temperature') {
|
|
if (props.curveType === 'temperature') {
|
|
|
typeName = '温度'
|
|
typeName = '温度'
|
|
|
|
|
+ unitType = '℃'
|
|
|
} else if (props.curveType === 'humidity') {
|
|
} else if (props.curveType === 'humidity') {
|
|
|
typeName = '湿度'
|
|
typeName = '湿度'
|
|
|
|
|
+ unitType = '%RH'
|
|
|
} else if (props.curveType === 'pressure') {
|
|
} else if (props.curveType === 'pressure') {
|
|
|
typeName = '压力'
|
|
typeName = '压力'
|
|
|
|
|
+ unitType = 'MPa'
|
|
|
} else if (props.curveType === 'total_flow') {
|
|
} else if (props.curveType === 'total_flow') {
|
|
|
typeName = '流量'
|
|
typeName = '流量'
|
|
|
|
|
+ unitType = 'm³'
|
|
|
}
|
|
}
|
|
|
const { dates, EPE, EPE_forecast } = getChartData(newVal);
|
|
const { dates, EPE, EPE_forecast } = getChartData(newVal);
|
|
|
if (newVal && chart == null) {
|
|
if (newVal && chart == null) {
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
|
- initChart(dates, EPE, typeName);
|
|
|
|
|
|
|
+ initChart(dates, EPE, typeName, unitType);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
if (chart) {
|
|
if (chart) {
|
|
@@ -171,6 +176,15 @@ watch(() => props.resultData, (newVal) => {
|
|
|
xAxis: {
|
|
xAxis: {
|
|
|
data: dates,
|
|
data: dates,
|
|
|
},
|
|
},
|
|
|
|
|
+ tooltip: {
|
|
|
|
|
+ formatter: function (params) {
|
|
|
|
|
+ let result = params[0].axisValue + '<br/>';
|
|
|
|
|
+ params.forEach(item => {
|
|
|
|
|
+ result += item.marker + item.seriesName + ':' + item.data + `${unitType} <br/>`;
|
|
|
|
|
+ });
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
series: [{
|
|
series: [{
|
|
|
name: typeName,
|
|
name: typeName,
|
|
|
type: 'line',
|
|
type: 'line',
|