({
width,
height,
data,
xDataKey,
margin,
animationDuration,
animationEasing,
enterTransition,
revealSignature,
children,
containerRef,
barSize,
maxBarSize,
barGap,
stacked = false,
stackGap = 0,
}: ChartInnerProps)
| 189 | } |
| 190 | |
| 191 | function ChartInner({ |
| 192 | width, |
| 193 | height, |
| 194 | data, |
| 195 | xDataKey, |
| 196 | margin, |
| 197 | animationDuration, |
| 198 | animationEasing, |
| 199 | enterTransition, |
| 200 | revealSignature, |
| 201 | children, |
| 202 | containerRef, |
| 203 | barSize, |
| 204 | maxBarSize, |
| 205 | barGap, |
| 206 | stacked = false, |
| 207 | stackGap = 0, |
| 208 | }: ChartInnerProps) { |
| 209 | const { lines, barDataKeys } = useMemo( |
| 210 | () => extractComposedSeries(children), |
| 211 | [children] |
| 212 | ); |
| 213 | |
| 214 | const composedStackOffsets = useMemo(() => { |
| 215 | if (!(stacked && barDataKeys.length > 0)) { |
| 216 | return undefined; |
| 217 | } |
| 218 | const offsets = new Map<number, Map<string, number>>(); |
| 219 | for (let i = 0; i < data.length; i++) { |
| 220 | const d = data[i]; |
| 221 | if (!d) { |
| 222 | continue; |
| 223 | } |
| 224 | const pointOffsets = new Map<string, number>(); |
| 225 | let cumulative = 0; |
| 226 | for (const key of barDataKeys) { |
| 227 | pointOffsets.set(key, cumulative); |
| 228 | const v = d[key]; |
| 229 | if (typeof v === "number") { |
| 230 | cumulative += v; |
| 231 | } |
| 232 | } |
| 233 | offsets.set(i, pointOffsets); |
| 234 | } |
| 235 | return offsets; |
| 236 | }, [data, barDataKeys, stacked]); |
| 237 | |
| 238 | const yScaleDomainMax = useMemo( |
| 239 | () => |
| 240 | stacked && barDataKeys.length > 0 |
| 241 | ? computeComposedYScaleDomainMax(data, lines, barDataKeys) |
| 242 | : undefined, |
| 243 | [data, lines, barDataKeys, stacked] |
| 244 | ); |
| 245 | |
| 246 | return ( |
| 247 | <TimeSeriesChartInner |
| 248 | animationDuration={animationDuration} |
nothing calls this directly
no test coverage detected