@octane-xplat/charts 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/core/marks.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { scaleBand } from 'd3-scale'
2
2
  import {
3
- arc as arcPath,
4
- area as areaPath,
5
- curveMonotoneX,
6
- line as linePath,
7
- pie as pieLayout,
3
+ arc as arcPath,
4
+ area as areaPath,
5
+ curveMonotoneX,
6
+ line as linePath,
7
+ pie as pieLayout,
8
8
  } from 'd3-shape'
9
9
 
10
10
  import type { ChartDatum, ChartType } from '../props'
@@ -15,368 +15,385 @@ import { categoryKey, xCenter } from './scales'
15
15
  /** Presentation attributes — the androidsvg ∩ SVGKit subset only (fills,
16
16
  * strokes, opacity). No filters, no text, no radial gradients. */
17
17
  export interface Paint {
18
- fill?: string
19
- fillOpacity?: number
20
- stroke?: string
21
- strokeOpacity?: number
22
- strokeWidth?: number
23
- strokeLinecap?: 'butt' | 'round' | 'square'
18
+ fill?: string
19
+ fillOpacity?: number
20
+ stroke?: string
21
+ strokeOpacity?: number
22
+ strokeWidth?: number
23
+ strokeLinecap?: 'butt' | 'round' | 'square'
24
24
  }
25
25
 
26
26
  /** Datum reference — lets the overlay and hit-test map marks back to data. */
27
27
  interface DatumRef {
28
- series?: number
29
- index?: number
28
+ series?: number
29
+ index?: number
30
30
  }
31
31
 
32
32
  export type Mark = DatumRef &
33
- Paint & { transform?: string } & (
34
- | { kind: 'path'; d: string }
35
- | { kind: 'rect'; x: number; y: number; width: number; height: number }
36
- | { kind: 'circle'; cx: number; cy: number; r: number }
37
- | { kind: 'line'; x1: number; y1: number; x2: number; y2: number }
38
- )
33
+ Paint & { transform?: string } & (
34
+ | { kind: 'path'; d: string }
35
+ | { kind: 'rect'; x: number; y: number; width: number; height: number }
36
+ | { kind: 'circle'; cx: number; cy: number; r: number }
37
+ | { kind: 'line'; x1: number; y1: number; x2: number; y2: number }
38
+ )
39
39
 
40
40
  /** One hit-testable datum position in chart space. */
41
41
  export interface ScenePoint {
42
- series: number
43
- index: number
44
- /** Snap-to-x group — String(datum.x). */
45
- key: string
46
- cx: number
47
- cy: number
48
- x: number | string | Date
49
- y: number
42
+ series: number
43
+ index: number
44
+ /** Snap-to-x group — String(datum.x). */
45
+ key: string
46
+ cx: number
47
+ cy: number
48
+ x: number | string | Date
49
+ y: number
50
50
  }
51
51
 
52
52
  export interface PieSlice {
53
- series: number
54
- index: number
55
- label: string
56
- value: number
57
- color: string
58
- startAngle: number
59
- endAngle: number
60
- /** Slice centroid relative to the pie center — the tooltip anchor. */
61
- cx: number
62
- cy: number
53
+ series: number
54
+ index: number
55
+ label: string
56
+ value: number
57
+ color: string
58
+ startAngle: number
59
+ endAngle: number
60
+ /** Slice centroid relative to the pie center — the tooltip anchor. */
61
+ cx: number
62
+ cy: number
63
63
  }
64
64
 
65
65
  export interface PieScene {
66
- /** Pie center in chart space (plot offset applied by scene.ts). */
67
- cx: number
68
- cy: number
69
- rOuter: number
70
- rInner: number
71
- slices: PieSlice[]
66
+ /** Pie center in chart space (plot offset applied by scene.ts). */
67
+ cx: number
68
+ cy: number
69
+ rOuter: number
70
+ rInner: number
71
+ slices: PieSlice[]
72
72
  }
73
73
 
74
74
  export interface ChartLayout {
75
- plot: PlotBox
76
- xKind: XScaleKind
77
- x: XScale
78
- y: YScale
75
+ plot: PlotBox
76
+ xKind: XScaleKind
77
+ x: XScale
78
+ y: YScale
79
79
  }
80
80
 
