improve chart scaling + add space below docker net chart for tooltip

This commit is contained in:
Henry Dollman
2024-08-05 19:17:54 -04:00
parent f36b0a4528
commit fdf0ce22dc
6 changed files with 61 additions and 45 deletions

View File

@@ -191,10 +191,10 @@ export function useYaxisWidth(chartRef: React.RefObject<HTMLDivElement>) {
const yAxisElement = chartRef?.current?.querySelector('.yAxis')
if (yAxisElement) {
// console.log('yAxisElement', yAxisElement)
setYAxisWidth(yAxisElement.getBoundingClientRect().width + 22)
clearInterval(interval)
setYAxisWidth(yAxisElement.getBoundingClientRect().width + 22)
}
}, 0)
}, 16)
return () => clearInterval(interval)
}, [])
return yAxisWidth
@@ -217,3 +217,7 @@ export function useClampedIsInViewport(options: HookOptions): [boolean | null, C
return [wasInViewportAtleastOnce, wrappedTargetRef]
}
export function toFixedWithoutTrailingZeros(num: number, digits: number) {
return parseFloat(num.toFixed(digits)).toString()
}