From cec719dbe872f9e0a1b3caf60a8f71618e0025a7 Mon Sep 17 00:00:00 2001 From: Saif Ur Rehman Date: Wed, 7 Oct 2020 22:04:45 +0500 Subject: [PATCH] fix(AggregationChart): Formatter not being applied (ex PercentageChart in AR/AP erpnext) --- src/js/charts/AggregationChart.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/charts/AggregationChart.js b/src/js/charts/AggregationChart.js index 1e13414..0877cc6 100644 --- a/src/js/charts/AggregationChart.js +++ b/src/js/charts/AggregationChart.js @@ -11,6 +11,7 @@ export default class AggregationChart extends BaseChart { configure(args) { super.configure(args); + this.config.formatTooltipY = args.tooltipOptions.formatTooltipY; this.config.maxSlices = args.maxSlices || 20; this.config.maxLegendPoints = args.maxLegendPoints || 20; } @@ -77,12 +78,13 @@ export default class AggregationChart extends BaseChart { } let x = barWidth * count + 5; let label = this.config.truncateLegends ? truncateString(s.labels[i], barWidth/10) : s.labels[i]; + let formatted = this.config.formatTooltipY ? this.config.formatTooltipY(d) : d; let dot = legendDot( x, y, 5, this.colors[i], - `${label}: ${d}`, + `${label}: ${formatted}`, false ); this.legendArea.appendChild(dot);