81
81
  export interface BuiltMarks {
82
- marks: Mark[]
83
- points: ScenePoint[]
84
- pie?: PieScene
82
+ marks: Mark[]
83
+ points: ScenePoint[]
84
+ pie?: PieScene
85
85
  }
86
86
 
87
87
  export function buildMarks(
88
- type: ChartType,
89
- layout: ChartLayout,
90
- series: ResolvedSeries[],
91
- options: { stacked?: boolean; innerRadiusRatio?: number; palette: string[] },
88
+ type: ChartType,
89
+ layout: ChartLayout,
90
+ series: ResolvedSeries[],
91
+ options: { stacked?: boolean; innerRadiusRatio?: number; palette: string[] },
92
92
  ): BuiltMarks {
93
- switch (type) {
94
- case 'line':
95
- return lineMarks(layout, series)
96
- case 'area':
97
- return areaMarks(layout, series)
98
- case 'scatter':
99
- return scatterMarks(layout, series)
100
- case 'bar':
101
- return options.stacked ? stackedBarMarks(layout, series) : groupedBarMarks(layout, series)
102
- case 'pie':
103
- return pieMarks(layout, series, options)
104
- }
93
+ switch (type) {
94
+ case 'line':
95
+ return lineMarks(layout, series)
96
+ case 'area':
97
+ return areaMarks(layout, series)
98
+ case 'scatter':
99
+ return scatterMarks(layout, series)
100
+ case 'bar':
101
+ return options.stacked ? stackedBarMarks(layout, series) : groupedBarMarks(layout, series)
102
+ case 'pie':
103
+ return pieMarks(layout, series, options)
104
+ }
105
105
  }
106
106
 
107
107
  function lineMarks(layout: ChartLayout, series: ResolvedSeries[]): BuiltMarks {
108
- const { xKind, x, y } = layout
109
- const gen = linePath<ChartDatum>()
110
- .defined((d) => Number.isFinite(d.y) && Number.isFinite(xCenter(xKind, x, d.x)))
111
- .x((d) => xCenter(xKind, x, d.x))
112
- .y((d) => y(d.y))
113
- .curve(curveMonotoneX)
114
-
115
- const marks: Mark[] = []
116
- const points: ScenePoint[] = []
117
- series.forEach((s, si) => {
118
- marks.push({
119
- kind: 'path',
120
- d: gen(s.values) ?? '',
121
- fill: 'none',
122
- stroke: s.color,
123
- strokeWidth: 2,
124
- strokeLinecap: 'round',
125
- series: si,
126
- })
127
-
128
- s.values.forEach((d, i) => {
129
- const cx = xCenter(xKind, x, d.x)
130
- const cy = y(d.y)
131
- if (!Number.isFinite(cx) || !Number.isFinite(cy)) {
132
- return
133
- }
134
-
135
- points.push({ series: si, index: i, key: categoryKey(d.x), cx, cy, x: d.x, y: d.y })
136
- })
137
- })
138
-
139
- return { marks, points }
108
+ const { xKind, x, y } = layout
109
+ const gen = linePath<ChartDatum>()
110
+ .defined((d) => Number.isFinite(d.y) && Number.isFinite(xCenter(xKind, x, d.x)))
111
+ .x((d) => xCenter(xKind, x, d.x))
112
+ .y((d) => y(d.y))
113
+ .curve(curveMonotoneX)
114
+
115
+ const marks: Mark[] = []
116
+ const points: ScenePoint[] = []
117
+
118
+ series.forEach((s, si) => {
119
+ marks.push({
120
+ kind: 'path',
121
+ d: gen(s.values) ?? '',
122
+ fill: 'none',
123
+ stroke: s.color,
124
+ strokeWidth: 2,
125
+ strokeLinecap: 'round',
126
+ series: si,
127
+ })
128
+
129
+ s.values.forEach((d, i) => {
130
+ const cx = xCenter(xKind, x, d.x)
131
+ const cy = y(d.y)
132
+
133
+ if (!Number.isFinite(cx) || !Number.isFinite(cy)) {
134
+ return
135
+ }
136
+
137
+ points.push({ series: si, index: i, key: categoryKey(d.x), cx, cy, x: d.x, y: d.y })
138
+ })
139
+ })
140
+
141
+ return { marks, points }
140
142
  }
141
143
 
