Skip to content

Commit e01283c

Browse files
committed
Internal lib - Expose more data hooks in makeDonut util
1 parent 2729a62 commit e01283c

File tree

2 files changed

+42
-10
lines changed

2 files changed

+42
-10
lines changed

src/lib.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ export function makeDonut(item, cx, cy, rx, ry, piProportion = 1.99999, piMult =
5959
startY: checkNaN(startY),
6060
endX: checkNaN(endX),
6161
endY: checkNaN(endY),
62+
separator: {
63+
x: inner.startX,
64+
y: inner.startY,
65+
},
66+
firstSeparator: {
67+
x: Number(inner.path.split(' ').at(-2)),
68+
y: Number(inner.path.split(' ').at(-1))
69+
},
6270
center: createArc(
6371
[cx, cy],
6472
[rx * arcAmpl, ry * arcAmpl],

tests/lib.test.js

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,14 @@ describe("makeDonut", () => {
473473
startY: 90.00022085272826,
474474
endX: 108.69274956498154,
475475
endY: 95.0567111150052,
476+
firstSeparator: {
477+
x: 100.06646055814842,
478+
y: 90.00022085272826,
479+
},
480+
separator: {
481+
x: 108.69274956498154,
482+
y: 95.0567111150052,
483+
},
476484
center: {
477485
startX: 100.09636780931521,
478486
startY: 85.50032023645599,
@@ -494,6 +502,14 @@ describe("makeDonut", () => {
494502
startY: 95.0567111150052,
495503
endX: 99.93579085805592,
496504
endY: 109.9997938571798,
505+
firstSeparator: {
506+
x: 108.69274956498154,
507+
y: 95.0567111150052
508+
},
509+
separator: {
510+
x: 99.93579085805592,
511+
y: 109.9997938571798,
512+
},
497513
center: {
498514
startX: 112.60448686922324,
499515
startY: 92.83223111675754,
@@ -515,6 +531,14 @@ describe("makeDonut", () => {
515531
startY: 109.9997938571798,
516532
endX: 100.06300489435868,
517533
endY: 90.00019848280543,
534+
firstSeparator: {
535+
x: 99.93579085805592,
536+
y: 109.9997938571798
537+
},
538+
separator: {
539+
x: 100.06300489435868,
540+
y: 90.00019848280543,
541+
},
518542
center: {
519543
startX: 99.9068967441811,
520544
startY: 114.4997010929107,
@@ -2315,16 +2339,16 @@ describe("largestTriangleThreeBuckets", () => {
23152339
threshold: 10,
23162340
})
23172341
).toStrictEqual([
2318-
{x: 12,y: 27,},
2319-
{x: 11,y: 39,},
2320-
{x: 0,y: 8,},
2321-
{x: 66,y: 33,},
2322-
{x: 22,y: 6,},
2323-
{x: -20,y: 29,},
2324-
{x: 12,y: 44,},
2325-
{x: -16,y: -23,},
2326-
{x: 20,y: 19,},
2327-
{x: 20,y: 19,}
2342+
{ x: 12, y: 27, },
2343+
{ x: 11, y: 39, },
2344+
{ x: 0, y: 8, },
2345+
{ x: 66, y: 33, },
2346+
{ x: 22, y: 6, },
2347+
{ x: -20, y: 29, },
2348+
{ x: 12, y: 44, },
2349+
{ x: -16, y: -23, },
2350+
{ x: 20, y: 19, },
2351+
{ x: 20, y: 19, }
23282352
]);
23292353
});
23302354
test('should start downsampled series with first coordinates', () => {

0 commit comments

Comments
 (0)