@diagrammo/dgmo 0.48.1 → 0.49.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/.cursorrules +8 -3
- package/.github/copilot-instructions.md +8 -3
- package/.windsurfrules +8 -3
- package/SKILL.md +8 -3
- package/dist/advanced.d.ts +444 -1
- package/dist/advanced.js +208 -146
- package/dist/auto.css +74 -5
- package/dist/auto.js +213 -107
- package/dist/auto.mjs +6906 -831
- package/dist/block.css +74 -5
- package/dist/block.d.ts +13 -5
- package/dist/block.js +148 -62
- package/dist/{charts-d3-QOZHKTCT.js → charts-d3-EW3YQTEA.js} +9 -8
- package/dist/chunk-26RVGM44.js +331 -0
- package/dist/{chunk-44CM72SQ.js → chunk-2WMBWZY2.js} +3 -3
- package/dist/{chunk-L66GEFB6.js → chunk-35BBZDFE.js} +4 -4
- package/dist/{chunk-4GRI7MEB.js → chunk-3BIAFYD2.js} +6 -6
- package/dist/chunk-3NFJWFNP.js +1474 -0
- package/dist/{chunk-76OWZ3BA.js → chunk-4BD7EVPK.js} +2 -2
- package/dist/{chunk-MITI6NOL.js → chunk-4FIV4K4Z.js} +9 -9
- package/dist/chunk-4HVNZ7WF.js +574 -0
- package/dist/{chunk-X5LCYCL5.js → chunk-4NQ3IKUM.js} +2 -2
- package/dist/{chunk-PWIHZ6NJ.js → chunk-4UDKKGHH.js} +4 -4
- package/dist/{chunk-6NYWYNBI.js → chunk-4XK3FLFB.js} +3 -3
- package/dist/chunk-4YNP6O47.js +607 -0
- package/dist/{chunk-3MQQNXPD.js → chunk-5FGDJIJX.js} +3 -3
- package/dist/{chunk-WCT3NYCV.js → chunk-5LWQH6QV.js} +1 -1
- package/dist/chunk-5XCM7UUW.js +261 -0
- package/dist/{chunk-RYEGFMUO.js → chunk-5ZZLLBFK.js} +2 -2
- package/dist/{chunk-EB6FPQUP.js → chunk-65RTDUZH.js} +3 -3
- package/dist/chunk-6CLKNXVP.js +664 -0
- package/dist/{chunk-H6PI3KJT.js → chunk-6IUAK7RZ.js} +2 -2
- package/dist/{chunk-ZGR7ULFJ.js → chunk-6SA7FJE4.js} +31 -19
- package/dist/{chunk-LIOHW36Z.js → chunk-6VE3VLWM.js} +3 -3
- package/dist/{chunk-AN2MOO5T.js → chunk-7OVSJI2V.js} +3 -3
- package/dist/{chunk-YAA6IID3.js → chunk-7UEMZREK.js} +2 -2
- package/dist/{chunk-FCIIHT24.js → chunk-7VLUGEMJ.js} +7 -7
- package/dist/{chunk-VOKGH627.js → chunk-AHGF2YYA.js} +13 -3
- package/dist/{chunk-3R5POCTZ.js → chunk-AJ2PEY7J.js} +6 -6
- package/dist/{chunk-PBHE5UG6.js → chunk-ALRHIR6I.js} +46 -12
- package/dist/{chunk-7JEGTRLD.js → chunk-B57V3DWN.js} +3 -3
- package/dist/{chunk-ILKORZ3H.js → chunk-BCT5G2VN.js} +7 -7
- package/dist/{chunk-TYS6CSS5.js → chunk-BCYVE3N5.js} +2 -2
- package/dist/{chunk-ZBWMSD5N.js → chunk-BGJV5ATD.js} +4 -4
- package/dist/{chunk-G2H74XJZ.js → chunk-BPIJLRYE.js} +8 -8
- package/dist/{chunk-YGJTDXVR.js → chunk-C4GQDB5L.js} +2 -2
- package/dist/{chunk-Y2ZE3MSG.js → chunk-C63UWAKM.js} +2 -2
- package/dist/{chunk-QEBUY5NY.js → chunk-CEHZOPGM.js} +4 -4
- package/dist/{chunk-725LDASD.js → chunk-CLD2OKV7.js} +2 -2
- package/dist/{chunk-5QXL4NYS.js → chunk-CLR4A2N2.js} +10 -5
- package/dist/{chunk-WBRZJOEC.js → chunk-CMCR5WBW.js} +3 -3
- package/dist/{chunk-SML67VPV.js → chunk-D5AVQCDN.js} +3 -3
- package/dist/{chunk-2LACINWN.js → chunk-DDTJ5N7Q.js} +9 -9
- package/dist/{chunk-FITOLXSX.js → chunk-EOFPYPAU.js} +26 -2
- package/dist/{chunk-B65G5DNL.js → chunk-EYN7VFKL.js} +3 -3
- package/dist/{chunk-4OHACBGX.js → chunk-F2L5GCQ4.js} +2 -2
- package/dist/{chunk-RVMRZAPB.js → chunk-F743CM2N.js} +3 -3
- package/dist/{chunk-3JLKYGBQ.js → chunk-F7BFXWNQ.js} +2 -2
- package/dist/{chunk-WCSOJFU3.js → chunk-FMKTYMP4.js} +3 -3
- package/dist/{chunk-RTLBSQ3G.js → chunk-FUCAB3KQ.js} +3 -3
- package/dist/{chunk-SGZYXELT.js → chunk-GB3YZTAM.js} +9 -6
- package/dist/{chunk-QLCCJEJI.js → chunk-HBVD67XG.js} +2 -2
- package/dist/{chunk-PBAHEPLQ.js → chunk-HGN652MU.js} +7 -6
- package/dist/{chunk-3SMGIJDD.js → chunk-HHXOONLX.js} +13 -1
- package/dist/{chunk-QOOUC2J5.js → chunk-HQCHYB5F.js} +2 -2
- package/dist/chunk-IAEC4KLA.js +492 -0
- package/dist/{chunk-J5FIXQRT.js → chunk-IBC35BTK.js} +4 -4
- package/dist/{chunk-NURGB5Z4.js → chunk-IFK3GIUW.js} +2 -2
- package/dist/{chunk-FANX6UJR.js → chunk-IHLSHCPZ.js} +11 -11
- package/dist/{chunk-GMR5MFHJ.js → chunk-IUK7AGD4.js} +2 -2
- package/dist/chunk-IVKC4GID.js +32 -0
- package/dist/{chunk-OJR3MQYV.js → chunk-JFPY3UJ7.js} +296 -57
- package/dist/{chunk-5MLYVTYM.js → chunk-K6HNAY5V.js} +2 -2
- package/dist/{chunk-P235SVAH.js → chunk-KQAEKMIX.js} +2 -2
- package/dist/{chunk-7DTWEFUE.js → chunk-KUBBJ2CD.js} +10 -10
- package/dist/{chunk-BUVJFRPY.js → chunk-KV6Y2HE6.js} +4 -4
- package/dist/{chunk-OURHMODR.js → chunk-LG4TWW4U.js} +13 -13
- package/dist/{chunk-XAKEUMEJ.js → chunk-LVHPTBO3.js} +3 -3
- package/dist/{chunk-ERLBPDGU.js → chunk-MJCG5K2O.js} +2 -2
- package/dist/{chunk-THXCFRTU.js → chunk-N4J5KGWG.js} +12 -12
- package/dist/{chunk-MZSBFAPJ.js → chunk-NVT6C2VE.js} +9 -9
- package/dist/{chunk-AELOBFW5.js → chunk-O5MQPK7E.js} +3 -3
- package/dist/{chunk-JM4LEPY3.js → chunk-O7NUCTFU.js} +2 -2
- package/dist/{chunk-JED6ZDEE.js → chunk-O7WP4ZD4.js} +2 -2
- package/dist/{chunk-ZO27FGJS.js → chunk-PH5X4GIP.js} +2 -2
- package/dist/{chunk-B7JUCQUA.js → chunk-PU3AUQPA.js} +4 -4
- package/dist/{chunk-A4VFQH5G.js → chunk-PZFVK3IH.js} +52 -7
- package/dist/chunk-QQJUTGQH.js +135 -0
- package/dist/{chunk-HSH73DP6.js → chunk-RI4NIMFP.js} +99 -39
- package/dist/{chunk-33LCUH4H.js → chunk-RTERS6S5.js} +3 -3
- package/dist/{chunk-T3UBLACL.js → chunk-SCQ5VPUF.js} +19 -5
- package/dist/chunk-SGHSY3LU.js +377 -0
- package/dist/{chunk-SRTU6HMQ.js → chunk-SJEGO2QL.js} +8 -8
- package/dist/chunk-SQDFK5ZQ.js +273 -0
- package/dist/{chunk-UC7TFHUM.js → chunk-SVDWQGX2.js} +296 -121
- package/dist/{chunk-Z5CGSFJB.js → chunk-T7IKPCMI.js} +4 -4
- package/dist/chunk-TC3YWBFO.js +233 -0
- package/dist/{chunk-EVCVDTXE.js → chunk-TLKMTQYL.js} +3 -3
- package/dist/{chunk-IJZFN3HM.js → chunk-TWQUYVP3.js} +4 -4
- package/dist/{chunk-IZMRON6C.js → chunk-UVCXZEGU.js} +2 -2
- package/dist/{chunk-CKNVO24D.js → chunk-UWDO3O52.js} +2 -2
- package/dist/{chunk-RJE5JTVK.js → chunk-VC3TR4NL.js} +7 -7
- package/dist/{chunk-CI2G3OEB.js → chunk-X2CH42BN.js} +9 -9
- package/dist/{chunk-6HO5ZTXK.js → chunk-XCC2RENT.js} +2 -2
- package/dist/chunk-XHVV4NVW.js +51 -0
- package/dist/{chunk-ZJEL4H2R.js → chunk-XJ7J6WOO.js} +9 -9
- package/dist/{chunk-ULOEATBZ.js → chunk-XKTN7CZF.js} +106 -29
- package/dist/{chunk-IPWPWM6R.js → chunk-YM2BSPYW.js} +111 -10
- package/dist/{chunk-BUPDIHML.js → chunk-YRVLP7UU.js} +3 -3
- package/dist/{chunk-T2OE3YQB.js → chunk-YTN572Q2.js} +3 -3
- package/dist/{chunk-WVAJFAIA.js → chunk-YYX3SU6H.js} +3 -3
- package/dist/{chunk-MO5YHHMQ.js → chunk-ZDUQGL3N.js} +2 -2
- package/dist/{chunk-Y3J7VR52.js → chunk-ZNQX6QWH.js} +30 -2
- package/dist/{chunk-UWN33VNX.js → chunk-ZREZOIGS.js} +8 -8
- package/dist/{chunk-6SM5NJQH.js → chunk-ZTLWVRNS.js} +4 -4
- package/dist/{chunk-RUNNI6VE.js → chunk-ZXL6MB4R.js} +3 -3
- package/dist/cli.cjs +159 -122
- package/dist/dgmo-router-ODKPEJ3P.js +79 -0
- package/dist/dimensions-WSIJXT5Q.js +22 -0
- package/dist/editor.js +4 -1
- package/dist/element.js +214 -108
- package/dist/element.mjs +6906 -831
- package/dist/{flowchart-parser-ZNSKIBVR.js → flowchart-parser-IVZN7CQN.js} +4 -4
- package/dist/{flowchart-renderer-SNDSII4D.js → flowchart-renderer-GMI2U3DD.js} +9 -9
- package/dist/highlight.js +7 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +193 -232
- package/dist/{layout-HRBZPFCN.js → layout-34CLNICW.js} +5 -5
- package/dist/{layout-5RA6QWR6.js → layout-4Z5JM7PT.js} +6 -6
- package/dist/layout-6RDJHS6E.js +9 -0
- package/dist/{layout-7QXCNOVS.js → layout-7H4H46CS.js} +3 -3
- package/dist/{layout-46N4JJYK.js → layout-7SKMFYHL.js} +5 -5
- package/dist/{layout-HWDSRX5E.js → layout-D42XE4RE.js} +6 -6
- package/dist/{layout-EE6GE46Y.js → layout-DC4TVXER.js} +5 -5
- package/dist/layout-FGQWRYYW.js +14 -0
- package/dist/layout-GZ2CWONU.js +14 -0
- package/dist/layout-HQMBPJVS.js +10 -0
- package/dist/{layout-UM5F4DJB.js → layout-K2ZN3Q42.js} +5 -5
- package/dist/{layout-S2QBYSK2.js → layout-NXG63LWH.js} +3 -3
- package/dist/{layout-N76NR4ZO.js → layout-PUQCB6AN.js} +7 -7
- package/dist/{layout-HYZPWAK5.js → layout-QNUQLEHU.js} +3 -3
- package/dist/layout-S3EK4IYO.js +14 -0
- package/dist/{layout-search-OYV77HHS.js → layout-search-QS44PI5R.js} +6 -6
- package/dist/{parser-KNSQSKQO.js → parser-4BKIFG2C.js} +5 -5
- package/dist/{parser-OV7NOBW6.js → parser-4ROBKVUR.js} +4 -4
- package/dist/parser-667RGSUW.js +13 -0
- package/dist/{parser-IXSZZQHY.js → parser-BL7Z72EY.js} +4 -4
- package/dist/{parser-AQETEVRW.js → parser-CLMFZWCC.js} +4 -4
- package/dist/{parser-XKRP7QKP.js → parser-D6ONJQFR.js} +3 -3
- package/dist/{parser-2EWECDSA.js → parser-DERPY5KC.js} +4 -4
- package/dist/{parser-4OGOBJJ4.js → parser-GFSOPDB7.js} +4 -4
- package/dist/{parser-2MFP2H2E.js → parser-HVJFTOXL.js} +3 -3
- package/dist/{parser-VQP2UJ6W.js → parser-IKZFTLOJ.js} +3 -3
- package/dist/parser-J3P2D6IP.js +13 -0
- package/dist/{parser-PQ3POX45.js → parser-JD7OQ2E6.js} +4 -4
- package/dist/{parser-O5J4VBII.js → parser-K647FRI4.js} +3 -3
- package/dist/{parser-NGU3ETO6.js → parser-KPMN5KKE.js} +4 -4
- package/dist/{parser-4FL2CMDG.js → parser-MBJSBTL5.js} +4 -4
- package/dist/{parser-TFZFBVWN.js → parser-MCJWF5G3.js} +3 -3
- package/dist/{parser-NRAI6O25.js → parser-MRBPXXIV.js} +4 -4
- package/dist/{parser-6BTRLKRZ.js → parser-OBQG655V.js} +4 -4
- package/dist/{parser-3STE62GB.js → parser-QJYS7KQQ.js} +4 -4
- package/dist/{parser-XDVELHRK.js → parser-SMBJO3XN.js} +4 -4
- package/dist/{parser-TRTHDFPP.js → parser-TITK4YW6.js} +5 -5
- package/dist/{parser-I6KXEYFK.js → parser-TNYX5S7E.js} +4 -4
- package/dist/{parser-Y6WTBU76.js → parser-UBGPTIZD.js} +3 -3
- package/dist/parser-UGA23PYK.js +14 -0
- package/dist/{parser-N5O4IHUN.js → parser-WISPH7LW.js} +4 -4
- package/dist/{parser-CFZD5IBL.js → parser-XWUDFJ7P.js} +4 -4
- package/dist/parser-ZKF5K2H2.js +15 -0
- package/dist/{parser-ZSDPZYQP.js → parser-ZYC3XGNS.js} +4 -4
- package/dist/{renderer-AWWAF6XD.js → renderer-4IUPINAE.js} +10 -10
- package/dist/renderer-6L3NBEY5.js +24 -0
- package/dist/{renderer-ZRNG54CW.js → renderer-6T3KK4S3.js} +11 -11
- package/dist/{renderer-KQB7UGDS.js → renderer-7RH2SI3B.js} +3 -3
- package/dist/{renderer-6EEZHMH4.js → renderer-A5VFZQQK.js} +9 -9
- package/dist/{renderer-5MYBMBYO.js → renderer-BB5PREMY.js} +5 -5
- package/dist/{renderer-BYCNMBF7.js → renderer-CGW7QPNA.js} +10 -10
- package/dist/{renderer-QIWVHWZO.js → renderer-DAXMXIKD.js} +3 -3
- package/dist/{renderer-7MVLWWQD.js → renderer-DKESNMU5.js} +9 -9
- package/dist/{renderer-ZTR3DER3.js → renderer-HVCU2C3Z.js} +3 -3
- package/dist/{renderer-VACVQYML.js → renderer-LWGJFT3D.js} +8 -8
- package/dist/{renderer-PGX2TKVS.js → renderer-MFJ7HY2H.js} +8 -8
- package/dist/{renderer-B2OMQIQG.js → renderer-MJDDU27W.js} +15 -15
- package/dist/{renderer-4JHRUBE6.js → renderer-QL5KO6SK.js} +10 -10
- package/dist/{renderer-W4M6QLIJ.js → renderer-QNHUXCRL.js} +14 -14
- package/dist/{renderer-ZGNTUWC4.js → renderer-ROV756WT.js} +8 -8
- package/dist/{renderer-YY2OSF6E.js → renderer-SQ3JUAI7.js} +9 -9
- package/dist/renderer-THD6V5TL.js +22 -0
- package/dist/{renderer-5NDVNDAZ.js → renderer-TPIBXNOS.js} +9 -9
- package/dist/{renderer-RPOA5YPZ.js → renderer-TYXRHMRI.js} +13 -13
- package/dist/{renderer-N43WR5GV.js → renderer-UZF3JROD.js} +11 -11
- package/dist/{renderer-6W5462RB.js → renderer-V3JEMWMM.js} +9 -9
- package/dist/{renderer-JGBKUCZD.js → renderer-VFUVRNLK.js} +4 -4
- package/dist/{renderer-Z7I3W2PP.js → renderer-VICQ4WNY.js} +8 -8
- package/dist/renderer-W5RMOURB.js +21 -0
- package/dist/renderer-XEKIRPI6.js +23 -0
- package/dist/{renderer-CLJHQPBJ.js → renderer-YHXPN3GF.js} +12 -12
- package/dist/renderer-radial-MHO2VDXN.js +21 -0
- package/dist/{resolver-NOAA7ID7.js → resolver-FHBCO3PL.js} +3 -3
- package/dist/{state-parser-Z2V23ATR.js → state-parser-RX3GXOIB.js} +4 -4
- package/dist/{state-renderer-B4DQBM6M.js → state-renderer-AJUKGNWU.js} +9 -9
- package/docs/ai-integration.md +8 -3
- package/docs/language-reference.md +179 -5
- package/gallery/fixtures/family.dgmo +23 -0
- package/gallery/fixtures/sketch.dgmo +22 -0
- package/package.json +1 -1
- package/dist/chunk-ODZVHU3R.js +0 -153
- package/dist/dgmo-router-X35VLZLM.js +0 -73
- package/dist/dimensions-J3FHIMJ6.js +0 -22
- package/dist/layout-5T6RH5M6.js +0 -14
- package/dist/layout-G23F7LDH.js +0 -9
- package/dist/layout-OB3RI63S.js +0 -14
- package/dist/parser-JAL2HD4I.js +0 -13
- package/dist/renderer-SMIBCRVB.js +0 -24
- package/dist/renderer-radial-C32GPJQ7.js +0 -21
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeQuadrantPointLabels,
|
|
3
|
+
rectCircleOverlap,
|
|
4
|
+
rectsOverlap
|
|
5
|
+
} from "./chunk-HGN652MU.js";
|
|
6
|
+
import {
|
|
7
|
+
getExtendedChartLegendGroups,
|
|
8
|
+
getSimpleChartLegendGroups,
|
|
9
|
+
parseChart,
|
|
10
|
+
parseExtendedChart
|
|
11
|
+
} from "./chunk-KQAEKMIX.js";
|
|
1
12
|
import {
|
|
2
13
|
EXPORT_HEIGHT,
|
|
3
14
|
EXPORT_WIDTH,
|
|
@@ -9,7 +20,7 @@ import {
|
|
|
9
20
|
} from "./chunk-U6EQI3U6.js";
|
|
10
21
|
import {
|
|
11
22
|
computeLegendLayout
|
|
12
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-7UEMZREK.js";
|
|
13
24
|
import {
|
|
14
25
|
FONT_FAMILY
|
|
15
26
|
} from "./chunk-6KFWC4CO.js";
|
|
@@ -18,17 +29,12 @@ import {
|
|
|
18
29
|
LEGEND_ENTRY_FONT_SIZE,
|
|
19
30
|
LEGEND_HEIGHT,
|
|
20
31
|
LEGEND_PILL_FONT_SIZE
|
|
21
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-HQCHYB5F.js";
|
|
22
33
|
import {
|
|
23
34
|
measureText
|
|
24
|
-
} from "./chunk-
|
|
25
|
-
import {
|
|
26
|
-
getExtendedChartLegendGroups,
|
|
27
|
-
getSimpleChartLegendGroups,
|
|
28
|
-
parseChart,
|
|
29
|
-
parseExtendedChart
|
|
30
|
-
} from "./chunk-P235SVAH.js";
|
|
35
|
+
} from "./chunk-5LWQH6QV.js";
|
|
31
36
|
import {
|
|
37
|
+
contrastText,
|
|
32
38
|
getSegmentColors,
|
|
33
39
|
getSeriesColors,
|
|
34
40
|
hexToHSL,
|
|
@@ -38,7 +44,7 @@ import {
|
|
|
38
44
|
} from "./chunk-P6T66CCZ.js";
|
|
39
45
|
import {
|
|
40
46
|
tagAttrKey
|
|
41
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-HBVD67XG.js";
|
|
42
48
|
|
|
43
49
|
// src/utils/legend-svg.ts
|
|
44
50
|
function esc(s) {
|
|
@@ -396,6 +402,7 @@ function seriesValue(pt, s) {
|
|
|
396
402
|
function renderLine(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, bgColor, hasTitle) {
|
|
397
403
|
const data = chart.data;
|
|
398
404
|
const isArea = chart.fill === true;
|
|
405
|
+
const solid = chart.solidFill === true;
|
|
399
406
|
const seriesNames = chart.seriesNames?.length ? chart.seriesNames : [chart.series ?? ""];
|
|
400
407
|
const seriesCount = Math.max(
|
|
401
408
|
1,
|
|
@@ -490,10 +497,11 @@ function renderLine(svg, chart, width, height, colors, palette, isDark, textColo
|
|
|
490
497
|
if (seriesLine !== void 0) g.attr("data-line-number", seriesLine);
|
|
491
498
|
if (isArea) {
|
|
492
499
|
const areaGen = d3area().x((p) => x(p.label) ?? 0).y0(yy(Math.max(yy.domain()[0], 0))).y1((p) => yy(p.v));
|
|
493
|
-
g.append("path").attr("class", "dgmo-series-area").attr("d", areaGen(pts) ?? "").attr("fill", shapeFill(palette, color, isDark)).attr("stroke", "none");
|
|
500
|
+
g.append("path").attr("class", "dgmo-series-area").attr("d", areaGen(pts) ?? "").attr("fill", solid ? color : shapeFill(palette, color, isDark)).attr("stroke", "none");
|
|
494
501
|
}
|
|
495
502
|
const lineGen = d3line().x((p) => x(p.label) ?? 0).y((p) => yy(p.v));
|
|
496
503
|
g.append("path").attr("class", "dgmo-series-line").attr("d", lineGen(pts) ?? "").attr("fill", "none").attr("stroke", color).attr("stroke-width", 2.5).attr("stroke-linejoin", "round").attr("stroke-linecap", "round");
|
|
504
|
+
g.append("path").attr("class", "dgmo-series-hit").attr("d", lineGen(pts) ?? "").attr("fill", "none").attr("stroke", "transparent").attr("stroke-width", 16).attr("stroke-linejoin", "round").attr("stroke-linecap", "round");
|
|
497
505
|
const labelColor = mix(color, textColor, 60);
|
|
498
506
|
for (const p of pts) {
|
|
499
507
|
g.append("circle").attr("class", "dgmo-pt").attr("data-series-index", s).attr("data-series-name", name).attr("data-color", color).attr("data-x-index", p.xIndex).attr("data-x-label", p.label).attr("data-value", p.v).attr("data-line-number", p.lineNumber).attr("cx", x(p.label) ?? 0).attr("cy", yy(p.v)).attr("r", 3.5).attr("fill", bgColor).attr("stroke", color).attr("stroke-width", 2);
|
|
@@ -547,8 +555,30 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
547
555
|
const total = data.reduce((a, d) => a + d.value, 0);
|
|
548
556
|
const cx = width / 2;
|
|
549
557
|
const top = topInset + 12;
|
|
550
|
-
const
|
|
551
|
-
const
|
|
558
|
+
const availH = height - top;
|
|
559
|
+
const cy = top + availH / 2;
|
|
560
|
+
const labels = data.map((d) => {
|
|
561
|
+
const pct = Math.round(d.value / total * 100);
|
|
562
|
+
const nm = chart.noName ? "" : d.label;
|
|
563
|
+
const tail = [
|
|
564
|
+
chart.noValue ? "" : fmtNum(d.value),
|
|
565
|
+
chart.noPercent ? "" : `(${pct}%)`
|
|
566
|
+
].filter(Boolean).join(" ");
|
|
567
|
+
return [nm, tail].filter(Boolean).join(" \u2014 ");
|
|
568
|
+
});
|
|
569
|
+
const maxLabelLen = labels.reduce((m, s) => Math.max(m, s.length), 0);
|
|
570
|
+
const MARGIN2 = 6;
|
|
571
|
+
const halfW = width / 2 - MARGIN2;
|
|
572
|
+
const rH = availH / 2 - availH * 0.06;
|
|
573
|
+
const labelExtent = 1.268 + 0.0428 * maxLabelLen;
|
|
574
|
+
const rLabeled = Math.min(rH, halfW / labelExtent);
|
|
575
|
+
const showLabels = maxLabelLen > 0 && rLabeled >= 45;
|
|
576
|
+
const rPlain = Math.min(rH, halfW * 0.94);
|
|
577
|
+
const radius = Math.max(8, showLabels ? rLabeled : rPlain);
|
|
578
|
+
const labelScale = radius / 180;
|
|
579
|
+
const font = Math.max(7, LABEL_FONT * labelScale);
|
|
580
|
+
const elbowOut = radius * 0.09;
|
|
581
|
+
const elbowRun = radius * 0.155;
|
|
552
582
|
const segColors = getSegmentColors(palette, data.length);
|
|
553
583
|
const strokeFor = (i, override) => override ?? segColors[i % segColors.length];
|
|
554
584
|
const arcs = d3pie().sort(null).value((d) => d.value)(data.map((d) => ({ value: d.value })));
|
|
@@ -566,26 +596,35 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
566
596
|
value: `${fmtNum(data[i].value)} (${pct}%)`,
|
|
567
597
|
color: stroke
|
|
568
598
|
});
|
|
599
|
+
if (!showLabels) return;
|
|
569
600
|
const mid = (a.startAngle + a.endAngle) / 2 - Math.PI / 2;
|
|
570
601
|
const rightSide = Math.cos(mid) >= 0;
|
|
571
602
|
const x0 = Math.cos(mid) * radius;
|
|
572
603
|
const y0 = Math.sin(mid) * radius;
|
|
573
|
-
const x1 = Math.cos(mid) * (radius +
|
|
574
|
-
const y1 = Math.sin(mid) * (radius +
|
|
575
|
-
const x2 = x1 + (rightSide ?
|
|
576
|
-
const
|
|
577
|
-
const tail = [
|
|
578
|
-
chart.noValue ? "" : fmtNum(data[i].value),
|
|
579
|
-
chart.noPercent ? "" : `(${pct}%)`
|
|
580
|
-
].filter(Boolean).join(" ");
|
|
581
|
-
const label = [nm, tail].filter(Boolean).join(" \u2014 ");
|
|
604
|
+
const x1 = Math.cos(mid) * (radius + elbowOut);
|
|
605
|
+
const y1 = Math.sin(mid) * (radius + elbowOut);
|
|
606
|
+
const x2 = x1 + (rightSide ? elbowRun : -elbowRun);
|
|
607
|
+
const label = labels[i];
|
|
582
608
|
if (label) {
|
|
583
|
-
|
|
584
|
-
|
|
609
|
+
const tag = {
|
|
610
|
+
line: data[i].lineNumber,
|
|
611
|
+
key: data[i].label,
|
|
612
|
+
name: data[i].label,
|
|
613
|
+
value: `${fmtNum(data[i].value)} (${pct}%)`,
|
|
614
|
+
color: stroke
|
|
615
|
+
};
|
|
616
|
+
tagDatum(
|
|
617
|
+
g.append("polyline").attr("points", `${x0},${y0} ${x1},${y1} ${x2},${y1}`).attr("fill", "none").attr("stroke", stroke).attr("stroke-width", 1),
|
|
618
|
+
tag
|
|
619
|
+
);
|
|
620
|
+
tagDatum(
|
|
621
|
+
g.append("text").attr("x", x2 + (rightSide ? font * 0.3 : -font * 0.3)).attr("y", y1 + font * 0.3).attr("text-anchor", rightSide ? "start" : "end").attr("fill", stroke).attr("font-size", font).attr("font-family", FONT_FAMILY).text(label),
|
|
622
|
+
tag
|
|
623
|
+
);
|
|
585
624
|
}
|
|
586
625
|
});
|
|
587
626
|
if (hasHole && !chart.noCenterTotal) {
|
|
588
|
-
g.append("text").attr("text-anchor", "middle").attr("y", 8).attr("fill", textColor).attr("font-size", 26).attr("font-weight", 700).attr("font-family", FONT_FAMILY).text(fmtNum(total));
|
|
627
|
+
g.append("text").attr("text-anchor", "middle").attr("y", Math.max(4, 8 * labelScale)).attr("fill", textColor).attr("font-size", Math.max(11, 26 * labelScale)).attr("font-weight", 700).attr("font-family", FONT_FAMILY).text(fmtNum(total));
|
|
589
628
|
}
|
|
590
629
|
}
|
|
591
630
|
|
|
@@ -649,13 +688,19 @@ function renderRadar(svg, chart, width, height, colors, palette, isDark, textCol
|
|
|
649
688
|
const vtx = g.append("circle").attr("cx", x).attr("cy", y).attr("r", 4).attr("fill", color);
|
|
650
689
|
tagDatum(vtx, {
|
|
651
690
|
line: d.lineNumber,
|
|
652
|
-
key: multi ? `${name}
|
|
691
|
+
key: multi ? `${name} ${d.label}` : d.label,
|
|
653
692
|
name: multi ? `${name} \u2014 ${d.label}` : d.label,
|
|
654
693
|
value: fmtNum(v),
|
|
655
694
|
color
|
|
656
695
|
});
|
|
657
696
|
if (!chart.noValue) {
|
|
658
|
-
|
|
697
|
+
const [lx, ly] = pt(i, v / maxValue * radius + 14);
|
|
698
|
+
const c = Math.cos(angle(i));
|
|
699
|
+
const s2 = Math.sin(angle(i));
|
|
700
|
+
g.append("text").attr("x", lx).attr("y", ly + (s2 < -0.3 ? 0 : s2 > 0.3 ? 11 : 4)).attr(
|
|
701
|
+
"text-anchor",
|
|
702
|
+
Math.abs(c) < 0.3 ? "middle" : c > 0 ? "start" : "end"
|
|
703
|
+
).attr("fill", multi ? color : textColor).attr("font-size", 12).attr("font-family", FONT_FAMILY).text(fmtNum(v));
|
|
659
704
|
}
|
|
660
705
|
});
|
|
661
706
|
}
|
|
@@ -710,26 +755,72 @@ function renderPolarArea(svg, chart, width, height, palette, isDark, textColor,
|
|
|
710
755
|
}
|
|
711
756
|
|
|
712
757
|
// src/charts-d3/funnel.ts
|
|
713
|
-
|
|
758
|
+
var PAD = 12;
|
|
759
|
+
var MARGIN = 8;
|
|
760
|
+
function renderFunnel(svg, chart, width, height, colors, palette, isDark, topInset) {
|
|
714
761
|
const sorted = [...chart.data].sort((a, b) => b.value - a.value);
|
|
715
762
|
const n = sorted.length;
|
|
716
763
|
if (n === 0) return;
|
|
717
764
|
const solid = chart.solidFill === true;
|
|
718
|
-
const plotLeft = width * 0.2;
|
|
719
|
-
const plotW = width * 0.6;
|
|
720
|
-
const cx = width / 2;
|
|
721
765
|
const top = topInset + 8;
|
|
722
766
|
const bottom = height - 30;
|
|
723
767
|
const H = bottom - top;
|
|
724
768
|
const bandH = H / n;
|
|
725
769
|
const maxValue = sorted[0].value || 1;
|
|
726
|
-
const
|
|
727
|
-
const
|
|
770
|
+
const sideFont = Math.max(11, Math.min(21, width / 52));
|
|
771
|
+
const est = (s, f) => s.length * f * 0.6;
|
|
772
|
+
const pctLabelFor = (i) => {
|
|
773
|
+
const pct = sorted[i].value / sorted[i - 1].value * 100;
|
|
774
|
+
return pct < 1 ? "<1%" : `${Math.round(pct)}%`;
|
|
775
|
+
};
|
|
776
|
+
const rightTextFor = (i, valueInside) => {
|
|
777
|
+
const parts = [];
|
|
778
|
+
if (!chart.noValue && !valueInside) parts.push(fmtNum(sorted[i].value));
|
|
779
|
+
if (!chart.noPercent && i > 0) parts.push(pctLabelFor(i));
|
|
780
|
+
return parts.join(" \xB7 ");
|
|
781
|
+
};
|
|
782
|
+
const nameW = chart.noName ? 0 : Math.max(...sorted.map((d) => est(d.label, sideFont))) + PAD;
|
|
783
|
+
const bandWidthsAt = (plotW2, i) => {
|
|
784
|
+
const minW = plotW2 * 0.14;
|
|
785
|
+
const scale = (v) => Math.max(minW, v / maxValue * plotW2);
|
|
786
|
+
const topW = scale(sorted[i].value);
|
|
787
|
+
const botW = i < n - 1 ? scale(sorted[i + 1].value) : topW * 0.7;
|
|
788
|
+
return { topW, botW };
|
|
789
|
+
};
|
|
790
|
+
const valueSizeAt = (plotW2, i) => {
|
|
791
|
+
const { topW, botW } = bandWidthsAt(plotW2, i);
|
|
792
|
+
const wMid = (topW + botW) / 2;
|
|
793
|
+
const label = fmtNum(sorted[i].value);
|
|
794
|
+
const fitByWidth = (wMid - 16) / (label.length * 0.6);
|
|
795
|
+
return Math.min(bandH * 0.55, fitByWidth);
|
|
796
|
+
};
|
|
797
|
+
const valueInsideAt = (plotW2, i) => !chart.noValue && valueSizeAt(plotW2, i) >= 13;
|
|
798
|
+
const layout = (rightW2) => {
|
|
799
|
+
const spanL = MARGIN + nameW;
|
|
800
|
+
const spanR = width - MARGIN - rightW2;
|
|
801
|
+
const plotW2 = Math.max(width * 0.25, Math.min(width * 0.6, spanR - spanL));
|
|
802
|
+
const lo = spanL + plotW2 / 2;
|
|
803
|
+
const hi = spanR - plotW2 / 2;
|
|
804
|
+
const cx2 = lo > hi ? (spanL + spanR) / 2 : Math.min(Math.max(width / 2, lo), hi);
|
|
805
|
+
return { plotW: plotW2, cx: cx2 };
|
|
806
|
+
};
|
|
807
|
+
const maxRightEst = (plotW2) => Math.max(
|
|
808
|
+
0,
|
|
809
|
+
...sorted.map(
|
|
810
|
+
(_, i) => est(
|
|
811
|
+
rightTextFor(i, plotW2 === null ? true : valueInsideAt(plotW2, i)),
|
|
812
|
+
sideFont
|
|
813
|
+
)
|
|
814
|
+
)
|
|
815
|
+
);
|
|
816
|
+
let rightW = maxRightEst(null) + PAD;
|
|
817
|
+
let { plotW, cx } = layout(rightW);
|
|
818
|
+
rightW = maxRightEst(plotW) + PAD;
|
|
819
|
+
({ plotW, cx } = layout(rightW));
|
|
728
820
|
sorted.forEach((d, i) => {
|
|
729
821
|
const stroke = d.color ?? colors[chart.data.indexOf(d) % colors.length];
|
|
730
822
|
const fill = solid ? stroke : shapeFill(palette, stroke, isDark);
|
|
731
|
-
const topW =
|
|
732
|
-
const botW = i < n - 1 ? scaleW(sorted[i + 1].value) : minW;
|
|
823
|
+
const { topW, botW } = bandWidthsAt(plotW, i);
|
|
733
824
|
const y0 = top + i * bandH;
|
|
734
825
|
const y1 = y0 + bandH;
|
|
735
826
|
const seg = svg.append("polygon").attr(
|
|
@@ -744,13 +835,26 @@ function renderFunnel(svg, chart, width, height, colors, palette, isDark, textCo
|
|
|
744
835
|
color: stroke
|
|
745
836
|
});
|
|
746
837
|
const yMid = (y0 + y1) / 2;
|
|
838
|
+
const halfEdge = (topW + botW) / 4;
|
|
747
839
|
if (!chart.noName) {
|
|
748
|
-
svg.append("
|
|
749
|
-
svg.append("text").attr("x", plotLeft - 12).attr("y", yMid + 4).attr("text-anchor", "end").attr("fill", textColor).attr("font-size", 13).attr("font-family", FONT_FAMILY).text(d.label);
|
|
840
|
+
svg.append("text").attr("x", cx - halfEdge - PAD).attr("y", yMid + sideFont * 0.35).attr("text-anchor", "end").attr("fill", stroke).attr("font-size", sideFont).attr("font-weight", 600).attr("font-family", FONT_FAMILY).text(d.label);
|
|
750
841
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
842
|
+
const showPct = !chart.noPercent && i > 0;
|
|
843
|
+
const valueInside = valueInsideAt(plotW, i);
|
|
844
|
+
if (valueInside) {
|
|
845
|
+
const valueSize = valueSizeAt(plotW, i);
|
|
846
|
+
const valueFill = solid ? contrastText(fill, palette.textOnFillLight, palette.textOnFillDark) : stroke;
|
|
847
|
+
svg.append("text").attr("x", cx).attr("y", yMid + valueSize * 0.35).attr("text-anchor", "middle").attr("fill", valueFill).attr("font-size", valueSize).attr("font-weight", 700).attr("font-family", FONT_FAMILY).text(fmtNum(d.value));
|
|
848
|
+
}
|
|
849
|
+
const showValueRight = !chart.noValue && !valueInside;
|
|
850
|
+
if (showValueRight || showPct) {
|
|
851
|
+
const text = svg.append("text").attr("x", cx + halfEdge + PAD).attr("y", yMid + sideFont * 0.35).attr("text-anchor", "start").attr("font-size", sideFont).attr("font-weight", 600).attr("font-family", FONT_FAMILY);
|
|
852
|
+
if (showValueRight) {
|
|
853
|
+
text.append("tspan").attr("fill", stroke).text(fmtNum(d.value));
|
|
854
|
+
}
|
|
855
|
+
if (showPct) {
|
|
856
|
+
text.append("tspan").attr("fill", stroke).text(showValueRight ? ` \xB7 ${pctLabelFor(i)}` : pctLabelFor(i));
|
|
857
|
+
}
|
|
754
858
|
}
|
|
755
859
|
});
|
|
756
860
|
}
|
|
@@ -801,11 +905,19 @@ function renderHeatmap(svg, chart, width, height, palette, isDark, textColor, bg
|
|
|
801
905
|
const plotH = height - top - bottom;
|
|
802
906
|
const cw = plotW / ncols;
|
|
803
907
|
const ch = plotH / nrows;
|
|
804
|
-
const
|
|
908
|
+
const REF = 100;
|
|
909
|
+
const maxValueW = Math.max(
|
|
910
|
+
1,
|
|
911
|
+
...rows.flatMap((r) => r.values.map((v) => measureText(fmtNum(v), REF)))
|
|
912
|
+
);
|
|
913
|
+
const cellFont = Math.max(
|
|
914
|
+
11,
|
|
915
|
+
Math.min(ch * 0.55, cw * 0.7 * REF / maxValueW)
|
|
916
|
+
);
|
|
805
917
|
const rotate = cols.some((c) => measureText(c, 12) > cw * 0.85);
|
|
806
918
|
cols.forEach((c, ci) => {
|
|
807
919
|
const x = left + ci * cw + cw / 2;
|
|
808
|
-
const t = svg.append("text").attr("fill", textColor).attr("font-size", 12).attr("font-family", FONT_FAMILY).text(c);
|
|
920
|
+
const t = svg.append("text").attr("class", "dgmo-axis-label").attr("data-filter-attr", "data-col-key").attr("data-filter-value", c).attr("fill", textColor).attr("font-size", 12).attr("font-family", FONT_FAMILY).text(c);
|
|
809
921
|
if (rotate) {
|
|
810
922
|
t.attr("transform", `translate(${x},${top - 8}) rotate(-40)`).attr(
|
|
811
923
|
"text-anchor",
|
|
@@ -816,30 +928,97 @@ function renderHeatmap(svg, chart, width, height, palette, isDark, textColor, bg
|
|
|
816
928
|
}
|
|
817
929
|
});
|
|
818
930
|
rows.forEach((row, ri) => {
|
|
819
|
-
svg.append("text").attr("x", left - 10).attr("y", top + ri * ch + ch / 2 + 4).attr("text-anchor", "end").attr("fill", textColor).attr("font-size", 13).attr("font-family", FONT_FAMILY).text(row.label);
|
|
931
|
+
svg.append("text").attr("class", "dgmo-axis-label").attr("data-filter-attr", "data-row-key").attr("data-filter-value", row.label).attr("x", left - 10).attr("y", top + ri * ch + ch / 2 + 4).attr("text-anchor", "end").attr("fill", textColor).attr("font-size", 13).attr("font-family", FONT_FAMILY).text(row.label);
|
|
820
932
|
row.values.forEach((v, ci) => {
|
|
821
933
|
const t = maxValue === minValue ? 0.5 : (v - minValue) / (maxValue - minValue);
|
|
822
934
|
const cell = gradientAt(t);
|
|
823
935
|
const colLabel = cols[ci] ?? `Col ${ci + 1}`;
|
|
824
|
-
const
|
|
936
|
+
const cellKey = `${row.label} \xB7 ${colLabel}`;
|
|
937
|
+
const r = svg.append("rect").attr("x", left + ci * cw).attr("y", top + ri * ch).attr("width", cw).attr("height", ch).attr("fill", cell).attr("stroke", bgColor).attr("stroke-width", 2).attr("data-row-key", row.label).attr("data-col-key", colLabel);
|
|
825
938
|
tagDatum(r, {
|
|
826
939
|
line: row.lineNumber,
|
|
827
|
-
key:
|
|
828
|
-
name:
|
|
940
|
+
key: cellKey,
|
|
941
|
+
name: cellKey,
|
|
829
942
|
value: fmtNum(v),
|
|
830
943
|
color: cell
|
|
831
944
|
});
|
|
832
945
|
if (!chart.noValue) {
|
|
833
|
-
svg.append("text").attr("x", left + ci * cw + cw / 2).attr("y", top + ri * ch + ch / 2 + cellFont / 3).attr("text-anchor", "middle").attr("fill", labelTint(cell)).attr("font-size", cellFont).attr("font-weight", 600).attr("font-family", FONT_FAMILY).text(fmtNum(v));
|
|
946
|
+
const label = svg.append("text").attr("x", left + ci * cw + cw / 2).attr("y", top + ri * ch + ch / 2 + cellFont / 3).attr("text-anchor", "middle").attr("fill", labelTint(cell)).attr("font-size", cellFont).attr("font-weight", 600).attr("font-family", FONT_FAMILY).text(fmtNum(v));
|
|
947
|
+
tagDatum(label, {
|
|
948
|
+
line: row.lineNumber,
|
|
949
|
+
key: cellKey,
|
|
950
|
+
name: cellKey,
|
|
951
|
+
value: fmtNum(v),
|
|
952
|
+
color: cell
|
|
953
|
+
});
|
|
954
|
+
label.attr("data-row-key", row.label).attr("data-col-key", colLabel);
|
|
834
955
|
}
|
|
835
956
|
});
|
|
836
957
|
});
|
|
837
958
|
}
|
|
838
959
|
|
|
839
960
|
// src/charts-d3/scatter.ts
|
|
840
|
-
import { scaleLinear as scaleLinear3 } from "d3-scale";
|
|
961
|
+
import { scaleLinear as scaleLinear3, scaleSqrt } from "d3-scale";
|
|
841
962
|
var FILL_OPACITY = 0.65;
|
|
842
963
|
var DEFAULT_SIZE = 15;
|
|
964
|
+
var LABEL_FONT2 = 11;
|
|
965
|
+
var SIZEVAL_FONT = 20;
|
|
966
|
+
var SIZEVAL_LINE = SIZEVAL_FONT + 4;
|
|
967
|
+
var SIZEVAL_LABEL_FONT = 11;
|
|
968
|
+
var SIZEVAL_LABEL_LINE = SIZEVAL_LABEL_FONT + 4;
|
|
969
|
+
var SIZEVAL_BOLD_FACTOR = 1.08;
|
|
970
|
+
function placeScatterHoverValue(cx, cy, r, labelText, valueText, labelRects, circles, bounds) {
|
|
971
|
+
const w = Math.max(
|
|
972
|
+
measureText(valueText, SIZEVAL_FONT) * SIZEVAL_BOLD_FACTOR,
|
|
973
|
+
measureText(labelText, SIZEVAL_LABEL_FONT)
|
|
974
|
+
) + 6;
|
|
975
|
+
const h = SIZEVAL_LINE + SIZEVAL_LABEL_LINE;
|
|
976
|
+
const gap = 8;
|
|
977
|
+
const toResult = (rect2, anchor, numberFirst) => {
|
|
978
|
+
const numY = numberFirst ? rect2.y + SIZEVAL_LINE - 6 : rect2.y + h - 6;
|
|
979
|
+
const lblY = numberFirst ? rect2.y + h - 4 : rect2.y + SIZEVAL_LABEL_LINE - 4;
|
|
980
|
+
return {
|
|
981
|
+
x: anchor === "middle" ? cx : anchor === "start" ? rect2.x : rect2.x + rect2.w,
|
|
982
|
+
y: numY,
|
|
983
|
+
labelY: lblY,
|
|
984
|
+
anchor,
|
|
985
|
+
rect: rect2
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
const gens = [
|
|
989
|
+
(off) => ({
|
|
990
|
+
rect: { x: cx - w / 2, y: cy + r + off, w, h },
|
|
991
|
+
anchor: "middle",
|
|
992
|
+
numberFirst: true
|
|
993
|
+
}),
|
|
994
|
+
(off) => ({
|
|
995
|
+
rect: { x: cx - w / 2, y: cy - r - off - h, w, h },
|
|
996
|
+
anchor: "middle",
|
|
997
|
+
numberFirst: false
|
|
998
|
+
}),
|
|
999
|
+
(off) => ({
|
|
1000
|
+
rect: { x: cx + r + off, y: cy - h / 2, w, h },
|
|
1001
|
+
anchor: "start",
|
|
1002
|
+
numberFirst: true
|
|
1003
|
+
}),
|
|
1004
|
+
(off) => ({
|
|
1005
|
+
rect: { x: cx - r - off - w, y: cy - h / 2, w, h },
|
|
1006
|
+
anchor: "end",
|
|
1007
|
+
numberFirst: true
|
|
1008
|
+
})
|
|
1009
|
+
];
|
|
1010
|
+
for (let off = gap; off <= gap + 96; off += 12) {
|
|
1011
|
+
for (const gen of gens) {
|
|
1012
|
+
const { rect: rect2, anchor, numberFirst } = gen(off);
|
|
1013
|
+
if (rect2.x < bounds.left || rect2.x + rect2.w > bounds.right || rect2.y < bounds.top || rect2.y + rect2.h > bounds.bottom)
|
|
1014
|
+
continue;
|
|
1015
|
+
if (labelRects.some((lr) => rectsOverlap(rect2, lr))) continue;
|
|
1016
|
+
if (circles.some((c) => rectCircleOverlap(rect2, c))) continue;
|
|
1017
|
+
return toResult(rect2, anchor, numberFirst);
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return toResult({ x: cx - w / 2, y: cy + r + gap, w, h }, "middle", true);
|
|
1021
|
+
}
|
|
843
1022
|
function renderScatter(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, topInset) {
|
|
844
1023
|
const points = chart.scatterPoints ?? [];
|
|
845
1024
|
if (points.length === 0) return;
|
|
@@ -869,8 +1048,17 @@ function renderScatter(svg, chart, width, height, colors, palette, isDark, textC
|
|
|
869
1048
|
};
|
|
870
1049
|
const plotW = width - m.left - m.right;
|
|
871
1050
|
const plotH = height - m.top - m.bottom;
|
|
872
|
-
const
|
|
873
|
-
|
|
1051
|
+
const sizes = points.map(
|
|
1052
|
+
(p) => hasSize ? p.size ?? DEFAULT_SIZE : DEFAULT_SIZE
|
|
1053
|
+
);
|
|
1054
|
+
const rBudget = Math.max(12, Math.min(plotW, plotH) * 0.14);
|
|
1055
|
+
const rScale = scaleSqrt().domain([0, Math.max(...sizes) || 1]).range([0, rBudget]);
|
|
1056
|
+
const radii = points.map(
|
|
1057
|
+
(_, i) => hasSize ? Math.max(5, rScale(sizes[i])) : DEFAULT_SIZE / 2
|
|
1058
|
+
);
|
|
1059
|
+
const rInset = Math.max(...radii) + 4;
|
|
1060
|
+
const x = scaleLinear3().domain([Math.floor(xMin - xPad), Math.ceil(xMax + xPad)]).range([m.left + rInset, m.left + plotW - rInset]);
|
|
1061
|
+
const y = scaleLinear3().domain([Math.floor(yMin - yPad), Math.ceil(yMax + yPad)]).range([m.top + plotH - rInset, m.top + rInset]);
|
|
874
1062
|
svg.append("rect").attr("class", "dgmo-plot-rect").attr("x", m.left).attr("y", m.top).attr("width", plotW).attr("height", plotH).attr("fill", "transparent").attr("pointer-events", "none");
|
|
875
1063
|
for (const t of y.ticks(6)) {
|
|
876
1064
|
const yy = y(t);
|
|
@@ -882,21 +1070,73 @@ function renderScatter(svg, chart, width, height, colors, palette, isDark, textC
|
|
|
882
1070
|
svg.append("line").attr("x1", xx).attr("x2", xx).attr("y1", m.top).attr("y2", m.top + plotH).attr("stroke", mutedColor).attr("stroke-opacity", 0.25);
|
|
883
1071
|
svg.append("text").attr("class", "dgmo-tick").attr("x", xx).attr("y", m.top + plotH + 18).attr("text-anchor", "middle").attr("fill", textColor).attr("font-size", TICK_FONT).attr("font-family", FONT_FAMILY).text(fmtNum(t));
|
|
884
1072
|
}
|
|
1073
|
+
const placedLabels = chart.noName ? null : computeQuadrantPointLabels(
|
|
1074
|
+
points.map((p, i) => ({
|
|
1075
|
+
label: p.name,
|
|
1076
|
+
cx: x(p.x),
|
|
1077
|
+
cy: y(p.y),
|
|
1078
|
+
r: radii[i]
|
|
1079
|
+
})),
|
|
1080
|
+
{
|
|
1081
|
+
left: m.left,
|
|
1082
|
+
top: m.top,
|
|
1083
|
+
right: m.left + plotW,
|
|
1084
|
+
bottom: m.top + plotH
|
|
1085
|
+
},
|
|
1086
|
+
[],
|
|
1087
|
+
DEFAULT_SIZE / 2,
|
|
1088
|
+
LABEL_FONT2
|
|
1089
|
+
);
|
|
1090
|
+
const plotBounds = {
|
|
1091
|
+
left: m.left,
|
|
1092
|
+
top: m.top,
|
|
1093
|
+
right: m.left + plotW,
|
|
1094
|
+
bottom: m.top + plotH
|
|
1095
|
+
};
|
|
1096
|
+
const ownLabelRect = (i) => {
|
|
1097
|
+
const pl = placedLabels?.[i];
|
|
1098
|
+
if (!pl) return [];
|
|
1099
|
+
const w = measureText(points[i].name, LABEL_FONT2) + 8;
|
|
1100
|
+
const h = LABEL_FONT2 + 4;
|
|
1101
|
+
const lx = pl.anchor === "middle" ? pl.x - w / 2 : pl.anchor === "end" ? pl.x - w : pl.x;
|
|
1102
|
+
return [{ x: lx, y: pl.y - h / 2, w, h }];
|
|
1103
|
+
};
|
|
885
1104
|
points.forEach((p, i) => {
|
|
886
1105
|
const stroke = p.color ?? (p.category ? catColor(p.category, catIndex.get(p.category) ?? 0) : colors[i % colors.length]);
|
|
887
|
-
const r =
|
|
1106
|
+
const r = radii[i];
|
|
888
1107
|
const dot = svg.append("circle").attr("cx", x(p.x)).attr("cy", y(p.y)).attr("r", r).attr("fill", solid ? stroke : shapeFill(palette, stroke, isDark)).attr("fill-opacity", FILL_OPACITY).attr("stroke", stroke).attr("stroke-width", 2);
|
|
889
1108
|
tagDatum(dot, {
|
|
890
1109
|
line: p.lineNumber,
|
|
891
1110
|
key: p.name,
|
|
892
1111
|
name: p.category ? `${p.name} \xB7 ${p.category}` : p.name,
|
|
893
|
-
value: `(${fmtNum(p.x)}, ${fmtNum(p.y)})`,
|
|
1112
|
+
value: p.size !== void 0 ? `(${fmtNum(p.x)}, ${fmtNum(p.y)}) \xB7 ${chart.sizelabel ?? "size"}: ${fmtNum(p.size)}` : `(${fmtNum(p.x)}, ${fmtNum(p.y)})`,
|
|
894
1113
|
color: stroke
|
|
895
1114
|
});
|
|
896
1115
|
dot.attr("data-axval-x", fmtNum(p.x)).attr("data-axval-y", fmtNum(p.y));
|
|
897
|
-
if (p.
|
|
898
|
-
|
|
899
|
-
|
|
1116
|
+
if (p.size !== void 0) {
|
|
1117
|
+
const sizeLabel = chart.sizelabel ?? "size";
|
|
1118
|
+
const pos = placeScatterHoverValue(
|
|
1119
|
+
x(p.x),
|
|
1120
|
+
y(p.y),
|
|
1121
|
+
r,
|
|
1122
|
+
sizeLabel,
|
|
1123
|
+
fmtNum(p.size),
|
|
1124
|
+
ownLabelRect(i),
|
|
1125
|
+
[],
|
|
1126
|
+
plotBounds
|
|
1127
|
+
);
|
|
1128
|
+
dot.attr("data-size", fmtNum(p.size)).attr("data-size-label", sizeLabel).attr("data-sizeval-x", pos.x).attr("data-sizeval-y", pos.y).attr("data-sizeval-ly", pos.labelY).attr("data-sizeval-anchor", pos.anchor);
|
|
1129
|
+
}
|
|
1130
|
+
if (p.category) {
|
|
1131
|
+
dot.attr("data-category", p.category);
|
|
1132
|
+
dot.attr("data-series-name", p.category);
|
|
1133
|
+
}
|
|
1134
|
+
if (placedLabels) {
|
|
1135
|
+
const placed = placedLabels[i];
|
|
1136
|
+
if (placed.connectorLine) {
|
|
1137
|
+
svg.append("line").attr("class", "dgmo-ptlabel").attr("data-line-number", p.lineNumber).attr("x1", placed.connectorLine.x1).attr("y1", placed.connectorLine.y1).attr("x2", placed.connectorLine.x2).attr("y2", placed.connectorLine.y2).attr("stroke", stroke).attr("stroke-width", 1).attr("opacity", 0.5);
|
|
1138
|
+
}
|
|
1139
|
+
svg.append("text").attr("class", "dgmo-ptlabel").attr("data-line-number", p.lineNumber).attr("x", placed.x).attr("y", placed.y).attr("text-anchor", placed.anchor).attr("dominant-baseline", "central").attr("fill", stroke).attr("font-size", LABEL_FONT2).attr("font-family", FONT_FAMILY).text(p.name);
|
|
900
1140
|
}
|
|
901
1141
|
});
|
|
902
1142
|
drawXAxisTitle(
|
|
@@ -1355,7 +1595,6 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1355
1595
|
seriesColors,
|
|
1356
1596
|
palette,
|
|
1357
1597
|
isDark,
|
|
1358
|
-
textColor,
|
|
1359
1598
|
hasTitle ? 52 : 24
|
|
1360
1599
|
);
|
|
1361
1600
|
return true;
|
|
@@ -1455,4 +1694,4 @@ export {
|
|
|
1455
1694
|
supportsD3DataChart,
|
|
1456
1695
|
renderDataChartD3
|
|
1457
1696
|
};
|
|
1458
|
-
//# sourceMappingURL=chunk-
|
|
1697
|
+
//# sourceMappingURL=chunk-JFPY3UJ7.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extractColor,
|
|
3
3
|
measureIndent
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZNQX6QWH.js";
|
|
5
5
|
import {
|
|
6
6
|
makeDgmoError
|
|
7
7
|
} from "./chunk-CXK4DZH3.js";
|
|
@@ -73,4 +73,4 @@ function tryCollectNote(lines, index, indent, palette, diagnostics) {
|
|
|
73
73
|
export {
|
|
74
74
|
tryCollectNote
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-K6HNAY5V.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
normalizeNumericToken,
|
|
6
6
|
parseFirstLine,
|
|
7
7
|
parseSeriesNames
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ZNQX6QWH.js";
|
|
9
9
|
import {
|
|
10
10
|
RECOGNIZED_COLOR_NAMES,
|
|
11
11
|
resolveColorWithDiagnostic
|
|
@@ -1054,4 +1054,4 @@ export {
|
|
|
1054
1054
|
getSimpleChartLegendGroups,
|
|
1055
1055
|
getExtendedChartLegendGroups
|
|
1056
1056
|
};
|
|
1057
|
-
//# sourceMappingURL=chunk-
|
|
1057
|
+
//# sourceMappingURL=chunk-KQAEKMIX.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
layoutClassDiagram
|
|
3
|
-
} from "./chunk-WBRZJOEC.js";
|
|
4
1
|
import {
|
|
5
2
|
NOTE_BADGE_RADIUS,
|
|
6
3
|
noteConnectorPoints,
|
|
@@ -12,16 +9,19 @@ import {
|
|
|
12
9
|
extractExportSvg,
|
|
13
10
|
runInExportContainer
|
|
14
11
|
} from "./chunk-JTSMEYIZ.js";
|
|
12
|
+
import {
|
|
13
|
+
layoutClassDiagram
|
|
14
|
+
} from "./chunk-CMCR5WBW.js";
|
|
15
15
|
import {
|
|
16
16
|
EDGE_STROKE_WIDTH,
|
|
17
17
|
NODE_STROKE_WIDTH
|
|
18
18
|
} from "./chunk-3CIOJ5YJ.js";
|
|
19
|
-
import {
|
|
20
|
-
renderIntegratedLegend
|
|
21
|
-
} from "./chunk-PWIHZ6NJ.js";
|
|
22
19
|
import {
|
|
23
20
|
ScaleContext
|
|
24
21
|
} from "./chunk-YYVTBZZC.js";
|
|
22
|
+
import {
|
|
23
|
+
renderIntegratedLegend
|
|
24
|
+
} from "./chunk-4UDKKGHH.js";
|
|
25
25
|
import {
|
|
26
26
|
TITLE_FONT_SIZE,
|
|
27
27
|
TITLE_FONT_WEIGHT,
|
|
@@ -32,17 +32,17 @@ import {
|
|
|
32
32
|
} from "./chunk-6KFWC4CO.js";
|
|
33
33
|
import {
|
|
34
34
|
LEGEND_HEIGHT
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-HQCHYB5F.js";
|
|
36
36
|
import {
|
|
37
37
|
measureText
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-5LWQH6QV.js";
|
|
39
39
|
import {
|
|
40
40
|
contrastText,
|
|
41
41
|
shapeFill
|
|
42
42
|
} from "./chunk-P6T66CCZ.js";
|
|
43
43
|
import {
|
|
44
44
|
parseClassDiagram
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-ZXL6MB4R.js";
|
|
46
46
|
|
|
47
47
|
// src/class/renderer.ts
|
|
48
48
|
import * as d3Selection from "d3-selection";
|
|
@@ -407,4 +407,4 @@ export {
|
|
|
407
407
|
renderClassDiagram,
|
|
408
408
|
renderClassDiagramForExport
|
|
409
409
|
};
|
|
410
|
-
//# sourceMappingURL=chunk-
|
|
410
|
+
//# sourceMappingURL=chunk-KUBBJ2CD.js.map
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
tagAttrKey,
|
|
8
8
|
validateTagGroupNames,
|
|
9
9
|
validateTagValues
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HBVD67XG.js";
|
|
11
11
|
import {
|
|
12
12
|
tryCollectNote
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-K6HNAY5V.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveNotes
|
|
16
16
|
} from "./chunk-FMDSF3OV.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
tryParseSharedOption,
|
|
31
31
|
warnUnknownMetaKeys,
|
|
32
32
|
withTagAliases
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ZNQX6QWH.js";
|
|
34
34
|
import {
|
|
35
35
|
makeDgmoError,
|
|
36
36
|
suggest
|
|
@@ -884,4 +884,4 @@ export {
|
|
|
884
884
|
looksLikeBoxesAndLines,
|
|
885
885
|
parseBoxesAndLines
|
|
886
886
|
};
|
|
887
|
-
//# sourceMappingURL=chunk-
|
|
887
|
+
//# sourceMappingURL=chunk-KV6Y2HE6.js.map
|