|
|
|
|
@ -229,7 +229,7 @@ interface CellColors { |
|
|
|
|
|
|
|
|
|
interface TitleDimensions { |
|
|
|
|
fontSize: number; |
|
|
|
|
placement: 'above' | 'left' | 'below'; |
|
|
|
|
placement: 'above' | 'left' | 'below' | 'hidden'; |
|
|
|
|
width: number; |
|
|
|
|
height: number; |
|
|
|
|
} |
|
|
|
|
@ -246,6 +246,15 @@ function calculateTitleDimensions(props: Props): TitleDimensions { |
|
|
|
|
return { fontSize: 0, width: 0, height: 0, placement: 'above' }; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (namePlacement === BarGaugeNamePlacement.Hidden) { |
|
|
|
|
return { |
|
|
|
|
fontSize: 0, |
|
|
|
|
width: 0, |
|
|
|
|
height: 0, |
|
|
|
|
placement: BarGaugeNamePlacement.Hidden, |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isVertical(orientation)) { |
|
|
|
|
const fontSize = text?.titleSize ?? 14; |
|
|
|
|
return { |
|
|
|
|
@ -316,18 +325,22 @@ export function getTitleStyles(props: Props): { wrapper: CSSProperties; title: C |
|
|
|
|
alignSelf: 'center', |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
if (isVertical(props.orientation)) { |
|
|
|
|
wrapperStyles.flexDirection = 'column-reverse'; |
|
|
|
|
titleStyles.textAlign = 'center'; |
|
|
|
|
if (titleDim.placement === 'hidden') { |
|
|
|
|
titleStyles.display = 'none'; |
|
|
|
|
} else { |
|
|
|
|
if (titleDim.placement === 'above') { |
|
|
|
|
wrapperStyles.flexDirection = 'column'; |
|
|
|
|
if (isVertical(props.orientation)) { |
|
|
|
|
wrapperStyles.flexDirection = 'column-reverse'; |
|
|
|
|
titleStyles.textAlign = 'center'; |
|
|
|
|
} else { |
|
|
|
|
wrapperStyles.flexDirection = 'row'; |
|
|
|
|
if (titleDim.placement === 'above') { |
|
|
|
|
wrapperStyles.flexDirection = 'column'; |
|
|
|
|
} else { |
|
|
|
|
wrapperStyles.flexDirection = 'row'; |
|
|
|
|
|
|
|
|
|
titleStyles.width = `${titleDim.width}px`; |
|
|
|
|
titleStyles.textAlign = 'right'; |
|
|
|
|
titleStyles.paddingRight = '10px'; |
|
|
|
|
titleStyles.width = `${titleDim.width}px`; |
|
|
|
|
titleStyles.textAlign = 'right'; |
|
|
|
|
titleStyles.paddingRight = '10px'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|