统计分析
This commit is contained in:
parent
f82b7d2d10
commit
d66811d2ba
@ -4,7 +4,7 @@
|
||||
<el-menu-item v-for="(item, index) in headerList" :index="index" :key="index"> {{ item }} </el-menu-item>
|
||||
</el-menu>
|
||||
<TrendAnalysis v-if="activeIndex == 1"></TrendAnalysis>
|
||||
<TrendComparison v-if="activeIndex == 2"></TrendComparison>
|
||||
<!-- <TrendComparison v-if="activeIndex == 2"></TrendComparison> -->
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
@ -12,7 +12,7 @@ import { ref } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useConfig } from '/@/stores/config'
|
||||
import TrendAnalysis from './trendAnalysis.vue'
|
||||
import TrendComparison from './trendComparison.vue'
|
||||
// import TrendComparison from './trendComparison.vue'
|
||||
const config = useConfig()
|
||||
const activeIndex = ref(1)
|
||||
const { t } = useI18n()
|
||||
|
@ -64,15 +64,15 @@
|
||||
<div class="icon">
|
||||
<el-button v-show="index !== 0" type="danger" size="small" :icon="Delete" @click="switchTime(index)" circle></el-button>
|
||||
</div>
|
||||
<div class="selectPart" v-if="calculate[index] && calculate[index]['max']">
|
||||
<div class="selectPart" v-if="calculate[index] && calculate[index]['max'] !== ''">
|
||||
<span>{{ t('statAnalysis.max') }}</span>
|
||||
<span class="max">{{ calculate[index]['max'] }}</span>
|
||||
</div>
|
||||
<div class="selectPart" v-if="calculate[index] && calculate[index]['min']">
|
||||
<div class="selectPart" v-if="calculate[index] && calculate[index]['min'] !== ''">
|
||||
<span>{{ t('statAnalysis.min') }}</span>
|
||||
<span class="min">{{ calculate[index]['min'] }}</span>
|
||||
</div>
|
||||
<div class="selectPart" v-if="calculate[index] && calculate[index]['average']">
|
||||
<div class="selectPart" v-if="calculate[index] && calculate[index]['average'] !== ''">
|
||||
<span>{{ t('statAnalysis.average') }}</span>
|
||||
<span class="average">{{ calculate[index]['average'] }}</span>
|
||||
</div>
|
||||
@ -347,17 +347,15 @@ const historyDataReq = (data, index) => {
|
||||
if (resData) {
|
||||
const xData = resData['times']
|
||||
const yData = resData['values']
|
||||
|
||||
calculate[index] = {
|
||||
max: Math.floor(Math.max(...yData)),
|
||||
min: Math.floor(Math.min(...yData)),
|
||||
average: Math.floor(yData.reduce((a, b) => a + b, 0) / yData.length),
|
||||
}
|
||||
|
||||
option.tooltip = {
|
||||
show: true,
|
||||
formatter: function (params) {
|
||||
const x = timestampToTime(xData[params.dataIndex])
|
||||
const x = timestampToTime(xDatas[index][params.dataIndex])
|
||||
return `${params.marker} ${params.seriesName} ${x} : ${params.data}`
|
||||
},
|
||||
}
|
||||
@ -369,6 +367,8 @@ const historyDataReq = (data, index) => {
|
||||
}
|
||||
option.legend.data.push(String(index + 1))
|
||||
option.series.push(seriesData)
|
||||
console.log('🚀 ~ historyReq ~ option:', option)
|
||||
|
||||
chart.value.setOption(option)
|
||||
} else {
|
||||
ElMessage.warning('查询失败1')
|
||||
|
Loading…
Reference in New Issue
Block a user