142
144
  function areaMarks(layout: ChartLayout, series: ResolvedSeries[]): BuiltMarks {
143
- const { xKind, x, y } = layout
144
- const zero = y(Math.max(y.domain()[0], Math.min(0, y.domain()[1])))
145
- const defined = (d: ChartDatum) => Number.isFinite(d.y) && Number.isFinite(xCenter(xKind, x, d.x))
146
-
147
- const gen = areaPath<ChartDatum>()
148
- .defined(defined)
149
- .x((d) => xCenter(xKind, x, d.x))
150
- .y0(zero)
151
- .y1((d) => y(d.y))
152
- .curve(curveMonotoneX)
153
-
154
- const stroke = linePath<ChartDatum>()
155
- .defined(defined)
156
- .x((d) => xCenter(xKind, x, d.x))
157
- .y((d) => y(d.y))
158
- .curve(curveMonotoneX)
159
-
160
- const marks: Mark[] = []
161
- const points: ScenePoint[] = []
162
- series.forEach((s, si) => {
163
- marks.push({
164
- kind: 'path',
165
- d: gen(s.values) ?? '',
166
- fill: s.color,
167
- fillOpacity: 0.25,
168
- series: si,
169
- })
170
-
171
- marks.push({
172
- kind: 'path',
173
- d: stroke(s.values) ?? '',
174
- fill: 'none',
175
- stroke: s.color,
176
- strokeWidth: 2,
177
- series: si,
178
- })
179
-
180
- s.values.forEach((d, i) => {
181
- const cx = xCenter(xKind, x, d.x)
182
- const cy = y(d.y)
183
- if (!Number.isFinite(cx) || !Number.isFinite(cy)) {
184
- return
185
- }
186
-
187
- points.push({ series: si, index: i, key: categoryKey(d.x), cx, cy, x: d.x, y: d.y })
188
- })
189
- })
190
-
191
- return { marks, points }
145
+ const { xKind, x, y } = layout
146
+ const zero = y(Math.max(y.domain()[0], Math.min(0, y.domain()[1])))
147
+ const defined = (d: ChartDatum) => Number.isFinite(d.y) && Number.isFinite(xCenter(xKind, x, d.x))
148
+
149
+ const gen = areaPath<ChartDatum>()
150
+ .defined(defined)
151
+ .x((d) => xCenter(xKind, x, d.x))
152
+ .y0(zero)
153
+ .y1((d) => y(d.y))
154
+ .curve(curveMonotoneX)
155
+
156
+ const stroke = linePath<ChartDatum>()
157
+ .defined(defined)
158
+ .x((d) => xCenter(xKind, x, d.x))
159
+ .y((d) => y(d.y))
160
+ .curve(curveMonotoneX)
161
+
162
+ const marks: Mark[] = []
163
+ const points: ScenePoint[] = []
164
+
165
+ series.forEach((s, si) => {
166
+ marks.push({
167
+ kind: 'path',
168
+ d: gen(s.values) ?? '',
169
+ fill: s.color,
170
+ fillOpacity: 0.25,
171
+ series: si,
172
+ })
173
+
174
+ marks.push({
175
+ kind: 'path',
176
+ d: stroke(s.values) ?? '',
177
+ fill: 'none',
178
+ stroke: s.color,
179
+ strokeWidth: 2,
180
+ series: si,
181
+ })
182
+
183
+ s.values.forEach((d, i) => {
184
+ const cx = xCenter(xKind, x, d.x)
185
+ const cy = y(d.y)
186
+
187
+ if (!Number.isFinite(cx) || !Number.isFinite(cy)) {
188
+ return
189
+ }
190
+
191
+ points.push({ series: si, index: i, key: categoryKey(d.x), cx, cy, x: d.x, y: d.y })
192
+ })
193
+ })
194
+
195
+ return { marks, points }
192
196
  }
193
197
 
