Skip to content

Commit

Permalink
fix: scale type category missing ordinal
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw authored and zhaoyongjie committed Nov 26, 2021
1 parent 740c7d1 commit 814e572
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface ScaleAgent<Output extends Value> {
| ScaleOrdinal<{ toString(): string }, Output>
| ScalePoint<{ toString(): string }>
| ScaleBand<{ toString(): string }>;
scaleTypeCategory: 'continuous' | 'discrete' | 'discretizing';
scaleTypeCategory: 'continuous' | 'discrete' | 'discretizing' | undefined;
}

export interface ScaleTypeToD3ScaleType<Output> {
Expand Down Expand Up @@ -201,7 +201,7 @@ function createScale<Output extends Value>(
}

const continuousScaleTypes = new Set(['linear', 'pow', 'sqrt', 'symlog', 'log', 'time', 'utc']);
const discreteScaleTypes = new Set(['band', 'point']);
const discreteScaleTypes = new Set(['band', 'point', 'ordinal']);
const discretizingScaleTypes = new Set(['bin-ordinal', 'quantile', 'quantize', 'threshold']);

function getScaleTypeCategory(scaleType: ScaleType) {
Expand All @@ -215,7 +215,9 @@ function getScaleTypeCategory(scaleType: ScaleType) {
return 'discretizing';
}

throw new Error(`Unknown scaleType ${scaleType}`);
console.warn(`Unknown scaleType ${scaleType}`);

return undefined;
}

export default function extractScale<Output extends Value>(
Expand Down

0 comments on commit 814e572

Please sign in to comment.