From 3ab233cb30ae1cbff021fe5d2cba5438330a93ab Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Thu, 7 Dec 2023 15:49:41 +0100 Subject: [PATCH] fix: use translated title and subtitle when available (DHIS2-16216) --- .../config/adapters/dhis_highcharts/subtitle/index.js | 7 +++++-- .../config/adapters/dhis_highcharts/title/index.js | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js b/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js index 585842325..9d2dc1bc7 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +++ b/src/visualizations/config/adapters/dhis_highcharts/subtitle/index.js @@ -50,8 +50,11 @@ export default function (series, layout, metaData, dashboard) { } // DHIS2-578: allow for optional custom subtitle - if (isString(layout.subtitle)) { - subtitle.text = layout.subtitle + const customSubtitle = + (layout.subtitle && layout.displaySubtitle) || layout.subtitle + + if (isString(customSubtitle) && customSubtitle.length) { + subtitle.text = customSubtitle } else { const filterTitle = getFilterText(layout.filters, metaData) diff --git a/src/visualizations/config/adapters/dhis_highcharts/title/index.js b/src/visualizations/config/adapters/dhis_highcharts/title/index.js index 3a42cb5f7..e4e4f1a4a 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/title/index.js +++ b/src/visualizations/config/adapters/dhis_highcharts/title/index.js @@ -55,8 +55,10 @@ export default function (layout, metaData, dashboard) { return title } - if (isString(layout.title) && layout.title.length) { - title.text = layout.title + const customTitle = (layout.title && layout.displayTitle) || layout.title + + if (isString(customTitle) && customTitle.length) { + title.text = customTitle } else { switch (layout.type) { case VIS_TYPE_GAUGE: