diff --git a/src/components/OrdinalFrame.tsx b/src/components/OrdinalFrame.tsx index 8080730a..4ab6fbcb 100644 --- a/src/components/OrdinalFrame.tsx +++ b/src/components/OrdinalFrame.tsx @@ -52,7 +52,7 @@ const defaultProps: Partial = { size: [500, 500], className: "", data: [], - oScaleType: scaleBand, + oScaleType: scaleBand(), rScaleType: scaleLinear, type: "none", useSpans: false, diff --git a/src/components/processing/ordinal.tsx b/src/components/processing/ordinal.tsx index 3f567254..f77494e5 100644 --- a/src/components/processing/ordinal.tsx +++ b/src/components/processing/ordinal.tsx @@ -303,9 +303,13 @@ export const calculateOrdinalFrame = ( { total: 0 } ) - const castOScaleType = oScaleType as unknown as Function + const castOScaleType = oScaleType as unknown as any - const oScale = dynamicColumnWidth ? scaleOrdinal() : castOScaleType() + const oScale = dynamicColumnWidth + ? scaleOrdinal() + : castOScaleType?.domain + ? castOScaleType + : castOScaleType() oScale.domain(oExtent) @@ -495,10 +499,11 @@ export const calculateOrdinalFrame = ( adjustedSize[0] ] - const castRScaleType = rScaleType as unknown as Function + const castRScaleType = rScaleType as unknown as any - const instantiatedRScaleType = rScaleType.domain - ? rScaleType + // if rScaleType has a domain that means it's instantiated, otherwise, it needs to be instantiated + const instantiatedRScaleType = castRScaleType.domain + ? castRScaleType : castRScaleType() const zeroCheck = instantiatedRScaleType(0) diff --git a/src/components/types/ordinalTypes.ts b/src/components/types/ordinalTypes.ts index 9c1f9e30..525288e7 100644 --- a/src/components/types/ordinalTypes.ts +++ b/src/components/types/ordinalTypes.ts @@ -80,7 +80,7 @@ export interface OrdinalFrameProps extends GeneralFrameProps { renderMode?: object | string | accessorType summaryRenderMode?: object | string | accessorType pixelColumnWidth?: number - oScaleType?: () => ScaleBand + oScaleType?: any rScaleType?: () => ScaleLinear data: Array oPadding?: number