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