2021-07-05 22:58:12 +08:00
|
|
|
<template>
|
2021-07-09 09:00:06 +08:00
|
|
|
<div class="chart__legend">
|
|
|
|
|
<div class="charts__table-top">
|
|
|
|
|
<p class="location">Average</p>
|
|
|
|
|
<p class="locations">Maximum</p>
|
2021-07-08 08:57:29 +08:00
|
|
|
</div>
|
2021-07-09 09:00:06 +08:00
|
|
|
<div class="legend__table">
|
|
|
|
|
<table>
|
|
|
|
|
<tr v-for="(d, i) in data" :key="i" class="legend__row">
|
2021-07-09 10:10:06 +08:00
|
|
|
<td style="width: 40px;"><div :style="{backgroundColor: getChartColor(i)}" class="legend__row-top" :title="getChartColor(i)"></div></td>
|
2021-07-09 09:00:06 +08:00
|
|
|
<td><div class="text__show" :title="d.legend">{{d.legend}}</div></td>
|
2021-07-09 10:10:06 +08:00
|
|
|
<td style="width: 70px;"><div :title="d.aggregation.avg">{{d.aggregation.avg}}</div></td>
|
|
|
|
|
<td style="width: 70px;"><div :title="d.aggregation.max">{{d.aggregation.max}}</div></td>
|
2021-07-09 09:00:06 +08:00
|
|
|
</tr>
|
|
|
|
|
</table>
|
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'
|
|
|
|
|
import {chartColor} from "./chart-options";
|
2021-07-05 22:58:12 +08:00
|
|
|
export default {
|
|
|
|
|
name: 'StatisticsLegend',
|
|
|
|
|
props: {
|
|
|
|
|
data: Array
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
data: {
|
|
|
|
|
immediate: true,
|
|
|
|
|
deep: true,
|
|
|
|
|
handler (n) {
|
2021-07-08 16:23:11 +08:00
|
|
|
console.log(n)
|
2021-07-05 22:58:12 +08:00
|
|
|
}
|
|
|
|
|
}
|
2021-07-08 08:57:29 +08:00
|
|
|
},
|
|
|
|
|
setup () {
|
|
|
|
|
return {
|
|
|
|
|
getChartColor,
|
2021-07-09 10:10:06 +08:00
|
|
|
chartColor
|
|
|
|
|
}
|
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 09:00:06 +08:00
|
|
|
.chart__legend{
|
2021-07-08 16:23:11 +08:00
|
|
|
width: 455px;
|
|
|
|
|
height: 111px;
|
|
|
|
|
border: 1px solid #E7EAED;
|
2021-07-08 08:57:29 +08:00
|
|
|
font-size: 10px;
|
|
|
|
|
color:#5f6368;
|
|
|
|
|
margin: auto;
|
|
|
|
|
}
|
2021-07-09 10:10:06 +08:00
|
|
|
.text__show {
|
|
|
|
|
max-width: 240px;
|
2021-07-09 09:00:06 +08:00
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow:ellipsis;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|
|
|
|
|
.charts__table-top{
|
2021-07-08 08:57:29 +08:00
|
|
|
position: relative;
|
2021-07-08 16:23:11 +08:00
|
|
|
width: 455px;
|
|
|
|
|
height: 30px;
|
2021-07-09 09:00:06 +08:00
|
|
|
border-bottom: #E7EAED 0.96px solid;
|
2021-07-08 08:57:29 +08:00
|
|
|
}
|
2021-07-09 09:00:06 +08:00
|
|
|
.location{
|
|
|
|
|
position: absolute;
|
2021-07-09 10:10:06 +08:00
|
|
|
right: 110px;
|
2021-07-09 09:00:06 +08:00
|
|
|
top: -9px;
|
2021-07-09 10:10:06 +08:00
|
|
|
font-size: 13px;
|
2021-07-08 16:23:11 +08:00
|
|
|
color: #0091FF;
|
2021-07-08 08:57:29 +08:00
|
|
|
}
|
2021-07-09 09:00:06 +08:00
|
|
|
.locations{
|
|
|
|
|
position: absolute;
|
2021-07-09 10:10:06 +08:00
|
|
|
right: 25px;
|
2021-07-09 09:00:06 +08:00
|
|
|
top: -8px;
|
2021-07-09 10:10:06 +08:00
|
|
|
font-size: 13px;
|
2021-07-08 16:23:11 +08:00
|
|
|
color: #0091FF;
|
2021-07-08 08:57:29 +08:00
|
|
|
}
|
2021-07-09 09:00:06 +08:00
|
|
|
.legend__row-top{
|
2021-07-08 16:23:11 +08:00
|
|
|
width: 17px;
|
|
|
|
|
height: 7px;
|
|
|
|
|
border-radius: 24%;
|
2021-07-09 09:00:06 +08:00
|
|
|
margin-left: 15px;
|
|
|
|
|
}
|
|
|
|
|
.legend__table {
|
|
|
|
|
overflow: auto;
|
2021-07-09 10:10:06 +08:00
|
|
|
height: calc(100% - 30px);
|
|
|
|
|
|
|
|
|
|
table {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2021-07-09 09:00:06 +08:00
|
|
|
}
|
|
|
|
|
.legend__row{
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
box-sizing: border-box;
|
2021-07-08 08:57:29 +08:00
|
|
|
}
|
2021-07-09 09:00:06 +08:00
|
|
|
.legend__row:hover {
|
|
|
|
|
background-color: #f9f9f9;
|
2021-07-09 10:10:06 +08:00
|
|
|
border: 0;
|
2021-07-09 09:00:06 +08:00
|
|
|
color: #383838;
|
2021-07-08 16:23:11 +08:00
|
|
|
}
|
2021-07-07 15:51:52 +08:00
|
|
|
</style>
|