@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/react.js
CHANGED
|
@@ -577,6 +577,7 @@ var KINDS_WITHOUT_TITLE_TEXT = /* @__PURE__ */ new Set([
|
|
|
577
577
|
"chart-stat",
|
|
578
578
|
"chart-waffle",
|
|
579
579
|
"chart-stacked-bar",
|
|
580
|
+
"chart-slope",
|
|
580
581
|
"gantt-timeline",
|
|
581
582
|
"mind-map",
|
|
582
583
|
"funnel-stages",
|
|
@@ -2312,8 +2313,10 @@ var NODE_KINDS = [
|
|
|
2312
2313
|
"chart-radial",
|
|
2313
2314
|
"chart-stat",
|
|
2314
2315
|
// chart-stacked-bar は帯を割合で区切り時点を並べる形 (cdl#551)
|
|
2316
|
+
// chart-slope は 2 時点を直線でつなぎ増減と順位の入れ替わりを見せる形 (cdl#688)
|
|
2315
2317
|
"chart-waffle",
|
|
2316
2318
|
"chart-stacked-bar",
|
|
2319
|
+
"chart-slope",
|
|
2317
2320
|
// Timeline / Mind 系 (2、 CAR-994 Phase B) ... 1 node に payload 配列、 SVG geometry render
|
|
2318
2321
|
"gantt-timeline",
|
|
2319
2322
|
"mind-map",
|
|
@@ -4448,6 +4451,7 @@ var GRID_ALIGNED_KINDS = /* @__PURE__ */ new Set([
|
|
|
4448
4451
|
"chart-stat",
|
|
4449
4452
|
"chart-waffle",
|
|
4450
4453
|
"chart-stacked-bar",
|
|
4454
|
+
"chart-slope",
|
|
4451
4455
|
"funnel-stages",
|
|
4452
4456
|
"quadrant-matrix"
|
|
4453
4457
|
]);
|
|
@@ -4906,10 +4910,10 @@ function countEdgeCrossings(edges, warnAt = 3) {
|
|
|
4906
4910
|
if (isNearAny(p, a.ends, SAME_POINT_TOL) || isNearAny(p, b.ends, SAME_POINT_TOL))
|
|
4907
4911
|
continue;
|
|
4908
4912
|
if (\u5171\u6709\u5074.length > 0) {
|
|
4909
|
-
const \
|
|
4910
|
-
const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \
|
|
4913
|
+
const \u67A02 = Math.min(MAX_CHECKS - checks, MAX_CHECKS_PER_PAIR - pairChecks);
|
|
4914
|
+
const \u4E88\u7B97 = { \u6B8B\u308A: Math.max(0, \u67A02) };
|
|
4911
4915
|
const \u5224\u5B9A = mergesTowardShared(a.flat, b.flat, p, \u5171\u6709\u5074, MERGE_TOL, \u4E88\u7B97);
|
|
4912
|
-
const \u4F7F\u3063\u305F = Math.max(0, \
|
|
4916
|
+
const \u4F7F\u3063\u305F = Math.max(0, \u67A02) - \u4E88\u7B97.\u6B8B\u308A;
|
|
4913
4917
|
checks += \u4F7F\u3063\u305F;
|
|
4914
4918
|
pairChecks += \u4F7F\u3063\u305F;
|
|
4915
4919
|
if (\u5224\u5B9A === "merged") continue;
|
|
@@ -6784,6 +6788,8 @@ var TOKENS = {
|
|
|
6784
6788
|
"chart-waffle": { w: 640, h: 320 },
|
|
6785
6789
|
// 帯を最大 2 本 + 下に一覧。 縦は帯 2 本ぶんで足りる (cdl#551)
|
|
6786
6790
|
"chart-stacked-bar": { w: 640, h: 320 },
|
|
6791
|
+
// 左右 2 本の縦軸と、その外に名札。 縦は系列が縦に並ぶぶん要る (cdl#688)
|
|
6792
|
+
"chart-slope": { w: 640, h: 360 },
|
|
6787
6793
|
// Timeline / Mind 系 (CAR-994 Phase B)
|
|
6788
6794
|
"gantt-timeline": { w: 720, h: 360 },
|
|
6789
6795
|
"mind-map": { w: 720, h: 480 },
|
|
@@ -9497,6 +9503,7 @@ var DRAW_KINDS = /* @__PURE__ */ new Set([
|
|
|
9497
9503
|
"chart-line",
|
|
9498
9504
|
"chart-bar",
|
|
9499
9505
|
"chart-pie",
|
|
9506
|
+
"chart-slope",
|
|
9500
9507
|
"journey-map",
|
|
9501
9508
|
"mind-map",
|
|
9502
9509
|
"tree-hierarchy",
|
|
@@ -11842,52 +11849,52 @@ function ChartPieNode({
|
|
|
11842
11849
|
const y0 = node.cy - node.h / 2;
|
|
11843
11850
|
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
11844
11851
|
const total = data.reduce((acc, d) => acc + d.value, 0) || 1;
|
|
11852
|
+
const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
|
|
11853
|
+
const \u4ECA\u306E\u5024 = data.map((d) => Math.max(0, d.value));
|
|
11854
|
+
const \u524D\u306E\u5024 = data.map((d) => Math.max(0, d.previous ?? 0));
|
|
11855
|
+
const \u4ECA\u306E\u5408\u8A08 = \u4ECA\u306E\u5024.reduce((acc, value) => acc + value, 0);
|
|
11856
|
+
const \u524D\u306E\u5408\u8A08 = \u524D\u306E\u5024.reduce((acc, value) => acc + value, 0);
|
|
11857
|
+
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);
|
|
11858
|
+
const \u524D\u306E\u5272\u5408 = \u524D\u306E\u5024.map((value) => \u524D\u306E\u5408\u8A08 > 0 ? value / \u524D\u306E\u5408\u8A08 : 0);
|
|
11859
|
+
const \u5F62 = node.chartPieForm === "arcs" || node.chartPieForm === "table" ? node.chartPieForm : "ring";
|
|
11845
11860
|
const PAD_TOP2 = 20;
|
|
11846
11861
|
const PAD_BOTTOM2 = 20;
|
|
11847
11862
|
const PAD_SIDE = 20;
|
|
11848
11863
|
const chartAreaH = node.h - PAD_TOP2 - PAD_BOTTOM2;
|
|
11849
|
-
const \
|
|
11850
|
-
const \
|
|
11864
|
+
const \u5272\u5408\u306E\u7D1A = 19;
|
|
11865
|
+
const \u540D\u524D\u306E\u7D1A = 12;
|
|
11851
11866
|
const \u5F15\u304D\u51FA\u3057 = 18;
|
|
11852
11867
|
const \u5B57\u307E\u3067\u306E\u9593 = 26;
|
|
11853
11868
|
const \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057 = 20;
|
|
11854
|
-
const \u5272\u5408\u306E\u6587\u5B57 =
|
|
11855
|
-
const \
|
|
11869
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u4ECA\u306E\u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
11870
|
+
const \u540D\u524D\u306E\u6587\u5B57 = data.map((d, i) => {
|
|
11871
|
+
const \u540D = d.label ?? "";
|
|
11872
|
+
if (\u524D\u3042\u308A) return `${\u540D} ${\u5B9F\u5024\u8868\u8A18(\u524D\u306E\u5024[i])} \u2192 ${\u5B9F\u5024\u8868\u8A18(\u4ECA\u306E\u5024[i])}`;
|
|
11873
|
+
return `${\u5B9F\u5024\u8868\u8A18(d.value)}%` === \u5272\u5408\u306E\u6587\u5B57[i] ? \u540D : `${\u540D} ${\u5B9F\u5024\u8868\u8A18(d.value)}`;
|
|
11874
|
+
});
|
|
11875
|
+
if (\u5F62 !== "ring") {
|
|
11876
|
+
const \u5171\u901A = { node, active, data, \u5272\u5408: \u4ECA\u306E\u5272\u5408, x0, y0, drawing, progress, instanceId };
|
|
11877
|
+
return \u5F62 === "arcs" ? \u5F27\u306E\u5F62(\u5171\u901A) : \u8868\u306E\u5F62(\u5171\u901A);
|
|
11878
|
+
}
|
|
11856
11879
|
const \u540D\u672D\u5E45 = Math.max(
|
|
11857
11880
|
0,
|
|
11858
11881
|
...data.map(
|
|
11859
|
-
(
|
|
11882
|
+
(_d, i) => Math.max(
|
|
11883
|
+
textWidth(\u5272\u5408\u306E\u6587\u5B57[i] ?? "", \u5272\u5408\u306E\u7D1A),
|
|
11884
|
+
textWidth(\u540D\u524D\u306E\u6587\u5B57[i] ?? "", \u540D\u524D\u306E\u7D1A)
|
|
11885
|
+
)
|
|
11860
11886
|
)
|
|
11861
11887
|
);
|
|
11862
11888
|
const \u7E26\u304B\u3089 = chartAreaH / 2 - \u5F15\u304D\u51FA\u3057 - \u540D\u672D\u306E\u7E26\u306E\u5F35\u308A\u51FA\u3057;
|
|
11863
11889
|
const \u6A2A\u304B\u3089 = (node.w - PAD_SIDE * 2) / 2 - \u5F15\u304D\u51FA\u3057 - \u5B57\u307E\u3067\u306E\u9593 - \u540D\u672D\u5E45;
|
|
11864
11890
|
const radius = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
11865
|
-
const \u5185\u534A\u5F84 = radius * 0.58;
|
|
11891
|
+
const \u5916\u306E\u5185\u534A\u5F84 = radius * (\u524D\u3042\u308A ? 0.75 : 0.58);
|
|
11892
|
+
const \u524D\u306E\u5916\u534A\u5F84 = radius * 0.67;
|
|
11893
|
+
const \u524D\u306E\u5185\u534A\u5F84 = radius * 0.42;
|
|
11866
11894
|
const cx = node.w / 2;
|
|
11867
11895
|
const cy = PAD_TOP2 + chartAreaH / 2;
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
const slices = data.map((d) => {
|
|
11871
|
-
const frac = d.value / total;
|
|
11872
|
-
const angle = frac * Math.PI * 2;
|
|
11873
|
-
const a0 = cumAngle;
|
|
11874
|
-
const a1 = cumAngle + angle;
|
|
11875
|
-
cumAngle = a1;
|
|
11876
|
-
const startFrac = cumFrac;
|
|
11877
|
-
cumFrac += frac;
|
|
11878
|
-
const x1 = cx + radius * Math.cos(a0);
|
|
11879
|
-
const y1 = cy + radius * Math.sin(a0);
|
|
11880
|
-
const x2 = cx + radius * Math.cos(a1);
|
|
11881
|
-
const y2 = cy + radius * Math.sin(a1);
|
|
11882
|
-
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
11883
|
-
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
11884
|
-
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
11885
|
-
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
11886
|
-
const large = angle > Math.PI ? 1 : 0;
|
|
11887
|
-
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`;
|
|
11888
|
-
const \u4E2D\u592E\u89D2 = (a0 + a1) / 2;
|
|
11889
|
-
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2 };
|
|
11890
|
-
});
|
|
11896
|
+
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) : [];
|
|
11897
|
+
const slices = \u8F2A\u3092\u7D44\u3080(data, cx, cy, radius, \u5916\u306E\u5185\u534A\u5F84, \u4ECA\u306E\u5272\u5408);
|
|
11891
11898
|
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
11892
11899
|
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
11893
11900
|
const \u5F71id = `cdl-pie-shadow-${instanceId}`;
|
|
@@ -11911,19 +11918,34 @@ function ChartPieNode({
|
|
|
11911
11918
|
drawing && /* @__PURE__ */ jsx("clipPath", { id: \u5207\u308A\u629C\u304Did, children: \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, radius + 2, \u958B\u304D) }),
|
|
11912
11919
|
/* @__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" }) })
|
|
11913
11920
|
] }),
|
|
11914
|
-
/* @__PURE__ */
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11921
|
+
/* @__PURE__ */ jsxs("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, filter: `url(#${\u5F71id})`, children: [
|
|
11922
|
+
\u524D\u306Eslices.map((s, idx) => /* @__PURE__ */ jsx(
|
|
11923
|
+
"path",
|
|
11924
|
+
{
|
|
11925
|
+
"data-cdl-role": "chart-pie-slice-previous",
|
|
11926
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
11927
|
+
d: s.path,
|
|
11928
|
+
fill: sliceColor(s.d.tone, idx),
|
|
11929
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
11930
|
+
strokeWidth: 3,
|
|
11931
|
+
strokeLinejoin: "round"
|
|
11932
|
+
},
|
|
11933
|
+
`slice-previous-${idx}`
|
|
11934
|
+
)),
|
|
11935
|
+
slices.map((s, idx) => /* @__PURE__ */ jsx(
|
|
11936
|
+
"path",
|
|
11937
|
+
{
|
|
11938
|
+
"data-cdl-role": "chart-pie-slice",
|
|
11939
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
11940
|
+
d: s.path,
|
|
11941
|
+
fill: sliceColor(s.d.tone, idx),
|
|
11942
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
11943
|
+
strokeWidth: 3,
|
|
11944
|
+
strokeLinejoin: "round"
|
|
11945
|
+
},
|
|
11946
|
+
`slice-${idx}`
|
|
11947
|
+
))
|
|
11948
|
+
] }),
|
|
11927
11949
|
/* @__PURE__ */ jsx(
|
|
11928
11950
|
"text",
|
|
11929
11951
|
{
|
|
@@ -11933,7 +11955,7 @@ function ChartPieNode({
|
|
|
11933
11955
|
fontSize: Math.round(radius * 0.26),
|
|
11934
11956
|
fontWeight: 600,
|
|
11935
11957
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
11936
|
-
children: \u5B9F\u5024\u8868\u8A18(Math.round(total))
|
|
11958
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(\u524D\u3042\u308A ? \u4ECA\u306E\u5408\u8A08 : total))
|
|
11937
11959
|
}
|
|
11938
11960
|
),
|
|
11939
11961
|
/* @__PURE__ */ jsx(
|
|
@@ -11970,12 +11992,12 @@ function ChartPieNode({
|
|
|
11970
11992
|
"text",
|
|
11971
11993
|
{
|
|
11972
11994
|
x: \u5B57x,
|
|
11973
|
-
y: \u6298\u308Cy -
|
|
11995
|
+
y: \u6298\u308Cy - 1,
|
|
11974
11996
|
textAnchor: \u53F3 ? "start" : "end",
|
|
11975
|
-
fontSize: \
|
|
11997
|
+
fontSize: \u5272\u5408\u306E\u7D1A,
|
|
11976
11998
|
fontWeight: 600,
|
|
11977
11999
|
fill: "var(--cdl-text, #1a1f2a)",
|
|
11978
|
-
children:
|
|
12000
|
+
children: \u5272\u5408\u306E\u6587\u5B57[idx]
|
|
11979
12001
|
}
|
|
11980
12002
|
),
|
|
11981
12003
|
/* @__PURE__ */ jsx(
|
|
@@ -11984,15 +12006,275 @@ function ChartPieNode({
|
|
|
11984
12006
|
x: \u5B57x,
|
|
11985
12007
|
y: \u6298\u308Cy + 15,
|
|
11986
12008
|
textAnchor: \u53F3 ? "start" : "end",
|
|
11987
|
-
fontSize: \
|
|
12009
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
11988
12010
|
fill: "var(--cdl-text-dim, #5a6270)",
|
|
11989
|
-
children: \
|
|
12011
|
+
children: \u540D\u524D\u306E\u6587\u5B57[idx]
|
|
11990
12012
|
}
|
|
11991
12013
|
)
|
|
11992
12014
|
] }, `callout-${idx}`);
|
|
11993
12015
|
})
|
|
11994
12016
|
] });
|
|
11995
12017
|
}
|
|
12018
|
+
function \u8F2A\u3092\u7D44\u3080(data, cx, cy, \u5916\u534A\u5F84, \u5185\u534A\u5F84, \u5272\u5408) {
|
|
12019
|
+
let cumAngle = -Math.PI / 2;
|
|
12020
|
+
let cumFrac = 0;
|
|
12021
|
+
return data.map((d, idx) => {
|
|
12022
|
+
const frac = \u5272\u5408[idx] ?? 0;
|
|
12023
|
+
const angle = frac * Math.PI * 2;
|
|
12024
|
+
const a0 = cumAngle;
|
|
12025
|
+
const a1 = cumAngle + angle;
|
|
12026
|
+
cumAngle = a1;
|
|
12027
|
+
const startFrac = cumFrac;
|
|
12028
|
+
cumFrac += frac;
|
|
12029
|
+
const x1 = cx + \u5916\u534A\u5F84 * Math.cos(a0);
|
|
12030
|
+
const y1 = cy + \u5916\u534A\u5F84 * Math.sin(a0);
|
|
12031
|
+
const x2 = cx + \u5916\u534A\u5F84 * Math.cos(a1);
|
|
12032
|
+
const y2 = cy + \u5916\u534A\u5F84 * Math.sin(a1);
|
|
12033
|
+
const x3 = cx + \u5185\u534A\u5F84 * Math.cos(a1);
|
|
12034
|
+
const y3 = cy + \u5185\u534A\u5F84 * Math.sin(a1);
|
|
12035
|
+
const x4 = cx + \u5185\u534A\u5F84 * Math.cos(a0);
|
|
12036
|
+
const y4 = cy + \u5185\u534A\u5F84 * Math.sin(a0);
|
|
12037
|
+
const large = angle > Math.PI ? 1 : 0;
|
|
12038
|
+
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`;
|
|
12039
|
+
return { d, frac, path, startFrac, \u4E2D\u592E\u89D2: (a0 + a1) / 2 };
|
|
12040
|
+
});
|
|
12041
|
+
}
|
|
12042
|
+
function \u67A0(node, active) {
|
|
12043
|
+
return /* @__PURE__ */ jsx(
|
|
12044
|
+
"rect",
|
|
12045
|
+
{
|
|
12046
|
+
"data-cdl-role": "node-body",
|
|
12047
|
+
x: 0,
|
|
12048
|
+
y: 0,
|
|
12049
|
+
width: node.w,
|
|
12050
|
+
height: node.h,
|
|
12051
|
+
rx: 16,
|
|
12052
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
12053
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
12054
|
+
strokeWidth: active ? 3 : 1.25
|
|
12055
|
+
}
|
|
12056
|
+
);
|
|
12057
|
+
}
|
|
12058
|
+
function \u5F27\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress }) {
|
|
12059
|
+
const PAD = 20;
|
|
12060
|
+
const \u540D\u524D\u306E\u7D1A = 14;
|
|
12061
|
+
const \u5272\u5408\u306E\u7D1A = 24;
|
|
12062
|
+
const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
|
|
12063
|
+
const \u540D\u524D\u304B\u3089\u5272\u5408\u307E\u3067 = 24;
|
|
12064
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
12065
|
+
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)));
|
|
12066
|
+
const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
|
|
12067
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u4E00\u89A7\u5E45 - 28) / 2;
|
|
12068
|
+
const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
12069
|
+
const cx = PAD + R;
|
|
12070
|
+
const cy = node.h / 2;
|
|
12071
|
+
const \u7A74 = R * 0.34;
|
|
12072
|
+
const \u523B\u307F = (R - \u7A74) / Math.max(1, data.length);
|
|
12073
|
+
const \u592A\u3055 = Math.max(3, \u523B\u307F * 0.6);
|
|
12074
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
12075
|
+
const \u4E00\u89A7\u5DE6 = node.w - PAD - \u4E00\u89A7\u5E45;
|
|
12076
|
+
const \u884C\u306E\u9593 = Math.min(56, (node.h - PAD * 2) / Math.max(1, data.length));
|
|
12077
|
+
const \u4E00\u89A7\u4E0A = node.h / 2 - \u884C\u306E\u9593 * (data.length - 1) / 2;
|
|
12078
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
12079
|
+
\u67A0(node, active),
|
|
12080
|
+
data.map((d, idx) => {
|
|
12081
|
+
const r = R - \u592A\u3055 / 2 - idx * \u523B\u307F;
|
|
12082
|
+
if (r <= \u592A\u3055 / 2) return null;
|
|
12083
|
+
const \u53D6\u308A\u5206 = (\u5272\u5408[idx] ?? 0) * (drawing ? \u958B\u304D : 1);
|
|
12084
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
12085
|
+
/* @__PURE__ */ jsx(
|
|
12086
|
+
"circle",
|
|
12087
|
+
{
|
|
12088
|
+
"data-cdl-role": "chart-pie-arc-track",
|
|
12089
|
+
cx,
|
|
12090
|
+
cy,
|
|
12091
|
+
r,
|
|
12092
|
+
fill: "none",
|
|
12093
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
12094
|
+
strokeWidth: \u592A\u3055
|
|
12095
|
+
}
|
|
12096
|
+
),
|
|
12097
|
+
/* @__PURE__ */ jsx(
|
|
12098
|
+
"path",
|
|
12099
|
+
{
|
|
12100
|
+
"data-cdl-role": "chart-pie-arc",
|
|
12101
|
+
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
12102
|
+
d: \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206),
|
|
12103
|
+
fill: "none",
|
|
12104
|
+
stroke: sliceColor(d.tone, idx),
|
|
12105
|
+
strokeWidth: \u592A\u3055,
|
|
12106
|
+
strokeLinecap: "round"
|
|
12107
|
+
}
|
|
12108
|
+
)
|
|
12109
|
+
] }, `arc-${idx}`);
|
|
12110
|
+
}),
|
|
12111
|
+
data.map((d, idx) => {
|
|
12112
|
+
const y = \u4E00\u89A7\u4E0A + \u884C\u306E\u9593 * idx;
|
|
12113
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
12114
|
+
/* @__PURE__ */ jsx(
|
|
12115
|
+
"rect",
|
|
12116
|
+
{
|
|
12117
|
+
x: \u4E00\u89A7\u5DE6,
|
|
12118
|
+
y: y - 9,
|
|
12119
|
+
width: 10,
|
|
12120
|
+
height: 10,
|
|
12121
|
+
rx: 2,
|
|
12122
|
+
fill: sliceColor(d.tone, idx)
|
|
12123
|
+
}
|
|
12124
|
+
),
|
|
12125
|
+
/* @__PURE__ */ jsx(
|
|
12126
|
+
"text",
|
|
12127
|
+
{
|
|
12128
|
+
x: \u4E00\u89A7\u5DE6 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672,
|
|
12129
|
+
y,
|
|
12130
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
12131
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
12132
|
+
children: d.label
|
|
12133
|
+
}
|
|
12134
|
+
),
|
|
12135
|
+
/* @__PURE__ */ jsx(
|
|
12136
|
+
"text",
|
|
12137
|
+
{
|
|
12138
|
+
x: node.w - PAD,
|
|
12139
|
+
y: y + 4,
|
|
12140
|
+
textAnchor: "end",
|
|
12141
|
+
fontSize: \u5272\u5408\u306E\u7D1A,
|
|
12142
|
+
fontWeight: 600,
|
|
12143
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
12144
|
+
children: \u5272\u5408\u306E\u6587\u5B57[idx]
|
|
12145
|
+
}
|
|
12146
|
+
)
|
|
12147
|
+
] }, `row-${idx}`);
|
|
12148
|
+
})
|
|
12149
|
+
] });
|
|
12150
|
+
}
|
|
12151
|
+
function \u8868\u306E\u5F62({ node, active, data, \u5272\u5408, x0, y0, drawing, progress, instanceId }) {
|
|
12152
|
+
const PAD = 20;
|
|
12153
|
+
const \u898B\u51FA\u3057\u306E\u7D1A = 11;
|
|
12154
|
+
const \u540D\u524D\u306E\u7D1A = 15;
|
|
12155
|
+
const \u5272\u5408\u306E\u7D1A = 17;
|
|
12156
|
+
const \u5B9F\u6570\u306E\u7D1A = 15;
|
|
12157
|
+
const \u5370\u304B\u3089\u540D\u524D\u307E\u30672 = 18;
|
|
12158
|
+
const \u5272\u5408\u306E\u6587\u5B57 = \u5272\u5408.map(\u5272\u5408\u8868\u8A18);
|
|
12159
|
+
const \u5B9F\u6570\u306E\u6587\u5B57 = data.map((d) => \u5B9F\u5024\u8868\u8A18(d.value));
|
|
12160
|
+
const \u540D\u524D\u5E45 = Math.max(0, ...data.map((d) => textWidth(d.label ?? "", \u540D\u524D\u306E\u7D1A)));
|
|
12161
|
+
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)));
|
|
12162
|
+
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)));
|
|
12163
|
+
const \u8868\u5E45 = 10 + \u5370\u304B\u3089\u540D\u524D\u307E\u30672 + \u540D\u524D\u5E45 + 28 + \u5272\u5408\u5E45 + 24 + \u5B9F\u6570\u5E45;
|
|
12164
|
+
const \u7E26\u304B\u3089 = (node.h - PAD * 2) / 2;
|
|
12165
|
+
const \u6A2A\u304B\u3089 = (node.w - PAD * 2 - \u8868\u5E45 - 28) / 2;
|
|
12166
|
+
const R = Math.max(24, Math.min(\u7E26\u304B\u3089, \u6A2A\u304B\u3089));
|
|
12167
|
+
const \u5185\u534A\u5F84 = R * 0.58;
|
|
12168
|
+
const cx = PAD + R;
|
|
12169
|
+
const cy = node.h / 2;
|
|
12170
|
+
const \u8868\u5DE6 = node.w - PAD - \u8868\u5E45;
|
|
12171
|
+
const \u53F3\u7AEF = node.w - PAD;
|
|
12172
|
+
const \u5272\u5408\u53F3 = \u53F3\u7AEF - \u5B9F\u6570\u5E45 - 24;
|
|
12173
|
+
const \u884C\u306E\u9593 = Math.min(52, (node.h - PAD * 2 - 40) / Math.max(1, data.length));
|
|
12174
|
+
const \u898B\u51FA\u3057\u306Ey = node.h / 2 - \u884C\u306E\u9593 * data.length / 2 - 14;
|
|
12175
|
+
const \u958B\u304D = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
12176
|
+
const \u5207\u308A\u629C\u304Did = `cdl-pie-draw-${instanceId}`;
|
|
12177
|
+
const \u958B\u304D\u59CB\u3081\u305F = (\u59CB\u307E\u308A) => !drawing || \u958B\u304D > \u59CB\u307E\u308A;
|
|
12178
|
+
let \u89D2 = -Math.PI / 2;
|
|
12179
|
+
let \u7D2F\u8A08 = 0;
|
|
12180
|
+
const \u6247\u305F\u3061 = data.map((d, idx) => {
|
|
12181
|
+
const frac = \u5272\u5408[idx] ?? 0;
|
|
12182
|
+
const a0 = \u89D2;
|
|
12183
|
+
const a1 = \u89D2 + frac * Math.PI * 2;
|
|
12184
|
+
\u89D2 = a1;
|
|
12185
|
+
const \u59CB\u307E\u308A = \u7D2F\u8A08;
|
|
12186
|
+
\u7D2F\u8A08 += frac;
|
|
12187
|
+
return { d, idx, \u59CB\u307E\u308A, path: \u8F2A\u306E\u9053(cx, cy, R, \u5185\u534A\u5F84, a0, a1) };
|
|
12188
|
+
});
|
|
12189
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
12190
|
+
\u67A0(node, active),
|
|
12191
|
+
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) }) }),
|
|
12192
|
+
/* @__PURE__ */ jsx("g", { ...drawing ? { clipPath: `url(#${\u5207\u308A\u629C\u304Did})` } : {}, children: \u6247\u305F\u3061.map((s) => /* @__PURE__ */ jsx(
|
|
12193
|
+
"path",
|
|
12194
|
+
{
|
|
12195
|
+
"data-cdl-role": "chart-pie-slice",
|
|
12196
|
+
"data-cdl-unresolved": s.d.unresolved ? "true" : void 0,
|
|
12197
|
+
d: s.path,
|
|
12198
|
+
fill: sliceColor(s.d.tone, s.idx),
|
|
12199
|
+
stroke: "var(--cdl-node-fill, #ffffff)",
|
|
12200
|
+
strokeWidth: 3,
|
|
12201
|
+
strokeLinejoin: "round"
|
|
12202
|
+
},
|
|
12203
|
+
`slice-${s.idx}`
|
|
12204
|
+
)) }),
|
|
12205
|
+
/* @__PURE__ */ jsx(
|
|
12206
|
+
"text",
|
|
12207
|
+
{
|
|
12208
|
+
x: cx,
|
|
12209
|
+
y: cy - 2,
|
|
12210
|
+
textAnchor: "middle",
|
|
12211
|
+
fontSize: Math.round(R * 0.26),
|
|
12212
|
+
fontWeight: 600,
|
|
12213
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
12214
|
+
children: \u5B9F\u5024\u8868\u8A18(Math.round(data.reduce((acc, d) => acc + d.value, 0)))
|
|
12215
|
+
}
|
|
12216
|
+
),
|
|
12217
|
+
/* @__PURE__ */ jsx(
|
|
12218
|
+
"text",
|
|
12219
|
+
{
|
|
12220
|
+
x: cx,
|
|
12221
|
+
y: cy + Math.round(R * 0.2),
|
|
12222
|
+
textAnchor: "middle",
|
|
12223
|
+
fontSize: Math.round(R * 0.12),
|
|
12224
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
12225
|
+
children: "\u5408\u8A08"
|
|
12226
|
+
}
|
|
12227
|
+
),
|
|
12228
|
+
/* @__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" }),
|
|
12229
|
+
/* @__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" }),
|
|
12230
|
+
/* @__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" }),
|
|
12231
|
+
/* @__PURE__ */ jsx(
|
|
12232
|
+
"line",
|
|
12233
|
+
{
|
|
12234
|
+
"data-cdl-role": "chart-pie-table-rule",
|
|
12235
|
+
x1: \u8868\u5DE6,
|
|
12236
|
+
y1: \u898B\u51FA\u3057\u306Ey + 10,
|
|
12237
|
+
x2: \u53F3\u7AEF,
|
|
12238
|
+
y2: \u898B\u51FA\u3057\u306Ey + 10,
|
|
12239
|
+
stroke: "var(--cdl-text, #1a1f2a)",
|
|
12240
|
+
strokeWidth: 1.2
|
|
12241
|
+
}
|
|
12242
|
+
),
|
|
12243
|
+
\u6247\u305F\u3061.map((s) => {
|
|
12244
|
+
if (!\u958B\u304D\u59CB\u3081\u305F(s.\u59CB\u307E\u308A)) return null;
|
|
12245
|
+
const y = \u898B\u51FA\u3057\u306Ey + 40 + \u884C\u306E\u9593 * s.idx;
|
|
12246
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
12247
|
+
/* @__PURE__ */ jsx("rect", { x: \u8868\u5DE6, y: y - 10, width: 10, height: 10, rx: 2, fill: sliceColor(s.d.tone, s.idx) }),
|
|
12248
|
+
/* @__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 }),
|
|
12249
|
+
/* @__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] }),
|
|
12250
|
+
/* @__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] }),
|
|
12251
|
+
/* @__PURE__ */ jsx(
|
|
12252
|
+
"line",
|
|
12253
|
+
{
|
|
12254
|
+
"data-cdl-role": "chart-pie-table-rule",
|
|
12255
|
+
x1: \u8868\u5DE6,
|
|
12256
|
+
y1: y + 16,
|
|
12257
|
+
x2: \u53F3\u7AEF,
|
|
12258
|
+
y2: y + 16,
|
|
12259
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
12260
|
+
strokeWidth: 1
|
|
12261
|
+
}
|
|
12262
|
+
)
|
|
12263
|
+
] }, `row-${s.idx}`);
|
|
12264
|
+
})
|
|
12265
|
+
] });
|
|
12266
|
+
}
|
|
12267
|
+
function \u5F27\u306E\u9053(cx, cy, r, \u53D6\u308A\u5206) {
|
|
12268
|
+
const \u5B9F\u52B9 = Math.max(0, Math.min(0.9999, \u53D6\u308A\u5206));
|
|
12269
|
+
const a0 = -Math.PI / 2;
|
|
12270
|
+
const a1 = a0 + \u5B9F\u52B9 * Math.PI * 2;
|
|
12271
|
+
const large = \u5B9F\u52B9 > 0.5 ? 1 : 0;
|
|
12272
|
+
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)}`;
|
|
12273
|
+
}
|
|
12274
|
+
function \u8F2A\u306E\u9053(cx, cy, R, r, a0, a1) {
|
|
12275
|
+
const large = a1 - a0 > Math.PI ? 1 : 0;
|
|
12276
|
+
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`;
|
|
12277
|
+
}
|
|
11996
12278
|
function \u6247\u5F62\u306E\u5207\u308A\u629C\u304D(cx, cy, r, \u958B\u304D) {
|
|
11997
12279
|
if (\u958B\u304D <= 0) return null;
|
|
11998
12280
|
if (\u958B\u304D >= 1) return /* @__PURE__ */ jsx("circle", { cx, cy, r });
|
|
@@ -12194,8 +12476,8 @@ function ChartRadialNode({
|
|
|
12194
12476
|
frac,
|
|
12195
12477
|
\u4E2D\u5FC3\u534A\u5F84,
|
|
12196
12478
|
// 軌道は全周。 1 周ちょうどは弧で表せないので、 わずかに欠かして描く
|
|
12197
|
-
\u8ECC\u9053: \u5F27\u306E\
|
|
12198
|
-
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\
|
|
12479
|
+
\u8ECC\u9053: \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, 0.9999),
|
|
12480
|
+
\u53D6\u308A\u5206: frac <= 0 ? null : \u5F27\u306E\u90532(\u5F27\u306Ecx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E2F\u306E\u5E45, Math.min(frac, 0.9999))
|
|
12199
12481
|
};
|
|
12200
12482
|
});
|
|
12201
12483
|
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;
|
|
@@ -12266,7 +12548,7 @@ function ChartRadialNode({
|
|
|
12266
12548
|
] });
|
|
12267
12549
|
}
|
|
12268
12550
|
var \u5370\u306E\u5E45 = 18;
|
|
12269
|
-
function \u5F27\u306E\
|
|
12551
|
+
function \u5F27\u306E\u90532(cx, cy, \u4E2D\u5FC3\u534A\u5F84, \u5E45, \u5272\u5408) {
|
|
12270
12552
|
const \u5916 = \u4E2D\u5FC3\u534A\u5F84 + \u5E45 / 2;
|
|
12271
12553
|
const \u5185 = Math.max(0.5, \u4E2D\u5FC3\u534A\u5F84 - \u5E45 / 2);
|
|
12272
12554
|
const a0 = -Math.PI / 2;
|
|
@@ -12312,12 +12594,12 @@ function ChartStatNode({
|
|
|
12312
12594
|
}
|
|
12313
12595
|
),
|
|
12314
12596
|
data.map((d, idx) => {
|
|
12315
|
-
const \
|
|
12597
|
+
const \u67A02 = \u533A\u753B.\u67A0(idx);
|
|
12316
12598
|
const frac = total > 0 ? d.value / total : 0;
|
|
12317
12599
|
const \u8272 = \u5370\u306E\u8272(d.tone, idx);
|
|
12318
12600
|
const \u6570\u5024 = \u5B9F\u5024\u8868\u8A184(d.value);
|
|
12319
|
-
const \u6570\u5024\u306E\u7D1A = \u53CE\u3081\u308B\u7D1A(\u6570\u5024, \
|
|
12320
|
-
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\
|
|
12601
|
+
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);
|
|
12602
|
+
return /* @__PURE__ */ jsxs("g", { "data-cdl-role": "chart-stat-item", transform: `translate(${\u67A02.x} ${\u67A02.y})`, children: [
|
|
12321
12603
|
idx > 0 && /* @__PURE__ */ jsx(
|
|
12322
12604
|
"line",
|
|
12323
12605
|
{
|
|
@@ -12325,7 +12607,7 @@ function ChartStatNode({
|
|
|
12325
12607
|
x1: 0,
|
|
12326
12608
|
y1: \u533A\u753B.\u4F59\u767D,
|
|
12327
12609
|
x2: 0,
|
|
12328
|
-
y2: \
|
|
12610
|
+
y2: \u67A02.h - \u533A\u753B.\u4F59\u767D,
|
|
12329
12611
|
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
12330
12612
|
strokeWidth: 1
|
|
12331
12613
|
}
|
|
@@ -12334,7 +12616,7 @@ function ChartStatNode({
|
|
|
12334
12616
|
"text",
|
|
12335
12617
|
{
|
|
12336
12618
|
"data-cdl-role": "chart-stat-label",
|
|
12337
|
-
x: \
|
|
12619
|
+
x: \u67A02.w / 2,
|
|
12338
12620
|
y: \u533A\u753B.\u540D\u524D\u306Ey,
|
|
12339
12621
|
fontSize: \u533A\u753B.\u540D\u524D\u306E\u7D1A,
|
|
12340
12622
|
fontWeight: 700,
|
|
@@ -12348,7 +12630,7 @@ function ChartStatNode({
|
|
|
12348
12630
|
{
|
|
12349
12631
|
"data-cdl-role": "chart-stat-value",
|
|
12350
12632
|
"data-cdl-unresolved": d.unresolved ? "true" : void 0,
|
|
12351
|
-
x: \
|
|
12633
|
+
x: \u67A02.w / 2,
|
|
12352
12634
|
y: \u533A\u753B.\u6570\u5024\u306Ey,
|
|
12353
12635
|
fontSize: \u6570\u5024\u306E\u7D1A,
|
|
12354
12636
|
fontWeight: 700,
|
|
@@ -12361,7 +12643,7 @@ function ChartStatNode({
|
|
|
12361
12643
|
"circle",
|
|
12362
12644
|
{
|
|
12363
12645
|
"data-cdl-role": "chart-stat-track",
|
|
12364
|
-
cx: \
|
|
12646
|
+
cx: \u67A02.w / 2,
|
|
12365
12647
|
cy: \u533A\u753B.\u5F27\u306Ey,
|
|
12366
12648
|
r: \u533A\u753B.\u5F27\u306E\u534A\u5F84,
|
|
12367
12649
|
fill: "none",
|
|
@@ -12374,7 +12656,7 @@ function ChartStatNode({
|
|
|
12374
12656
|
"path",
|
|
12375
12657
|
{
|
|
12376
12658
|
"data-cdl-role": "chart-stat-arc",
|
|
12377
|
-
d: \u5F27\u306E\
|
|
12659
|
+
d: \u5F27\u306E\u90533(\u67A02.w / 2, \u533A\u753B.\u5F27\u306Ey, \u533A\u753B.\u5F27\u306E\u534A\u5F84, Math.min(frac, 0.9999)),
|
|
12378
12660
|
fill: "none",
|
|
12379
12661
|
stroke: \u8272,
|
|
12380
12662
|
strokeWidth: \u533A\u753B.\u5F27\u306E\u592A\u3055,
|
|
@@ -12385,7 +12667,7 @@ function ChartStatNode({
|
|
|
12385
12667
|
"text",
|
|
12386
12668
|
{
|
|
12387
12669
|
"data-cdl-role": "chart-stat-share",
|
|
12388
|
-
x: \
|
|
12670
|
+
x: \u67A02.w / 2,
|
|
12389
12671
|
y: \u533A\u753B.\u5272\u5408\u306Ey,
|
|
12390
12672
|
fontSize: \u533A\u753B.\u5272\u5408\u306E\u7D1A,
|
|
12391
12673
|
textAnchor: "middle",
|
|
@@ -12430,7 +12712,7 @@ function \u53CE\u3081\u308B\u7D1A(\u5B57, \u4F7F\u3048\u308B\u5E452, \u521D\u671
|
|
|
12430
12712
|
while (\u7D1A > \u4E0B\u9650 && textWidth(\u5B57, \u7D1A) > \u4F7F\u3048\u308B\u5E452) \u7D1A -= 1;
|
|
12431
12713
|
return \u7D1A;
|
|
12432
12714
|
}
|
|
12433
|
-
function \u5F27\u306E\
|
|
12715
|
+
function \u5F27\u306E\u90533(cx, cy, r, \u5272\u5408) {
|
|
12434
12716
|
const a0 = -Math.PI / 2;
|
|
12435
12717
|
const a1 = a0 + \u5272\u5408 * Math.PI * 2;
|
|
12436
12718
|
const large = \u5272\u5408 > 0.5 ? 1 : 0;
|
|
@@ -12738,6 +13020,238 @@ function \u4E00\u89A7\u306E\u4E26\u3073(data, \u5DE6, \u53F3\u7AEF, \u7D1A) {
|
|
|
12738
13020
|
});
|
|
12739
13021
|
return out;
|
|
12740
13022
|
}
|
|
13023
|
+
|
|
13024
|
+
// src/kinds/chart-number.ts
|
|
13025
|
+
function \u5B9F\u5024\u8868\u8A187(v) {
|
|
13026
|
+
return Number.isInteger(v) ? v.toLocaleString("en-US") : v.toLocaleString("en-US", { maximumFractionDigits: 1 });
|
|
13027
|
+
}
|
|
13028
|
+
var \u7DDA\u306E\u6700\u5C0F\u5E45 = 120;
|
|
13029
|
+
function ChartSlopeNode({
|
|
13030
|
+
node,
|
|
13031
|
+
active,
|
|
13032
|
+
stateValues = {},
|
|
13033
|
+
drawing = false,
|
|
13034
|
+
progress = 1
|
|
13035
|
+
}) {
|
|
13036
|
+
const x0 = node.cx - node.w / 2;
|
|
13037
|
+
const y0 = node.cy - node.h / 2;
|
|
13038
|
+
const data = resolveChartData(node.chartData ?? [], stateValues);
|
|
13039
|
+
const PAD = 24;
|
|
13040
|
+
const \u6642\u70B9\u306E\u7D1A = 12;
|
|
13041
|
+
const \u5024\u306E\u7D1A = 14;
|
|
13042
|
+
const \u540D\u524D\u306E\u4E0A\u9650\u7D1A = 13;
|
|
13043
|
+
const \u540D\u524D\u306E\u4E0B\u9650\u7D1A = 9;
|
|
13044
|
+
const \u8EF8\u304B\u3089\u5024\u307E\u3067 = 10;
|
|
13045
|
+
const \u5024\u304B\u3089\u540D\u524D\u307E\u3067 = 8;
|
|
13046
|
+
const \u524D\u3042\u308A = data.some((d) => d.previous !== void 0);
|
|
13047
|
+
const \u7CFB\u5217\u305F\u3061 = data.map((d, i) => ({
|
|
13048
|
+
\u540D\u524D: d.label ?? "",
|
|
13049
|
+
// 前を持たない件は 0 から立ち上げる。 件を落とすと左右で系列の数が変わり、色の並びが
|
|
13050
|
+
// 対応しなくなる (`chart-stacked-bar` と同じ判断)
|
|
13051
|
+
\u524D: d.previous ?? 0,
|
|
13052
|
+
\u4ECA: d.value,
|
|
13053
|
+
\u8272: \u5370\u306E\u82724(d.tone, i),
|
|
13054
|
+
\u672A\u89E3\u6C7A: d.unresolved === true
|
|
13055
|
+
}));
|
|
13056
|
+
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);
|
|
13057
|
+
const \u6700\u5C0F = \u5168\u90E8\u306E\u5024.length > 0 ? Math.min(...\u5168\u90E8\u306E\u5024) : 0;
|
|
13058
|
+
const \u6700\u5927 = \u5168\u90E8\u306E\u5024.length > 0 ? Math.max(...\u5168\u90E8\u306E\u5024) : 0;
|
|
13059
|
+
const \u5C3A\u306E\u5E45 = \u6700\u5927 - \u6700\u5C0F;
|
|
13060
|
+
const \u4E0A\u7AEF = PAD + (\u524D\u3042\u308A ? \u6642\u70B9\u306E\u7D1A + 12 : 0) + 6;
|
|
13061
|
+
const \u4E0B\u7AEF = Math.max(\u4E0A\u7AEF + 10, node.h - PAD - 6);
|
|
13062
|
+
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;
|
|
13063
|
+
const \u5DE6\u306E\u5B57 = \u7CFB\u5217\u305F\u3061.map((s) => \u5B9F\u5024\u8868\u8A187(s.\u524D));
|
|
13064
|
+
const \u53F3\u306E\u5B57 = \u7CFB\u5217\u305F\u3061.map((s) => \u5B9F\u5024\u8868\u8A187(s.\u4ECA));
|
|
13065
|
+
const \u5DE6\u5024\u5E45 = Math.max(0, ...\u5DE6\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A)));
|
|
13066
|
+
const \u53F3\u5024\u5E45 = Math.max(0, ...\u53F3\u306E\u5B57.map((t) => textWidth(t, \u5024\u306E\u7D1A)));
|
|
13067
|
+
const \u540D\u524D\u306B\u4F7F\u3048\u308B = Math.max(
|
|
13068
|
+
0,
|
|
13069
|
+
(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
|
|
13070
|
+
);
|
|
13071
|
+
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);
|
|
13072
|
+
const \u540D\u524D\u5E45 = Math.min(
|
|
13073
|
+
\u540D\u524D\u306B\u4F7F\u3048\u308B,
|
|
13074
|
+
Math.max(0, ...\u7CFB\u5217\u305F\u3061.map((s) => textWidth(s.\u540D\u524D, \u540D\u524D\u306E\u7D1A)))
|
|
13075
|
+
);
|
|
13076
|
+
const \u5DE6\u306E\u4F59\u767D = \u540D\u524D\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067 + \u5DE6\u5024\u5E45 + \u8EF8\u304B\u3089\u5024\u307E\u3067;
|
|
13077
|
+
const \u53F3\u306E\u4F59\u767D = \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u53F3\u5024\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067 + \u540D\u524D\u5E45;
|
|
13078
|
+
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));
|
|
13079
|
+
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;
|
|
13080
|
+
const \u4F38\u3073 = \u9032\u307F\u3092\u7573\u3080(drawing, progress);
|
|
13081
|
+
const \u53F3\u3092\u51FA\u3059 = !drawing || \u4F38\u3073 >= 1;
|
|
13082
|
+
return /* @__PURE__ */ jsxs("g", { transform: `translate(${x0} ${y0})`, children: [
|
|
13083
|
+
/* @__PURE__ */ jsx(
|
|
13084
|
+
"rect",
|
|
13085
|
+
{
|
|
13086
|
+
"data-cdl-role": "node-body",
|
|
13087
|
+
x: 0,
|
|
13088
|
+
y: 0,
|
|
13089
|
+
width: node.w,
|
|
13090
|
+
height: node.h,
|
|
13091
|
+
rx: 16,
|
|
13092
|
+
fill: "var(--cdl-node-fill, #ffffff)",
|
|
13093
|
+
stroke: active ? "var(--cdl-tone-accent, #2d6a8f)" : "var(--cdl-divider, #d4d4d8)",
|
|
13094
|
+
strokeWidth: active ? 3 : 1.25
|
|
13095
|
+
}
|
|
13096
|
+
),
|
|
13097
|
+
(\u524D\u3042\u308A ? [\u5DE6\u8EF8x, \u53F3\u8EF8x] : [\u5DE6\u8EF8x]).map((x, i) => /* @__PURE__ */ jsx(
|
|
13098
|
+
"line",
|
|
13099
|
+
{
|
|
13100
|
+
"data-cdl-role": "chart-slope-axis",
|
|
13101
|
+
x1: x,
|
|
13102
|
+
y1: \u4E0A\u7AEF - 6,
|
|
13103
|
+
x2: x,
|
|
13104
|
+
y2: \u4E0B\u7AEF + 6,
|
|
13105
|
+
stroke: "var(--cdl-divider, #d4d4d8)",
|
|
13106
|
+
strokeWidth: 1
|
|
13107
|
+
},
|
|
13108
|
+
`axis-${i}`
|
|
13109
|
+
)),
|
|
13110
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13111
|
+
/* @__PURE__ */ jsx(
|
|
13112
|
+
"text",
|
|
13113
|
+
{
|
|
13114
|
+
"data-cdl-role": "chart-slope-period",
|
|
13115
|
+
x: \u5DE6\u8EF8x,
|
|
13116
|
+
y: PAD + \u6642\u70B9\u306E\u7D1A,
|
|
13117
|
+
textAnchor: "middle",
|
|
13118
|
+
fontSize: \u6642\u70B9\u306E\u7D1A,
|
|
13119
|
+
fontWeight: 700,
|
|
13120
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
13121
|
+
children: "\u524D"
|
|
13122
|
+
}
|
|
13123
|
+
),
|
|
13124
|
+
/* @__PURE__ */ jsx(
|
|
13125
|
+
"text",
|
|
13126
|
+
{
|
|
13127
|
+
"data-cdl-role": "chart-slope-period",
|
|
13128
|
+
x: \u53F3\u8EF8x,
|
|
13129
|
+
y: PAD + \u6642\u70B9\u306E\u7D1A,
|
|
13130
|
+
textAnchor: "middle",
|
|
13131
|
+
fontSize: \u6642\u70B9\u306E\u7D1A,
|
|
13132
|
+
fontWeight: 700,
|
|
13133
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
13134
|
+
children: "\u4ECA"
|
|
13135
|
+
}
|
|
13136
|
+
)
|
|
13137
|
+
] }),
|
|
13138
|
+
\u7CFB\u5217\u305F\u3061.map((s, i) => {
|
|
13139
|
+
const \u5DE6y = y\u3092\u53D6\u308B(s.\u524D);
|
|
13140
|
+
const \u53F3y = y\u3092\u53D6\u308B(s.\u4ECA);
|
|
13141
|
+
const \u672A\u89E3\u6C7A = s.\u672A\u89E3\u6C7A ? "true" : void 0;
|
|
13142
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
13143
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
13144
|
+
"path",
|
|
13145
|
+
{
|
|
13146
|
+
"data-cdl-role": "chart-slope-line",
|
|
13147
|
+
"data-cdl-unresolved": \u672A\u89E3\u6C7A,
|
|
13148
|
+
d: `M ${\u5DE6\u8EF8x} ${\u5DE6y} L ${\u53F3\u8EF8x} ${\u53F3y}`,
|
|
13149
|
+
fill: "none",
|
|
13150
|
+
stroke: s.\u8272,
|
|
13151
|
+
strokeWidth: 2.5,
|
|
13152
|
+
strokeLinecap: "round",
|
|
13153
|
+
...\u4F38\u3070\u3059dash(drawing, \u4F38\u3073)
|
|
13154
|
+
}
|
|
13155
|
+
),
|
|
13156
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
13157
|
+
"circle",
|
|
13158
|
+
{
|
|
13159
|
+
"data-cdl-role": "chart-slope-dot",
|
|
13160
|
+
"data-cdl-unresolved": \u672A\u89E3\u6C7A,
|
|
13161
|
+
cx: \u5DE6\u8EF8x,
|
|
13162
|
+
cy: \u5DE6y,
|
|
13163
|
+
r: 4,
|
|
13164
|
+
fill: s.\u8272
|
|
13165
|
+
}
|
|
13166
|
+
),
|
|
13167
|
+
\u53F3\u3092\u51FA\u3059 && /* @__PURE__ */ jsx(
|
|
13168
|
+
"circle",
|
|
13169
|
+
{
|
|
13170
|
+
"data-cdl-role": "chart-slope-dot",
|
|
13171
|
+
"data-cdl-unresolved": \u672A\u89E3\u6C7A,
|
|
13172
|
+
cx: \u53F3\u8EF8x,
|
|
13173
|
+
cy: \u53F3y,
|
|
13174
|
+
r: 4,
|
|
13175
|
+
fill: s.\u8272
|
|
13176
|
+
}
|
|
13177
|
+
),
|
|
13178
|
+
\u524D\u3042\u308A ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13179
|
+
/* @__PURE__ */ jsx(
|
|
13180
|
+
"text",
|
|
13181
|
+
{
|
|
13182
|
+
"data-cdl-role": "chart-slope-label",
|
|
13183
|
+
x: \u5DE6\u8EF8x - \u8EF8\u304B\u3089\u5024\u307E\u3067,
|
|
13184
|
+
y: \u5DE6y + 5,
|
|
13185
|
+
textAnchor: "end",
|
|
13186
|
+
fontSize: \u5024\u306E\u7D1A,
|
|
13187
|
+
fontWeight: 600,
|
|
13188
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
13189
|
+
children: \u5DE6\u306E\u5B57[i]
|
|
13190
|
+
}
|
|
13191
|
+
),
|
|
13192
|
+
/* @__PURE__ */ jsx(
|
|
13193
|
+
"text",
|
|
13194
|
+
{
|
|
13195
|
+
"data-cdl-role": "chart-slope-label",
|
|
13196
|
+
x: \u5DE6\u8EF8x - \u8EF8\u304B\u3089\u5024\u307E\u3067 - \u5DE6\u5024\u5E45 - \u5024\u304B\u3089\u540D\u524D\u307E\u3067,
|
|
13197
|
+
y: \u5DE6y + 5,
|
|
13198
|
+
textAnchor: "end",
|
|
13199
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
13200
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
13201
|
+
children: s.\u540D\u524D
|
|
13202
|
+
}
|
|
13203
|
+
)
|
|
13204
|
+
] }) : /* @__PURE__ */ jsx(
|
|
13205
|
+
"text",
|
|
13206
|
+
{
|
|
13207
|
+
"data-cdl-role": "chart-slope-label",
|
|
13208
|
+
x: \u5DE6\u8EF8x - \u8EF8\u304B\u3089\u5024\u307E\u3067,
|
|
13209
|
+
y: \u53F3y + 5,
|
|
13210
|
+
textAnchor: "end",
|
|
13211
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
13212
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
13213
|
+
children: s.\u540D\u524D
|
|
13214
|
+
}
|
|
13215
|
+
),
|
|
13216
|
+
\u53F3\u3092\u51FA\u3059 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13217
|
+
/* @__PURE__ */ jsx(
|
|
13218
|
+
"text",
|
|
13219
|
+
{
|
|
13220
|
+
"data-cdl-role": "chart-slope-label",
|
|
13221
|
+
x: \u53F3\u8EF8x + \u8EF8\u304B\u3089\u5024\u307E\u3067,
|
|
13222
|
+
y: \u53F3y + 5,
|
|
13223
|
+
fontSize: \u5024\u306E\u7D1A,
|
|
13224
|
+
fontWeight: 600,
|
|
13225
|
+
fill: "var(--cdl-text, #1a1f2a)",
|
|
13226
|
+
children: \u53F3\u306E\u5B57[i]
|
|
13227
|
+
}
|
|
13228
|
+
),
|
|
13229
|
+
\u524D\u3042\u308A && /* @__PURE__ */ jsx(
|
|
13230
|
+
"text",
|
|
13231
|
+
{
|
|
13232
|
+
"data-cdl-role": "chart-slope-label",
|
|
13233
|
+
x: \u53F3\u8EF8x + \u8EF8\u304B\u3089\u5024\u307E\u3067 + \u53F3\u5024\u5E45 + \u5024\u304B\u3089\u540D\u524D\u307E\u3067,
|
|
13234
|
+
y: \u53F3y + 5,
|
|
13235
|
+
fontSize: \u540D\u524D\u306E\u7D1A,
|
|
13236
|
+
fill: "var(--cdl-text-dim, #5a6270)",
|
|
13237
|
+
children: s.\u540D\u524D
|
|
13238
|
+
}
|
|
13239
|
+
)
|
|
13240
|
+
] })
|
|
13241
|
+
] }, `slope-${i}`);
|
|
13242
|
+
})
|
|
13243
|
+
] });
|
|
13244
|
+
}
|
|
13245
|
+
function \u5370\u306E\u82724(tone, idx) {
|
|
13246
|
+
if (tone) return TONE[tone];
|
|
13247
|
+
return chartSeriesColor(idx);
|
|
13248
|
+
}
|
|
13249
|
+
function \u53CE\u3081\u308B\u7D1A2(\u540D\u524D\u305F\u3061, \u5E45, \u4E0A\u9650, \u4E0B\u9650) {
|
|
13250
|
+
if (\u540D\u524D\u305F\u3061.length === 0) return \u4E0A\u9650;
|
|
13251
|
+
let \u7D1A = \u4E0A\u9650;
|
|
13252
|
+
while (\u7D1A > \u4E0B\u9650 && Math.max(...\u540D\u524D\u305F\u3061.map((n) => textWidth(n, \u7D1A))) > \u5E45) \u7D1A -= 1;
|
|
13253
|
+
return \u7D1A;
|
|
13254
|
+
}
|
|
12741
13255
|
function ChartBarNode({
|
|
12742
13256
|
node,
|
|
12743
13257
|
active,
|
|
@@ -17417,6 +17931,17 @@ function CdlNodeView({
|
|
|
17417
17931
|
return /* @__PURE__ */ jsx(ChartGaugeNode, { node: resolvedNode, active, stateValues });
|
|
17418
17932
|
case "chart-stacked-bar":
|
|
17419
17933
|
return /* @__PURE__ */ jsx(ChartStackedBarNode, { node: resolvedNode, active, stateValues });
|
|
17934
|
+
case "chart-slope":
|
|
17935
|
+
return /* @__PURE__ */ jsx(
|
|
17936
|
+
ChartSlopeNode,
|
|
17937
|
+
{
|
|
17938
|
+
node: resolvedNode,
|
|
17939
|
+
active,
|
|
17940
|
+
stateValues,
|
|
17941
|
+
drawing,
|
|
17942
|
+
progress
|
|
17943
|
+
}
|
|
17944
|
+
);
|
|
17420
17945
|
case "chart-waffle":
|
|
17421
17946
|
return /* @__PURE__ */ jsx(ChartWaffleNode, { node: resolvedNode, active, stateValues });
|
|
17422
17947
|
case "chart-stat":
|