Skip to content

Commit

Permalink
Get us back to working with scaleX or scaleX()
Browse files Browse the repository at this point in the history
  • Loading branch information
emeeks committed Jan 26, 2022
1 parent 4509169 commit ec02017
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/OrdinalFrame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const defaultProps: Partial<OrdinalFrameProps> = {
size: [500, 500],
className: "",
data: [],
oScaleType: scaleBand,
oScaleType: scaleBand(),
rScaleType: scaleLinear,
type: "none",
useSpans: false,
Expand Down
15 changes: 10 additions & 5 deletions src/components/processing/ordinal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/components/types/ordinalTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export interface OrdinalFrameProps extends GeneralFrameProps {
renderMode?: object | string | accessorType<string | object>
summaryRenderMode?: object | string | accessorType<string | object>
pixelColumnWidth?: number
oScaleType?: () => ScaleBand<string>
oScaleType?: any
rScaleType?: () => ScaleLinear<number, number>
data: Array<object | number>
oPadding?: number
Expand Down

0 comments on commit ec02017

Please sign in to comment.