@diagrammo/dgmo 0.54.0 → 0.55.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/dist/advanced.d.ts +76 -9
- package/dist/advanced.js +118 -95
- package/dist/auto.js +125 -124
- package/dist/auto.mjs +1579 -282
- package/dist/block.js +49 -48
- package/dist/chart-meta.js +43 -43
- package/dist/{charts-d3-25E4VWXO.js → charts-d3-KZ6V4OP2.js} +7 -6
- package/dist/{chunk-MTZOXISJ.js → chunk-2HX6ZGY7.js} +3 -3
- package/dist/{chunk-ICKXIMBA.js → chunk-2R6HG6D5.js} +5 -5
- package/dist/{chunk-NUTWTV6G.js → chunk-2ZJXKJSI.js} +102 -56
- package/dist/{chunk-LPJ6H5X4.js → chunk-32HUNA33.js} +53 -11
- package/dist/{chunk-UIT7E6UF.js → chunk-3BFXELBL.js} +51 -4
- package/dist/{chunk-C2UORMIA.js → chunk-3BZJ5KD5.js} +7 -3
- package/dist/{chunk-A3BDLDYG.js → chunk-3FUTFYSP.js} +57 -18
- package/dist/{chunk-DPGQ5UMO.js → chunk-4MZCJV4M.js} +6 -6
- package/dist/{chunk-WWHECSYZ.js → chunk-4R5KIPNX.js} +2 -2
- package/dist/{chunk-47JNEKJA.js → chunk-5D5VHDJM.js} +43 -8
- package/dist/{chunk-KQYQECWQ.js → chunk-5H5GWWA4.js} +49 -13
- package/dist/{chunk-RRGKMJYL.js → chunk-5K5XBEXT.js} +8 -3
- package/dist/{chunk-HAA25PLC.js → chunk-6NJWBMJV.js} +44 -9
- package/dist/{chunk-3FRO35WW.js → chunk-A2ARDILY.js} +17 -3
- package/dist/{chunk-TLNVYWPA.js → chunk-A2PTRSAO.js} +2 -2
- package/dist/{chunk-APKUAJ2L.js → chunk-A2RUBBVT.js} +14 -1
- package/dist/{chunk-KS5ZSM5T.js → chunk-A4UJP4IS.js} +61 -13
- package/dist/{chunk-LRSW4JLE.js → chunk-AKE6C2D7.js} +3 -3
- package/dist/{chunk-2NZOHEP4.js → chunk-ASPS5O6F.js} +3 -3
- package/dist/{chunk-KV4HLIJE.js → chunk-AU75JHSR.js} +6 -3
- package/dist/{chunk-R5BGGBFF.js → chunk-DS4MDEQ7.js} +2 -2
- package/dist/{chunk-7JDTNFAK.js → chunk-EFUQENO5.js} +76 -32
- package/dist/{chunk-BULHGPHK.js → chunk-EMSOFHEN.js} +2 -2
- package/dist/{chunk-IYNKLCAZ.js → chunk-ETTDF3S2.js} +45 -7
- package/dist/{chunk-KDK5EKUR.js → chunk-ETYF5QZR.js} +2 -2
- package/dist/{chunk-COJW2NEY.js → chunk-F5ZNUMSY.js} +50 -11
- package/dist/{chunk-EAI6XJ7D.js → chunk-FBP33UM6.js} +3 -3
- package/dist/{chunk-KINOX74I.js → chunk-FGAMFJNJ.js} +48 -10
- package/dist/{chunk-J7HQPVYH.js → chunk-GRXPFBYC.js} +23 -2
- package/dist/{chunk-GQ5ECRP4.js → chunk-GTO5VCYG.js} +3 -3
- package/dist/{chunk-RJ5LBZ5U.js → chunk-HES4K6DV.js} +13 -13
- package/dist/{chunk-ADCHLNWT.js → chunk-HGKOVKAX.js} +3 -3
- package/dist/{chunk-EPRF3ZRV.js → chunk-HLGOG44K.js} +2 -2
- package/dist/{chunk-KQ3FNRGR.js → chunk-HUTP35XT.js} +5 -4
- package/dist/{chunk-OJ435DQZ.js → chunk-HX7QNHC6.js} +3 -3
- package/dist/{chunk-6KL7TFLS.js → chunk-IALX52TR.js} +2 -2
- package/dist/{chunk-7SP4C6EV.js → chunk-IF4KYSJZ.js} +7 -3
- package/dist/{chunk-5XSNLXU5.js → chunk-IG6J7JWH.js} +51 -12
- package/dist/{chunk-M24VXUFG.js → chunk-IIUYKQ5J.js} +3 -3
- package/dist/{chunk-5VXU6MND.js → chunk-INTAQV2Y.js} +2 -2
- package/dist/{chunk-3KHJJP3J.js → chunk-ITXL2KU5.js} +2 -2
- package/dist/{chunk-I47VHSPS.js → chunk-IWG2ECAO.js} +2 -2
- package/dist/{chunk-CSHFU6LT.js → chunk-JGCEFKZP.js} +7 -7
- package/dist/{chunk-O576GYAP.js → chunk-JQLSFZZP.js} +2 -2
- package/dist/{chunk-AHTTKERF.js → chunk-JR7Q6GHE.js} +2 -2
- package/dist/{chunk-4T6OCSJ2.js → chunk-KC3WBBI7.js} +3 -3
- package/dist/{chunk-BM7MG6HT.js → chunk-KK3L5NVK.js} +3 -3
- package/dist/{chunk-FR6UFVSV.js → chunk-L2DIXZUT.js} +91 -41
- package/dist/{chunk-WW4BQ744.js → chunk-LCRPGGGS.js} +6 -6
- package/dist/{chunk-GKYHWJXI.js → chunk-LKGQ46P4.js} +3 -3
- package/dist/{chunk-IOIMQHQ6.js → chunk-LW7STMYZ.js} +2 -2
- package/dist/{chunk-OR3R27CU.js → chunk-M53MDBIW.js} +2 -2
- package/dist/{chunk-T7Y554OK.js → chunk-MEH4TJEX.js} +4 -4
- package/dist/{chunk-T3FAJAJT.js → chunk-MNS2ENXF.js} +3 -3
- package/dist/{chunk-CCGWX6AO.js → chunk-MSWIBF6J.js} +2 -2
- package/dist/{chunk-B7N5KYXQ.js → chunk-NL7FUIVD.js} +4 -4
- package/dist/{chunk-EQOMY4PY.js → chunk-NN5TF4OV.js} +2 -2
- package/dist/{chunk-BZJIITYM.js → chunk-NPPUZ4SK.js} +4 -4
- package/dist/{chunk-XWODFBHJ.js → chunk-NYOOPQFD.js} +7 -3
- package/dist/{chunk-VQFDBNYF.js → chunk-O4CZDTQA.js} +3 -3
- package/dist/{chunk-FVMKCZHF.js → chunk-P5XXIVEU.js} +2 -2
- package/dist/{chunk-F7XM366V.js → chunk-PC4YLEKA.js} +3 -3
- package/dist/{chunk-AQEYUVGJ.js → chunk-PCVXXPYU.js} +12 -5
- package/dist/{chunk-TJN2OIVG.js → chunk-PKUWYPI5.js} +180 -12
- package/dist/{chunk-W6PCFRPL.js → chunk-PSIDVCBA.js} +2 -2
- package/dist/{chunk-RIEAN4D5.js → chunk-PV7ND5WL.js} +48 -8
- package/dist/{chunk-7K6NDSXH.js → chunk-Q5CMQVWF.js} +3 -3
- package/dist/{chunk-FFVFZLRT.js → chunk-QQXFYTLC.js} +346 -46
- package/dist/{chunk-N7BSBAVP.js → chunk-QZYGRDMM.js} +108 -89
- package/dist/{chunk-U4IN6AHE.js → chunk-RKBCKCSF.js} +2 -2
- package/dist/{chunk-GK32ZFZY.js → chunk-RSBH2C7O.js} +3 -3
- package/dist/{chunk-OSXQKC3S.js → chunk-RYNCWA5X.js} +6 -3
- package/dist/{chunk-S7YFT3PO.js → chunk-RZWIPDZ2.js} +3 -3
- package/dist/{chunk-7UPFTBOW.js → chunk-S52F62GW.js} +4 -4
- package/dist/{chunk-WKNAJ4BR.js → chunk-SCOHNGPG.js} +51 -10
- package/dist/{chunk-BWYFIVZF.js → chunk-UBQU2BY6.js} +3 -3
- package/dist/{chunk-VMSBMIHW.js → chunk-UES4P7FN.js} +2 -2
- package/dist/chunk-US3P2DQO.js +87 -0
- package/dist/{chunk-AJFHNS67.js → chunk-UXXLE6AH.js} +5 -5
- package/dist/{chunk-M3H7ZE6C.js → chunk-VMWSZCAK.js} +5 -4
- package/dist/{chunk-S7FOIURR.js → chunk-VVIRAGID.js} +6 -6
- package/dist/{chunk-3SBHODJ4.js → chunk-VXTUWXFB.js} +48 -9
- package/dist/{chunk-HFEOOQ46.js → chunk-W4TSD3IP.js} +2 -2
- package/dist/{chunk-7U4OR7CD.js → chunk-WB3NA3JJ.js} +2 -2
- package/dist/{chunk-3SEEP2JM.js → chunk-WITOJZGL.js} +8 -4
- package/dist/{chunk-6OYDOQ2Q.js → chunk-WVGNXDEE.js} +2 -2
- package/dist/{chunk-UEU6IYKY.js → chunk-X3X4LZDC.js} +2 -2
- package/dist/{chunk-SBOAZ7YK.js → chunk-XKKH2DPG.js} +39 -39
- package/dist/{chunk-NR5HCAUD.js → chunk-XSVWUOUZ.js} +1 -1
- package/dist/{chunk-62Y27T4C.js → chunk-Y4BBGFKY.js} +2 -2
- package/dist/{chunk-YENNFS5F.js → chunk-YP2T5YUP.js} +8 -3
- package/dist/{chunk-2NYXI35Z.js → chunk-YXKNXIWA.js} +5 -4
- package/dist/{chunk-KBVOVDYP.js → chunk-ZGIBV36U.js} +3 -3
- package/dist/{chunk-4ZIKWVSQ.js → chunk-ZP265ICS.js} +4 -4
- package/dist/{chunk-DLU643TF.js → chunk-ZWVKTWK6.js} +3 -3
- package/dist/{chunk-QBYP2FBZ.js → chunk-ZXNHHO6D.js} +2 -2
- package/dist/cli.cjs +150 -147
- package/dist/clock.js +34 -1
- package/dist/completion-registry.js +12 -4
- package/dist/dgmo-router-T4HGLIGA.js +88 -0
- package/dist/{dimensions-L6BXQXXL.js → dimensions-3JINHSYK.js} +6 -6
- package/dist/editor.js +10 -1
- package/dist/element.js +124 -123
- package/dist/element.mjs +1579 -282
- package/dist/{flowchart-parser-UKYOW3VM.js → flowchart-parser-M7KKTLX7.js} +4 -4
- package/dist/{flowchart-renderer-DCFKUDDR.js → flowchart-renderer-FFEQFQEU.js} +5 -5
- package/dist/highlight.js +10 -1
- package/dist/index.js +58 -48
- package/dist/{layout-G2ABQJQZ.js → layout-3ZZBKUQC.js} +3 -3
- package/dist/{layout-CH4HFFRD.js → layout-AUKTWGYL.js} +4 -4
- package/dist/{layout-QBNAMEOA.js → layout-CRLTSFYQ.js} +3 -3
- package/dist/{layout-25Y3VDYF.js → layout-FNZDJGKF.js} +4 -4
- package/dist/{layout-NY7MHJCL.js → layout-GHWRJKZQ.js} +4 -4
- package/dist/{layout-ITLPDG6M.js → layout-LGXOKUCD.js} +4 -4
- package/dist/{layout-A6OIGZN2.js → layout-UR7CYAHL.js} +2 -2
- package/dist/{layout-4SPLI4HG.js → layout-UTMEVFHN.js} +4 -4
- package/dist/{layout-search-LUI475P3.js → layout-search-U2H4ORFJ.js} +8 -6
- package/dist/{parser-XRDUX2AR.js → parser-2AXPSKWB.js} +5 -5
- package/dist/{parser-B2A7XOAK.js → parser-2AZ2KQTO.js} +4 -4
- package/dist/{parser-VVE4THG3.js → parser-2LF33IS2.js} +4 -4
- package/dist/{parser-MHKYQPC2.js → parser-3QJ2Z4H4.js} +3 -3
- package/dist/parser-5GCQFSTQ.js +13 -0
- package/dist/{parser-XCPMEB2Z.js → parser-62OHBRU5.js} +3 -3
- package/dist/{parser-GML6V2KZ.js → parser-7LYJFZCP.js} +4 -4
- package/dist/{parser-LTA2BOZO.js → parser-BMOTF72G.js} +3 -3
- package/dist/{parser-FHRMFUNX.js → parser-CIFLYZYP.js} +3 -3
- package/dist/{parser-KTYF6WO5.js → parser-D2UL2G5U.js} +3 -3
- package/dist/{parser-5C3PEZK3.js → parser-DM2APTKB.js} +3 -3
- package/dist/{parser-X5XLFY4Z.js → parser-DYYTPLBL.js} +4 -4
- package/dist/{parser-WPPJGB4R.js → parser-GOUGUTPU.js} +4 -4
- package/dist/{parser-T3D7BV6O.js → parser-HGVUVD6J.js} +3 -3
- package/dist/{parser-F4FEU57T.js → parser-IEJD3CZB.js} +3 -3
- package/dist/{parser-FY3YFFBS.js → parser-JBEWNLAV.js} +5 -5
- package/dist/{parser-2UWWNTFL.js → parser-JMXPHNZD.js} +4 -4
- package/dist/{parser-YULS5MLD.js → parser-JMXSQY3K.js} +4 -4
- package/dist/{parser-YPWYT46P.js → parser-LUXS7J32.js} +4 -4
- package/dist/{parser-O7YQYFEN.js → parser-M5BUHULF.js} +4 -4
- package/dist/{parser-MVSYFK63.js → parser-MESRHUS4.js} +4 -4
- package/dist/{parser-HA3PF5FL.js → parser-OOYNI2UT.js} +4 -4
- package/dist/{parser-OPIXXUY4.js → parser-PVBUAVRR.js} +4 -4
- package/dist/{parser-3RXYQSA7.js → parser-QKRBSQLJ.js} +5 -5
- package/dist/{parser-CCNJKDDA.js → parser-S6NWSIJO.js} +4 -4
- package/dist/{parser-S4EJPNVN.js → parser-SFEK6Q7Z.js} +4 -4
- package/dist/{parser-7UI6UQ7B.js → parser-SUV52NQW.js} +4 -4
- package/dist/{parser-ESHNUFME.js → parser-SZHGLOOZ.js} +4 -4
- package/dist/{parser-66RYGJRB.js → parser-TO7IENWL.js} +4 -4
- package/dist/{parser-FPCWDYQV.js → parser-TVAMC7CQ.js} +4 -4
- package/dist/{parser-LU7UAKNB.js → parser-VAW46R57.js} +4 -4
- package/dist/{parser-6MQM7WT3.js → parser-XDSPOXSE.js} +4 -4
- package/dist/pert.d.ts +2 -0
- package/dist/{renderer-YVMETH6V.js → renderer-3PWLOJPD.js} +8 -8
- package/dist/{renderer-7HMZ5OCJ.js → renderer-5EMHIQL5.js} +3 -3
- package/dist/{renderer-2DME63VZ.js → renderer-5PODNLYP.js} +4 -4
- package/dist/{renderer-4A32DX5L.js → renderer-AQJIQ2XU.js} +7 -6
- package/dist/{renderer-RMAM2SOJ.js → renderer-BEW3AYFT.js} +8 -8
- package/dist/{renderer-YP3P6UVT.js → renderer-C3UYAXA6.js} +8 -6
- package/dist/{renderer-X2LYSMLU.js → renderer-CENXCMWG.js} +3 -3
- package/dist/{renderer-6CFML5G3.js → renderer-CXM3ARYN.js} +8 -7
- package/dist/{renderer-LHVCKEWF.js → renderer-DW6TEBLA.js} +8 -7
- package/dist/{renderer-Y3NXZINM.js → renderer-FE5M6SEZ.js} +8 -7
- package/dist/{renderer-G4UOW3RH.js → renderer-FXK6ZL3P.js} +3 -3
- package/dist/{renderer-4K5YYX5R.js → renderer-G5ESLCJB.js} +9 -8
- package/dist/{renderer-P3YQES7B.js → renderer-HTDS4FED.js} +9 -8
- package/dist/{renderer-YEFOOULC.js → renderer-IO4KCFVL.js} +8 -8
- package/dist/{renderer-FXMGCSRP.js → renderer-IRAFJNTK.js} +7 -6
- package/dist/{renderer-SES7QZYL.js → renderer-MFTTFW32.js} +9 -8
- package/dist/{renderer-Z4GNKNXO.js → renderer-MPXI4FVL.js} +6 -6
- package/dist/{renderer-RA4PTAMF.js → renderer-NVBEMQ6L.js} +5 -5
- package/dist/{renderer-7ZNVOVFG.js → renderer-OOGDCR6K.js} +3 -3
- package/dist/{renderer-CJ56SUMF.js → renderer-Q5P72O4A.js} +7 -7
- package/dist/{renderer-WCWI4I6A.js → renderer-QZESC66H.js} +2 -2
- package/dist/{renderer-B7Y6I7JX.js → renderer-RDBUXW7P.js} +4 -4
- package/dist/{renderer-V5SNTPAM.js → renderer-S4XB3JR2.js} +9 -9
- package/dist/{renderer-COJZZ4F6.js → renderer-SIWEEWJ5.js} +7 -6
- package/dist/{renderer-C3RI4OPJ.js → renderer-TKTM2SL4.js} +8 -7
- package/dist/{renderer-WVD6G2TS.js → renderer-TXTTV4HA.js} +8 -7
- package/dist/{renderer-HQ4JFZOV.js → renderer-UZIU4AHK.js} +7 -6
- package/dist/{renderer-3VY3VXJE.js → renderer-V72VJIGG.js} +9 -8
- package/dist/{renderer-PLVIARM7.js → renderer-VEGOEZOI.js} +7 -6
- package/dist/{renderer-OZX5KGQM.js → renderer-W6I6T2TA.js} +6 -6
- package/dist/{renderer-TQ5QDZOE.js → renderer-WSHJRR2T.js} +6 -6
- package/dist/{renderer-radial-VYBZAXXE.js → renderer-radial-AG75PBYD.js} +7 -7
- package/dist/{resolver-WFKZYBJ2.js → resolver-ZSFQQRTH.js} +3 -3
- package/dist/{state-parser-VIW2WNA5.js → state-parser-KIPZGIB4.js} +5 -5
- package/dist/{state-renderer-H22AQD3U.js → state-renderer-U6OSJG52.js} +9 -8
- package/docs/language-reference.md +2 -1
- package/package.json +1 -1
- package/dist/dgmo-router-TGZWFIZO.js +0 -88
- package/dist/parser-6GN5YJBJ.js +0 -13
|
@@ -12,9 +12,18 @@ import {
|
|
|
12
12
|
renderChartTitle,
|
|
13
13
|
resolveExportPalette
|
|
14
14
|
} from "./chunk-ADYKAKE3.js";
|
|
15
|
+
import {
|
|
16
|
+
layoutInlineHeader
|
|
17
|
+
} from "./chunk-US3P2DQO.js";
|
|
15
18
|
import {
|
|
16
19
|
computeLegendLayout
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GRXPFBYC.js";
|
|
21
|
+
import {
|
|
22
|
+
TITLE_FONT_SIZE,
|
|
23
|
+
TITLE_FONT_WEIGHT,
|
|
24
|
+
TITLE_OFFSET,
|
|
25
|
+
TITLE_Y
|
|
26
|
+
} from "./chunk-A4GOY3PE.js";
|
|
18
27
|
import {
|
|
19
28
|
FONT_FAMILY
|
|
20
29
|
} from "./chunk-6KFWC4CO.js";
|
|
@@ -23,7 +32,7 @@ import {
|
|
|
23
32
|
getSimpleChartLegendGroups,
|
|
24
33
|
parseChart,
|
|
25
34
|
parseExtendedChart
|
|
26
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-PCVXXPYU.js";
|
|
27
36
|
import {
|
|
28
37
|
EMPHASIS_DIM_OPACITY,
|
|
29
38
|
EMPHASIS_DIM_TEXT_OPACITY,
|
|
@@ -51,7 +60,7 @@ import {
|
|
|
51
60
|
} from "./chunk-JYDMBWRP.js";
|
|
52
61
|
import {
|
|
53
62
|
tagAttrKey
|
|
54
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-JR7Q6GHE.js";
|
|
55
64
|
|
|
56
65
|
// src/utils/legend-svg.ts
|
|
57
66
|
function esc(s) {
|
|
@@ -88,7 +97,10 @@ function renderLegendSvg(groups, options) {
|
|
|
88
97
|
const wrapWidth = containerWidth > 0 ? containerWidth : 1200;
|
|
89
98
|
const config = {
|
|
90
99
|
groups,
|
|
91
|
-
position: {
|
|
100
|
+
position: {
|
|
101
|
+
placement: "top-center",
|
|
102
|
+
titleRelation: options.align === "left" ? "inline-with-title" : "below-title"
|
|
103
|
+
},
|
|
92
104
|
mode: "preview"
|
|
93
105
|
};
|
|
94
106
|
const state = { activeGroup: activeGroup ?? null };
|
|
@@ -147,7 +159,47 @@ function fmtNum(n) {
|
|
|
147
159
|
if (Math.abs(n) >= 1e3) return n.toLocaleString("en-US");
|
|
148
160
|
return String(Math.round(n * 100) / 100);
|
|
149
161
|
}
|
|
150
|
-
function
|
|
162
|
+
function renderInlineHeader(svg, groups, palette, isDark, width, info) {
|
|
163
|
+
const {
|
|
164
|
+
svg: legendSvg,
|
|
165
|
+
height: legendH,
|
|
166
|
+
width: legendW
|
|
167
|
+
} = renderLegendSvg(groups, {
|
|
168
|
+
palette,
|
|
169
|
+
isDark,
|
|
170
|
+
containerWidth: width,
|
|
171
|
+
activeGroup: groups[0].name,
|
|
172
|
+
className: "chart-legend",
|
|
173
|
+
align: "left"
|
|
174
|
+
});
|
|
175
|
+
if (!legendSvg) return null;
|
|
176
|
+
const geom = layoutInlineHeader({
|
|
177
|
+
requested: true,
|
|
178
|
+
title: info.title,
|
|
179
|
+
hasLegend: true,
|
|
180
|
+
legendWidth: legendW,
|
|
181
|
+
legendHeight: legendH,
|
|
182
|
+
containerWidth: width,
|
|
183
|
+
titleBandHeight: TITLE_OFFSET,
|
|
184
|
+
legendReserve: 0,
|
|
185
|
+
titleBaselineY: TITLE_Y,
|
|
186
|
+
titleFontSize: TITLE_FONT_SIZE
|
|
187
|
+
});
|
|
188
|
+
if (!geom.inline) return null;
|
|
189
|
+
const titleEl = svg.append("text").attr("class", "chart-title").attr("x", geom.titleX).attr("y", TITLE_Y).attr("fill", info.textColor).attr("font-size", TITLE_FONT_SIZE).attr("font-weight", TITLE_FONT_WEIGHT).text(info.title);
|
|
190
|
+
if (info.titleLineNumber) {
|
|
191
|
+
titleEl.attr("data-line-number", info.titleLineNumber);
|
|
192
|
+
}
|
|
193
|
+
const node = svg.node();
|
|
194
|
+
if (node) {
|
|
195
|
+
node.insertAdjacentHTML(
|
|
196
|
+
"beforeend",
|
|
197
|
+
`<g transform="translate(${geom.legendX},${geom.legendY})">${legendSvg}</g>`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
return TITLE_OFFSET + 12;
|
|
201
|
+
}
|
|
202
|
+
function reserveHeader(svg, chart, colors, palette, isDark, hasTitle, width, inlineTitle) {
|
|
151
203
|
return injectLegendGroups(
|
|
152
204
|
svg,
|
|
153
205
|
// `no-legend` (#48) → pass no groups; injectLegendGroups then returns the
|
|
@@ -156,10 +208,31 @@ function reserveHeader(svg, chart, colors, palette, isDark, hasTitle, width) {
|
|
|
156
208
|
palette,
|
|
157
209
|
isDark,
|
|
158
210
|
hasTitle,
|
|
159
|
-
width
|
|
211
|
+
width,
|
|
212
|
+
inlineTitle
|
|
160
213
|
);
|
|
161
214
|
}
|
|
162
|
-
function injectLegendGroups(svg, groups, palette, isDark, hasTitle, width) {
|
|
215
|
+
function injectLegendGroups(svg, groups, palette, isDark, hasTitle, width, inlineTitle) {
|
|
216
|
+
if (inlineTitle && groups.length > 0) {
|
|
217
|
+
const inset = renderInlineHeader(
|
|
218
|
+
svg,
|
|
219
|
+
groups,
|
|
220
|
+
palette,
|
|
221
|
+
isDark,
|
|
222
|
+
width,
|
|
223
|
+
inlineTitle
|
|
224
|
+
);
|
|
225
|
+
if (inset !== null) return inset;
|
|
226
|
+
}
|
|
227
|
+
if (inlineTitle) {
|
|
228
|
+
renderChartTitle(
|
|
229
|
+
svg,
|
|
230
|
+
inlineTitle.title,
|
|
231
|
+
inlineTitle.titleLineNumber,
|
|
232
|
+
width,
|
|
233
|
+
inlineTitle.textColor
|
|
234
|
+
);
|
|
235
|
+
}
|
|
163
236
|
const titleH = hasTitle ? 40 : 0;
|
|
164
237
|
if (groups.length === 0) return hasTitle ? titleH + 12 : 24;
|
|
165
238
|
const legendY = 8 + titleH;
|
|
@@ -202,6 +275,7 @@ function tagDatum(sel, o) {
|
|
|
202
275
|
if (o.name != null) sel.attr("data-name", o.name);
|
|
203
276
|
if (o.value != null) sel.attr("data-value", String(o.value));
|
|
204
277
|
if (o.color != null) sel.attr("data-color", o.color);
|
|
278
|
+
if (o.seriesName != null) sel.attr("data-series-name", o.seriesName);
|
|
205
279
|
return sel;
|
|
206
280
|
}
|
|
207
281
|
function drawValueLabel(svg, text, x, y, color, anchor = "middle") {
|
|
@@ -216,7 +290,7 @@ function seriesValues(pt, seriesCount) {
|
|
|
216
290
|
for (let s = 1; s < seriesCount; s++) out.push(pt.extraValues?.[s - 1] ?? 0);
|
|
217
291
|
return out;
|
|
218
292
|
}
|
|
219
|
-
function renderBar(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, hasTitle) {
|
|
293
|
+
function renderBar(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, hasTitle, inlineTitle) {
|
|
220
294
|
const data = chart.data;
|
|
221
295
|
const seriesNames = chart.seriesNames?.length ? chart.seriesNames : [chart.series ?? ""];
|
|
222
296
|
const stacked = chart.barLayout === "stack";
|
|
@@ -231,7 +305,7 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
231
305
|
const fillMode = chart.fillMode;
|
|
232
306
|
const colorFor = (seriesIdx, catIdx, override) => {
|
|
233
307
|
if (override) return override;
|
|
234
|
-
return multiSeries ? colors[seriesIdx % colors.length] : colors[catIdx % colors.length];
|
|
308
|
+
return multiSeries ? chart.seriesNameColors?.[seriesIdx] ?? colors[seriesIdx % colors.length] : colors[catIdx % colors.length];
|
|
235
309
|
};
|
|
236
310
|
const fillOf = (c) => shapeFill(palette, c, isDark, { mode: fillMode });
|
|
237
311
|
const top = reserveHeader(
|
|
@@ -241,7 +315,8 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
241
315
|
palette,
|
|
242
316
|
isDark,
|
|
243
317
|
hasTitle,
|
|
244
|
-
width
|
|
318
|
+
width,
|
|
319
|
+
inlineTitle
|
|
245
320
|
);
|
|
246
321
|
const perCat = data.map((d) => seriesValues(d, seriesCount));
|
|
247
322
|
const maxVal = stacked ? d3max(perCat, (vals) => vals.reduce((a, b) => a + b, 0)) ?? 0 : d3max(perCat, (vals) => d3max(vals) ?? 0) ?? 0;
|
|
@@ -294,7 +369,8 @@ function renderBar(svg, chart, width, height, colors, palette, isDark, textColor
|
|
|
294
369
|
key: multiSeries ? sName : d.label,
|
|
295
370
|
name: multiSeries ? `${d.label} \xB7 ${sName}` : d.label,
|
|
296
371
|
value: v,
|
|
297
|
-
color: stroke
|
|
372
|
+
color: stroke,
|
|
373
|
+
seriesName: multiSeries ? sName : void 0
|
|
298
374
|
};
|
|
299
375
|
if (stacked) {
|
|
300
376
|
if (horiz) {
|
|
@@ -407,7 +483,7 @@ import { line as d3line, area as d3area } from "d3-shape";
|
|
|
407
483
|
function seriesValue(pt, s) {
|
|
408
484
|
return s === 0 ? pt.value : pt.extraValues?.[s - 1] ?? 0;
|
|
409
485
|
}
|
|
410
|
-
function renderLine(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, bgColor, hasTitle) {
|
|
486
|
+
function renderLine(svg, chart, width, height, colors, palette, isDark, textColor, mutedColor, bgColor, hasTitle, inlineTitle) {
|
|
411
487
|
const data = chart.data;
|
|
412
488
|
const isArea = chart.fill === true;
|
|
413
489
|
const solid = chart.fillMode === "solid";
|
|
@@ -433,7 +509,8 @@ function renderLine(svg, chart, width, height, colors, palette, isDark, textColo
|
|
|
433
509
|
palette,
|
|
434
510
|
isDark,
|
|
435
511
|
hasTitle,
|
|
436
|
-
width
|
|
512
|
+
width,
|
|
513
|
+
inlineTitle
|
|
437
514
|
);
|
|
438
515
|
const extentFor = (side) => {
|
|
439
516
|
let lo = Infinity;
|
|
@@ -585,7 +662,7 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
585
662
|
const MARGIN2 = 6;
|
|
586
663
|
const halfW = width / 2 - MARGIN2;
|
|
587
664
|
const rH = availH / 2 - availH * 0.06;
|
|
588
|
-
const labelExtent = 1.
|
|
665
|
+
const labelExtent = 1.27 + 0.06 * maxLabelLen;
|
|
589
666
|
const rLabeled = Math.min(rH, halfW / labelExtent);
|
|
590
667
|
const showLabels = maxLabelLen > 0 && rLabeled >= 45;
|
|
591
668
|
const rPlain = Math.min(rH, halfW * 0.94);
|
|
@@ -599,6 +676,7 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
599
676
|
const arcs = d3pie().sort(null).value((d) => d.value)(data.map((d) => ({ value: d.value })));
|
|
600
677
|
const arcGen = d3arc().innerRadius(hasHole ? radius * holeRatio : 0).outerRadius(radius);
|
|
601
678
|
const g = svg.append("g").attr("transform", `translate(${cx},${cy})`);
|
|
679
|
+
const labelInfos = [];
|
|
602
680
|
arcs.forEach((a, i) => {
|
|
603
681
|
const stroke = strokeFor(i, data[i].color);
|
|
604
682
|
const fill = shapeFill(palette, stroke, isDark, { mode: fillMode });
|
|
@@ -612,32 +690,65 @@ function renderPie(svg, chart, width, height, palette, isDark, textColor, topIns
|
|
|
612
690
|
color: stroke
|
|
613
691
|
});
|
|
614
692
|
if (!showLabels) return;
|
|
693
|
+
const label = labels[i];
|
|
694
|
+
if (!label) return;
|
|
615
695
|
const mid = (a.startAngle + a.endAngle) / 2 - Math.PI / 2;
|
|
616
696
|
const rightSide = Math.cos(mid) >= 0;
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
697
|
+
labelInfos.push({
|
|
698
|
+
rightSide,
|
|
699
|
+
x0: Math.cos(mid) * radius,
|
|
700
|
+
y0: Math.sin(mid) * radius,
|
|
701
|
+
// Radial stub end — meets the arc at 90° to the circle edge.
|
|
702
|
+
x1: Math.cos(mid) * (radius + elbowOut),
|
|
703
|
+
y1: Math.sin(mid) * (radius + elbowOut),
|
|
704
|
+
idealY: Math.sin(mid) * (radius + elbowOut),
|
|
705
|
+
y: 0,
|
|
706
|
+
label,
|
|
707
|
+
stroke,
|
|
708
|
+
// Tag the leader-line + label with the same emph-key as the wedge so
|
|
709
|
+
// hover (baked-CSS :has() and the app's JS dim) emphasizes all three
|
|
710
|
+
// together; colour the label text to match its segment.
|
|
711
|
+
tag: {
|
|
625
712
|
line: data[i].lineNumber,
|
|
626
713
|
key: data[i].label,
|
|
627
714
|
name: data[i].label,
|
|
628
715
|
value: `${fmtNum(data[i].value)} (${pct}%)`,
|
|
629
716
|
color: stroke
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
g.append("polyline").attr("points", `${x0},${y0} ${x1},${y1} ${x2},${y1}`).attr("fill", "none").attr("stroke", stroke).attr("stroke-width", 1),
|
|
633
|
-
tag
|
|
634
|
-
);
|
|
635
|
-
tagDatum(
|
|
636
|
-
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),
|
|
637
|
-
tag
|
|
638
|
-
);
|
|
639
|
-
}
|
|
717
|
+
}
|
|
718
|
+
});
|
|
640
719
|
});
|
|
720
|
+
if (showLabels && labelInfos.length > 0) {
|
|
721
|
+
const labelX = radius + elbowOut + elbowRun;
|
|
722
|
+
const minGap = font * 1.18;
|
|
723
|
+
const bound = availH / 2 - font;
|
|
724
|
+
for (const side of [true, false]) {
|
|
725
|
+
const group = labelInfos.filter((l) => l.rightSide === side);
|
|
726
|
+
if (group.length === 0) continue;
|
|
727
|
+
const topHalf = group.filter((l) => l.idealY < 0).sort((a, b) => b.idealY - a.idealY);
|
|
728
|
+
const botHalf = group.filter((l) => l.idealY >= 0).sort((a, b) => a.idealY - b.idealY);
|
|
729
|
+
topHalf.forEach((l, i) => {
|
|
730
|
+
l.y = i === 0 ? l.idealY : Math.min(l.idealY, topHalf[i - 1].y - minGap);
|
|
731
|
+
l.y = Math.max(l.y, -bound);
|
|
732
|
+
});
|
|
733
|
+
botHalf.forEach((l, i) => {
|
|
734
|
+
l.y = i === 0 ? l.idealY : Math.max(l.idealY, botHalf[i - 1].y + minGap);
|
|
735
|
+
l.y = Math.min(l.y, bound);
|
|
736
|
+
});
|
|
737
|
+
const sx = side ? 1 : -1;
|
|
738
|
+
const tx = sx * labelX;
|
|
739
|
+
for (const l of group) {
|
|
740
|
+
const xr = Math.abs(l.y0) < 1e-3 ? l.x1 : l.y * l.x0 / l.y0;
|
|
741
|
+
tagDatum(
|
|
742
|
+
g.append("polyline").attr("points", `${l.x0},${l.y0} ${xr},${l.y} ${tx},${l.y}`).attr("fill", "none").attr("stroke", l.stroke).attr("stroke-width", 1),
|
|
743
|
+
l.tag
|
|
744
|
+
);
|
|
745
|
+
tagDatum(
|
|
746
|
+
g.append("text").attr("x", tx + sx * font * 0.3).attr("y", l.y + font * 0.3).attr("text-anchor", side ? "start" : "end").attr("fill", l.stroke).attr("font-size", font).attr("font-family", FONT_FAMILY).text(l.label),
|
|
747
|
+
l.tag
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
641
752
|
if (hasHole && !chart.noCenterTotal) {
|
|
642
753
|
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));
|
|
643
754
|
}
|
|
@@ -1408,13 +1519,166 @@ function renderChord(svg, chart, width, height, colors, palette, isDark, textCol
|
|
|
1408
1519
|
|
|
1409
1520
|
// src/charts-d3/function.ts
|
|
1410
1521
|
import { scaleLinear as scaleLinear4 } from "d3-scale";
|
|
1411
|
-
import { line as d3line2 } from "d3-shape";
|
|
1522
|
+
import { line as d3line2, area as d3area2 } from "d3-shape";
|
|
1412
1523
|
|
|
1413
1524
|
// src/utils/expr-eval.ts
|
|
1525
|
+
var FUNCS = {
|
|
1526
|
+
sin: Math.sin,
|
|
1527
|
+
cos: Math.cos,
|
|
1528
|
+
tan: Math.tan,
|
|
1529
|
+
ln: Math.log,
|
|
1530
|
+
log: Math.log10,
|
|
1531
|
+
exp: Math.exp,
|
|
1532
|
+
sqrt: Math.sqrt,
|
|
1533
|
+
abs: Math.abs
|
|
1534
|
+
};
|
|
1535
|
+
function tokenize(expr) {
|
|
1536
|
+
const tokens = [];
|
|
1537
|
+
let i = 0;
|
|
1538
|
+
const n = expr.length;
|
|
1539
|
+
while (i < n) {
|
|
1540
|
+
const c = expr.charAt(i);
|
|
1541
|
+
if (c === " " || c === " ") {
|
|
1542
|
+
i++;
|
|
1543
|
+
continue;
|
|
1544
|
+
}
|
|
1545
|
+
if (c >= "0" && c <= "9" || c === ".") {
|
|
1546
|
+
let j = i + 1;
|
|
1547
|
+
while (/[0-9.]/.test(expr.charAt(j))) j++;
|
|
1548
|
+
const exp = expr.charAt(j);
|
|
1549
|
+
if (exp === "e" || exp === "E") {
|
|
1550
|
+
let k = j + 1;
|
|
1551
|
+
const sign = expr.charAt(k);
|
|
1552
|
+
if (sign === "+" || sign === "-") k++;
|
|
1553
|
+
if (/[0-9]/.test(expr.charAt(k))) {
|
|
1554
|
+
while (/[0-9]/.test(expr.charAt(k))) k++;
|
|
1555
|
+
j = k;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
const num = Number(expr.slice(i, j));
|
|
1559
|
+
if (!isFinite(num)) throw new Error("bad number");
|
|
1560
|
+
tokens.push({ t: "num", v: num });
|
|
1561
|
+
i = j;
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1564
|
+
if (/[a-zA-Z]/.test(c)) {
|
|
1565
|
+
let j = i + 1;
|
|
1566
|
+
while (/[a-zA-Z0-9]/.test(expr.charAt(j))) j++;
|
|
1567
|
+
tokens.push({ t: "id", v: expr.slice(i, j).toLowerCase() });
|
|
1568
|
+
i = j;
|
|
1569
|
+
continue;
|
|
1570
|
+
}
|
|
1571
|
+
if ("+-*/^()".includes(c)) {
|
|
1572
|
+
tokens.push({ t: "op", v: c });
|
|
1573
|
+
i++;
|
|
1574
|
+
continue;
|
|
1575
|
+
}
|
|
1576
|
+
throw new Error(`unexpected char: ${c}`);
|
|
1577
|
+
}
|
|
1578
|
+
return tokens;
|
|
1579
|
+
}
|
|
1580
|
+
var Parser = class {
|
|
1581
|
+
constructor(tokens, x) {
|
|
1582
|
+
this.tokens = tokens;
|
|
1583
|
+
this.x = x;
|
|
1584
|
+
}
|
|
1585
|
+
tokens;
|
|
1586
|
+
x;
|
|
1587
|
+
pos = 0;
|
|
1588
|
+
peek() {
|
|
1589
|
+
return this.tokens[this.pos];
|
|
1590
|
+
}
|
|
1591
|
+
eatOp(v) {
|
|
1592
|
+
const tk = this.peek();
|
|
1593
|
+
if (tk?.t !== "op" || tk.v !== v) throw new Error(`expected ${v}`);
|
|
1594
|
+
this.pos++;
|
|
1595
|
+
}
|
|
1596
|
+
evaluate() {
|
|
1597
|
+
const value = this.parseExpr();
|
|
1598
|
+
if (this.pos !== this.tokens.length) throw new Error("trailing input");
|
|
1599
|
+
return value;
|
|
1600
|
+
}
|
|
1601
|
+
// expr = term (('+' | '-') term)*
|
|
1602
|
+
parseExpr() {
|
|
1603
|
+
let value = this.parseTerm();
|
|
1604
|
+
for (; ; ) {
|
|
1605
|
+
const tk = this.peek();
|
|
1606
|
+
if (tk?.t === "op" && (tk.v === "+" || tk.v === "-")) {
|
|
1607
|
+
this.pos++;
|
|
1608
|
+
const rhs = this.parseTerm();
|
|
1609
|
+
value = tk.v === "+" ? value + rhs : value - rhs;
|
|
1610
|
+
} else break;
|
|
1611
|
+
}
|
|
1612
|
+
return value;
|
|
1613
|
+
}
|
|
1614
|
+
// term = factor (('*' | '/') factor)*
|
|
1615
|
+
parseTerm() {
|
|
1616
|
+
let value = this.parseFactor();
|
|
1617
|
+
for (; ; ) {
|
|
1618
|
+
const tk = this.peek();
|
|
1619
|
+
if (tk?.t === "op" && (tk.v === "*" || tk.v === "/")) {
|
|
1620
|
+
this.pos++;
|
|
1621
|
+
const rhs = this.parseFactor();
|
|
1622
|
+
value = tk.v === "*" ? value * rhs : value / rhs;
|
|
1623
|
+
} else break;
|
|
1624
|
+
}
|
|
1625
|
+
return value;
|
|
1626
|
+
}
|
|
1627
|
+
// factor = ('+' | '-') factor | power
|
|
1628
|
+
parseFactor() {
|
|
1629
|
+
const tk = this.peek();
|
|
1630
|
+
if (tk?.t === "op" && (tk.v === "+" || tk.v === "-")) {
|
|
1631
|
+
this.pos++;
|
|
1632
|
+
const operand = this.parseFactor();
|
|
1633
|
+
return tk.v === "-" ? -operand : operand;
|
|
1634
|
+
}
|
|
1635
|
+
return this.parsePower();
|
|
1636
|
+
}
|
|
1637
|
+
// power = primary ('^' factor)? — right-associative
|
|
1638
|
+
parsePower() {
|
|
1639
|
+
const base = this.parsePrimary();
|
|
1640
|
+
const tk = this.peek();
|
|
1641
|
+
if (tk?.t === "op" && tk.v === "^") {
|
|
1642
|
+
this.pos++;
|
|
1643
|
+
const exponent = this.parseFactor();
|
|
1644
|
+
return base ** exponent;
|
|
1645
|
+
}
|
|
1646
|
+
return base;
|
|
1647
|
+
}
|
|
1648
|
+
// primary = number | const | 'x' | func '(' expr ')' | '(' expr ')'
|
|
1649
|
+
parsePrimary() {
|
|
1650
|
+
const tk = this.peek();
|
|
1651
|
+
if (!tk) throw new Error("unexpected end");
|
|
1652
|
+
if (tk.t === "num") {
|
|
1653
|
+
this.pos++;
|
|
1654
|
+
return tk.v;
|
|
1655
|
+
}
|
|
1656
|
+
if (tk.t === "op" && tk.v === "(") {
|
|
1657
|
+
this.pos++;
|
|
1658
|
+
const value = this.parseExpr();
|
|
1659
|
+
this.eatOp(")");
|
|
1660
|
+
return value;
|
|
1661
|
+
}
|
|
1662
|
+
if (tk.t === "id") {
|
|
1663
|
+
this.pos++;
|
|
1664
|
+
if (tk.v === "x") return this.x;
|
|
1665
|
+
if (tk.v === "pi") return Math.PI;
|
|
1666
|
+
if (tk.v === "e") return Math.E;
|
|
1667
|
+
const fn = FUNCS[tk.v];
|
|
1668
|
+
if (fn) {
|
|
1669
|
+
this.eatOp("(");
|
|
1670
|
+
const arg = this.parseExpr();
|
|
1671
|
+
this.eatOp(")");
|
|
1672
|
+
return fn(arg);
|
|
1673
|
+
}
|
|
1674
|
+
throw new Error(`unknown identifier: ${tk.v}`);
|
|
1675
|
+
}
|
|
1676
|
+
throw new Error("unexpected token");
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1414
1679
|
function evaluateExpression(expr, x) {
|
|
1415
1680
|
try {
|
|
1416
|
-
const
|
|
1417
|
-
const result = new Function(`return ${processed}`)();
|
|
1681
|
+
const result = new Parser(tokenize(expr), x).evaluate();
|
|
1418
1682
|
return typeof result === "number" && isFinite(result) ? result : NaN;
|
|
1419
1683
|
} catch {
|
|
1420
1684
|
return NaN;
|
|
@@ -1423,7 +1687,7 @@ function evaluateExpression(expr, x) {
|
|
|
1423
1687
|
|
|
1424
1688
|
// src/charts-d3/function.ts
|
|
1425
1689
|
var SAMPLES = 200;
|
|
1426
|
-
function renderFunction(svg, chart, width, height, colors, textColor, mutedColor, topInset) {
|
|
1690
|
+
function renderFunction(svg, chart, width, height, colors, textColor, mutedColor, topInset, palette, isDark) {
|
|
1427
1691
|
const fns = chart.functions ?? [];
|
|
1428
1692
|
if (fns.length === 0) return;
|
|
1429
1693
|
const xr = chart.xRange ?? { min: -10, max: 10 };
|
|
@@ -1471,7 +1735,15 @@ function renderFunction(svg, chart, width, height, colors, textColor, mutedColor
|
|
|
1471
1735
|
svg.append("line").attr("x1", xx).attr("x2", xx).attr("y1", m.top).attr("y2", m.top + plotH).attr("stroke", mutedColor).attr("stroke-opacity", t === 0 ? 0.6 : 0.2);
|
|
1472
1736
|
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));
|
|
1473
1737
|
}
|
|
1474
|
-
const
|
|
1738
|
+
const inRange = (p) => isFinite(p[1]) && p[1] >= yLo - 1 && p[1] <= yHi + 1;
|
|
1739
|
+
if (chart.fill === true) {
|
|
1740
|
+
const solid = chart.fillMode === "solid";
|
|
1741
|
+
const areaGen = d3area2().defined(inRange).x((p) => x(p[0])).y0(y(Math.max(y.domain()[0], 0))).y1((p) => y(p[1]));
|
|
1742
|
+
for (const c of curves) {
|
|
1743
|
+
svg.append("path").attr("class", "dgmo-series-area").attr("d", areaGen(c.pts) ?? "").attr("fill", solid ? c.color : shapeFill(palette, c.color, isDark)).attr("stroke", "none").attr("data-series-name", c.name);
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
const gen = d3line2().defined(inRange).x((p) => x(p[0])).y((p) => y(p[1]));
|
|
1475
1747
|
for (const c of curves) {
|
|
1476
1748
|
const path = svg.append("path").attr("d", gen(c.pts) ?? "").attr("fill", "none").attr("stroke", c.color).attr("stroke-width", 1.75).attr("stroke-linejoin", "round").attr("data-series-name", c.name);
|
|
1477
1749
|
tagDatum(path, { line: c.line, key: c.name, name: c.name, color: c.color });
|
|
@@ -1500,6 +1772,25 @@ var D3_DATA_CHART_TYPES = /* @__PURE__ */ new Set([...STANDARD, ...EXTENDED]);
|
|
|
1500
1772
|
function supportsD3DataChart(type) {
|
|
1501
1773
|
return D3_DATA_CHART_TYPES.has(type);
|
|
1502
1774
|
}
|
|
1775
|
+
var INLINE_LEGEND_TYPES = /* @__PURE__ */ new Set([
|
|
1776
|
+
"bar",
|
|
1777
|
+
"line",
|
|
1778
|
+
"radar",
|
|
1779
|
+
"scatter",
|
|
1780
|
+
"function"
|
|
1781
|
+
]);
|
|
1782
|
+
function inlineTitleFor(chart, hasTitle, textColor) {
|
|
1783
|
+
if (!hasTitle || !chart.legendInline || chart.noLegend || !INLINE_LEGEND_TYPES.has(chart.type)) {
|
|
1784
|
+
return void 0;
|
|
1785
|
+
}
|
|
1786
|
+
return {
|
|
1787
|
+
title: chart.title,
|
|
1788
|
+
...chart.titleLineNumber !== void 0 && {
|
|
1789
|
+
titleLineNumber: chart.titleLineNumber
|
|
1790
|
+
},
|
|
1791
|
+
textColor
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1503
1794
|
function firstNonCommentToken(content) {
|
|
1504
1795
|
for (const raw of content.split("\n")) {
|
|
1505
1796
|
const l = raw.trim();
|
|
@@ -1547,7 +1838,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1547
1838
|
const std = forceExtended ? null : parseChart(content, palette);
|
|
1548
1839
|
if (std && !std.error && std.data.length > 0 && STANDARD.has(std.type)) {
|
|
1549
1840
|
const hasTitle2 = !std.noTitle && !!std.title;
|
|
1550
|
-
|
|
1841
|
+
const inlineTitle2 = inlineTitleFor(std, hasTitle2, textColor);
|
|
1842
|
+
if (hasTitle2 && !inlineTitle2)
|
|
1551
1843
|
renderChartTitle(s, std.title, std.titleLineNumber, width, textColor);
|
|
1552
1844
|
switch (std.type) {
|
|
1553
1845
|
case "bar":
|
|
@@ -1561,7 +1853,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1561
1853
|
isDark,
|
|
1562
1854
|
textColor,
|
|
1563
1855
|
mutedColor,
|
|
1564
|
-
hasTitle2
|
|
1856
|
+
hasTitle2,
|
|
1857
|
+
inlineTitle2
|
|
1565
1858
|
);
|
|
1566
1859
|
return true;
|
|
1567
1860
|
case "line":
|
|
@@ -1576,7 +1869,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1576
1869
|
textColor,
|
|
1577
1870
|
mutedColor,
|
|
1578
1871
|
bgColor,
|
|
1579
|
-
hasTitle2
|
|
1872
|
+
hasTitle2,
|
|
1873
|
+
inlineTitle2
|
|
1580
1874
|
);
|
|
1581
1875
|
return true;
|
|
1582
1876
|
case "pie":
|
|
@@ -1599,7 +1893,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1599
1893
|
palette,
|
|
1600
1894
|
isDark,
|
|
1601
1895
|
hasTitle2,
|
|
1602
|
-
width
|
|
1896
|
+
width,
|
|
1897
|
+
inlineTitle2
|
|
1603
1898
|
);
|
|
1604
1899
|
renderRadar(
|
|
1605
1900
|
s,
|
|
@@ -1633,7 +1928,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1633
1928
|
if (ext.error || !EXTENDED.has(ext.type)) return false;
|
|
1634
1929
|
const seriesColors = getSeriesColors(palette);
|
|
1635
1930
|
const hasTitle = !ext.noTitle && !!ext.title;
|
|
1636
|
-
|
|
1931
|
+
const inlineTitle = inlineTitleFor(ext, hasTitle, textColor);
|
|
1932
|
+
if (hasTitle && !inlineTitle)
|
|
1637
1933
|
renderChartTitle(s, ext.title, ext.titleLineNumber, width, textColor);
|
|
1638
1934
|
switch (ext.type) {
|
|
1639
1935
|
case "funnel":
|
|
@@ -1669,7 +1965,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1669
1965
|
palette,
|
|
1670
1966
|
isDark,
|
|
1671
1967
|
hasTitle,
|
|
1672
|
-
width
|
|
1968
|
+
width,
|
|
1969
|
+
inlineTitle
|
|
1673
1970
|
);
|
|
1674
1971
|
renderScatter(
|
|
1675
1972
|
s,
|
|
@@ -1718,7 +2015,8 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1718
2015
|
palette,
|
|
1719
2016
|
isDark,
|
|
1720
2017
|
hasTitle,
|
|
1721
|
-
width
|
|
2018
|
+
width,
|
|
2019
|
+
inlineTitle
|
|
1722
2020
|
);
|
|
1723
2021
|
renderFunction(
|
|
1724
2022
|
s,
|
|
@@ -1728,7 +2026,9 @@ function renderInto(s, content, palette, isDark, width, height, textColor, muted
|
|
|
1728
2026
|
seriesColors,
|
|
1729
2027
|
textColor,
|
|
1730
2028
|
mutedColor,
|
|
1731
|
-
top
|
|
2029
|
+
top,
|
|
2030
|
+
palette,
|
|
2031
|
+
isDark
|
|
1732
2032
|
);
|
|
1733
2033
|
return true;
|
|
1734
2034
|
}
|
|
@@ -1744,4 +2044,4 @@ export {
|
|
|
1744
2044
|
supportsD3DataChart,
|
|
1745
2045
|
renderDataChartD3
|
|
1746
2046
|
};
|
|
1747
|
-
//# sourceMappingURL=chunk-
|
|
2047
|
+
//# sourceMappingURL=chunk-QQXFYTLC.js.map
|