@cardenelabs/cdl 0.31.1 → 0.33.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/CHANGELOG.md +30 -1
- package/README.md +66 -0
- package/dist/index.cjs +591 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +591 -65
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +589 -64
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +589 -64
- package/dist/react.js.map +1 -1
- package/dist/{render-D6wVFGfI.d.cts → render-C2rcAsgk.d.cts} +16 -2
- package/dist/{render-D6wVFGfI.d.ts → render-C2rcAsgk.d.ts} +16 -2
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/kinds/chart-number.ts +20 -0
- package/src/kinds/chart-pie.tsx +451 -48
- package/src/kinds/chart-slope.tsx +323 -0
- package/src/layout/spec.ts +1 -0
- package/src/layout/tokens.ts +2 -0
- package/src/presets.ts +3 -1
- package/src/render/nodes.tsx +12 -0
- package/src/render/template-fields.ts +2 -0
- package/src/types.ts +17 -1
- package/src/validate.ts +2 -0
- package/src/visual-validate.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -11746,6 +11746,7 @@ var KINDS_WITHOUT_TITLE_TEXT = /* @__PURE__ */ new Set([
|
|
|
11746
11746
|
"chart-stat",
|
|
11747
11747
|
"chart-waffle",
|
|
11748
11748
|
"chart-stacked-bar",
|
|
11749
|
+
"chart-slope",
|
|
11749
11750
|
"gantt-timeline",
|
|
11750
11751
|
"mind-map",
|
|
11751
11752
|
"funnel-stages",
|
|
@@ -13654,8 +13655,10 @@ var NODE_KINDS = [
|
|
|
13654
13655
|
"chart-radial",
|
|
13655
13656
|
"chart-stat",
|
|
13656
13657
|
// chart-stacked-bar は帯を割合で区切り時点を並べる形 (cdl#551)
|
|
13658
|
+
// chart-slope は 2 時点を直線でつなぎ増減と順位の入れ替わりを見せる形 (cdl#688)
|
|
13657
13659
|
"chart-waffle",
|
|
13658
13660
|
"chart-stacked-bar",
|
|
13661
|
+
"chart-slope",
|
|
13659
13662
|
// Timeline / Mind 系 (2、 CAR-994 Phase B) ... 1 node に payload 配列、 SVG geometry render
|
|
13660
13663
|
"gantt-timeline",
|
|
13661
13664
|
"mind-map",
|
|
@@ -15460,6 +15463,7 @@ var GRID_ALIGNED_KINDS = /* @__PURE__ */ new Set([
|
|
|
15460
15463
|
"chart-stat",
|
|
15461
15464
|
"chart-waffle",
|
|
15462
15465
|
"chart-stacked-bar",
|
|
15466
|
+
"chart-slope",
|
|
15463
15467
|
"funnel-stages",
|
|
15464
15468
|
"quadrant-matrix"
|
|
15465
15469
|
]);
|
|
@@ -15918,10 +15922,10 @@ function countEdgeCrossings(edges, warnAt = 3) {
|
|
|
15918
15922
|
if (isNearAny(p, a.ends, SAME_POINT_TOL) || isNearAny(p, b.ends, SAME_POINT_TOL))
|
|
15919
15923
|
continue;
|
|
15920
15924
|
if (\u5171\u6709\u5074.length > 0) {
|
|
15921
|
-
const \
|
|
15922
|
-
const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \
|
|
15925
|
+
const \u67A02 = Math.min(MAX_CHECKS - checks, MAX_CHECKS_PER_PAIR - pairChecks);
|
|
15926
|
+
const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \u67A02) };
|
|
15923
15927
|
const \u5224\u5B9A = mergesTowardShared(a.flat, b.flat, p, \u5171\u6709\u5074, MERGE_TOL, \u4E88\u7B97);
|
|
15924
|
-
const \u4F7F\u3063\u305F = Math.max(0, \
|
|
15928
|
+
const \u4F7F\u3063\u305F = Math.max(0, \u67A02) - \u4E88\u7B97.\u6B8B\u308A;
|
|
15925
15929
|
checks += \u4F7F\u3063\u305F;
|
|
15926
15930
|
pairChecks += \u4F7F\u3063\u305F;
|
|
15927
15931
|
if (\u5224\u5B9A === "merged") continue;
|
|
@@ -18066,6 +18070,8 @@ var TOKENS = {
|
|
|
18066
18070
|
"chart-waffle": { w: 640, h: 320 },
|
|
18067
18071
|
// 帯を最大 2 本 + 下に一覧。 縦は帯 2 本ぶんで足りる (cdl#551)
|
|
18068
18072
|
"chart-stacked-bar": { w: 640, h: 320 },
|
|
18073
|
+
// 左右 2 本の縦軸と、その外に名札。 縦は系列が縦に並ぶぶん要る (cdl#688)
|
|
18074
|
+
"chart-slope": { w: 640, h: 360 },
|
|
18069
18075
|
// Timeline / Mind 系 (CAR-994 Phase B)
|
|
18070
18076
|
"gantt-timeline": { w: 720, h: 360 },
|
|
18071
18077
|
"mind-map": { w: 720, h: 480 },
|
|
@@ -20779,6 +20785,7 @@ var DRAW_KINDS = /* @__PURE__ */ new Set([
|
|
|
20779
20785
|
"chart-line",
|
|
20780
20786
|
"chart-bar",
|
|
20781
20787
|
"chart-pie",
|
|
20788
|
+
"chart-slope",
|
|
20782
20789
|
"journey-map",
|
|
20783
20790
|
"mind-map",
|
|
20784
20791
|
"tree-hierarchy",
|
|
@@ -24341,52 +24348,52 @@ function ChartPieNode({
|
|
|
24341
24348
|
const y0 = node.cy - node.h / 2;
|
|
24342
24349
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
24343
24350
|
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
24351
|
+
const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
|
|
24352
|
+
const \u4ECA\u306E\u5024 = data.map((d) => Math.max(0, d.value));
|
|
24353
|
+
const \u524D\u306E\u5024 = data.map((d) => Math.max(0, d.previous ?? 0));
|
|
24354
|
+
const \u4ECA\u306E\u5408\u8A08 = \u4ECA\u306E\u5024.reduce((acc, value) => acc + value, 0);
|
|
24355
|
+
const \u524D\u306E\u5408\u8A08 = \u524D\u306E\u5024.reduce((acc, value) => acc + value, 0);
|
|
24356
|
+
const \u4ECA\u306E\u5272\u5408 = \u524D\u3042\u308A ? \u4ECA\u306E\u5024.map((value) => \u4ECA\u306E\u5408\u8A08 > 0 ? value / \u4ECA\u306E\u5408\u8A08 : 0) : data.map((d) => d.value / total);
|
|
24357
|
+
const \u524D\u306E\u5272\u5408 = \u524D\u306E\u5024.map((value) => \u524D\u306E\u5408\u8A08 > 0 ? value / \u524D\u306E\u5408\u8A08 : 0);
|
|
24358
|
+
const \u5F62 = node.chartPieForm === "arcs" || node.chartPieForm === "table" ? node.chartPieForm : "ring";
|
|
24344
24359
|
const PAD_TOP2 = 20;
|
|
24345
24360
|
const PAD_BOTTOM2 = 20;
|
|
24346
24361
|
const PAD_SIDE = 20;
|
|
24347
24362
|
const chartAreaH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
24348
|
-
const \
|
|
24349
|
-
const \
|
|
24363
|
+
const \u5272\u5408\u306E\u7D1A = 19;
|
|
24364
|
+
const \u540D\u524D\u306E\u7D1A = 12;
|
|
24350
24365
|
const \u5F15\u304D\u51FA\u3057 = 18;
|
|
24351
24366
|
const \u5B57\u307E\u3067\u306E\u9593 = 26;
|
|
24352
24367
|
const \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057 = 20;
|
|
24353
|
-
const \u5272\u5408\u306E\u6587\u5B57 =
|
|
24354
|
-
const \
|
|
24368
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u4ECA\u306E\u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
24369
|
+
const \u540D\u524D\u306E\u6587\u5B57 = data.map((d, i) => {
|
|
24370
|
+
const \u540D = d.label ?? "";
|
|
24371
|
+
if (\u524D\u3042\u308A) return `${\u540D} ${\u5B9F\u5024\u8868\u8A18(\u524D\u306E\u5024[i])} \u2192 ${\u5B9F\u5024\u8868\u8A18(\u4ECA\u306E\u5024[i])}`;
|
|
24372
|
+
return `${\u5B9F\u5024\u8868\u8A18(d.value)}%` === \u5272\u5408\u306E\u6587\u5B57[i] ? \u540D : `${\u540D} ${\u5B9F\u5024\u8868\u8A18(d.value)}`;
|
|
24373
|
+
});
|
|
24374
|
+
if (\u5F62 !== "ring") {
|
|
24375
|
+
const \u5171\u901A = { node, active, data, \u5272\u5408: \u4ECA\u306E\u5272\u5408, x0, y0, drawing, progress, instanceId };
|
|
24376
|
+
return \u5F62 === "arcs" ? \u5F27\u306E\u5F62(\u5171\u901A) : \u8868\u306E\u5F62(\u5171\u901A);
|
|
24377
|
+
}
|
|
24355
24378
|
const \u540D\u672D\u5E45 = Math.max(
|
|
24356
24379
|
0,
|
|
24357
24380
|
...data.map(
|
|
24358
|
-
(
|
|
24381
|
+
(_d, i) => Math.max(
|
|
24382
|
+
textWidth(\u5272\u5408\u306E\u6587\u5B57[i] ?? "", \u5272\u5408\u306E\u7D1A),
|
|
24383
|
+
textWidth(\u540D\u524D\u306E\u6587\u5B57[i] ?? "", \u540D\u524D\u306E\u7D1A)
|
|
24384
|
+
)
|
|
24359
24385
|
)
|
|
24360
24386
|
);
|
|
24361
24387
|
const \u7E26\u304B\u3089 = chartAreaH / 2 - \u5F15\u304D\u51FA\u3057 - \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057;
|
|
24362
24388
|
const \u6A2A\u304B\u3089 = (node.w - PAD_SIDE * 2) / 2 - \u5F15\u304D\u51FA\u3057 - \u5B57\u307E\u3067\u306E\u9593 - \u540D\u672D\u5E45;
|
|
24363
24389
|
const radius = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
24364
|
-
const \u5185\u534A\u5F84 = radius * 0.58;
|
|
24390
|
+
const \u5916\u306E\u5185\u534A\u5F84 = radius * (\u524D\u3042\u308A ? 0.75 : 0.58);
|
|
24391
|
+
const \u524D\u306E\u5916\u534A\u5F84 = radius * 0.67;
|
|
24392
|
+
const \u524D\u306E\u5185\u534A\u5F84 = radius * 0.42;
|
|
24365
24393
|
const cx = node.w / 2;
|
|
24366
24394
|
const cy = PAD_TOP2 + chartAreaH / 2;
|
|
24367
|
-
|
|
24368
|
-
|
|
24369
|
-
const slices = data.map((d) => {
|
|
24370
|
-
const frac = d.value / total;
|
|
24371
|
-
const angle = frac * Math.PI * 2;
|
|
24372
|
-
const a0 = cumAngle;
|
|
24373
|
-
const a1 = cumAngle + angle;
|
|
24374
|
-
cumAngle = a1;
|
|
24375
|
-
const startFrac = cumFrac;
|
|
24376
|
-
cumFrac += frac;
|
|
24377
|
-
const x1 = cx + radius * Math.cos(a0);
|
|
24378
|
-
const y1 = cy + radius * Math.sin(a0);
|
|
24379
|
-
const x2 = cx + radius * Math.cos(a1);
|
|
24380
|
-
const y2 = cy + radius * Math.sin(a1);
|
|
24381
|
-
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
24382
|
-
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
24383
|
-
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
24384
|
-
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
24385
|
-
const large = angle > Math.PI ? 1 : 0;
|
|
24386
|
-
const path = `M ${x1} ${y1} A ${radius} ${radius} 0 ${large} 1 ${x2} ${y2} L ${x3} ${y3} A ${\u5185\u534A\u5F84} ${\u5185\u534A\u5F84} 0 ${large} 0 ${x4} ${y4} Z`;
|
|
24387
|
-
const \u4E2D\u592E\u89D2 = (a0 + a1) / 2;
|
|
24388
|
-
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2 };
|
|
24389
|
-
});
|
|
24395
|
+
const \u524D\u306Eslices = \u524D\u3042\u308A ? \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u524D\u306E\u5916\u534A\u5F84, \u524D\u306E\u5185\u534A\u5F84, \u524D\u306E\u5272\u5408) : [];
|
|
24396
|
+
const slices = \u8F2A\u3092\u7D44\u3080(data, cx, cy, radius, \u5916\u306E\u5185\u534A\u5F84, \u4ECA\u306E\u5272\u5408);
|
|
24390
24397
|
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24391
24398
|
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
24392
24399
|
const \u5F71id = `cdl-pie-shadow-${instanceId}`;
|
|
@@ -24410,19 +24417,34 @@ function ChartPieNode({
|
|
|
24410
24417
|
drawing && /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }),
|
|
24411
24418
|
/* @__PURE__ */ jsx("filter", { id: \u5F71id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: /* @__PURE__ */ jsx("feDropShadow", { dx: "0", dy: "6", stdDeviation: "10", floodColor: "#0b1220", floodOpacity: "0.16" }) })
|
|
24412
24419
|
] }),
|
|
24413
|
-
/* @__PURE__ */
|
|
24414
|
-
|
|
24415
|
-
|
|
24416
|
-
|
|
24417
|
-
|
|
24418
|
-
|
|
24419
|
-
|
|
24420
|
-
|
|
24421
|
-
|
|
24422
|
-
|
|
24423
|
-
|
|
24424
|
-
|
|
24425
|
-
|
|
24420
|
+
/* @__PURE__ */ jsxs("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: [
|
|
24421
|
+
\u524D\u306Eslices.map((s, idx) => /* @__PURE__ */ jsx(
|
|
24422
|
+
"path",
|
|
24423
|
+
{
|
|
24424
|
+
"data-cdl-role": "chart-pie-slice-previous",
|
|
24425
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
24426
|
+
d: s.path,
|
|
24427
|
+
fill: sliceColor(s.d.tone, idx),
|
|
24428
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
24429
|
+
strokeWidth: 3,
|
|
24430
|
+
strokeLinejoin: "round"
|
|
24431
|
+
},
|
|
24432
|
+
`slice-previous-${idx}`
|
|
24433
|
+
)),
|
|
24434
|
+
slices.map((s, idx) => /* @__PURE__ */ jsx(
|
|
24435
|
+
"path",
|
|
24436
|
+
{
|
|
24437
|
+
"data-cdl-role": "chart-pie-slice",
|
|
24438
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
24439
|
+
d: s.path,
|
|
24440
|
+
fill: sliceColor(s.d.tone, idx),
|
|
24441
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
24442
|
+
strokeWidth: 3,
|
|
24443
|
+
strokeLinejoin: "round"
|
|
24444
|
+
},
|
|
24445
|
+
`slice-${idx}`
|
|
24446
|
+
))
|
|
24447
|
+
] }),
|
|
24426
24448
|
/* @__PURE__ */ jsx(
|
|
24427
24449
|
"text",
|
|
24428
24450
|
{
|
|
@@ -24432,7 +24454,7 @@ function ChartPieNode({
|
|
|
24432
24454
|
fontSize: Math.round(radius * 0.26),
|
|
24433
24455
|
fontWeight: 600,
|
|
24434
24456
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
24435
|
-
children: \u5B9F\u5024\u8868\u8A18(Math.round(total))
|
|
24457
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(\u524D\u3042\u308A ? \u4ECA\u306E\u5408\u8A08 : total))
|
|
24436
24458
|
}
|
|
24437
24459
|
),
|
|
24438
24460
|
/* @__PURE__ */ jsx(
|
|
@@ -24469,12 +24491,12 @@ function ChartPieNode({
|
|
|
24469
24491
|
"text",
|
|
24470
24492
|
{
|
|
24471
24493
|
x: \u5B57x,
|
|
24472
|
-
y: \u6298\u308Cy -
|
|
24494
|
+
y: \u6298\u308Cy - 1,
|
|
24473
24495
|
textAnchor: \u53F3 ? "start" : "end",
|
|
24474
|
-
fontSize: \
|
|
24496
|
+
fontSize: \u5272\u5408\u306E\u7D1A,
|
|
24475
24497
|
fontWeight: 600,
|
|
24476
24498
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
24477
|
-
children:
|
|
24499
|
+
children: \u5272\u5408\u306E\u6587\u5B57[idx]
|
|
24478
24500
|
}
|
|
24479
24501
|
),
|
|
24480
24502
|
/* @__PURE__ */ jsx(
|
|
@@ -24483,15 +24505,275 @@ function ChartPieNode({
|
|
|
24483
24505
|
x: \u5B57x,
|
|
24484
24506
|
y: \u6298\u308Cy + 15,
|
|
24485
24507
|
textAnchor: \u53F3 ? "start" : "end",
|
|
24486
|
-
fontSize: \
|
|
24508
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
24487
24509
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
24488
|
-
children: \
|
|
24510
|
+
children: \u540D\u524D\u306E\u6587\u5B57[idx]
|
|
24489
24511
|
}
|
|
24490
24512
|
)
|
|
24491
24513
|
] }, `callout-${idx}`);
|
|
24492
24514
|
})
|
|
24493
24515
|
] });
|
|
24494
24516
|
}
|
|
24517
|
+
function \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u5916\u534A\u5F84, \u5185\u534A\u5F84, \u5272\u5408) {
|
|
24518
|
+
let cumAngle = -Math.PI / 2;
|
|
24519
|
+
let cumFrac = 0;
|
|
24520
|
+
return data.map((d, idx) => {
|
|
24521
|
+
const frac = \u5272\u5408[idx] ?? 0;
|
|
24522
|
+
const angle = frac * Math.PI * 2;
|
|
24523
|
+
const a0 = cumAngle;
|
|
24524
|
+
const a1 = cumAngle + angle;
|
|
24525
|
+
cumAngle = a1;
|
|
24526
|
+
const startFrac = cumFrac;
|
|
24527
|
+
cumFrac += frac;
|
|
24528
|
+
const x1 = cx + \u5916\u534A\u5F84 * Math.cos(a0);
|
|
24529
|
+
const y1 = cy + \u5916\u534A\u5F84 * Math.sin(a0);
|
|
24530
|
+
const x2 = cx + \u5916\u534A\u5F84 * Math.cos(a1);
|
|
24531
|
+
const y2 = cy + \u5916\u534A\u5F84 * Math.sin(a1);
|
|
24532
|
+
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
24533
|
+
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
24534
|
+
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
24535
|
+
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
24536
|
+
const large = angle > Math.PI ? 1 : 0;
|
|
24537
|
+
const path = `M ${x1} ${y1} A ${\u5916\u534A\u5F84} ${\u5916\u534A\u5F84} 0 ${large} 1 ${x2} ${y2} L ${x3} ${y3} A ${\u5185\u534A\u5F84} ${\u5185\u534A\u5F84} 0 ${large} 0 ${x4} ${y4} Z`;
|
|
24538
|
+
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2: (a0 + a1) / 2 };
|
|
24539
|
+
});
|
|
24540
|
+
}
|
|
24541
|
+
function \u67A0(node, active) {
|
|
24542
|
+
return /* @__PURE__ */ jsx(
|
|
24543
|
+
"rect",
|
|
24544
|
+
{
|
|
24545
|
+
"data-cdl-role": "node-body",
|
|
24546
|
+
x: 0,
|
|
24547
|
+
y: 0,
|
|
24548
|
+
width: node.w,
|
|
24549
|
+
height: node.h,
|
|
24550
|
+
rx: 16,
|
|
24551
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
24552
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
24553
|
+
strokeWidth: active ? 3 : 1.25
|
|
24554
|
+
}
|
|
24555
|
+
);
|
|
24556
|
+
}
|
|
24557
|
+
function \u5F27\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress }) {
|
|
24558
|
+
const PAD = 20;
|
|
24559
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
24560
|
+
const \u5272\u5408\u306E\u7D1A = 24;
|
|
24561
|
+
const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
|
|
24562
|
+
const \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 = 24;
|
|
24563
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
24564
|
+
const \u4E00\u89A7\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A))) + \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 + Math.max(0, ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A)));
|
|
24565
|
+
const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
|
|
24566
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u4E00\u89A7\u5E45 - 28) / 2;
|
|
24567
|
+
const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
24568
|
+
const cx = PAD + R;
|
|
24569
|
+
const cy = node.h / 2;
|
|
24570
|
+
const \u7A74 = R * 0.34;
|
|
24571
|
+
const \u523B\u307F = (R - \u7A74) / Math.max(1, data.length);
|
|
24572
|
+
const \u592A\u3055 = Math.max(3, \u523B\u307F * 0.6);
|
|
24573
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24574
|
+
const \u4E00\u89A7\u5DE6 = node.w - PAD - \u4E00\u89A7\u5E45;
|
|
24575
|
+
const \u884C\u306E\u9593 = Math.min(56, (node.h - PAD * 2) / Math.max(1, data.length));
|
|
24576
|
+
const \u4E00\u89A7\u4E0A = node.h / 2 - \u884C\u306E\u9593 * (data.length - 1) / 2;
|
|
24577
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
24578
|
+
\u67A0(node, active),
|
|
24579
|
+
data.map((d, idx) => {
|
|
24580
|
+
const r = R - \u592A\u3055 / 2 - idx * \u523B\u307F;
|
|
24581
|
+
if (r <= \u592A\u3055 / 2) return null;
|
|
24582
|
+
const \u53D6\u308A\u5206 = (\u5272\u5408[idx] ?? 0) * (drawing ? \u958B\u304D : 1);
|
|
24583
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
24584
|
+
/* @__PURE__ */ jsx(
|
|
24585
|
+
"circle",
|
|
24586
|
+
{
|
|
24587
|
+
"data-cdl-role": "chart-pie-arc-track",
|
|
24588
|
+
cx,
|
|
24589
|
+
cy,
|
|
24590
|
+
r,
|
|
24591
|
+
fill: "none",
|
|
24592
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24593
|
+
strokeWidth: \u592A\u3055
|
|
24594
|
+
}
|
|
24595
|
+
),
|
|
24596
|
+
/* @__PURE__ */ jsx(
|
|
24597
|
+
"path",
|
|
24598
|
+
{
|
|
24599
|
+
"data-cdl-role": "chart-pie-arc",
|
|
24600
|
+
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
24601
|
+
d: \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206),
|
|
24602
|
+
fill: "none",
|
|
24603
|
+
stroke: sliceColor(d.tone, idx),
|
|
24604
|
+
strokeWidth: \u592A\u3055,
|
|
24605
|
+
strokeLinecap: "round"
|
|
24606
|
+
}
|
|
24607
|
+
)
|
|
24608
|
+
] }, `arc-${idx}`);
|
|
24609
|
+
}),
|
|
24610
|
+
data.map((d, idx) => {
|
|
24611
|
+
const y = \u4E00\u89A7\u4E0A + \u884C\u306E\u9593 * idx;
|
|
24612
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
24613
|
+
/* @__PURE__ */ jsx(
|
|
24614
|
+
"rect",
|
|
24615
|
+
{
|
|
24616
|
+
x: \u4E00\u89A7\u5DE6,
|
|
24617
|
+
y: y - 9,
|
|
24618
|
+
width: 10,
|
|
24619
|
+
height: 10,
|
|
24620
|
+
rx: 2,
|
|
24621
|
+
fill: sliceColor(d.tone, idx)
|
|
24622
|
+
}
|
|
24623
|
+
),
|
|
24624
|
+
/* @__PURE__ */ jsx(
|
|
24625
|
+
"text",
|
|
24626
|
+
{
|
|
24627
|
+
x: \u4E00\u89A7\u5DE6 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672,
|
|
24628
|
+
y,
|
|
24629
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
24630
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
24631
|
+
children: d.label
|
|
24632
|
+
}
|
|
24633
|
+
),
|
|
24634
|
+
/* @__PURE__ */ jsx(
|
|
24635
|
+
"text",
|
|
24636
|
+
{
|
|
24637
|
+
x: node.w - PAD,
|
|
24638
|
+
y: y + 4,
|
|
24639
|
+
textAnchor: "end",
|
|
24640
|
+
fontSize: \u5272\u5408\u306E\u7D1A,
|
|
24641
|
+
fontWeight: 600,
|
|
24642
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
24643
|
+
children: \u5272\u5408\u306E\u6587\u5B57[idx]
|
|
24644
|
+
}
|
|
24645
|
+
)
|
|
24646
|
+
] }, `row-${idx}`);
|
|
24647
|
+
})
|
|
24648
|
+
] });
|
|
24649
|
+
}
|
|
24650
|
+
function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress, instanceId }) {
|
|
24651
|
+
const PAD = 20;
|
|
24652
|
+
const \u898B\u51FA\u3057\u306E\u7D1A = 11;
|
|
24653
|
+
const \u540D\u524D\u306E\u7D1A = 15;
|
|
24654
|
+
const \u5272\u5408\u306E\u7D1A = 17;
|
|
24655
|
+
const \u5B9F\u6570\u306E\u7D1A = 15;
|
|
24656
|
+
const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
|
|
24657
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
24658
|
+
const \u5B9F\u6570\u306E\u6587\u5B57 = data.map((d) => \u5B9F\u5024\u8868\u8A18(d.value));
|
|
24659
|
+
const \u540D\u524D\u5E45 = Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A)));
|
|
24660
|
+
const \u5272\u5408\u5E45 = Math.max(textWidth("\u5272\u5408", \u898B\u51FA\u3057\u306E\u7D1A), ...\u5272\u5408\u306E\u6587\u5B57.map((t) => textWidth(t, \u5272\u5408\u306E\u7D1A)));
|
|
24661
|
+
const \u5B9F\u6570\u5E45 = Math.max(textWidth("\u5024", \u898B\u51FA\u3057\u306E\u7D1A), ...\u5B9F\u6570\u306E\u6587\u5B57.map((t) => textWidth(t, \u5B9F\u6570\u306E\u7D1A)));
|
|
24662
|
+
const \u8868\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + \u540D\u524D\u5E45 + 28 + \u5272\u5408\u5E45 + 24 + \u5B9F\u6570\u5E45;
|
|
24663
|
+
const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
|
|
24664
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u8868\u5E45 - 28) / 2;
|
|
24665
|
+
const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
24666
|
+
const \u5185\u534A\u5F84 = R * 0.58;
|
|
24667
|
+
const cx = PAD + R;
|
|
24668
|
+
const cy = node.h / 2;
|
|
24669
|
+
const \u8868\u5DE6 = node.w - PAD - \u8868\u5E45;
|
|
24670
|
+
const \u53F3\u7AEF = node.w - PAD;
|
|
24671
|
+
const \u5272\u5408\u53F3 = \u53F3\u7AEF - \u5B9F\u6570\u5E45 - 24;
|
|
24672
|
+
const \u884C\u306E\u9593 = Math.min(52, (node.h - PAD * 2 - 40) / Math.max(1, data.length));
|
|
24673
|
+
const \u898B\u51FA\u3057\u306Ey = node.h / 2 - \u884C\u306E\u9593 * data.length / 2 - 14;
|
|
24674
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24675
|
+
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
24676
|
+
const \u958B\u304D\u59CB\u3081\u305F = (\u59CB\u307E\u308A) => !drawing || \u958B\u304D > \u59CB\u307E\u308A;
|
|
24677
|
+
let \u89D2 = -Math.PI / 2;
|
|
24678
|
+
let \u7D2F\u8A08 = 0;
|
|
24679
|
+
const \u6247\u305F\u3061 = data.map((d, idx) => {
|
|
24680
|
+
const frac = \u5272\u5408[idx] ?? 0;
|
|
24681
|
+
const a0 = \u89D2;
|
|
24682
|
+
const a1 = \u89D2 + frac * Math.PI * 2;
|
|
24683
|
+
\u89D2 = a1;
|
|
24684
|
+
const \u59CB\u307E\u308A = \u7D2F\u8A08;
|
|
24685
|
+
\u7D2F\u8A08 += frac;
|
|
24686
|
+
return { d, idx, \u59CB\u307E\u308A, path: \u8F2A\u306E\u9053(cx, cy, R, \u5185\u534A\u5F84, a0, a1) };
|
|
24687
|
+
});
|
|
24688
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
24689
|
+
\u67A0(node, active),
|
|
24690
|
+
drawing && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, R + 2, \u958B\u304D) }) }),
|
|
24691
|
+
/* @__PURE__ */ jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, children: \u6247\u305F\u3061.map((s) => /* @__PURE__ */ jsx(
|
|
24692
|
+
"path",
|
|
24693
|
+
{
|
|
24694
|
+
"data-cdl-role": "chart-pie-slice",
|
|
24695
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
24696
|
+
d: s.path,
|
|
24697
|
+
fill: sliceColor(s.d.tone, s.idx),
|
|
24698
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
24699
|
+
strokeWidth: 3,
|
|
24700
|
+
strokeLinejoin: "round"
|
|
24701
|
+
},
|
|
24702
|
+
`slice-${s.idx}`
|
|
24703
|
+
)) }),
|
|
24704
|
+
/* @__PURE__ */ jsx(
|
|
24705
|
+
"text",
|
|
24706
|
+
{
|
|
24707
|
+
x: cx,
|
|
24708
|
+
y: cy - 2,
|
|
24709
|
+
textAnchor: "middle",
|
|
24710
|
+
fontSize: Math.round(R * 0.26),
|
|
24711
|
+
fontWeight: 600,
|
|
24712
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
24713
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(data.reduce((acc, d) => acc + d.value, 0)))
|
|
24714
|
+
}
|
|
24715
|
+
),
|
|
24716
|
+
/* @__PURE__ */ jsx(
|
|
24717
|
+
"text",
|
|
24718
|
+
{
|
|
24719
|
+
x: cx,
|
|
24720
|
+
y: cy + Math.round(R * 0.2),
|
|
24721
|
+
textAnchor: "middle",
|
|
24722
|
+
fontSize: Math.round(R * 0.12),
|
|
24723
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
24724
|
+
children: "\u5408\u8A08"
|
|
24725
|
+
}
|
|
24726
|
+
),
|
|
24727
|
+
/* @__PURE__ */ jsx("text", { x: \u8868\u5DE6, y: \u898B\u51FA\u3057\u306Ey, fontSize: \u898B\u51FA\u3057\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: "\u5185\u8A33" }),
|
|
24728
|
+
/* @__PURE__ */ jsx("text", { x: \u5272\u5408\u53F3, y: \u898B\u51FA\u3057\u306Ey, textAnchor: "end", fontSize: \u898B\u51FA\u3057\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: "\u5272\u5408" }),
|
|
24729
|
+
/* @__PURE__ */ jsx("text", { x: \u53F3\u7AEF, y: \u898B\u51FA\u3057\u306Ey, textAnchor: "end", fontSize: \u898B\u51FA\u3057\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: "\u5024" }),
|
|
24730
|
+
/* @__PURE__ */ jsx(
|
|
24731
|
+
"line",
|
|
24732
|
+
{
|
|
24733
|
+
"data-cdl-role": "chart-pie-table-rule",
|
|
24734
|
+
x1: \u8868\u5DE6,
|
|
24735
|
+
y1: \u898B\u51FA\u3057\u306Ey + 10,
|
|
24736
|
+
x2: \u53F3\u7AEF,
|
|
24737
|
+
y2: \u898B\u51FA\u3057\u306Ey + 10,
|
|
24738
|
+
stroke: "var(--cdl-text, #1a1f2a)",
|
|
24739
|
+
strokeWidth: 1.2
|
|
24740
|
+
}
|
|
24741
|
+
),
|
|
24742
|
+
\u6247\u305F\u3061.map((s) => {
|
|
24743
|
+
if (!\u958B\u304D\u59CB\u3081\u305F(s.\u59CB\u307E\u308A)) return null;
|
|
24744
|
+
const y = \u898B\u51FA\u3057\u306Ey + 40 + \u884C\u306E\u9593 * s.idx;
|
|
24745
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
24746
|
+
/* @__PURE__ */ jsx("rect", { x: \u8868\u5DE6, y: y - 10, width: 10, height: 10, rx: 2, fill: sliceColor(s.d.tone, s.idx) }),
|
|
24747
|
+
/* @__PURE__ */ jsx("text", { x: \u8868\u5DE6 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672, y, fontSize: \u540D\u524D\u306E\u7D1A, fill: "var(--cdl-text, #1a1f2a)", children: s.d.label }),
|
|
24748
|
+
/* @__PURE__ */ jsx("text", { x: \u5272\u5408\u53F3, y, textAnchor: "end", fontSize: \u5272\u5408\u306E\u7D1A, fontWeight: 600, fill: "var(--cdl-text, #1a1f2a)", children: \u5272\u5408\u306E\u6587\u5B57[s.idx] }),
|
|
24749
|
+
/* @__PURE__ */ jsx("text", { x: \u53F3\u7AEF, y, textAnchor: "end", fontSize: \u5B9F\u6570\u306E\u7D1A, fill: "var(--cdl-text-dim, #5a6270)", children: \u5B9F\u6570\u306E\u6587\u5B57[s.idx] }),
|
|
24750
|
+
/* @__PURE__ */ jsx(
|
|
24751
|
+
"line",
|
|
24752
|
+
{
|
|
24753
|
+
"data-cdl-role": "chart-pie-table-rule",
|
|
24754
|
+
x1: \u8868\u5DE6,
|
|
24755
|
+
y1: y + 16,
|
|
24756
|
+
x2: \u53F3\u7AEF,
|
|
24757
|
+
y2: y + 16,
|
|
24758
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24759
|
+
strokeWidth: 1
|
|
24760
|
+
}
|
|
24761
|
+
)
|
|
24762
|
+
] }, `row-${s.idx}`);
|
|
24763
|
+
})
|
|
24764
|
+
] });
|
|
24765
|
+
}
|
|
24766
|
+
function \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206) {
|
|
24767
|
+
const \u5B9F\u52B9 = Math.max(0, Math.min(0.9999, \u53D6\u308A\u5206));
|
|
24768
|
+
const a0 = -Math.PI / 2;
|
|
24769
|
+
const a1 = a0 + \u5B9F\u52B9 * Math.PI * 2;
|
|
24770
|
+
const large = \u5B9F\u52B9 > 0.5 ? 1 : 0;
|
|
24771
|
+
return `M ${cx + r * Math.cos(a0)} ${cy + r * Math.sin(a0)} A ${r} ${r} 0 ${large} 1 ${cx + r * Math.cos(a1)} ${cy + r * Math.sin(a1)}`;
|
|
24772
|
+
}
|
|
24773
|
+
function \u8F2A\u306E\u9053(cx, cy, R, r, a0, a1) {
|
|
24774
|
+
const large = a1 - a0 > Math.PI ? 1 : 0;
|
|
24775
|
+
return `M ${cx + R * Math.cos(a0)} ${cy + R * Math.sin(a0)} A ${R} ${R} 0 ${large} 1 ${cx + R * Math.cos(a1)} ${cy + R * Math.sin(a1)} L ${cx + r * Math.cos(a1)} ${cy + r * Math.sin(a1)} A ${r} ${r} 0 ${large} 0 ${cx + r * Math.cos(a0)} ${cy + r * Math.sin(a0)} Z`;
|
|
24776
|
+
}
|
|
24495
24777
|
function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
|
|
24496
24778
|
if (\u958B\u304D <= 0) return null;
|
|
24497
24779
|
if (\u958B\u304D >= 1) return /* @__PURE__ */ jsx("circle", { cx, cy, r });
|
|
@@ -24693,8 +24975,8 @@ function ChartRadialNode({
|
|
|
24693
24975
|
frac,
|
|
24694
24976
|
\u4E2D\u5FC3\u534A\u5F84,
|
|
24695
24977
|
// 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
|
|
24696
|
-
\u8ECC\u9053: \u5F27\u306E\
|
|
24697
|
-
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\
|
|
24978
|
+
\u8ECC\u9053: \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
|
|
24979
|
+
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(frac, 0.9999))
|
|
24698
24980
|
};
|
|
24699
24981
|
});
|
|
24700
24982
|
const \u4E00\u89A7\u306E\u59CB\u307E\u308A = PAD + (\u4F7F\u3048\u308B\u9AD8\u3055 - \u884C\u306E\u9AD8\u3055 * data.length) / 2 + \u884C\u306E\u9AD8\u3055 / 2;
|
|
@@ -24765,7 +25047,7 @@ function ChartRadialNode({
|
|
|
24765
25047
|
] });
|
|
24766
25048
|
}
|
|
24767
25049
|
var \u5370\u306E\u5E45 = 18;
|
|
24768
|
-
function \u5F27\u306E\
|
|
25050
|
+
function \u5F27\u306E\u90532(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
|
|
24769
25051
|
const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2;
|
|
24770
25052
|
const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2);
|
|
24771
25053
|
const a0 = -Math.PI / 2;
|
|
@@ -24811,12 +25093,12 @@ function ChartStatNode({
|
|
|
24811
25093
|
}
|
|
24812
25094
|
),
|
|
24813
25095
|
data.map((d, idx) => {
|
|
24814
|
-
const \
|
|
25096
|
+
const \u67A02 = \u533A\u753B.\u67A0(idx);
|
|
24815
25097
|
const frac = total > 0 ? d.value / total : 0;
|
|
24816
25098
|
const \u8272 = \u5370\u306E\u8272(d.tone, idx);
|
|
24817
25099
|
const \u6570\u5024 = \u5B9F\u5024\u8868\u8A184(d.value);
|
|
24818
|
-
const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \
|
|
24819
|
-
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\
|
|
25100
|
+
const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \u67A02.w - \u533A\u753B.\u4F59\u767D * 2, \u533A\u753B.\u6570\u5024\u306E\u7D1A, \u533A\u753B.\u540D\u524D\u306E\u7D1A + 1);
|
|
25101
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A02.x} ${\u67A02.y})`, children: [
|
|
24820
25102
|
idx > 0 && /* @__PURE__ */ jsx(
|
|
24821
25103
|
"line",
|
|
24822
25104
|
{
|
|
@@ -24824,7 +25106,7 @@ function ChartStatNode({
|
|
|
24824
25106
|
x1: 0,
|
|
24825
25107
|
y1: \u533A\u753B.\u4F59\u767D,
|
|
24826
25108
|
x2: 0,
|
|
24827
|
-
y2: \
|
|
25109
|
+
y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
|
|
24828
25110
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24829
25111
|
strokeWidth: 1
|
|
24830
25112
|
}
|
|
@@ -24833,7 +25115,7 @@ function ChartStatNode({
|
|
|
24833
25115
|
"text",
|
|
24834
25116
|
{
|
|
24835
25117
|
"data-cdl-role": "chart-stat-label",
|
|
24836
|
-
x: \
|
|
25118
|
+
x: \u67A02.w / 2,
|
|
24837
25119
|
y: \u533A\u753B.\u540D\u524D\u306Ey,
|
|
24838
25120
|
fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
|
|
24839
25121
|
fontWeight: 700,
|
|
@@ -24847,7 +25129,7 @@ function ChartStatNode({
|
|
|
24847
25129
|
{
|
|
24848
25130
|
"data-cdl-role": "chart-stat-value",
|
|
24849
25131
|
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
24850
|
-
x: \
|
|
25132
|
+
x: \u67A02.w / 2,
|
|
24851
25133
|
y: \u533A\u753B.\u6570\u5024\u306Ey,
|
|
24852
25134
|
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
24853
25135
|
fontWeight: 700,
|
|
@@ -24860,7 +25142,7 @@ function ChartStatNode({
|
|
|
24860
25142
|
"circle",
|
|
24861
25143
|
{
|
|
24862
25144
|
"data-cdl-role": "chart-stat-track",
|
|
24863
|
-
cx: \
|
|
25145
|
+
cx: \u67A02.w / 2,
|
|
24864
25146
|
cy: \u533A\u753B.\u5F27\u306Ey,
|
|
24865
25147
|
r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
|
|
24866
25148
|
fill: "none",
|
|
@@ -24873,7 +25155,7 @@ function ChartStatNode({
|
|
|
24873
25155
|
"path",
|
|
24874
25156
|
{
|
|
24875
25157
|
"data-cdl-role": "chart-stat-arc",
|
|
24876
|
-
d: \u5F27\u306E\
|
|
25158
|
+
d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
|
|
24877
25159
|
fill: "none",
|
|
24878
25160
|
stroke: \u8272,
|
|
24879
25161
|
strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
|
|
@@ -24884,7 +25166,7 @@ function ChartStatNode({
|
|
|
24884
25166
|
"text",
|
|
24885
25167
|
{
|
|
24886
25168
|
"data-cdl-role": "chart-stat-share",
|
|
24887
|
-
x: \
|
|
25169
|
+
x: \u67A02.w / 2,
|
|
24888
25170
|
y: \u533A\u753B.\u5272\u5408\u306Ey,
|
|
24889
25171
|
fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
|
|
24890
25172
|
textAnchor: "middle",
|
|
@@ -24929,7 +25211,7 @@ function \u53CE\u3081\u308B\u7D1A(\u5B57, \u4F7F\u3048\u308B\u5E452, \u521D\u671
|
|
|
24929
25211
|
while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B57, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
|
|
24930
25212
|
return \u7D1A;
|
|
24931
25213
|
}
|
|
24932
|
-
function \u5F27\u306E\
|
|
25214
|
+
function \u5F27\u306E\u90533(cx, cy, r, \u5272\u5408) {
|
|
24933
25215
|
const a0 = -Math.PI / 2;
|
|
24934
25216
|
const a1 = a0 + \u5272\u5408 * Math.PI * 2;
|
|
24935
25217
|
const large = \u5272\u5408 > 0.5 ? 1 : 0;
|
|
@@ -25237,6 +25519,238 @@ function \u4E00\u89A7\u306E\u4E26\u3073(data, \u5DE6, \u53F3\u7AEF, \u7D1A) {
|
|
|
25237
25519
|
});
|
|
25238
25520
|
return out;
|
|
25239
25521
|
}
|
|
25522
|
+
|
|
25523
|
+
// src/kinds/chart-number.ts
|
|
25524
|
+
function \u5B9F\u5024\u8868\u8A187(v) {
|
|
25525
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
25526
|
+
}
|
|
25527
|
+
var \u7DDA\u306E\u6700\u5C0F\u5E45 = 120;
|
|
25528
|
+
function ChartSlopeNode({
|
|
25529
|
+
node,
|
|
25530
|
+
active,
|
|
25531
|
+
stateValues = {},
|
|
25532
|
+
drawing = false,
|
|
25533
|
+
progress = 1
|
|
25534
|
+
}) {
|
|
25535
|
+
const x0 = node.cx - node.w / 2;
|
|
25536
|
+
const y0 = node.cy - node.h / 2;
|
|
25537
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
25538
|
+
const PAD = 24;
|
|
25539
|
+
const \u6642\u70B9\u306E\u7D1A = 12;
|
|
25540
|
+
const \u5024\u306E\u7D1A = 14;
|
|
25541
|
+
const \u540D\u524D\u306E\u4E0A\u9650\u7D1A = 13;
|
|
25542
|
+
const \u540D\u524D\u306E\u4E0B\u9650\u7D1A = 9;
|
|
25543
|
+
const \u8EF8\u304B\u3089\u5024\u307E\u3067 = 10;
|
|
25544
|
+
const \u5024\u304B\u3089\u540D\u524D\u307E\u3067 = 8;
|
|
25545
|
+
const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
|
|
25546
|
+
const \u7CFB\u5217\u305F\u3061 = data.map((d, i) => ({
|
|
25547
|
+
\u540D\u524D: d.label ?? "",
|
|
25548
|
+
// 前を持たない件は 0 から立ち上げる。 件を落とすと左右で系列の数が変わり、色の並びが
|
|
25549
|
+
// 対応しなくなる (`chart-stacked-bar` と同じ判断)
|
|
25550
|
+
\u524D: d.previous ?? 0,
|
|
25551
|
+
\u4ECA: d.value,
|
|
25552
|
+
\u8272: \u5370\u306E\u82724(d.tone, i),
|
|
25553
|
+
\u672A\u89E3\u6C7A: d.unresolved === true
|
|
25554
|
+
}));
|
|
25555
|
+
const \u5168\u90E8\u306E\u5024 = \u524D\u3042\u308A ? \u7CFB\u5217\u305F\u3061.flatMap((s) => [s.\u524D, s.\u4ECA]) : \u7CFB\u5217\u305F\u3061.map((s) => s.\u4ECA);
|
|
25556
|
+
const \u6700\u5C0F = \u5168\u90E8\u306E\u5024.length > 0 ? Math.min(...\u5168\u90E8\u306E\u5024) : 0;
|
|
25557
|
+
const \u6700\u5927 = \u5168\u90E8\u306E\u5024.length > 0 ? Math.max(...\u5168\u90E8\u306E\u5024) : 0;
|
|
25558
|
+
const \u5C3A\u306E\u5E45 = \u6700\u5927 - \u6700\u5C0F;
|
|
25559
|
+
const \u4E0A\u7AEF = PAD + (\u524D\u3042\u308A ? \u6642\u70B9\u306E\u7D1A + 12 : 0) + 6;
|
|
25560
|
+
const \u4E0B\u7AEF = Math.max(\u4E0A\u7AEF + 10, node.h - PAD - 6);
|
|
25561
|
+
const y\u3092\u53D6\u308B = (v) => \u5C3A\u306E\u5E45 > 0 ? \u4E0B\u7AEF - (v - \u6700\u5C0F) / \u5C3A\u306E\u5E45 * (\u4E0B\u7AEF - \u4E0A\u7AEF) : (\u4E0A\u7AEF + \u4E0B\u7AEF) / 2;
|
|
25562
|
+
const \u5DE6\u306E\u5B57 = \u7CFB\u5217\u305F\u3061.map((s) => \u5B9F\u5024\u8868\u8A187(s.\u524D));
|
|
25563
|
+
const \u53F3\u306E\u5B57 = \u7CFB\u5217\u305F\u3061.map((s) => \u5B9F\u5024\u8868\u8A187(s.\u4ECA));
|
|
25564
|
+
const \u5DE6\u5024\u5E45 = Math.max(0, ...\u5DE6\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A)));
|
|
25565
|
+
const \u53F3\u5024\u5E45 = Math.max(0, ...\u53F3\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A)));
|
|
25566
|
+
const \u540D\u524D\u306B\u4F7F\u3048\u308B = Math.max(
|
|
25567
|
+
0,
|
|
25568
|
+
(node.w - PAD * 2 - \u7DDA\u306E\u6700\u5C0F\u5E45 - (\u5DE6\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067) - (\u53F3\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067)) / 2
|
|
25569
|
+
);
|
|
25570
|
+
const \u540D\u524D\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A2(\u7CFB\u5217\u305F\u3061.map((s) => s.\u540D\u524D), \u540D\u524D\u306B\u4F7F\u3048\u308B, \u540D\u524D\u306E\u4E0A\u9650\u7D1A, \u540D\u524D\u306E\u4E0B\u9650\u7D1A);
|
|
25571
|
+
const \u540D\u524D\u5E45 = Math.min(
|
|
25572
|
+
\u540D\u524D\u306B\u4F7F\u3048\u308B,
|
|
25573
|
+
Math.max(0, ...\u7CFB\u5217\u305F\u3061.map((s) => textWidth(s.\u540D\u524D, \u540D\u524D\u306E\u7D1A)))
|
|
25574
|
+
);
|
|
25575
|
+
const \u5DE6\u306E\u4F59\u767D = \u540D\u524D\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067 + \u5DE6\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067;
|
|
25576
|
+
const \u53F3\u306E\u4F59\u767D = \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u53F3\u5024\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067 + \u540D\u524D\u5E45;
|
|
25577
|
+
const \u5DE6\u8EF8x = \u524D\u3042\u308A ? Math.max(PAD, Math.min(PAD + \u5DE6\u306E\u4F59\u767D, node.w / 2 - \u7DDA\u306E\u6700\u5C0F\u5E45 / 2)) : Math.max(PAD, Math.min(node.w / 2, node.w - PAD));
|
|
25578
|
+
const \u53F3\u8EF8x = \u524D\u3042\u308A ? Math.min(node.w - PAD, Math.max(node.w - PAD - \u53F3\u306E\u4F59\u767D, node.w / 2 + \u7DDA\u306E\u6700\u5C0F\u5E45 / 2)) : \u5DE6\u8EF8x;
|
|
25579
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
25580
|
+
const \u53F3\u3092\u51FA\u3059 = !drawing || \u4F38\u3073 >= 1;
|
|
25581
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
25582
|
+
/* @__PURE__ */ jsx(
|
|
25583
|
+
"rect",
|
|
25584
|
+
{
|
|
25585
|
+
"data-cdl-role": "node-body",
|
|
25586
|
+
x: 0,
|
|
25587
|
+
y: 0,
|
|
25588
|
+
width: node.w,
|
|
25589
|
+
height: node.h,
|
|
25590
|
+
rx: 16,
|
|
25591
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
25592
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
25593
|
+
strokeWidth: active ? 3 : 1.25
|
|
25594
|
+
}
|
|
25595
|
+
),
|
|
25596
|
+
(\u524D\u3042\u308A ? [\u5DE6\u8EF8x, \u53F3\u8EF8x] : [\u5DE6\u8EF8x]).map((x, i) => /* @__PURE__ */ jsx(
|
|
25597
|
+
"line",
|
|
25598
|
+
{
|
|
25599
|
+
"data-cdl-role": "chart-slope-axis",
|
|
25600
|
+
x1: x,
|
|
25601
|
+
y1: \u4E0A\u7AEF - 6,
|
|
25602
|
+
x2: x,
|
|
25603
|
+
y2: \u4E0B\u7AEF + 6,
|
|
25604
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
25605
|
+
strokeWidth: 1
|
|
25606
|
+
},
|
|
25607
|
+
`axis-${i}`
|
|
25608
|
+
)),
|
|
25609
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25610
|
+
/* @__PURE__ */ jsx(
|
|
25611
|
+
"text",
|
|
25612
|
+
{
|
|
25613
|
+
"data-cdl-role": "chart-slope-period",
|
|
25614
|
+
x: \u5DE6\u8EF8x,
|
|
25615
|
+
y: PAD + \u6642\u70B9\u306E\u7D1A,
|
|
25616
|
+
textAnchor: "middle",
|
|
25617
|
+
fontSize: \u6642\u70B9\u306E\u7D1A,
|
|
25618
|
+
fontWeight: 700,
|
|
25619
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
25620
|
+
children: "\u524D"
|
|
25621
|
+
}
|
|
25622
|
+
),
|
|
25623
|
+
/* @__PURE__ */ jsx(
|
|
25624
|
+
"text",
|
|
25625
|
+
{
|
|
25626
|
+
"data-cdl-role": "chart-slope-period",
|
|
25627
|
+
x: \u53F3\u8EF8x,
|
|
25628
|
+
y: PAD + \u6642\u70B9\u306E\u7D1A,
|
|
25629
|
+
textAnchor: "middle",
|
|
25630
|
+
fontSize: \u6642\u70B9\u306E\u7D1A,
|
|
25631
|
+
fontWeight: 700,
|
|
25632
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
25633
|
+
children: "\u4ECA"
|
|
25634
|
+
}
|
|
25635
|
+
)
|
|
25636
|
+
] }),
|
|
25637
|
+
\u7CFB\u5217\u305F\u3061.map((s, i) => {
|
|
25638
|
+
const \u5DE6y = y\u3092\u53D6\u308B(s.\u524D);
|
|
25639
|
+
const \u53F3y = y\u3092\u53D6\u308B(s.\u4ECA);
|
|
25640
|
+
const \u672A\u89E3\u6C7A = s.\u672A\u89E3\u6C7A ? "true" : void 0;
|
|
25641
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
25642
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
25643
|
+
"path",
|
|
25644
|
+
{
|
|
25645
|
+
"data-cdl-role": "chart-slope-line",
|
|
25646
|
+
"data-cdl-unresolved": \u672A\u89E3\u6C7A,
|
|
25647
|
+
d: `M ${\u5DE6\u8EF8x} ${\u5DE6y} L ${\u53F3\u8EF8x} ${\u53F3y}`,
|
|
25648
|
+
fill: "none",
|
|
25649
|
+
stroke: s.\u8272,
|
|
25650
|
+
strokeWidth: 2.5,
|
|
25651
|
+
strokeLinecap: "round",
|
|
25652
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
25653
|
+
}
|
|
25654
|
+
),
|
|
25655
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
25656
|
+
"circle",
|
|
25657
|
+
{
|
|
25658
|
+
"data-cdl-role": "chart-slope-dot",
|
|
25659
|
+
"data-cdl-unresolved": \u672A\u89E3\u6C7A,
|
|
25660
|
+
cx: \u5DE6\u8EF8x,
|
|
25661
|
+
cy: \u5DE6y,
|
|
25662
|
+
r: 4,
|
|
25663
|
+
fill: s.\u8272
|
|
25664
|
+
}
|
|
25665
|
+
),
|
|
25666
|
+
\u53F3\u3092\u51FA\u3059 && /* @__PURE__ */ jsx(
|
|
25667
|
+
"circle",
|
|
25668
|
+
{
|
|
25669
|
+
"data-cdl-role": "chart-slope-dot",
|
|
25670
|
+
"data-cdl-unresolved": \u672A\u89E3\u6C7A,
|
|
25671
|
+
cx: \u53F3\u8EF8x,
|
|
25672
|
+
cy: \u53F3y,
|
|
25673
|
+
r: 4,
|
|
25674
|
+
fill: s.\u8272
|
|
25675
|
+
}
|
|
25676
|
+
),
|
|
25677
|
+
\u524D\u3042\u308A ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25678
|
+
/* @__PURE__ */ jsx(
|
|
25679
|
+
"text",
|
|
25680
|
+
{
|
|
25681
|
+
"data-cdl-role": "chart-slope-label",
|
|
25682
|
+
x: \u5DE6\u8EF8x - \u8EF8\u304B\u3089\u5024\u307E\u3067,
|
|
25683
|
+
y: \u5DE6y + 5,
|
|
25684
|
+
textAnchor: "end",
|
|
25685
|
+
fontSize: \u5024\u306E\u7D1A,
|
|
25686
|
+
fontWeight: 600,
|
|
25687
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
25688
|
+
children: \u5DE6\u306E\u5B57[i]
|
|
25689
|
+
}
|
|
25690
|
+
),
|
|
25691
|
+
/* @__PURE__ */ jsx(
|
|
25692
|
+
"text",
|
|
25693
|
+
{
|
|
25694
|
+
"data-cdl-role": "chart-slope-label",
|
|
25695
|
+
x: \u5DE6\u8EF8x - \u8EF8\u304B\u3089\u5024\u307E\u3067 - \u5DE6\u5024\u5E45 - \u5024\u304B\u3089\u540D\u524D\u307E\u3067,
|
|
25696
|
+
y: \u5DE6y + 5,
|
|
25697
|
+
textAnchor: "end",
|
|
25698
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
25699
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
25700
|
+
children: s.\u540D\u524D
|
|
25701
|
+
}
|
|
25702
|
+
)
|
|
25703
|
+
] }) : /* @__PURE__ */ jsx(
|
|
25704
|
+
"text",
|
|
25705
|
+
{
|
|
25706
|
+
"data-cdl-role": "chart-slope-label",
|
|
25707
|
+
x: \u5DE6\u8EF8x - \u8EF8\u304B\u3089\u5024\u307E\u3067,
|
|
25708
|
+
y: \u53F3y + 5,
|
|
25709
|
+
textAnchor: "end",
|
|
25710
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
25711
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
25712
|
+
children: s.\u540D\u524D
|
|
25713
|
+
}
|
|
25714
|
+
),
|
|
25715
|
+
\u53F3\u3092\u51FA\u3059 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25716
|
+
/* @__PURE__ */ jsx(
|
|
25717
|
+
"text",
|
|
25718
|
+
{
|
|
25719
|
+
"data-cdl-role": "chart-slope-label",
|
|
25720
|
+
x: \u53F3\u8EF8x + \u8EF8\u304B\u3089\u5024\u307E\u3067,
|
|
25721
|
+
y: \u53F3y + 5,
|
|
25722
|
+
fontSize: \u5024\u306E\u7D1A,
|
|
25723
|
+
fontWeight: 600,
|
|
25724
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
25725
|
+
children: \u53F3\u306E\u5B57[i]
|
|
25726
|
+
}
|
|
25727
|
+
),
|
|
25728
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
25729
|
+
"text",
|
|
25730
|
+
{
|
|
25731
|
+
"data-cdl-role": "chart-slope-label",
|
|
25732
|
+
x: \u53F3\u8EF8x + \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u53F3\u5024\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067,
|
|
25733
|
+
y: \u53F3y + 5,
|
|
25734
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
25735
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
25736
|
+
children: s.\u540D\u524D
|
|
25737
|
+
}
|
|
25738
|
+
)
|
|
25739
|
+
] })
|
|
25740
|
+
] }, `slope-${i}`);
|
|
25741
|
+
})
|
|
25742
|
+
] });
|
|
25743
|
+
}
|
|
25744
|
+
function \u5370\u306E\u82724(tone, idx) {
|
|
25745
|
+
if (tone) return TONE[tone];
|
|
25746
|
+
return chartSeriesColor(idx);
|
|
25747
|
+
}
|
|
25748
|
+
function \u53CE\u3081\u308B\u7D1A2(\u540D\u524D\u305F\u3061, \u5E45, \u4E0A\u9650, \u4E0B\u9650) {
|
|
25749
|
+
if (\u540D\u524D\u305F\u3061.length === 0) return \u4E0A\u9650;
|
|
25750
|
+
let \u7D1A = \u4E0A\u9650;
|
|
25751
|
+
while (\u7D1A > \u4E0B\u9650 && Math.max(...\u540D\u524D\u305F\u3061.map((n) => textWidth(n, \u7D1A))) > \u5E45) \u7D1A -= 1;
|
|
25752
|
+
return \u7D1A;
|
|
25753
|
+
}
|
|
25240
25754
|
function ChartBarNode({
|
|
25241
25755
|
node,
|
|
25242
25756
|
active,
|
|
@@ -29916,6 +30430,17 @@ function CdlNodeView({
|
|
|
29916
30430
|
return /* @__PURE__ */ jsx(ChartGaugeNode, { node: resolvedNode, active, stateValues });
|
|
29917
30431
|
case "chart-stacked-bar":
|
|
29918
30432
|
return /* @__PURE__ */ jsx(ChartStackedBarNode, { node: resolvedNode, active, stateValues });
|
|
30433
|
+
case "chart-slope":
|
|
30434
|
+
return /* @__PURE__ */ jsx(
|
|
30435
|
+
ChartSlopeNode,
|
|
30436
|
+
{
|
|
30437
|
+
node: resolvedNode,
|
|
30438
|
+
active,
|
|
30439
|
+
stateValues,
|
|
30440
|
+
drawing,
|
|
30441
|
+
progress
|
|
30442
|
+
}
|
|
30443
|
+
);
|
|
29919
30444
|
case "chart-waffle":
|
|
29920
30445
|
return /* @__PURE__ */ jsx(ChartWaffleNode, { node: resolvedNode, active, stateValues });
|
|
29921
30446
|
case "chart-stat":
|
|
@@ -31697,7 +32222,8 @@ function chart(preset) {
|
|
|
31697
32222
|
radial: "chart-radial",
|
|
31698
32223
|
stat: "chart-stat",
|
|
31699
32224
|
waffle: "chart-waffle",
|
|
31700
|
-
"stacked-bar": "chart-stacked-bar"
|
|
32225
|
+
"stacked-bar": "chart-stacked-bar",
|
|
32226
|
+
slope: "chart-slope"
|
|
31701
32227
|
};
|
|
31702
32228
|
const api = {
|
|
31703
32229
|
datum(d) {
|