Skip to content

Commit

Permalink
fix: series point type
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Aug 6, 2020
1 parent afb69cd commit 443aaa3
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions packages/vx-shape/src/types/barStack.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
import { SeriesPoint } from 'd3-shape';
import { BarGroupBar } from './barGroup';
import { BaseStackProps, StackKey } from './stack';
import { PositionScale } from './base';

export { SeriesPoint };
/**
* Each series point j in a stack chart corresponds to the jth element in the input data.
* Each point is represented as an array [y0, y1] where y0 is the lower value (baseline) and y1 is the upper value (topline);
* the difference between y0 and y1 corresponds to the computed value for this point.
*
* SeriesPoint is a [number, number] two-element Array with added data and index properties
* related to the data element which formed the basis for theSeriesPoint.
*/
export interface SeriesPoint<Datum> extends Array<number> {
/**
* Corresponds to y0, the lower value (baseline).
*/
0: number;
/**
* Corresponds to y1, the upper value (topline).
*/
1: number;
/**
* The data element underlying the series point.
*/
data: Datum;
}

/** One BarStack is returned for each datum, which has multiple sub-bars (based on keys). */
export interface BarStack<Datum, Key> {
Expand Down

0 comments on commit 443aaa3

Please sign in to comment.