chore(client): tweak ui
This commit is contained in:
parent
4c2cd3c8d5
commit
cb697cf582
3 changed files with 54 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ Chart.register(
|
|||
);
|
||||
|
||||
const props = defineProps<{
|
||||
data: { name: string; value: number; color: string; }[];
|
||||
data: { name: string; value: number; color: string; onClick?: () => void }[];
|
||||
}>();
|
||||
|
||||
const chartEl = ref<HTMLCanvasElement>(null);
|
||||
|
|
@ -79,6 +79,12 @@ onMounted(() => {
|
|||
bottom: 16,
|
||||
},
|
||||
},
|
||||
onClick: (ev) => {
|
||||
const hit = chartInstance.getElementsAtEventForMode(ev, 'nearest', { intersect: true }, false)[0];
|
||||
if (hit && props.data[hit.index].onClick) {
|
||||
props.data[hit.index].onClick();
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
display: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue