CN-65 fix: statistics-legend点击事件

This commit is contained in:
chenjinsong
2021-07-22 21:35:06 +08:00
parent fd1bee2ad9
commit 36f0f5570c
6 changed files with 70 additions and 35 deletions

View File

@@ -7,7 +7,7 @@
<div class="table__below-statistics">Max</div>
</div>
<div class="chart__table-below">
<div v-for="(item,index) in data" :key="index" class="table-below-box">
<div v-for="(item, index) in data" :key="index" class="table-below-box" :class="{'table-below-box--inactivated': !item.active}" @click="toggleLegend(index)">
<div class="table__below-color"><div :style="{backgroundColor: getChartColor(index)}"></div></div>
<div class="table__below-title" :title="item.legend">{{item.legend}}</div>
<div class="table__below-statistics" :title="item.aggregation.avg">{{unitConvert(item.aggregation.avg, chartInfo.params.unitType).join(' ')}}</div>
@@ -27,6 +27,11 @@ export default {
data: Array,
chartInfo: Object
},
methods: {
toggleLegend (index) {
this.$emit('toggleLegend', index)
}
},
setup () {
return {
getChartColor,
@@ -99,4 +104,13 @@ export default {
text-overflow: ellipsis;
white-space: nowrap;
}
.table-below-box:not(.chart__table-top) {
cursor: pointer;
}
.table-below-box.table-below-box--inactivated {
color: #ccc;
.table__below-color div {
background-color: #ccc !important;
}
}
</style>