-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parameter type of lineGenerator is weird #1604
Comments
Here is what I'm doing in the meantime interface FixedCustomLayerProps
extends Omit<CustomLayerProps, 'xScale' | 'yScale'> {
xScale: (x: DatumValue) => DatumValue;
yScale: (y: DatumValue) => DatumValue;
} |
My question is about lineGenerator. Not xScale or yScale. |
In @nivo/line/index.d.ts, there is a declation, export interface CustomLayerProps extends Omit<LineSvgProps, 'xScale' | 'yScale'> { And I changed lineGenerator type to D3Line<ComputedDatum['position']> and it works well without any messages. |
@hoi82 Any update on this issue ? I'm facing the same problem in my code |
When I make custom layer in ResponsiveLine, lineGenerator's parameter type is displayed,
'Iterable<{x: number, y: number}> | {x: number, y: number}[][]'
But, like below codes, pass the data like documents works well.
const CustomLine = (props: CustomLayerProps) => {
const { series, lineGenerator, xScale, yScale } = props;
return series.map((s : ComputedSerie) => {
const { id, data, color } = s;
return (
<path d={lineGenerator(data.map(d => ({ x: xScale(d.data.x), y: yScale(d.data.y) })))}
stroke={color} style={{strokeWidth: '1rem'}}/>
)
})
}
I'm using 0.70.1 version nivo/line, nivo/core, nivo/bar, nivo/tooltip.
Is there any missing of declares?
The text was updated successfully, but these errors were encountered: