From 267432f00e989eb04ddd595447e5e6e4f07ab6ae Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Fri, 18 Apr 2025 16:07:15 -0600 Subject: [PATCH] Update useY2Axis.ts --- .../ui/charts/BusterChartJS/hooks/useOptions/useY2Axis.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/src/components/ui/charts/BusterChartJS/hooks/useOptions/useY2Axis.ts b/web/src/components/ui/charts/BusterChartJS/hooks/useOptions/useY2Axis.ts index c0b0fa996..f1ecc0aca 100644 --- a/web/src/components/ui/charts/BusterChartJS/hooks/useOptions/useY2Axis.ts +++ b/web/src/components/ui/charts/BusterChartJS/hooks/useOptions/useY2Axis.ts @@ -41,12 +41,12 @@ export const useY2Axis = ({ const canUseSameY2Formatter = useMemo(() => { if (!isSupportedType) return false; - const hasMultipleY = selectedAxis.y2!.length > 1; - return hasMultipleY ? yAxisSimilar(selectedAxis.y2!, columnLabelFormats) : true; + const hasMultipleY = (selectedAxis.y2?.length || 0) > 1; + return hasMultipleY ? yAxisSimilar(selectedAxis.y2 || [], columnLabelFormats) : true; }, [selectedAxis.y2, columnLabelFormats, isSupportedType]); const title = useY2AxisTitle({ - y2Axis: selectedAxis.y2 || DEFAULT_CHART_CONFIG.comboChartAxis.y2!, + y2Axis: selectedAxis.y2 || DEFAULT_CHART_CONFIG.comboChartAxis.y2 || [], columnLabelFormats, y2AxisAxisTitle, y2AxisShowAxisTitle, @@ -62,7 +62,7 @@ export const useY2Axis = ({ const labelValue = this.getLabelForValue(index); return formatYAxisLabel( labelValue, - selectedAxis.y2!, + selectedAxis.y2 || [], canUseSameY2Formatter, columnLabelFormats, false