Skip to content

Commit e196ef2

Browse files
committed
Update formatter
1 parent 83af083 commit e196ef2

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

TestingArena/ArenaVueUiWaffle.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ const config = computed(() => {
140140
...c.style.chart.layout.labels,
141141
dataLabels: {
142142
...c.style.chart.layout.labels.dataLabels,
143-
formatter: (val) => {
144-
return `f - ${val}`
143+
formatter: ({value, config }) => {
144+
// console.log(config)
145+
return `f - ${value}`
145146
}
146147
}
147148
}

src/components/vue-ui-waffle.vue

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,12 @@ function useTooltip(index) {
510510
v: selected.value,
511511
s: FINAL_CONFIG.value.style.chart.layout.labels.dataLabels.suffix,
512512
r: FINAL_CONFIG.value.style.chart.tooltip.roundingValue
513-
})
513+
}),
514+
{
515+
datapoint: selected,
516+
seriesIndex: rects.value[index].absoluteIndex,
517+
series: datasetCopy.value
518+
}
514519
)}</b>`;
515520
}
516521
if(FINAL_CONFIG.value.style.chart.tooltip.showPercentage) {
@@ -824,7 +829,8 @@ defineExpose({
824829
v: rects[i].value,
825830
s: FINAL_CONFIG.style.chart.layout.labels.dataLabels.suffix,
826831
r: FINAL_CONFIG.style.chart.layout.labels.captions.roundingValue
827-
})
832+
}),
833+
{ datapoint: rects[i], position }
828834
)}})
829835
</span>
830836
<span v-if="!FINAL_CONFIG.style.chart.layout.labels.captions.showPercentage && FINAL_CONFIG.style.chart.layout.labels.captions.showValue">
@@ -835,7 +841,8 @@ defineExpose({
835841
v: rects[i].value,
836842
s: FINAL_CONFIG.style.chart.layout.labels.dataLabels.suffix,
837843
r: FINAL_CONFIG.style.chart.layout.labels.captions.roundingValue
838-
})
844+
}),
845+
{ datapoint: rects[i], position }
839846
)
840847
}}
841848
</span>
@@ -893,7 +900,9 @@ defineExpose({
893900
v: legend.value,
894901
s: FINAL_CONFIG.style.chart.layout.labels.dataLabels.suffix,
895902
r:FINAL_CONFIG.style.chart.legend.roundingValue, isAnimating
896-
}))
903+
}),
904+
{ datapoint: legend }
905+
)
897906
}}
898907
<span v-if="!segregated.includes(legend.uid)">
899908
({{ isNaN(legend.value / total) ? '-' : dataLabel({v: legend.value /total * 100, s: '%', r: FINAL_CONFIG.style.chart.legend.roundingPercentage, isAnimating }) }})

0 commit comments

Comments
 (0)