Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
fix: scale type category missing ordinal
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed May 31, 2019
1 parent 1d8d7bc commit 1516ed4
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 1516ed4

Please sign in to comment.