Skip to content

Commit 2698fde

Browse files
committed
VueUiDonut add @selectDatapoint emit
1 parent 90561cd commit 2698fde

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-data-ui",
33
"private": false,
4-
"version": "2.0.20",
4+
"version": "2.0.21",
55
"type": "module",
66
"description": "A user-empowering data visualization Vue components library",
77
"keywords": [

src/components/vue-ui-donut.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const svg = computed(() => {
7676
}
7777
});
7878
79-
const emit = defineEmits(['selectLegend'])
79+
const emit = defineEmits(['selectLegend', 'selectDatapoint'])
8080
8181
const segregated = ref([]);
8282
@@ -340,6 +340,10 @@ function toggleFullscreen(state) {
340340
step.value += 1;
341341
}
342342
343+
function selectDatapoint(datapoint, index) {
344+
emit('selectDatapoint', { datapoint, index })
345+
}
346+
343347
defineExpose({
344348
getData,
345349
generatePdf,
@@ -491,7 +495,7 @@ defineExpose({
491495
show: true
492496
})"
493497
@mouseleave="isTooltip = false; selectedSerie = null"
494-
@click="segregate(i)"
498+
@click="selectDatapoint(arc, i)"
495499
/>
496500

497501
<circle
@@ -560,6 +564,7 @@ defineExpose({
560564
:font-size="donutConfig.style.chart.layout.labels.percentage.fontSize * 0.8"
561565
font-family="Arial"
562566
:class="!defaultConfig.useBlurOnHover || [null, undefined].includes(selectedSerie) || selectedSerie === i ? '' : 'vue-ui-donut-blur'"
567+
@click="selectDatapoint(arc, i)"
563568
>
564569
565570
</text>
@@ -572,6 +577,7 @@ defineExpose({
572577
:fill="donutConfig.style.chart.layout.labels.percentage.color"
573578
:font-size="donutConfig.style.chart.layout.labels.percentage.fontSize"
574579
:style="`font-weight:${donutConfig.style.chart.layout.labels.percentage.bold ? 'bold': ''}`"
580+
@click="selectDatapoint(arc, i)"
575581
>
576582
{{ displayArcPercentage(arc, currentDonut) }} {{ donutConfig.style.chart.layout.labels.value.show ? `(${dataLabel({p: donutConfig.style.chart.layout.labels.dataLabels.prefix, v: arc.value, s: donutConfig.style.chart.layout.labels.dataLabels.suffix, rounding: donutConfig.style.chart.layout.labels.value.rounding})})` : '' }}
577583
</text>
@@ -584,6 +590,7 @@ defineExpose({
584590
:fill="donutConfig.style.chart.layout.labels.name.color"
585591
:font-size="donutConfig.style.chart.layout.labels.name.fontSize"
586592
:style="`font-weight:${donutConfig.style.chart.layout.labels.name.bold ? 'bold': ''}`"
593+
@click="selectDatapoint(arc, i)"
587594
>
588595
{{ arc.name}}
589596
</text>

0 commit comments

Comments
 (0)