@cardenelabs/cdl 0.31.0 → 0.32.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 +25 -1
- package/README.md +40 -0
- package/dist/index.cjs +353 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +353 -64
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +353 -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 +353 -64
- package/dist/react.js.map +1 -1
- package/dist/{render-D6wVFGfI.d.cts → render-DjnLKv2Q.d.cts} +15 -1
- package/dist/{render-D6wVFGfI.d.ts → render-DjnLKv2Q.d.ts} +15 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/kinds/chart-line.tsx +11 -0
- package/src/kinds/chart-pie.tsx +451 -48
- package/src/render/template-fields.ts +2 -0
- package/src/types.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,28 @@ CDL (Chainome Diagram Language) の主要変更履歴。
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.32.0] - 2026-09-07
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **円グラフで datum の `previous` を内側の輪として描けるようになった** (#680)
|
|
13
|
+
- **円グラフの名札で割合を主役にした** (#683)。 1 行目が割合 (級 19 の太字)、2 行目が名前 (級 12)。 実数は割合と違う数になる図でだけ 2 行目に添える
|
|
14
|
+
- **円グラフの見せ方を記法から選べるようになった** (#684)。 `chartPieForm` に `arcs` (系列ごとに 1 本の弧) と `table` (図と表を左右に据える) を書ける。 欄を書かない図は今までどおりの輪
|
|
15
|
+
|
|
16
|
+
## [0.31.1] - 2026-09-06
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **折れ線図の図表の境界が分かるようになった** (#675)
|
|
21
|
+
|
|
22
|
+
`0.31.0` で図表の枠を外した。枠は何も表していないと判断したためだが、実際には図が
|
|
23
|
+
どこからどこまでかを示していた。外した結果、目盛線の外側と台の区別が付かなくなった。
|
|
24
|
+
|
|
25
|
+
前と同じ形には戻さず、境界だけを示す静かな細枠にした。色は折れ線と同じ
|
|
26
|
+
`--cdl-tone-accent` ではなく、目盛線と同じ `--cdl-divider` にした。太さは光っている時が
|
|
27
|
+
1.5、通常時が 1。読ませたい折れ線は光っている時が 3、通常時が 2 になり、今光っている
|
|
28
|
+
ことを枠と折れ線の両方で示す。
|
|
29
|
+
|
|
8
30
|
## [0.31.0] - 2026-09-06
|
|
9
31
|
|
|
10
32
|
### Added
|
|
@@ -1607,7 +1629,9 @@ Initial OSS release.
|
|
|
1607
1629
|
使わない = annotated tag を push しても GitHub Release は作られず、 Release を作っていない版で
|
|
1608
1630
|
行き止まりになる。
|
|
1609
1631
|
|
|
1610
|
-
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.
|
|
1632
|
+
[Unreleased]: https://github.com/cardene777/cdl/compare/v0.32.0...HEAD
|
|
1633
|
+
[0.32.0]: https://github.com/cardene777/cdl/compare/v0.31.1...v0.32.0
|
|
1634
|
+
[0.31.1]: https://github.com/cardene777/cdl/compare/v0.31.0...v0.31.1
|
|
1611
1635
|
[0.31.0]: https://github.com/cardene777/cdl/compare/v0.30.3...v0.31.0
|
|
1612
1636
|
[0.30.3]: https://github.com/cardene777/cdl/compare/v0.30.2...v0.30.3
|
|
1613
1637
|
[0.30.2]: https://github.com/cardene777/cdl/compare/v0.30.1...v0.30.2
|
package/README.md
CHANGED
|
@@ -244,6 +244,46 @@ state placeholder は node の `title` / `subtitle` / `eyebrow` / `value` 内で
|
|
|
244
244
|
|
|
245
245
|
phase 切替に連動して `status: idle` → `status: running` のように描画される。
|
|
246
246
|
|
|
247
|
+
## 2 時点の構成比
|
|
248
|
+
|
|
249
|
+
`chart-pie` と `chart-stacked-bar` は datum の `previous` で前の時点を受け取る。
|
|
250
|
+
`previous` を 1 件でも書くと、書かない datum も前の時点では 0 として扱うため、系列の色と
|
|
251
|
+
並びが時点間で対応する。
|
|
252
|
+
|
|
253
|
+
```ts
|
|
254
|
+
.node("share", {
|
|
255
|
+
lane: "l",
|
|
256
|
+
stack: 0,
|
|
257
|
+
kind: "chart-pie",
|
|
258
|
+
chartData: [
|
|
259
|
+
{ label: "Web", previous: 45, value: 30 },
|
|
260
|
+
{ label: "Mobile", previous: 35, value: 45 },
|
|
261
|
+
{ label: "API", value: 25 },
|
|
262
|
+
],
|
|
263
|
+
})
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`chart-pie` は前を内側、今を外側の輪で描き、名札には `45 → 30 30%` の形で今の割合を添える。
|
|
267
|
+
`chart-stacked-bar` は前から今の順に帯を並べる。`previous` を書かない図は、どちらも今だけを描く。
|
|
268
|
+
3 時点以上は持たない。
|
|
269
|
+
|
|
270
|
+
## 円グラフの見せ方
|
|
271
|
+
|
|
272
|
+
`chart-pie` は `chartPieForm` で見せ方を選ぶ。 欄を書かない図は `ring` と同じ。
|
|
273
|
+
|
|
274
|
+
| 値 | 形 | 向くもの |
|
|
275
|
+
|---|---|---|
|
|
276
|
+
| `ring` (既定) | 輪を扇に切り分け、外へ引き出し線を伸ばして名札を置く | 内訳の割合をひとめで見せる |
|
|
277
|
+
| `arcs` | 系列ごとに 1 本の弧を置き、割合を角度ではなく弧の長さで読む | 合計が 100 にならない図 (系列ごとの達成率など) |
|
|
278
|
+
| `table` | 輪を左に寄せ、右に 名前 / 割合 / 実数 の 3 列の表を組む | 割合と実数の両方を読ませたい図 |
|
|
279
|
+
|
|
280
|
+
```ts
|
|
281
|
+
.node("share", { lane: "l", stack: 0, kind: "chart-pie", chartPieForm: "arcs", chartData: [...] })
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
型の外の値を書いた図は `ring` として描く。 `previous` が効くのは `ring` だけで、
|
|
285
|
+
他の形では内側の輪を描かない。
|
|
286
|
+
|
|
247
287
|
## CdlDiagramView props
|
|
248
288
|
|
|
249
289
|
```ts
|
package/dist/index.cjs
CHANGED
|
@@ -15920,10 +15920,10 @@ function countEdgeCrossings(edges, warnAt = 3) {
|
|
|
15920
15920
|
if (isNearAny(p, a.ends, SAME_POINT_TOL) || isNearAny(p, b.ends, SAME_POINT_TOL))
|
|
15921
15921
|
continue;
|
|
15922
15922
|
if (\u5171\u6709\u5074.length > 0) {
|
|
15923
|
-
const \
|
|
15924
|
-
const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \
|
|
15923
|
+
const \u67A02 = Math.min(MAX_CHECKS - checks, MAX_CHECKS_PER_PAIR - pairChecks);
|
|
15924
|
+
const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \u67A02) };
|
|
15925
15925
|
const \u5224\u5B9A = mergesTowardShared(a.flat, b.flat, p, \u5171\u6709\u5074, MERGE_TOL, \u4E88\u7B97);
|
|
15926
|
-
const \u4F7F\u3063\u305F = Math.max(0, \
|
|
15926
|
+
const \u4F7F\u3063\u305F = Math.max(0, \u67A02) - \u4E88\u7B97.\u6B8B\u308A;
|
|
15927
15927
|
checks += \u4F7F\u3063\u305F;
|
|
15928
15928
|
pairChecks += \u4F7F\u3063\u305F;
|
|
15929
15929
|
if (\u5224\u5B9A === "merged") continue;
|
|
@@ -22472,6 +22472,20 @@ function ChartLineNode({
|
|
|
22472
22472
|
}
|
|
22473
22473
|
const gridTicks = scale.ticks.map((value) => ({ y: yAt(value), value }));
|
|
22474
22474
|
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
22475
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22476
|
+
"rect",
|
|
22477
|
+
{
|
|
22478
|
+
"data-cdl-role": "node-body",
|
|
22479
|
+
x: 0,
|
|
22480
|
+
y: 0,
|
|
22481
|
+
width: node.w,
|
|
22482
|
+
height: node.h,
|
|
22483
|
+
rx: 16,
|
|
22484
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
22485
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
22486
|
+
strokeWidth: active ? 1.5 : 1
|
|
22487
|
+
}
|
|
22488
|
+
),
|
|
22475
22489
|
gridTicks.map((t, i) => /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
22476
22490
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22477
22491
|
"line",
|
|
@@ -24329,52 +24343,52 @@ function ChartPieNode({
|
|
|
24329
24343
|
const y0 = node.cy - node.h / 2;
|
|
24330
24344
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
24331
24345
|
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
24346
|
+
const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
|
|
24347
|
+
const \u4ECA\u306E\u5024 = data.map((d) => Math.max(0, d.value));
|
|
24348
|
+
const \u524D\u306E\u5024 = data.map((d) => Math.max(0, d.previous ?? 0));
|
|
24349
|
+
const \u4ECA\u306E\u5408\u8A08 = \u4ECA\u306E\u5024.reduce((acc, value) => acc + value, 0);
|
|
24350
|
+
const \u524D\u306E\u5408\u8A08 = \u524D\u306E\u5024.reduce((acc, value) => acc + value, 0);
|
|
24351
|
+
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);
|
|
24352
|
+
const \u524D\u306E\u5272\u5408 = \u524D\u306E\u5024.map((value) => \u524D\u306E\u5408\u8A08 > 0 ? value / \u524D\u306E\u5408\u8A08 : 0);
|
|
24353
|
+
const \u5F62 = node.chartPieForm === "arcs" || node.chartPieForm === "table" ? node.chartPieForm : "ring";
|
|
24332
24354
|
const PAD_TOP2 = 20;
|
|
24333
24355
|
const PAD_BOTTOM2 = 20;
|
|
24334
24356
|
const PAD_SIDE = 20;
|
|
24335
24357
|
const chartAreaH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
24336
|
-
const \
|
|
24337
|
-
const \
|
|
24358
|
+
const \u5272\u5408\u306E\u7D1A = 19;
|
|
24359
|
+
const \u540D\u524D\u306E\u7D1A = 12;
|
|
24338
24360
|
const \u5F15\u304D\u51FA\u3057 = 18;
|
|
24339
24361
|
const \u5B57\u307E\u3067\u306E\u9593 = 26;
|
|
24340
24362
|
const \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057 = 20;
|
|
24341
|
-
const \u5272\u5408\u306E\u6587\u5B57 =
|
|
24342
|
-
const \
|
|
24363
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u4ECA\u306E\u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
24364
|
+
const \u540D\u524D\u306E\u6587\u5B57 = data.map((d, i) => {
|
|
24365
|
+
const \u540D = d.label ?? "";
|
|
24366
|
+
if (\u524D\u3042\u308A) return `${\u540D} ${\u5B9F\u5024\u8868\u8A18(\u524D\u306E\u5024[i])} \u2192 ${\u5B9F\u5024\u8868\u8A18(\u4ECA\u306E\u5024[i])}`;
|
|
24367
|
+
return `${\u5B9F\u5024\u8868\u8A18(d.value)}%` === \u5272\u5408\u306E\u6587\u5B57[i] ? \u540D : `${\u540D} ${\u5B9F\u5024\u8868\u8A18(d.value)}`;
|
|
24368
|
+
});
|
|
24369
|
+
if (\u5F62 !== "ring") {
|
|
24370
|
+
const \u5171\u901A = { node, active, data, \u5272\u5408: \u4ECA\u306E\u5272\u5408, x0, y0, drawing, progress, instanceId };
|
|
24371
|
+
return \u5F62 === "arcs" ? \u5F27\u306E\u5F62(\u5171\u901A) : \u8868\u306E\u5F62(\u5171\u901A);
|
|
24372
|
+
}
|
|
24343
24373
|
const \u540D\u672D\u5E45 = Math.max(
|
|
24344
24374
|
0,
|
|
24345
24375
|
...data.map(
|
|
24346
|
-
(
|
|
24376
|
+
(_d, i) => Math.max(
|
|
24377
|
+
textWidth(\u5272\u5408\u306E\u6587\u5B57[i] ?? "", \u5272\u5408\u306E\u7D1A),
|
|
24378
|
+
textWidth(\u540D\u524D\u306E\u6587\u5B57[i] ?? "", \u540D\u524D\u306E\u7D1A)
|
|
24379
|
+
)
|
|
24347
24380
|
)
|
|
24348
24381
|
);
|
|
24349
24382
|
const \u7E26\u304B\u3089 = chartAreaH / 2 - \u5F15\u304D\u51FA\u3057 - \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057;
|
|
24350
24383
|
const \u6A2A\u304B\u3089 = (node.w - PAD_SIDE * 2) / 2 - \u5F15\u304D\u51FA\u3057 - \u5B57\u307E\u3067\u306E\u9593 - \u540D\u672D\u5E45;
|
|
24351
24384
|
const radius = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
24352
|
-
const \u5185\u534A\u5F84 = radius * 0.58;
|
|
24385
|
+
const \u5916\u306E\u5185\u534A\u5F84 = radius * (\u524D\u3042\u308A ? 0.75 : 0.58);
|
|
24386
|
+
const \u524D\u306E\u5916\u534A\u5F84 = radius * 0.67;
|
|
24387
|
+
const \u524D\u306E\u5185\u534A\u5F84 = radius * 0.42;
|
|
24353
24388
|
const cx = node.w / 2;
|
|
24354
24389
|
const cy = PAD_TOP2 + chartAreaH / 2;
|
|
24355
|
-
|
|
24356
|
-
|
|
24357
|
-
const slices = data.map((d) => {
|
|
24358
|
-
const frac = d.value / total;
|
|
24359
|
-
const angle = frac * Math.PI * 2;
|
|
24360
|
-
const a0 = cumAngle;
|
|
24361
|
-
const a1 = cumAngle + angle;
|
|
24362
|
-
cumAngle = a1;
|
|
24363
|
-
const startFrac = cumFrac;
|
|
24364
|
-
cumFrac += frac;
|
|
24365
|
-
const x1 = cx + radius * Math.cos(a0);
|
|
24366
|
-
const y1 = cy + radius * Math.sin(a0);
|
|
24367
|
-
const x2 = cx + radius * Math.cos(a1);
|
|
24368
|
-
const y2 = cy + radius * Math.sin(a1);
|
|
24369
|
-
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
24370
|
-
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
24371
|
-
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
24372
|
-
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
24373
|
-
const large = angle > Math.PI ? 1 : 0;
|
|
24374
|
-
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`;
|
|
24375
|
-
const \u4E2D\u592E\u89D2 = (a0 + a1) / 2;
|
|
24376
|
-
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2 };
|
|
24377
|
-
});
|
|
24390
|
+
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) : [];
|
|
24391
|
+
const slices = \u8F2A\u3092\u7D44\u3080(data, cx, cy, radius, \u5916\u306E\u5185\u534A\u5F84, \u4ECA\u306E\u5272\u5408);
|
|
24378
24392
|
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24379
24393
|
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
24380
24394
|
const \u5F71id = `cdl-pie-shadow-${instanceId}`;
|
|
@@ -24398,19 +24412,34 @@ function ChartPieNode({
|
|
|
24398
24412
|
drawing && /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }),
|
|
24399
24413
|
/* @__PURE__ */ jsxRuntime.jsx("filter", { id: \u5F71id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: /* @__PURE__ */ jsxRuntime.jsx("feDropShadow", { dx: "0", dy: "6", stdDeviation: "10", floodColor: "#0b1220", floodOpacity: "0.16" }) })
|
|
24400
24414
|
] }),
|
|
24401
|
-
/* @__PURE__ */ jsxRuntime.
|
|
24402
|
-
|
|
24403
|
-
|
|
24404
|
-
|
|
24405
|
-
|
|
24406
|
-
|
|
24407
|
-
|
|
24408
|
-
|
|
24409
|
-
|
|
24410
|
-
|
|
24411
|
-
|
|
24412
|
-
|
|
24413
|
-
|
|
24415
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: [
|
|
24416
|
+
\u524D\u306Eslices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24417
|
+
"path",
|
|
24418
|
+
{
|
|
24419
|
+
"data-cdl-role": "chart-pie-slice-previous",
|
|
24420
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
24421
|
+
d: s.path,
|
|
24422
|
+
fill: sliceColor(s.d.tone, idx),
|
|
24423
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
24424
|
+
strokeWidth: 3,
|
|
24425
|
+
strokeLinejoin: "round"
|
|
24426
|
+
},
|
|
24427
|
+
`slice-previous-${idx}`
|
|
24428
|
+
)),
|
|
24429
|
+
slices.map((s, idx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24430
|
+
"path",
|
|
24431
|
+
{
|
|
24432
|
+
"data-cdl-role": "chart-pie-slice",
|
|
24433
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
24434
|
+
d: s.path,
|
|
24435
|
+
fill: sliceColor(s.d.tone, idx),
|
|
24436
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
24437
|
+
strokeWidth: 3,
|
|
24438
|
+
strokeLinejoin: "round"
|
|
24439
|
+
},
|
|
24440
|
+
`slice-${idx}`
|
|
24441
|
+
))
|
|
24442
|
+
] }),
|
|
24414
24443
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24415
24444
|
"text",
|
|
24416
24445
|
{
|
|
@@ -24420,7 +24449,7 @@ function ChartPieNode({
|
|
|
24420
24449
|
fontSize: Math.round(radius * 0.26),
|
|
24421
24450
|
fontWeight: 600,
|
|
24422
24451
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
24423
|
-
children: \u5B9F\u5024\u8868\u8A18(Math.round(total))
|
|
24452
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(\u524D\u3042\u308A ? \u4ECA\u306E\u5408\u8A08 : total))
|
|
24424
24453
|
}
|
|
24425
24454
|
),
|
|
24426
24455
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -24457,12 +24486,12 @@ function ChartPieNode({
|
|
|
24457
24486
|
"text",
|
|
24458
24487
|
{
|
|
24459
24488
|
x: \u5B57x,
|
|
24460
|
-
y: \u6298\u308Cy -
|
|
24489
|
+
y: \u6298\u308Cy - 1,
|
|
24461
24490
|
textAnchor: \u53F3 ? "start" : "end",
|
|
24462
|
-
fontSize: \
|
|
24491
|
+
fontSize: \u5272\u5408\u306E\u7D1A,
|
|
24463
24492
|
fontWeight: 600,
|
|
24464
24493
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
24465
|
-
children:
|
|
24494
|
+
children: \u5272\u5408\u306E\u6587\u5B57[idx]
|
|
24466
24495
|
}
|
|
24467
24496
|
),
|
|
24468
24497
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -24471,15 +24500,275 @@ function ChartPieNode({
|
|
|
24471
24500
|
x: \u5B57x,
|
|
24472
24501
|
y: \u6298\u308Cy + 15,
|
|
24473
24502
|
textAnchor: \u53F3 ? "start" : "end",
|
|
24474
|
-
fontSize: \
|
|
24503
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
24475
24504
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
24476
|
-
children: \
|
|
24505
|
+
children: \u540D\u524D\u306E\u6587\u5B57[idx]
|
|
24477
24506
|
}
|
|
24478
24507
|
)
|
|
24479
24508
|
] }, `callout-${idx}`);
|
|
24480
24509
|
})
|
|
24481
24510
|
] });
|
|
24482
24511
|
}
|
|
24512
|
+
function \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u5916\u534A\u5F84, \u5185\u534A\u5F84, \u5272\u5408) {
|
|
24513
|
+
let cumAngle = -Math.PI / 2;
|
|
24514
|
+
let cumFrac = 0;
|
|
24515
|
+
return data.map((d, idx) => {
|
|
24516
|
+
const frac = \u5272\u5408[idx] ?? 0;
|
|
24517
|
+
const angle = frac * Math.PI * 2;
|
|
24518
|
+
const a0 = cumAngle;
|
|
24519
|
+
const a1 = cumAngle + angle;
|
|
24520
|
+
cumAngle = a1;
|
|
24521
|
+
const startFrac = cumFrac;
|
|
24522
|
+
cumFrac += frac;
|
|
24523
|
+
const x1 = cx + \u5916\u534A\u5F84 * Math.cos(a0);
|
|
24524
|
+
const y1 = cy + \u5916\u534A\u5F84 * Math.sin(a0);
|
|
24525
|
+
const x2 = cx + \u5916\u534A\u5F84 * Math.cos(a1);
|
|
24526
|
+
const y2 = cy + \u5916\u534A\u5F84 * Math.sin(a1);
|
|
24527
|
+
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
24528
|
+
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
24529
|
+
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
24530
|
+
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
24531
|
+
const large = angle > Math.PI ? 1 : 0;
|
|
24532
|
+
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`;
|
|
24533
|
+
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2: (a0 + a1) / 2 };
|
|
24534
|
+
});
|
|
24535
|
+
}
|
|
24536
|
+
function \u67A0(node, active) {
|
|
24537
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24538
|
+
"rect",
|
|
24539
|
+
{
|
|
24540
|
+
"data-cdl-role": "node-body",
|
|
24541
|
+
x: 0,
|
|
24542
|
+
y: 0,
|
|
24543
|
+
width: node.w,
|
|
24544
|
+
height: node.h,
|
|
24545
|
+
rx: 16,
|
|
24546
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
24547
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
24548
|
+
strokeWidth: active ? 3 : 1.25
|
|
24549
|
+
}
|
|
24550
|
+
);
|
|
24551
|
+
}
|
|
24552
|
+
function \u5F27\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress }) {
|
|
24553
|
+
const PAD = 20;
|
|
24554
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
24555
|
+
const \u5272\u5408\u306E\u7D1A = 24;
|
|
24556
|
+
const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
|
|
24557
|
+
const \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 = 24;
|
|
24558
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
24559
|
+
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)));
|
|
24560
|
+
const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
|
|
24561
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u4E00\u89A7\u5E45 - 28) / 2;
|
|
24562
|
+
const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
24563
|
+
const cx = PAD + R;
|
|
24564
|
+
const cy = node.h / 2;
|
|
24565
|
+
const \u7A74 = R * 0.34;
|
|
24566
|
+
const \u523B\u307F = (R - \u7A74) / Math.max(1, data.length);
|
|
24567
|
+
const \u592A\u3055 = Math.max(3, \u523B\u307F * 0.6);
|
|
24568
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24569
|
+
const \u4E00\u89A7\u5DE6 = node.w - PAD - \u4E00\u89A7\u5E45;
|
|
24570
|
+
const \u884C\u306E\u9593 = Math.min(56, (node.h - PAD * 2) / Math.max(1, data.length));
|
|
24571
|
+
const \u4E00\u89A7\u4E0A = node.h / 2 - \u884C\u306E\u9593 * (data.length - 1) / 2;
|
|
24572
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
24573
|
+
\u67A0(node, active),
|
|
24574
|
+
data.map((d, idx) => {
|
|
24575
|
+
const r = R - \u592A\u3055 / 2 - idx * \u523B\u307F;
|
|
24576
|
+
if (r <= \u592A\u3055 / 2) return null;
|
|
24577
|
+
const \u53D6\u308A\u5206 = (\u5272\u5408[idx] ?? 0) * (drawing ? \u958B\u304D : 1);
|
|
24578
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
24579
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24580
|
+
"circle",
|
|
24581
|
+
{
|
|
24582
|
+
"data-cdl-role": "chart-pie-arc-track",
|
|
24583
|
+
cx,
|
|
24584
|
+
cy,
|
|
24585
|
+
r,
|
|
24586
|
+
fill: "none",
|
|
24587
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24588
|
+
strokeWidth: \u592A\u3055
|
|
24589
|
+
}
|
|
24590
|
+
),
|
|
24591
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24592
|
+
"path",
|
|
24593
|
+
{
|
|
24594
|
+
"data-cdl-role": "chart-pie-arc",
|
|
24595
|
+
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
24596
|
+
d: \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206),
|
|
24597
|
+
fill: "none",
|
|
24598
|
+
stroke: sliceColor(d.tone, idx),
|
|
24599
|
+
strokeWidth: \u592A\u3055,
|
|
24600
|
+
strokeLinecap: "round"
|
|
24601
|
+
}
|
|
24602
|
+
)
|
|
24603
|
+
] }, `arc-${idx}`);
|
|
24604
|
+
}),
|
|
24605
|
+
data.map((d, idx) => {
|
|
24606
|
+
const y = \u4E00\u89A7\u4E0A + \u884C\u306E\u9593 * idx;
|
|
24607
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
24608
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24609
|
+
"rect",
|
|
24610
|
+
{
|
|
24611
|
+
x: \u4E00\u89A7\u5DE6,
|
|
24612
|
+
y: y - 9,
|
|
24613
|
+
width: 10,
|
|
24614
|
+
height: 10,
|
|
24615
|
+
rx: 2,
|
|
24616
|
+
fill: sliceColor(d.tone, idx)
|
|
24617
|
+
}
|
|
24618
|
+
),
|
|
24619
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24620
|
+
"text",
|
|
24621
|
+
{
|
|
24622
|
+
x: \u4E00\u89A7\u5DE6 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672,
|
|
24623
|
+
y,
|
|
24624
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
24625
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
24626
|
+
children: d.label
|
|
24627
|
+
}
|
|
24628
|
+
),
|
|
24629
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24630
|
+
"text",
|
|
24631
|
+
{
|
|
24632
|
+
x: node.w - PAD,
|
|
24633
|
+
y: y + 4,
|
|
24634
|
+
textAnchor: "end",
|
|
24635
|
+
fontSize: \u5272\u5408\u306E\u7D1A,
|
|
24636
|
+
fontWeight: 600,
|
|
24637
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
24638
|
+
children: \u5272\u5408\u306E\u6587\u5B57[idx]
|
|
24639
|
+
}
|
|
24640
|
+
)
|
|
24641
|
+
] }, `row-${idx}`);
|
|
24642
|
+
})
|
|
24643
|
+
] });
|
|
24644
|
+
}
|
|
24645
|
+
function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress, instanceId }) {
|
|
24646
|
+
const PAD = 20;
|
|
24647
|
+
const \u898B\u51FA\u3057\u306E\u7D1A = 11;
|
|
24648
|
+
const \u540D\u524D\u306E\u7D1A = 15;
|
|
24649
|
+
const \u5272\u5408\u306E\u7D1A = 17;
|
|
24650
|
+
const \u5B9F\u6570\u306E\u7D1A = 15;
|
|
24651
|
+
const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
|
|
24652
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
24653
|
+
const \u5B9F\u6570\u306E\u6587\u5B57 = data.map((d) => \u5B9F\u5024\u8868\u8A18(d.value));
|
|
24654
|
+
const \u540D\u524D\u5E45 = Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A)));
|
|
24655
|
+
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)));
|
|
24656
|
+
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)));
|
|
24657
|
+
const \u8868\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + \u540D\u524D\u5E45 + 28 + \u5272\u5408\u5E45 + 24 + \u5B9F\u6570\u5E45;
|
|
24658
|
+
const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
|
|
24659
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u8868\u5E45 - 28) / 2;
|
|
24660
|
+
const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
24661
|
+
const \u5185\u534A\u5F84 = R * 0.58;
|
|
24662
|
+
const cx = PAD + R;
|
|
24663
|
+
const cy = node.h / 2;
|
|
24664
|
+
const \u8868\u5DE6 = node.w - PAD - \u8868\u5E45;
|
|
24665
|
+
const \u53F3\u7AEF = node.w - PAD;
|
|
24666
|
+
const \u5272\u5408\u53F3 = \u53F3\u7AEF - \u5B9F\u6570\u5E45 - 24;
|
|
24667
|
+
const \u884C\u306E\u9593 = Math.min(52, (node.h - PAD * 2 - 40) / Math.max(1, data.length));
|
|
24668
|
+
const \u898B\u51FA\u3057\u306Ey = node.h / 2 - \u884C\u306E\u9593 * data.length / 2 - 14;
|
|
24669
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
24670
|
+
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
24671
|
+
const \u958B\u304D\u59CB\u3081\u305F = (\u59CB\u307E\u308A) => !drawing || \u958B\u304D > \u59CB\u307E\u308A;
|
|
24672
|
+
let \u89D2 = -Math.PI / 2;
|
|
24673
|
+
let \u7D2F\u8A08 = 0;
|
|
24674
|
+
const \u6247\u305F\u3061 = data.map((d, idx) => {
|
|
24675
|
+
const frac = \u5272\u5408[idx] ?? 0;
|
|
24676
|
+
const a0 = \u89D2;
|
|
24677
|
+
const a1 = \u89D2 + frac * Math.PI * 2;
|
|
24678
|
+
\u89D2 = a1;
|
|
24679
|
+
const \u59CB\u307E\u308A = \u7D2F\u8A08;
|
|
24680
|
+
\u7D2F\u8A08 += frac;
|
|
24681
|
+
return { d, idx, \u59CB\u307E\u308A, path: \u8F2A\u306E\u9053(cx, cy, R, \u5185\u534A\u5F84, a0, a1) };
|
|
24682
|
+
});
|
|
24683
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
24684
|
+
\u67A0(node, active),
|
|
24685
|
+
drawing && /* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, R + 2, \u958B\u304D) }) }),
|
|
24686
|
+
/* @__PURE__ */ jsxRuntime.jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, children: \u6247\u305F\u3061.map((s) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
24687
|
+
"path",
|
|
24688
|
+
{
|
|
24689
|
+
"data-cdl-role": "chart-pie-slice",
|
|
24690
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
24691
|
+
d: s.path,
|
|
24692
|
+
fill: sliceColor(s.d.tone, s.idx),
|
|
24693
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
24694
|
+
strokeWidth: 3,
|
|
24695
|
+
strokeLinejoin: "round"
|
|
24696
|
+
},
|
|
24697
|
+
`slice-${s.idx}`
|
|
24698
|
+
)) }),
|
|
24699
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24700
|
+
"text",
|
|
24701
|
+
{
|
|
24702
|
+
x: cx,
|
|
24703
|
+
y: cy - 2,
|
|
24704
|
+
textAnchor: "middle",
|
|
24705
|
+
fontSize: Math.round(R * 0.26),
|
|
24706
|
+
fontWeight: 600,
|
|
24707
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
24708
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(data.reduce((acc, d) => acc + d.value, 0)))
|
|
24709
|
+
}
|
|
24710
|
+
),
|
|
24711
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24712
|
+
"text",
|
|
24713
|
+
{
|
|
24714
|
+
x: cx,
|
|
24715
|
+
y: cy + Math.round(R * 0.2),
|
|
24716
|
+
textAnchor: "middle",
|
|
24717
|
+
fontSize: Math.round(R * 0.12),
|
|
24718
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
24719
|
+
children: "\u5408\u8A08"
|
|
24720
|
+
}
|
|
24721
|
+
),
|
|
24722
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
24723
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
24724
|
+
/* @__PURE__ */ jsxRuntime.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" }),
|
|
24725
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24726
|
+
"line",
|
|
24727
|
+
{
|
|
24728
|
+
"data-cdl-role": "chart-pie-table-rule",
|
|
24729
|
+
x1: \u8868\u5DE6,
|
|
24730
|
+
y1: \u898B\u51FA\u3057\u306Ey + 10,
|
|
24731
|
+
x2: \u53F3\u7AEF,
|
|
24732
|
+
y2: \u898B\u51FA\u3057\u306Ey + 10,
|
|
24733
|
+
stroke: "var(--cdl-text, #1a1f2a)",
|
|
24734
|
+
strokeWidth: 1.2
|
|
24735
|
+
}
|
|
24736
|
+
),
|
|
24737
|
+
\u6247\u305F\u3061.map((s) => {
|
|
24738
|
+
if (!\u958B\u304D\u59CB\u3081\u305F(s.\u59CB\u307E\u308A)) return null;
|
|
24739
|
+
const y = \u898B\u51FA\u3057\u306Ey + 40 + \u884C\u306E\u9593 * s.idx;
|
|
24740
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
24741
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: \u8868\u5DE6, y: y - 10, width: 10, height: 10, rx: 2, fill: sliceColor(s.d.tone, s.idx) }),
|
|
24742
|
+
/* @__PURE__ */ jsxRuntime.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 }),
|
|
24743
|
+
/* @__PURE__ */ jsxRuntime.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] }),
|
|
24744
|
+
/* @__PURE__ */ jsxRuntime.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] }),
|
|
24745
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
24746
|
+
"line",
|
|
24747
|
+
{
|
|
24748
|
+
"data-cdl-role": "chart-pie-table-rule",
|
|
24749
|
+
x1: \u8868\u5DE6,
|
|
24750
|
+
y1: y + 16,
|
|
24751
|
+
x2: \u53F3\u7AEF,
|
|
24752
|
+
y2: y + 16,
|
|
24753
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24754
|
+
strokeWidth: 1
|
|
24755
|
+
}
|
|
24756
|
+
)
|
|
24757
|
+
] }, `row-${s.idx}`);
|
|
24758
|
+
})
|
|
24759
|
+
] });
|
|
24760
|
+
}
|
|
24761
|
+
function \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206) {
|
|
24762
|
+
const \u5B9F\u52B9 = Math.max(0, Math.min(0.9999, \u53D6\u308A\u5206));
|
|
24763
|
+
const a0 = -Math.PI / 2;
|
|
24764
|
+
const a1 = a0 + \u5B9F\u52B9 * Math.PI * 2;
|
|
24765
|
+
const large = \u5B9F\u52B9 > 0.5 ? 1 : 0;
|
|
24766
|
+
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)}`;
|
|
24767
|
+
}
|
|
24768
|
+
function \u8F2A\u306E\u9053(cx, cy, R, r, a0, a1) {
|
|
24769
|
+
const large = a1 - a0 > Math.PI ? 1 : 0;
|
|
24770
|
+
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`;
|
|
24771
|
+
}
|
|
24483
24772
|
function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
|
|
24484
24773
|
if (\u958B\u304D <= 0) return null;
|
|
24485
24774
|
if (\u958B\u304D >= 1) return /* @__PURE__ */ jsxRuntime.jsx("circle", { cx, cy, r });
|
|
@@ -24681,8 +24970,8 @@ function ChartRadialNode({
|
|
|
24681
24970
|
frac,
|
|
24682
24971
|
\u4E2D\u5FC3\u534A\u5F84,
|
|
24683
24972
|
// 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
|
|
24684
|
-
\u8ECC\u9053: \u5F27\u306E\
|
|
24685
|
-
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\
|
|
24973
|
+
\u8ECC\u9053: \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
|
|
24974
|
+
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(frac, 0.9999))
|
|
24686
24975
|
};
|
|
24687
24976
|
});
|
|
24688
24977
|
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;
|
|
@@ -24753,7 +25042,7 @@ function ChartRadialNode({
|
|
|
24753
25042
|
] });
|
|
24754
25043
|
}
|
|
24755
25044
|
var \u5370\u306E\u5E45 = 18;
|
|
24756
|
-
function \u5F27\u306E\
|
|
25045
|
+
function \u5F27\u306E\u90532(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
|
|
24757
25046
|
const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2;
|
|
24758
25047
|
const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2);
|
|
24759
25048
|
const a0 = -Math.PI / 2;
|
|
@@ -24799,12 +25088,12 @@ function ChartStatNode({
|
|
|
24799
25088
|
}
|
|
24800
25089
|
),
|
|
24801
25090
|
data.map((d, idx) => {
|
|
24802
|
-
const \
|
|
25091
|
+
const \u67A02 = \u533A\u753B.\u67A0(idx);
|
|
24803
25092
|
const frac = total > 0 ? d.value / total : 0;
|
|
24804
25093
|
const \u8272 = \u5370\u306E\u8272(d.tone, idx);
|
|
24805
25094
|
const \u6570\u5024 = \u5B9F\u5024\u8868\u8A184(d.value);
|
|
24806
|
-
const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \
|
|
24807
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\
|
|
25095
|
+
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);
|
|
25096
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A02.x} ${\u67A02.y})`, children: [
|
|
24808
25097
|
idx > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
24809
25098
|
"line",
|
|
24810
25099
|
{
|
|
@@ -24812,7 +25101,7 @@ function ChartStatNode({
|
|
|
24812
25101
|
x1: 0,
|
|
24813
25102
|
y1: \u533A\u753B.\u4F59\u767D,
|
|
24814
25103
|
x2: 0,
|
|
24815
|
-
y2: \
|
|
25104
|
+
y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
|
|
24816
25105
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
24817
25106
|
strokeWidth: 1
|
|
24818
25107
|
}
|
|
@@ -24821,7 +25110,7 @@ function ChartStatNode({
|
|
|
24821
25110
|
"text",
|
|
24822
25111
|
{
|
|
24823
25112
|
"data-cdl-role": "chart-stat-label",
|
|
24824
|
-
x: \
|
|
25113
|
+
x: \u67A02.w / 2,
|
|
24825
25114
|
y: \u533A\u753B.\u540D\u524D\u306Ey,
|
|
24826
25115
|
fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
|
|
24827
25116
|
fontWeight: 700,
|
|
@@ -24835,7 +25124,7 @@ function ChartStatNode({
|
|
|
24835
25124
|
{
|
|
24836
25125
|
"data-cdl-role": "chart-stat-value",
|
|
24837
25126
|
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
24838
|
-
x: \
|
|
25127
|
+
x: \u67A02.w / 2,
|
|
24839
25128
|
y: \u533A\u753B.\u6570\u5024\u306Ey,
|
|
24840
25129
|
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
24841
25130
|
fontWeight: 700,
|
|
@@ -24848,7 +25137,7 @@ function ChartStatNode({
|
|
|
24848
25137
|
"circle",
|
|
24849
25138
|
{
|
|
24850
25139
|
"data-cdl-role": "chart-stat-track",
|
|
24851
|
-
cx: \
|
|
25140
|
+
cx: \u67A02.w / 2,
|
|
24852
25141
|
cy: \u533A\u753B.\u5F27\u306Ey,
|
|
24853
25142
|
r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
|
|
24854
25143
|
fill: "none",
|
|
@@ -24861,7 +25150,7 @@ function ChartStatNode({
|
|
|
24861
25150
|
"path",
|
|
24862
25151
|
{
|
|
24863
25152
|
"data-cdl-role": "chart-stat-arc",
|
|
24864
|
-
d: \u5F27\u306E\
|
|
25153
|
+
d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
|
|
24865
25154
|
fill: "none",
|
|
24866
25155
|
stroke: \u8272,
|
|
24867
25156
|
strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
|
|
@@ -24872,7 +25161,7 @@ function ChartStatNode({
|
|
|
24872
25161
|
"text",
|
|
24873
25162
|
{
|
|
24874
25163
|
"data-cdl-role": "chart-stat-share",
|
|
24875
|
-
x: \
|
|
25164
|
+
x: \u67A02.w / 2,
|
|
24876
25165
|
y: \u533A\u753B.\u5272\u5408\u306Ey,
|
|
24877
25166
|
fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
|
|
24878
25167
|
textAnchor: "middle",
|
|
@@ -24917,7 +25206,7 @@ function \u53CE\u3081\u308B\u7D1A(\u5B57, \u4F7F\u3048\u308B\u5E452, \u521D\u671
|
|
|
24917
25206
|
while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B57, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
|
|
24918
25207
|
return \u7D1A;
|
|
24919
25208
|
}
|
|
24920
|
-
function \u5F27\u306E\
|
|
25209
|
+
function \u5F27\u306E\u90533(cx, cy, r, \u5272\u5408) {
|
|
24921
25210
|
const a0 = -Math.PI / 2;
|
|
24922
25211
|
const a1 = a0 + \u5272\u5408 * Math.PI * 2;
|
|
24923
25212
|
const large = \u5272\u5408 > 0.5 ? 1 : 0;
|