From ca02b442dd9aebdc3fc6851285751c12559f565d Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Sat, 22 Feb 2025 03:18:43 +0530 Subject: [PATCH] fix: Reports chart by removing y-axis numeric labels (#10941) # Pull Request Template ## Description This PR fixes showing y-axis numeric labels in reports charts. It occurs after merging this PR. https://github.com/chatwoot/chatwoot/pull/10938 ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? #### **Screenshots** #### **Before** image #### **After** image ## Checklist: - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my code - [x] I have commented on my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --- .../settings/reports/ReportContainer.vue | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/ReportContainer.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/ReportContainer.vue index c831612e0..da4cc0167 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/ReportContainer.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/ReportContainer.vue @@ -112,33 +112,28 @@ export default { }; }, getChartOptions(metric) { - const baseOptions = METRIC_CHART[metric.KEY].scales; + const options = { + scales: METRIC_CHART[metric.KEY].scales, + }; - // If not an average metric type, return base options early - if (!this.isAverageMetricType(metric.KEY)) { - return baseOptions; - } - - // Only create tooltip config for time-based metrics - return { - ...baseOptions, - plugins: { + // Only add tooltip configuration for time-based metrics + if (this.isAverageMetricType(metric.KEY)) { + options.plugins = { tooltip: { callbacks: { label: ({ raw, dataIndex }) => { - const value = raw || 0; - const count = - this.accountReport.data[metric.KEY][dataIndex]?.count || 0; - return this.$t(metric.TOOLTIP_TEXT, { - metricValue: formatTime(value), - conversationCount: count, + metricValue: formatTime(raw || 0), + conversationCount: + this.accountReport.data[metric.KEY][dataIndex]?.count || 0, }); }, }, }, - }, - }; + }; + } + + return options; }, }, };