Skip to content

Commit

Permalink
fix: set subtext in customSVGOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Sep 12, 2024
1 parent bd8158b commit ffc03df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
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
}
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
}

0 comments on commit ffc03df

Please sign in to comment.