Skip to content

Commit

Permalink
refactor: rename ShapeScale to PositionScale
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Aug 4, 2020
1 parent d0d59f8 commit 58d826d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/vx-shape/src/shapes/AreaClosed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import cx from 'classnames';
import { area } from 'd3-shape';
import { AreaProps } from './Area';
import setNumOrAccessor from '../util/setNumberOrNumberAccessor';
import { ShapeScale, AddSVGProps } from '../types';
import { PositionScale, AddSVGProps } from '../types';

export type AreaClosedProps<Datum> = {
yScale: ShapeScale;
yScale: PositionScale;
} & Pick<
AreaProps<Datum>,
| 'className'
Expand Down
4 changes: 2 additions & 2 deletions packages/vx-shape/src/shapes/BarGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cx from 'classnames';
import { Group } from '@vx/group';
import { ScaleInput } from '@vx/scale';
import Bar from './Bar';
import { ShapeScale, DatumObject, AnyScaleBand, AddSVGProps } from '../types';
import { PositionScale, DatumObject, AnyScaleBand, AddSVGProps } from '../types';
import { BaseBarGroupProps, BarGroup } from '../types/bar';
import { Accessor } from '../types/accessor';

Expand All @@ -20,7 +20,7 @@ export type BarGroupProps<
/** @vx/scale or d3-scale that takes a group key and maps it to an x axis position (within a group). */
x1Scale: X1Scale;
/** @vx/scale or d3-scale that takes an y value (Datum[key]) and maps it to a y axis position. */
yScale: ShapeScale;
yScale: PositionScale;
/** Total height of the y-axis. */
height: number;
/** Override render function which is passed the computed BarGroups. */
Expand Down
4 changes: 2 additions & 2 deletions packages/vx-shape/src/shapes/BarGroupHorizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cx from 'classnames';
import { Group } from '@vx/group';
import { ScaleInput } from '@vx/scale';
import Bar from './Bar';
import { ShapeScale, AnyScaleBand, DatumObject, AddSVGProps } from '../types';
import { PositionScale, AnyScaleBand, DatumObject, AddSVGProps } from '../types';
import { BarGroupHorizontal, BaseBarGroupProps } from '../types/bar';
import { Accessor } from '../types/accessor';

Expand All @@ -18,7 +18,7 @@ export type BarGroupHorizontalProps<
/** Returns the value mapped to the y0 (position of group) of a bar */
y0: Accessor<Datum, ScaleInput<Y0Scale>>;
/** @vx/scale or d3-scale that takes a key value (Datum[key]) and maps it to an x axis position (width of bar). */
xScale: ShapeScale;
xScale: PositionScale;
/** @vx/scale or d3-scale that takes a y0 value (position of group) and maps it to a y axis position. */
y0Scale: Y0Scale;
/** @vx/scale or d3-scale that takes a group key and maps it to an y axis position (within a group). */
Expand Down
6 changes: 3 additions & 3 deletions packages/vx-shape/src/shapes/BarStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import stackOrder from '../util/stackOrder';
import stackOffset from '../util/stackOffset';
import Bar from './Bar';
import { StackProps } from './Stack';
import { StackKey, $TSFIXME, ShapeScale, AddSVGProps } from '../types';
import { StackKey, $TSFIXME, PositionScale, AddSVGProps } from '../types';
import setNumOrAccessor from '../util/setNumberOrNumberAccessor';
import { BarStack } from '../types/bar';

Expand All @@ -21,9 +21,9 @@ export type BarStackProps<Datum, Key> = Pick<StackProps<Datum, Key>, PickProps>
/** Returns the value mapped to the y1 of a bar. */
y1?: (d: SeriesPoint<Datum>) => $TSFIXME;
/** @vx/scale or d3-scale that takes an x value and maps it to an x axis position. */
xScale: ShapeScale;
xScale: PositionScale;
/** @vx/scale or d3-scale that takes a y value and maps it to an y axis position. */
yScale: ShapeScale;
yScale: PositionScale;
/** Returns the desired color for a bar with a given key and index. */
color: (key: Key, index: number) => string;
/** Override render function which is passed the configured arc generator as input. */
Expand Down
2 changes: 1 addition & 1 deletion packages/vx-shape/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export type AnyScaleBand = PickD3Scale<'band', any, any>;

/** A catch-all type for scales that returns number */
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type ShapeScale = D3Scale<number, any, any>;
export type PositionScale = D3Scale<number, any, any>;

/**
* Add fields from `SVGProps` for the specified SVG `Element`
Expand Down

0 comments on commit 58d826d

Please sign in to comment.