Skip to content

Commit

Permalink
chore(stream): respond to pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze authored and plouc committed Jun 3, 2021
1 parent 780954a commit 54dc1c2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
32 changes: 28 additions & 4 deletions packages/stream/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,30 @@ declare module '@nivo/stream' {
y2: number
}

interface DotDatum extends StreamLayerDatum {
id: string
color: string
}

export interface DatumId {
id: string
}

export interface StreamLayerDatum {
index: number
x: number
value: number
y1: number
y2: number
}

export interface ComputedDatum {
id: number
layer: StreamLayerDatum[]
path: string
color: string
}

export type DatumToNumber = (datum: Datum) => number

interface OptionalStreamProps<T> extends SvgDefsAndFill<T>, MotionProps {
Expand All @@ -56,7 +80,7 @@ declare module '@nivo/stream' {
offsetType: StackOffset
curve: AreaCurve

legendLabel: PropertyAccessor<T, string>
legendLabel: PropertyAccessor<DatumId, string>

margin: Box

Expand All @@ -71,15 +95,15 @@ declare module '@nivo/stream' {
fillOpacity: number

borderWidth: number
borderColor: InheritedColorConfig<T>
borderColor: InheritedColorConfig<ComputedDatum>

enableDots: boolean
renderDot: StreamDotsItem
dotPosition: 'start' | 'center' | 'end'
dotSize: DatumToNumber | number
dotColor: InheritedColorConfig<T>
dotColor: InheritedColorConfig<DotDatum>
dotBorderWidth: DatumToNumber | number
dotBorderColor: InheritedColorConfig<T>
dotBorderColor: InheritedColorConfig<DotDatum>

isInteractive: boolean
tooltipLabel: TooltipLabel<T>
Expand Down
2 changes: 1 addition & 1 deletion website/src/data/components/stream/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ const props = [
Define how to access the legend label of each datum,
by default, nivo will look for the \`id\` property.
`,
type: 'string | (datum: RawDatum): string',
type: 'string | (datum: { id: string }): string',
required: false,
defaultValue: defaults.legendLabel,
group: 'Customization',
Expand Down

0 comments on commit 54dc1c2

Please sign in to comment.