From 8fcee4e5f8d69ffbe1b5da606cdd5024a20bc2b1 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Thu, 18 Mar 2021 20:24:00 +0530 Subject: [PATCH] fix: Format currency values in dashboard chart --- frappe/public/js/frappe/widgets/chart_widget.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/widgets/chart_widget.js b/frappe/public/js/frappe/widgets/chart_widget.js index c1f5e6053f..104c457991 100644 --- a/frappe/public/js/frappe/widgets/chart_widget.js +++ b/frappe/public/js/frappe/widgets/chart_widget.js @@ -208,6 +208,7 @@ export default class ChartWidget extends Widget { this.fetch(this.filters, true, this.args).then(data => { if (this.chart_doc.chart_type == "Report") { + this.report_result = data; this.summary = data.report_summary; data = this.get_report_chart_data(data); } @@ -571,6 +572,13 @@ export default class ChartWidget extends Widget { axisOptions: { xIsSeries: this.chart_doc.timeseries, shortenYAxisNumbers: 1 + }, + tooltipOptions: { + formatTooltipY: value => + frappe.format(value, { + fieldtype: this.report_result.chart.fieldtype, + options: this.report_result.chart.options + }, { always_show_decimals: true, inline: true }) } }; @@ -750,4 +758,4 @@ export default class ChartWidget extends Widget { this.dashboard_chart && this.dashboard_chart.draw(true); }); } -} \ No newline at end of file +}