diff --git a/src/visualizations/config/adapters/dhis_highcharts/index.js b/src/visualizations/config/adapters/dhis_highcharts/index.js index 1c6b428e9..0f3ddb271 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/index.js +++ b/src/visualizations/config/adapters/dhis_highcharts/index.js @@ -20,6 +20,7 @@ import getExporting from './exporting.js' import getScatterData from './getScatterData.js' import getSortedConfig from './getSortedConfig.js' import getTrimmedConfig from './getTrimmedConfig.js' +import getLang from './lang.js' import getLegend from './legend.js' import { applyLegendSet, getLegendSetTooltip } from './legendSet.js' import getNoData from './noData.js' @@ -121,10 +122,7 @@ export default function ({ store, layout, el, extraConfig, extraOptions }) { pane: getPane(_layout.type), // no data + zoom - lang: { - noData: _extraOptions.noData.text, - resetZoom: _extraOptions.resetZoom.text, - }, + lang: getLang(_layout.type, _extraOptions), noData: getNoData(_layout.type), // credits @@ -242,5 +240,7 @@ export default function ({ store, layout, el, extraConfig, extraOptions }) { // force apply extra config Object.assign(config, extraConfig) + console.log(objectClean(config)) + return objectClean(config) } diff --git a/src/visualizations/config/adapters/dhis_highcharts/lang.js b/src/visualizations/config/adapters/dhis_highcharts/lang.js new file mode 100644 index 000000000..80299fe41 --- /dev/null +++ b/src/visualizations/config/adapters/dhis_highcharts/lang.js @@ -0,0 +1,15 @@ +import { VIS_TYPE_SINGLE_VALUE } from '../../../../modules/visTypes.js' + +export default function getLang(visType, extraOptions) { + return { + /* The SingleValue visualization consists of some custom SVG elements + * rendered on an empty chart. Since the chart is empty, there is never + * any data and Highcharts will show the noData text. To avoid this we + * clear the text here. */ + noData: + visType === VIS_TYPE_SINGLE_VALUE + ? undefined + : extraOptions.noData.text, + resetZoom: extraOptions.resetZoom.text, + } +} diff --git a/src/visualizations/config/adapters/dhis_highcharts/noData.js b/src/visualizations/config/adapters/dhis_highcharts/noData.js index b2f40d7ff..8597b5ccd 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/noData.js +++ b/src/visualizations/config/adapters/dhis_highcharts/noData.js @@ -1,13 +1,8 @@ -import { VIS_TYPE_SINGLE_VALUE } from '../../../../modules/visTypes.js' - -export default function (visualizationType) { +export default function () { return { style: { fontSize: '13px', fontWeight: 'normal', - /* Hide no data label for single value visualizations because - * the data is always missing. */ - opacity: visualizationType === VIS_TYPE_SINGLE_VALUE ? 0 : 1, }, } }