) => {
- const { data, px, py, ...rest } = props
- const line = d3.line(px, py).curve(d3.curveStepAfter)
+ const { data, px, py, curve, ...rest } = props
+ const line = d3.line
(px, py).curve(curve)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return
}
@@ -230,40 +242,40 @@ const AreaPathInternal =
(
px: number | ((p: P) => number)
py0: number | ((p: P) => number)
py1: number | ((p: P) => number)
+ curve: d3.CurveFactory
} & React.SVGProps
) => {
- const { data, px, py0, py1, ...rest } = props
- const area = d3.area(px, py0, py1).curve(d3.curveStepAfter)
+ const { data, px, py0, py1, curve, ...rest } = props
+ const area = d3.area
(px, py0, py1).curve(curve)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return
}
const AreaPath = memo(AreaPathInternal) as typeof AreaPathInternal
-const TwoAxisChart = (props: {
+const SVGChart = (props: {
children: React.ReactNode
w: number
h: number
- xScale: d3.ScaleTime
- yScale: d3.ScaleContinuousNumeric
+ xAxis: d3.Axis
+ yAxis: d3.Axis
onMouseOver?: (ev: React.PointerEvent) => void
onMouseLeave?: (ev: React.PointerEvent) => void
pct?: boolean
}) => {
- const { children, w, h, xScale, yScale, onMouseOver, onMouseLeave, pct } =
- props
+ const { children, w, h, xAxis, yAxis, onMouseOver, onMouseLeave } = props
const innerW = w - MARGIN_X
const innerH = h - MARGIN_Y
return (