194
198
  function scatterMarks(layout: ChartLayout, series: ResolvedSeries[]): BuiltMarks {
195
- const { xKind, x, y } = layout
196
- const marks: Mark[] = []
197
- const points: ScenePoint[] = []
198
- series.forEach((s, si) => {
199
- s.values.forEach((d, i) => {
200
- const cx = xCenter(xKind, x, d.x)
201
- const cy = y(d.y)
202
- if (!Number.isFinite(cx) || !Number.isFinite(cy)) {
203
- return
204
- }
205
-
206
- marks.push({
207
- kind: 'circle',
208
- cx,
209
- cy,
210
- r: 3.5,
211
- fill: d.color ?? s.color,
212
- fillOpacity: 0.85,
213
- series: si,
214
- index: i,
215
- })
216
-
217
- points.push({ series: si, index: i, key: categoryKey(d.x), cx, cy, x: d.x, y: d.y })
218
- })
219
- })
220
-
221
- return { marks, points }
199
+ const { xKind, x, y } = layout
200
+ const marks: Mark[] = []
201
+ const points: ScenePoint[] = []
202
+
203
+ series.forEach((s, si) => {
204
+ s.values.forEach((d, i) => {
205
+ const cx = xCenter(xKind, x, d.x)
206
+ const cy = y(d.y)
207
+
208
+ if (!Number.isFinite(cx) || !Number.isFinite(cy)) {
209
+ return
210
+ }
211
+
212
+ marks.push({
213
+ kind: 'circle',
214
+ cx,
215
+ cy,
216
+ r: 3.5,
217
+ fill: d.color ?? s.color,
218
+ fillOpacity: 0.85,
219
+ series: si,
220
+ index: i,
221
+ })
222
+
223
+ points.push({ series: si, index: i, key: categoryKey(d.x), cx, cy, x: d.x, y: d.y })
224
+ })
225
+ })
226
+
227
+ return { marks, points }
222
228
  }
223
229
 
224
230
  function groupedBarMarks(layout: ChartLayout, series: ResolvedSeries[]): BuiltMarks {
225
- const { x, y } = layout
226
- const outer = x as ScaleBand<string>
227
- const inner = scaleBand<string>()
228
- .domain(series.map((_, i) => String(i)))
229
- .range([0, outer.bandwidth()])
230
- .padding(0.08)
231
-
232
- const marks: Mark[] = []
233
- const points: ScenePoint[] = []
234
- series.forEach((s, si) => {
235
- const offset = inner(String(si)) ?? 0
236
- const width = inner.bandwidth()
237
- s.values.forEach((d, i) => {
238
- const band = outer(String(d.x))
239
- if (band === undefined || !Number.isFinite(d.y)) {
240
- return
241
- }
242
-
243
- const top = y(Math.max(0, d.y))
244
- const bottom = y(Math.min(0, d.y))
245
- marks.push({
246
- kind: 'rect',
247
- x: band + offset,
248
- y: top,
249
- width,
250
- height: Math.max(0, bottom - top),
251
- fill: d.color ?? s.color,
252
- series: si,
253
- index: i,
254
- })
255
-
256
- points.push({
257
- series: si,
258
- index: i,
259
- key: categoryKey(d.x),
260
- cx: band + offset + width / 2,
261
- cy: y(d.y),
262
- x: d.x,
263
- y: d.y,
264
- })
265
- })
266
- })
267
-
268
- return { marks, points }
231
+ const { x, y } = layout
232
+ const outer = x as ScaleBand<string>
233
+ const inner = scaleBand<string>()
234
+ .domain(series.map((_, i) => String(i)))
235
+ .range([0, outer.bandwidth()])
236
+ .padding(0.08)
237
+
238
+ const marks: Mark[] = []
239
+ const points: ScenePoint[] = []
240
+
241
+ series.forEach((s, si) => {
242
+ const offset = inner(String(si)) ?? 0
243
+ const width = inner.bandwidth()
244
+
245
+ s.values.forEach((d, i) => {
246
+ const band = outer(String(d.x))
247
+
248
+ if (band === undefined || !Number.isFinite(d.y)) {
249
+ return
250
+ }
251
+
252
+ const top = y(Math.max(0, d.y))
253
+ const bottom = y(Math.min(0, d.y))
254
+
255
+ marks.push({
256
+ kind: 'rect',
257
+ x: band + offset,
258
+ y: top,
259
+ width,
260
+ height: Math.max(0, bottom - top),
261
+ fill: d.color ?? s.color,
262
+ series: si,
263
+ index: i,
264
+ })
265
+
266
+ points.push({
267
+ series: si,
268
+ index: i,
269
+ key: categoryKey(d.x),
270
+ cx: band + offset + width / 2,
271
+ cy: y(d.y),
272
+ x: d.x,
273
+ y: d.y,
274
+ })
275
+ })
276
+ })
277
+
278
+ return { marks, points }
269
279
  }
