Skip to content

Commit

Permalink
fix: autocenter fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Sciator committed Feb 10, 2021
1 parent e96d3ee commit e645c03
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion giraffe/src/components/GaugeMini.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,8 @@ export const GaugeMini: FunctionComponent<Props> = ({
labelBarsFontColor,
labelBarsFontSize,
colors,
axesSteps,
axesFontSize,
} = theme
const [barLabelsWidth] = useState<number[]>([])

Expand All @@ -501,7 +503,19 @@ export const GaugeMini: FunctionComponent<Props> = ({
const [autocenterToken, setAutocenterToken] = useState(0)
useEffect(() => {
setAutocenterToken(x => x + 1)
}, [barLabelWidth, sidePaddings, valueHeight, width, height])
}, [
width,
height,
barLabelWidth,
barsDefinitions,
valueHeight,
gaugeHeight,
barPaddings,
sidePaddings,
labelMainFontSize,
axesSteps,
axesFontSize,
])

/** return value as fraction 0->min 1->max */
const getFrac = (val: number): number => (val - colors.min.value) / colorLen
Expand Down

0 comments on commit e645c03

Please sign in to comment.