@@ -76,7 +76,7 @@ const svg = computed(() => {
7676 }
7777});
7878
79- const emit = defineEmits ([' selectLegend' ])
79+ const emit = defineEmits ([' selectLegend' , ' selectDatapoint ' ])
8080
8181const 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+
343347defineExpose ({
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