270
280
 
271
281
  /** Stacked bars accumulate per category — positive values stack up from the
272
282
  * baseline, negatives down, so mixed-sign data stays correct. */
273
283
  function stackedBarMarks(layout: ChartLayout, series: ResolvedSeries[]): BuiltMarks {
274
- const { x, y } = layout
275
- const outer = x as ScaleBand<string>
276
- const posBase = new Map<string, number>()
277
- const negBase = new Map<string, number>()
278
-
279
- const marks: Mark[] = []
280
- const points: ScenePoint[] = []
281
- series.forEach((s, si) => {
282
- s.values.forEach((d, i) => {
283
- const cat = String(d.x)
284
- const band = outer(cat)
285
- if (band === undefined || !Number.isFinite(d.y)) {
286
- return
287
- }
288
-
289
- const v0 = d.y >= 0 ? (posBase.get(cat) ?? 0) : (negBase.get(cat) ?? 0)
290
- const v1 = v0 + d.y
291
- if (d.y >= 0) {
292
- posBase.set(cat, v1)
293
- } else {
294
- negBase.set(cat, v1)
295
- }
296
-
297
- const top = y(Math.max(v0, v1))
298
- const bottom = y(Math.min(v0, v1))
299
- marks.push({
300
- kind: 'rect',
301
- x: band,
302
- y: top,
303
- width: outer.bandwidth(),
304
- height: Math.max(0, bottom - top),
305
- fill: d.color ?? s.color,
306
- series: si,
307
- index: i,
308
- })
309
-
310
- points.push({
311
- series: si,
312
- index: i,
313
- key: cat,
314
- cx: band + outer.bandwidth() / 2,
315
- cy: y(v1),
316
- x: d.x,
317
- y: d.y,
318
- })
319
- })
320
- })
321
-
322
- return { marks, points }
284
+ const { x, y } = layout
285
+ const outer = x as ScaleBand<string>
286
+ const posBase = new Map<string, number>()
287
+ const negBase = new Map<string, number>()
288
+
289
+ const marks: Mark[] = []
290
+ const points: ScenePoint[] = []
291
+
292
+ series.forEach((s, si) => {
293
+ s.values.forEach((d, i) => {
294
+ const cat = String(d.x)
295
+ const band = outer(cat)
296
+
297
+ if (band === undefined || !Number.isFinite(d.y)) {
298
+ return
299
+ }
300
+
301
+ const v0 = d.y >= 0 ? (posBase.get(cat) ?? 0) : (negBase.get(cat) ?? 0)
302
+ const v1 = v0 + d.y
303
+
304
+ if (d.y >= 0) {
305
+ posBase.set(cat, v1)
306
+ } else {
307
+ negBase.set(cat, v1)
308
+ }
309
+
310
+ const top = y(Math.max(v0, v1))
311
+ const bottom = y(Math.min(v0, v1))
312
+
313
+ marks.push({
314
+ kind: 'rect',
315
+ x: band,
316
+ y: top,
317
+ width: outer.bandwidth(),
318
+ height: Math.max(0, bottom - top),
319
+ fill: d.color ?? s.color,
320
+ series: si,
321
+ index: i,
322
+ })
323
+
324
+ points.push({
325
+ series: si,
326
+ index: i,
327
+ key: cat,
328
+ cx: band + outer.bandwidth() / 2,
329
+ cy: y(v1),
330
+ x: d.x,
331
+ y: d.y,
332
+ })
333
+ })
334
+ })
335
+
336
+ return { marks, points }
323
337
  }
324
338
 
325
339
  /** Pie consumes every datum across series — each {x: label, y: value} is a
326
340
  * slice; slice colors are categorical (palette by order) with datum.color
327
341
  * overrides. A series color is ignored on pie — it would be monochrome. */
