add popover

This commit is contained in:
Fine 2022-11-09 18:11:25 +08:00
parent 690dacddb3
commit 63f9833899
2 changed files with 37 additions and 7 deletions

View File

@ -47,7 +47,7 @@ export default function useLegendProcess(legend?: LegendOptions) {
for (const [key, value] of keys.entries()) { for (const [key, value] of keys.entries()) {
const item: { [key: string]: unknown } = { const item: { [key: string]: unknown } = {
name: value, name: value,
linear: data[value], topN: data[value],
}; };
if (legend) { if (legend) {
if (legend.min) { if (legend.min) {

View File

@ -29,10 +29,24 @@ limitations under the License. -->
</tr> </tr>
<tr class="col-item" v-for="(item, index) in tableData" :key="index"> <tr class="col-item" v-for="(item, index) in tableData" :key="index">
<td class="header-cell"> <td class="header-cell">
<div class="cell"> <el-popover placement="bottom" :width="100" trigger="click">
<Icon iconName="circle" :style="`color: ${colors[index]};`" /> <template #reference>
<i style="font-style: normal">{{ item.name }}</i> <div class="cell name">
</div> <Icon iconName="circle" :style="`color: ${colors[index]};`" />
<i>{{ item.name }}</i>
</div>
</template>
<div>
<div
class="value"
v-for="(value, index) in item.topN"
:key="index"
>
<span>{{ index }}</span>
<span>{{ value }}</span>
</div>
</div>
</el-popover>
</td> </td>
<td v-for="h in headerRow" :key="h.value"> <td v-for="h in headerRow" :key="h.value">
<div class="cell">{{ item[h.value] }}</div> <div class="cell">{{ item[h.value] }}</div>
@ -95,6 +109,10 @@ table {
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: middle; vertical-align: middle;
width: 100px; width: 100px;
&.header-cell {
width: 150px;
}
} }
} }
@ -106,9 +124,21 @@ table {
word-break: break-all; word-break: break-all;
line-height: 23px; line-height: 23px;
padding: 0 5px; padding: 0 5px;
i {
font-style: normal;
}
} }
.header-cell { .value {
width: 150px; span {
display: inline-block;
padding: 5px;
width: 50px;
}
}
.name {
cursor: pointer;
} }
</style> </style>