2021-07-05 22:58:12 +08:00
|
|
|
<template>
|
2021-07-09 09:00:06 +08:00
|
|
|
<div class="chart__legend">
|
2021-07-09 18:15:15 +08:00
|
|
|
<div class="chart__table-top">
|
2021-07-15 19:21:23 +08:00
|
|
|
<div>Avg</div>
|
|
|
|
|
<div>Max</div>
|
2021-07-09 18:15:15 +08:00
|
|
|
</div>
|
|
|
|
|
<div class="chart__table-below">
|
|
|
|
|
<div v-for="(item,index) in data" :key="index" class="table-below-box">
|
2021-07-09 21:58:49 +08:00
|
|
|
<div class="table__below-color"><div :style="{backgroundColor: getChartColor(index)}"></div></div>
|
2021-07-09 19:42:11 +08:00
|
|
|
<div class="table__below-title" :title="item.legend">{{item.legend}}</div>
|
2021-07-22 18:35:15 +08:00
|
|
|
<div class="table__below-statistics" :title="item.aggregation.avg">{{unitConvert(item.aggregation.avg, chartInfo.params.unitType).join(' ')}}</div>
|
|
|
|
|
<div class="table__below-statistics" :title="item.aggregation.max">{{unitConvert(item.aggregation.max, chartInfo.params.unitType).join(' ')}}</div>
|
2021-07-09 18:15:15 +08:00
|
|
|
</div>
|
2021-07-08 08:57:29 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2021-07-09 09:00:06 +08:00
|
|
|
|
2021-07-05 22:58:12 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-07-08 08:57:29 +08:00
|
|
|
import { getChartColor } from '@/components/charts/chart-options'
|
2021-07-21 22:46:08 +08:00
|
|
|
import unitConvert from '@/utils/unit-convert'
|
2021-07-05 22:58:12 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'StatisticsLegend',
|
|
|
|
|
props: {
|
2021-07-22 18:35:15 +08:00
|
|
|
data: Array,
|
|
|
|
|
chartInfo: Object
|
2021-07-05 22:58:12 +08:00
|
|
|
},
|
2021-07-08 08:57:29 +08:00
|
|
|
setup () {
|
|
|
|
|
return {
|
|
|
|
|
getChartColor,
|
2021-07-21 22:46:08 +08:00
|
|
|
unitConvert
|
2021-07-09 10:10:06 +08:00
|
|
|
}
|
2021-07-05 22:58:12 +08:00
|
|
|
}
|
|
|
|
|
}
|
2021-07-08 08:57:29 +08:00
|
|
|
|
2021-07-05 22:58:12 +08:00
|
|
|
</script>
|
2021-07-09 10:10:06 +08:00
|
|
|
<style lang="scss" scoped>
|
2021-07-09 21:58:49 +08:00
|
|
|
.chart__legend {
|
2021-07-10 11:18:40 +08:00
|
|
|
width: calc(100% - 40px);
|
2021-07-08 16:23:11 +08:00
|
|
|
border: 1px solid #E7EAED;
|
2021-07-10 11:07:54 +08:00
|
|
|
color: #5f6368;
|
2021-07-08 08:57:29 +08:00
|
|
|
margin: auto;
|
2021-07-13 15:44:49 +08:00
|
|
|
margin-bottom: 15px;
|
2021-07-08 08:57:29 +08:00
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
.chart__table-top {
|
2021-07-10 11:07:54 +08:00
|
|
|
width: 100%;
|
2021-07-08 16:23:11 +08:00
|
|
|
height: 30px;
|
2021-07-10 11:07:54 +08:00
|
|
|
border-bottom: #E7EAED 1px solid;
|
2021-07-09 18:15:15 +08:00
|
|
|
display: flex;
|
2021-07-10 11:07:54 +08:00
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
|
|
|
|
div {
|
|
|
|
|
width: 80px;
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
line-height: 28px;
|
|
|
|
|
color: $--color-primary;
|
2021-07-09 18:15:15 +08:00
|
|
|
}
|
2021-07-08 08:57:29 +08:00
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
.chart__table-below {
|
2021-07-10 11:07:54 +08:00
|
|
|
width: 100%;
|
2021-07-09 21:58:49 +08:00
|
|
|
font-size: 13px;
|
|
|
|
|
|
|
|
|
|
.table-below-box {
|
2021-07-09 10:10:06 +08:00
|
|
|
width: 100%;
|
2021-07-09 18:15:15 +08:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2021-07-09 21:58:49 +08:00
|
|
|
line-height: 24px;
|
2021-07-09 18:15:15 +08:00
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
.table-below-box:hover {
|
2021-07-09 18:15:15 +08:00
|
|
|
background-color: #f9f9f9;
|
|
|
|
|
border: 0;
|
|
|
|
|
color: #383838;
|
|
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
.table__below-color {
|
|
|
|
|
width: 27px;
|
2021-07-09 18:15:15 +08:00
|
|
|
height: 7px;
|
2021-07-09 21:58:49 +08:00
|
|
|
flex-shrink: 0;
|
|
|
|
|
padding-left: 10px;
|
|
|
|
|
|
|
|
|
|
div {
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
|
|
|
|
border-radius: 24%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.table__below-title {
|
|
|
|
|
padding: 0 6px;
|
|
|
|
|
flex-shrink: 1;
|
|
|
|
|
flex-grow: 1;
|
|
|
|
|
overflow: hidden;
|
2021-07-12 11:03:10 +08:00
|
|
|
min-width: 200px;
|
2021-07-09 21:58:49 +08:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
white-space: nowrap;
|
2021-07-09 18:15:15 +08:00
|
|
|
}
|
2021-07-09 21:58:49 +08:00
|
|
|
.table__below-statistics {
|
2021-07-10 11:07:54 +08:00
|
|
|
width: 80px;
|
2021-07-09 21:58:49 +08:00
|
|
|
flex-shrink: 0;
|
2021-07-09 18:15:15 +08:00
|
|
|
overflow: hidden;
|
2021-07-09 21:58:49 +08:00
|
|
|
text-overflow: ellipsis;
|
2021-07-09 18:15:15 +08:00
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
2021-07-09 09:00:06 +08:00
|
|
|
}
|
2021-07-07 15:51:52 +08:00
|
|
|
</style>
|