328
342
  function pieMarks(
329
- layout: ChartLayout,
330
- series: ResolvedSeries[],
331
- options: { innerRadiusRatio?: number; palette: string[] },
343
+ layout: ChartLayout,
344
+ series: ResolvedSeries[],
345
+ options: { innerRadiusRatio?: number; palette: string[] },
332
346
  ): BuiltMarks {
333
- const { plot } = layout
334
- const flat: { d: ChartDatum; si: number; i: number }[] = []
335
- series.forEach((s, si) => s.values.forEach((d, i) => flat.push({ d, si, i })))
336
-
337
- // Marks are plot-space; d3 arcs generate around (0,0), so each slice path
338
- // carries its own translate to the pie center and scene.ts folds the plot
339
- // offset into the published pie center.
340
- const cx = plot.width / 2
341
- const cy = plot.height / 2
342
- const rOuter = Math.max(0, Math.min(plot.width, plot.height) / 2)
343
- const ratio = options.innerRadiusRatio ?? 0
344
- const rInner = rOuter * Math.min(Math.max(ratio, 0), 0.95)
345
-
346
- const arcs = pieLayout<{ d: ChartDatum; si: number; i: number }>()
347
- .value((v) => Math.max(0, v.d.y))
348
- .sort(null)(flat)
349
-
350
- const gen = arcPath<any, any>().innerRadius(rInner).outerRadius(rOuter)
351
-
352
- const marks: Mark[] = []
353
- const slices: PieSlice[] = []
354
- arcs.forEach((a, order) => {
355
- // Pie slices are categorical — palette by slice order; a series color on
356
- // pie would monochrome every slice. datum.color overrides.
357
- const color = a.data.d.color ?? options.palette[order % options.palette.length]
358
- const centroid = gen.centroid(a)
359
- marks.push({
360
- kind: 'path',
361
- d: gen(a) ?? '',
362
- transform: `translate(${cx} ${cy})`,
363
- fill: color,
364
- series: a.data.si,
365
- index: a.data.i,
366
- })
367
-
368
- slices.push({
369
- series: a.data.si,
370
- index: a.data.i,
371
- label: String(a.data.d.x),
372
- value: a.data.d.y,
373
- color,
374
- startAngle: a.startAngle,
375
- endAngle: a.endAngle,
376
- cx: centroid[0],
377
- cy: centroid[1],
378
- })
379
- })
380
-
381
- return { marks, points: [], pie: { cx, cy, rOuter, rInner, slices } }
347
+ const { plot } = layout
348
+ const flat: { d: ChartDatum; si: number; i: number }[] = []
349
+
350
+ series.forEach((s, si) => s.values.forEach((d, i) => flat.push({ d, si, i })))
351
+
352
+ // Marks are plot-space; d3 arcs generate around (0,0), so each slice path
353
+ // carries its own translate to the pie center and scene.ts folds the plot
354
+ // offset into the published pie center.
355
+ const cx = plot.width / 2
356
+ const cy = plot.height / 2
357
+ const rOuter = Math.max(0, Math.min(plot.width, plot.height) / 2)
358
+ const ratio = options.innerRadiusRatio ?? 0
359
+ const rInner = rOuter * Math.min(Math.max(ratio, 0), 0.95)
360
+
361
+ const arcs = pieLayout<{ d: ChartDatum; si: number; i: number }>()
362
+ .value((v) => Math.max(0, v.d.y))
363
+ .sort(null)(flat)
364
+
365
+ const gen = arcPath<any, any>().innerRadius(rInner).outerRadius(rOuter)
366
+
367
+ const marks: Mark[] = []
368
+ const slices: PieSlice[] = []
369
+
370
+ arcs.forEach((a, order) => {
371
+ // Pie slices are categorical — palette by slice order; a series color on
372
+ // pie would monochrome every slice. datum.color overrides.
373
+ const color = a.data.d.color ?? options.palette[order % options.palette.length]
374
+ const centroid = gen.centroid(a)
375
+
376
+ marks.push({
377
+ kind: 'path',
378
+ d: gen(a) ?? '',
379
+ transform: `translate(${cx} ${cy})`,
380
+ fill: color,
381
+ series: a.data.si,
382
+ index: a.data.i,
383
+ })
384
+
385
+ slices.push({
386
+ series: a.data.si,
387
+ index: a.data.i,
388
+ label: String(a.data.d.x),
389
+ value: a.data.d.y,
390
+ color,
391
+ startAngle: a.startAngle,
392
+ endAngle: a.endAngle,
393
+ cx: centroid[0],
394
+ cy: centroid[1],
395
+ })
396
+ })
397
+
398
+ return { marks, points: [], pie: { cx, cy, rOuter, rInner, slices } }
382
399
  }