This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/components/charts/StatisticsLegend.vue

106 lines
2.1 KiB
Vue
Raw Normal View History

2021-07-05 22:58:12 +08:00
<template>
<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>
<div class="legend__table">
<table>
<tr v-for="(d, i) in data" :key="i" class="legend__row">
<td style="width: 40px;"><div :style="{backgroundColor: getChartColor(i)}" class="legend__row-top" :title="getChartColor(i)"></div></td>
<td><div class="text__show" :title="d.legend">{{d.legend}}</div></td>
<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>
</tr>
</table>
2021-07-08 08:57:29 +08:00
</div>
</div>
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,
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>
<style lang="scss" scoped>
.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;
}
.text__show {
max-width: 240px;
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;
border-bottom: #E7EAED 0.96px solid;
2021-07-08 08:57:29 +08:00
}
.location{
position: absolute;
right: 110px;
top: -9px;
font-size: 13px;
2021-07-08 16:23:11 +08:00
color: #0091FF;
2021-07-08 08:57:29 +08:00
}
.locations{
position: absolute;
right: 25px;
top: -8px;
font-size: 13px;
2021-07-08 16:23:11 +08:00
color: #0091FF;
2021-07-08 08:57:29 +08:00
}
.legend__row-top{
2021-07-08 16:23:11 +08:00
width: 17px;
height: 7px;
border-radius: 24%;
margin-left: 15px;
}
.legend__table {
overflow: auto;
height: calc(100% - 30px);
table {
width: 100%;
}
}
.legend__row{
font-size: 12px;
box-sizing: border-box;
2021-07-08 08:57:29 +08:00
}
.legend__row:hover {
background-color: #f9f9f9;
border: 0;
color: #383838;
2021-07-08 16:23:11 +08:00
}
</style>