-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: set subtext in customSVGOptions
- Loading branch information
1 parent
bd8158b
commit ffc03df
Showing
2 changed files
with
15 additions
and
32 deletions.
There are no files selected for viewing
36 changes: 4 additions & 32 deletions
36
...g/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueCustomSVGOptions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,19 @@ | ||
import { getSingleValueFormattedValue } from './getSingleValueFormattedValue.js' | ||
import { getSingleValueSubtext } from './getSingleValueSubtext.js' | ||
|
||
export function getSingleValueCustomSVGOptions({ | ||
extraConfig, | ||
layout, | ||
extraOptions, | ||
metaData, | ||
series, | ||
}) { | ||
const { dashboard, legendSets, fontStyle, noData, legendOptions, icon } = | ||
extraOptions | ||
const { dashboard, icon } = extraOptions | ||
const value = series[0] | ||
|
||
console.log( | ||
'++++setSingleValueOptions++++', | ||
'\nextraConfig: ', | ||
extraConfig, | ||
'\nlayout: ', | ||
layout, | ||
'\nmetaData: ', | ||
metaData, | ||
'\nseries: ', | ||
series, | ||
'\ndashboard: ', | ||
dashboard, | ||
'\nlegendSets: ', | ||
legendSets, | ||
'\nfontStyle: ', | ||
fontStyle, | ||
'\nnoData: ', | ||
noData, | ||
'\nlegendOptions: ', | ||
legendOptions, | ||
'\nicon: ', | ||
icon, | ||
'\n=============' | ||
) | ||
const customSVGOptions = { | ||
return { | ||
value, | ||
formattedValue: getSingleValueFormattedValue(value, layout, metaData), | ||
icon, | ||
dashboard, | ||
subText: 'Test', | ||
subText: getSingleValueSubtext(metaData), | ||
} | ||
console.log('singleValueCustomSvgOptions', customSVGOptions) | ||
return customSVGOptions | ||
} |
11 changes: 11 additions & 0 deletions
11
...ons/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueSubtext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { INDICATOR_FACTOR_100 } from './getSingleValueFormattedValue.js' | ||
|
||
export function getSingleValueSubtext(metaData) { | ||
const indicatorType = | ||
metaData.items[metaData.dimensions.dx[0]].indicatorType | ||
|
||
return indicatorType?.displayName && | ||
indicatorType?.factor !== INDICATOR_FACTOR_100 | ||
? indicatorType?.displayName | ||
: undefined | ||
} |