diff --git a/src/__demo__/SingleValue.stories.js b/src/__demo__/SingleValue.stories.js index df520a3f9..4373697dd 100644 --- a/src/__demo__/SingleValue.stories.js +++ b/src/__demo__/SingleValue.stories.js @@ -694,6 +694,14 @@ storiesOf('SingleValue', module).add('default', () => { if (newChartRef.current) { const currentBackgroundColor = newChartRef.current.userOptions.chart.backgroundColor + + newChartRef.current.update({ + exporting: { + chartOptions: { + isPDF: exportAsPdf, + }, + }, + }) newChartRef.current.exportChartLocal( { sourceHeight: 768, diff --git a/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/renderSingleValueSVG.js b/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/renderSingleValueSVG.js index 380f52e7c..e0c891a4a 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/renderSingleValueSVG.js +++ b/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/renderSingleValueSVG.js @@ -7,7 +7,7 @@ import { DynamicStyles } from './styles.js' export function renderSingleValueSVG() { const { formattedValue, icon, subText, fontColor } = this.userOptions.customSVGOptions - const dynamicStyles = new DynamicStyles() + const dynamicStyles = new DynamicStyles(this.userOptions?.isPDF) const valueElement = this.renderer .text(formattedValue) .css({ color: fontColor, visibility: 'hidden' }) diff --git a/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/styles.js b/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/styles.js index 09564281d..d3cf5869c 100644 --- a/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/styles.js +++ b/src/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/renderer/styles.js @@ -1,10 +1,3 @@ -const baseStyle = { - value: { - 'font-weight': 300, - }, - subText: {}, -} - const valueStyles = [ { 'font-size': '200px', 'letter-spacing': '-6px' }, { 'font-size': '182px', 'letter-spacing': '-5.5px' }, @@ -50,16 +43,17 @@ const spacings = [ export const MIN_SIDE_WHITESPACE = 4 export class DynamicStyles { - constructor() { + constructor(isExportingToPDF) { this.currentIndex = 0 + this.isExportingToPDF = isExportingToPDF } getStyle() { return { - value: { ...baseStyle.value, ...valueStyles[this.currentIndex] }, - subText: { - ...baseStyle.subText, - ...subTextStyles[this.currentIndex], + value: { + ...valueStyles[this.currentIndex], + 'font-weight': this.isExportingToPDF ? 'normal' : '300', }, + subText: subTextStyles[this.currentIndex], spacing: spacings[this.currentIndex], } }