@primeui/chart-core 0.0.1-alpha.1
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/LICENSE +23 -0
- package/README.md +1 -0
- package/dist/animations/index.d.mts +136 -0
- package/dist/animations/index.mjs +18 -0
- package/dist/annotation.utils-Bm0lOO1o.d.mts +290 -0
- package/dist/borderRadius.utils-Cz73LLR_.d.mts +54 -0
- package/dist/canvas-D4vigq47.d.mts +34 -0
- package/dist/canvas.utils-D2WHi2gL.d.mts +167 -0
- package/dist/cartesian/index.d.mts +94 -0
- package/dist/cartesian/index.mjs +93 -0
- package/dist/chunk-22ST6YPP.mjs +304 -0
- package/dist/chunk-2QK2KOBN.mjs +10 -0
- package/dist/chunk-2QRS4YQ5.mjs +18 -0
- package/dist/chunk-3FFJEX4A.mjs +261 -0
- package/dist/chunk-3IYSJ2U7.mjs +567 -0
- package/dist/chunk-3OZLP4I4.mjs +190 -0
- package/dist/chunk-3WEMHXZI.mjs +198 -0
- package/dist/chunk-3Z62EUJN.mjs +138 -0
- package/dist/chunk-4C6EVJ54.mjs +362 -0
- package/dist/chunk-53HW45JB.mjs +102 -0
- package/dist/chunk-55Y3WI6S.mjs +186 -0
- package/dist/chunk-5JCI2DEB.mjs +97 -0
- package/dist/chunk-66T4MRC5.mjs +113 -0
- package/dist/chunk-6HSEJLSR.mjs +376 -0
- package/dist/chunk-6STOLMCA.mjs +187 -0
- package/dist/chunk-7CMVDIOU.mjs +54 -0
- package/dist/chunk-7QQ6ETB4.mjs +228 -0
- package/dist/chunk-A6ZQZFL2.mjs +272 -0
- package/dist/chunk-ADKLH73T.mjs +1 -0
- package/dist/chunk-AGU3NG6D.mjs +22 -0
- package/dist/chunk-AHYIS6EB.mjs +230 -0
- package/dist/chunk-AP3UYWYT.mjs +4 -0
- package/dist/chunk-ARB5T6MP.mjs +326 -0
- package/dist/chunk-ARRGOEFX.mjs +585 -0
- package/dist/chunk-AUF4CHDP.mjs +422 -0
- package/dist/chunk-B4FTADAZ.mjs +561 -0
- package/dist/chunk-BABQKA6K.mjs +339 -0
- package/dist/chunk-BETFQBM2.mjs +197 -0
- package/dist/chunk-BKP26M4K.mjs +413 -0
- package/dist/chunk-BZN2QHGP.mjs +200 -0
- package/dist/chunk-C36VWQ7A.mjs +86 -0
- package/dist/chunk-CHW4RKY3.mjs +16 -0
- package/dist/chunk-CINXJIRR.mjs +120 -0
- package/dist/chunk-DN6AXQYZ.mjs +667 -0
- package/dist/chunk-DP2IZNN3.mjs +92 -0
- package/dist/chunk-DTWTCFRG.mjs +119 -0
- package/dist/chunk-EAMUNLRU.mjs +172 -0
- package/dist/chunk-EDAKJLNA.mjs +17 -0
- package/dist/chunk-ERVQB2VZ.mjs +59 -0
- package/dist/chunk-FFMT6OCO.mjs +92 -0
- package/dist/chunk-FHTC2YDB.mjs +102 -0
- package/dist/chunk-FRST55HY.mjs +16 -0
- package/dist/chunk-HDFGCN2F.mjs +132 -0
- package/dist/chunk-IEGLX7VL.mjs +42 -0
- package/dist/chunk-ILUWFYGY.mjs +220 -0
- package/dist/chunk-IXOWSEHO.mjs +114 -0
- package/dist/chunk-J4RI2C2G.mjs +172 -0
- package/dist/chunk-J65DBT4R.mjs +13 -0
- package/dist/chunk-JGOVWSKH.mjs +179 -0
- package/dist/chunk-JO7VACY2.mjs +25 -0
- package/dist/chunk-JWFBOPM6.mjs +122 -0
- package/dist/chunk-KNDZP446.mjs +895 -0
- package/dist/chunk-KP2TWD4Z.mjs +90 -0
- package/dist/chunk-KQIFO5I3.mjs +225 -0
- package/dist/chunk-KVDEROP6.mjs +59 -0
- package/dist/chunk-LKC7MZKK.mjs +87 -0
- package/dist/chunk-LVMDQ4OJ.mjs +305 -0
- package/dist/chunk-M7B3JF43.mjs +90 -0
- package/dist/chunk-MTGMXRNF.mjs +136 -0
- package/dist/chunk-N3TIT3OH.mjs +1040 -0
- package/dist/chunk-NHRK5KU2.mjs +890 -0
- package/dist/chunk-NKUYIWAP.mjs +243 -0
- package/dist/chunk-NPDZLYIF.mjs +238 -0
- package/dist/chunk-O2X6FF45.mjs +499 -0
- package/dist/chunk-OGJ6IIBW.mjs +176 -0
- package/dist/chunk-OHGCZZPZ.mjs +403 -0
- package/dist/chunk-OWW3K55O.mjs +351 -0
- package/dist/chunk-OXTFAWSK.mjs +60 -0
- package/dist/chunk-PLSDU3C2.mjs +890 -0
- package/dist/chunk-PRDVPOZX.mjs +223 -0
- package/dist/chunk-Q6PPVIHU.mjs +21 -0
- package/dist/chunk-QQBXUDM4.mjs +885 -0
- package/dist/chunk-QS76E3TD.mjs +111 -0
- package/dist/chunk-QWQ6HY4I.mjs +209 -0
- package/dist/chunk-R6Y3R7EW.mjs +135 -0
- package/dist/chunk-RBLZRT5K.mjs +190 -0
- package/dist/chunk-RO4N6YFS.mjs +167 -0
- package/dist/chunk-RQ3CKQOX.mjs +984 -0
- package/dist/chunk-SALTGZFR.mjs +208 -0
- package/dist/chunk-SANZPAJ4.mjs +14 -0
- package/dist/chunk-SDBPQ5CF.mjs +624 -0
- package/dist/chunk-SSLTFJ3U.mjs +364 -0
- package/dist/chunk-SXHVDJGF.mjs +77 -0
- package/dist/chunk-TA4MVAEX.mjs +243 -0
- package/dist/chunk-TAHCOZHF.mjs +1772 -0
- package/dist/chunk-TQ6S34QZ.mjs +152 -0
- package/dist/chunk-UPRXABX5.mjs +90 -0
- package/dist/chunk-VGLSBZDN.mjs +71 -0
- package/dist/chunk-VN7CKCSE.mjs +364 -0
- package/dist/chunk-VVI3OBPJ.mjs +524 -0
- package/dist/chunk-VWF57TS3.mjs +62 -0
- package/dist/chunk-WA3OVISZ.mjs +179 -0
- package/dist/chunk-WCG35U6M.mjs +964 -0
- package/dist/chunk-WFTX4AQJ.mjs +194 -0
- package/dist/chunk-WFVOQ2QZ.mjs +18 -0
- package/dist/chunk-WH3C3Y7P.mjs +149 -0
- package/dist/chunk-WPFUV7K3.mjs +488 -0
- package/dist/chunk-WRULPWHD.mjs +492 -0
- package/dist/chunk-WS64BZXT.mjs +1 -0
- package/dist/chunk-WY4AURRE.mjs +2419 -0
- package/dist/chunk-WYLILAOO.mjs +167 -0
- package/dist/chunk-X4D7FKUS.mjs +62 -0
- package/dist/chunk-X7T34OLW.mjs +139 -0
- package/dist/chunk-XIHBK5D3.mjs +68 -0
- package/dist/chunk-XQQCGFYB.mjs +50 -0
- package/dist/chunk-XTVE4P3L.mjs +214 -0
- package/dist/chunk-XUAASRXW.mjs +579 -0
- package/dist/chunk-Y3L3D4GQ.mjs +685 -0
- package/dist/chunk-YBJ56XJS.mjs +132 -0
- package/dist/chunk-ZQFK6CAE.mjs +1 -0
- package/dist/chunk-ZT2Z7ERM.mjs +874 -0
- package/dist/chunk-ZTL2FQEW.mjs +714 -0
- package/dist/circular/arc/index.d.mts +8 -0
- package/dist/circular/arc/index.mjs +3 -0
- package/dist/circular/index.d.mts +44 -0
- package/dist/circular/index.mjs +13 -0
- package/dist/collect.utils-DiKB4ciO.d.mts +12 -0
- package/dist/computeChartState-BTVIqwyO.d.mts +304 -0
- package/dist/controller-BJE1AZ3q.d.mts +82 -0
- package/dist/controller-BoNigQJr.d.mts +63 -0
- package/dist/controllers/index.d.mts +16 -0
- package/dist/controllers/index.mjs +110 -0
- package/dist/datalabel.utils-CkjGeB8S.d.mts +122 -0
- package/dist/decimation.utils-CcvJVhI4.d.mts +244 -0
- package/dist/geometry-DUUQJXVM.d.mts +60 -0
- package/dist/index-DseIZa1j.d.mts +167 -0
- package/dist/index.d.mts +88 -0
- package/dist/index.mjs +110 -0
- package/dist/orchestrator/index.d.mts +264 -0
- package/dist/orchestrator/index.mjs +33 -0
- package/dist/plugins/index.d.mts +18 -0
- package/dist/plugins/index.mjs +1 -0
- package/dist/property-animations-D433wXzz.d.mts +580 -0
- package/dist/property-store-NORUWFND.d.mts +17 -0
- package/dist/radial/index.d.mts +14 -0
- package/dist/radial/index.mjs +37 -0
- package/dist/renderers/axis/index.d.mts +39 -0
- package/dist/renderers/axis/index.mjs +8 -0
- package/dist/renderers/circular/index.d.mts +13 -0
- package/dist/renderers/circular/index.mjs +13 -0
- package/dist/renderers/index.d.mts +83 -0
- package/dist/renderers/index.mjs +75 -0
- package/dist/renderers/navigator/index.d.mts +103 -0
- package/dist/renderers/navigator/index.mjs +8 -0
- package/dist/resize.utils-D_2qm6rv.d.mts +142 -0
- package/dist/ring.utils-DXvrxMkU.d.mts +138 -0
- package/dist/scale-KFv30jqZ.d.mts +307 -0
- package/dist/scales-Drf8AIhL.d.mts +75 -0
- package/dist/series/bar/canvas/index.d.mts +8 -0
- package/dist/series/bar/canvas/index.mjs +10 -0
- package/dist/series/bar/controller/index.d.mts +105 -0
- package/dist/series/bar/controller/index.mjs +44 -0
- package/dist/series/bar/controller-canvas/index.d.mts +7 -0
- package/dist/series/bar/controller-canvas/index.mjs +49 -0
- package/dist/series/bar/controller-svg/index.d.mts +7 -0
- package/dist/series/bar/controller-svg/index.mjs +49 -0
- package/dist/series/bar/index.d.mts +60 -0
- package/dist/series/bar/index.mjs +13 -0
- package/dist/series/bar/svg/index.d.mts +8 -0
- package/dist/series/bar/svg/index.mjs +11 -0
- package/dist/series/candlestick/canvas/index.d.mts +8 -0
- package/dist/series/candlestick/canvas/index.mjs +8 -0
- package/dist/series/candlestick/controller/index.d.mts +123 -0
- package/dist/series/candlestick/controller/index.mjs +40 -0
- package/dist/series/candlestick/controller-canvas/index.d.mts +7 -0
- package/dist/series/candlestick/controller-canvas/index.mjs +45 -0
- package/dist/series/candlestick/controller-svg/index.d.mts +7 -0
- package/dist/series/candlestick/controller-svg/index.mjs +45 -0
- package/dist/series/candlestick/index.d.mts +11 -0
- package/dist/series/candlestick/index.mjs +10 -0
- package/dist/series/candlestick/svg/index.d.mts +8 -0
- package/dist/series/candlestick/svg/index.mjs +8 -0
- package/dist/series/heatmap/canvas/index.d.mts +16 -0
- package/dist/series/heatmap/canvas/index.mjs +9 -0
- package/dist/series/heatmap/controller/index.d.mts +110 -0
- package/dist/series/heatmap/controller/index.mjs +23 -0
- package/dist/series/heatmap/controller-canvas/index.d.mts +7 -0
- package/dist/series/heatmap/controller-canvas/index.mjs +28 -0
- package/dist/series/heatmap/controller-svg/index.d.mts +7 -0
- package/dist/series/heatmap/controller-svg/index.mjs +28 -0
- package/dist/series/heatmap/index.d.mts +34 -0
- package/dist/series/heatmap/index.mjs +13 -0
- package/dist/series/heatmap/svg/index.d.mts +15 -0
- package/dist/series/heatmap/svg/index.mjs +10 -0
- package/dist/series/line/canvas/index.d.mts +6 -0
- package/dist/series/line/canvas/index.mjs +9 -0
- package/dist/series/line/controller/index.d.mts +111 -0
- package/dist/series/line/controller/index.mjs +47 -0
- package/dist/series/line/controller-canvas/index.d.mts +7 -0
- package/dist/series/line/controller-canvas/index.mjs +54 -0
- package/dist/series/line/controller-svg/index.d.mts +7 -0
- package/dist/series/line/controller-svg/index.mjs +54 -0
- package/dist/series/line/index.d.mts +49 -0
- package/dist/series/line/index.mjs +13 -0
- package/dist/series/line/svg/index.d.mts +6 -0
- package/dist/series/line/svg/index.mjs +9 -0
- package/dist/series/pie/canvas/index.d.mts +8 -0
- package/dist/series/pie/canvas/index.mjs +10 -0
- package/dist/series/pie/controller/index.d.mts +174 -0
- package/dist/series/pie/controller/index.mjs +110 -0
- package/dist/series/pie/controller-canvas/index.d.mts +8 -0
- package/dist/series/pie/controller-canvas/index.mjs +119 -0
- package/dist/series/pie/controller-svg/index.d.mts +8 -0
- package/dist/series/pie/controller-svg/index.mjs +118 -0
- package/dist/series/pie/index.d.mts +59 -0
- package/dist/series/pie/index.mjs +15 -0
- package/dist/series/pie/svg/index.d.mts +6 -0
- package/dist/series/pie/svg/index.mjs +11 -0
- package/dist/series/polar/canvas/index.d.mts +6 -0
- package/dist/series/polar/canvas/index.mjs +7 -0
- package/dist/series/polar/controller/index.d.mts +102 -0
- package/dist/series/polar/controller/index.mjs +46 -0
- package/dist/series/polar/controller-canvas/index.d.mts +8 -0
- package/dist/series/polar/controller-canvas/index.mjs +52 -0
- package/dist/series/polar/controller-svg/index.d.mts +8 -0
- package/dist/series/polar/controller-svg/index.mjs +52 -0
- package/dist/series/polar/index.d.mts +25 -0
- package/dist/series/polar/index.mjs +16 -0
- package/dist/series/polar/svg/index.d.mts +10 -0
- package/dist/series/polar/svg/index.mjs +8 -0
- package/dist/series/radar/canvas/index.d.mts +6 -0
- package/dist/series/radar/canvas/index.mjs +8 -0
- package/dist/series/radar/controller/index.d.mts +121 -0
- package/dist/series/radar/controller/index.mjs +43 -0
- package/dist/series/radar/controller-canvas/index.d.mts +8 -0
- package/dist/series/radar/controller-canvas/index.mjs +51 -0
- package/dist/series/radar/controller-svg/index.d.mts +8 -0
- package/dist/series/radar/controller-svg/index.mjs +51 -0
- package/dist/series/radar/index.d.mts +40 -0
- package/dist/series/radar/index.mjs +13 -0
- package/dist/series/radar/svg/index.d.mts +12 -0
- package/dist/series/radar/svg/index.mjs +9 -0
- package/dist/series/scatter/canvas/index.d.mts +8 -0
- package/dist/series/scatter/canvas/index.mjs +11 -0
- package/dist/series/scatter/controller/index.d.mts +124 -0
- package/dist/series/scatter/controller/index.mjs +44 -0
- package/dist/series/scatter/controller-canvas/index.d.mts +7 -0
- package/dist/series/scatter/controller-canvas/index.mjs +51 -0
- package/dist/series/scatter/controller-svg/index.d.mts +7 -0
- package/dist/series/scatter/controller-svg/index.mjs +51 -0
- package/dist/series/scatter/index.d.mts +25 -0
- package/dist/series/scatter/index.mjs +14 -0
- package/dist/series/scatter/svg/index.d.mts +8 -0
- package/dist/series/scatter/svg/index.mjs +12 -0
- package/dist/series/treemap/canvas/index.d.mts +50 -0
- package/dist/series/treemap/canvas/index.mjs +10 -0
- package/dist/series/treemap/controller/index.d.mts +130 -0
- package/dist/series/treemap/controller/index.mjs +20 -0
- package/dist/series/treemap/controller-canvas/index.d.mts +7 -0
- package/dist/series/treemap/controller-canvas/index.mjs +25 -0
- package/dist/series/treemap/controller-svg/index.d.mts +7 -0
- package/dist/series/treemap/controller-svg/index.mjs +25 -0
- package/dist/series/treemap/index.d.mts +15 -0
- package/dist/series/treemap/index.mjs +12 -0
- package/dist/series/treemap/svg/index.d.mts +15 -0
- package/dist/series/treemap/svg/index.mjs +9 -0
- package/dist/slices-DtewiwJx.d.mts +72 -0
- package/dist/spatialIndex.utils-B_GJkotZ.d.mts +5 -0
- package/dist/squarify.utils-B9CQBpa1.d.mts +50 -0
- package/dist/stacking-CChuAcLN.d.mts +319 -0
- package/dist/streaming.utils-DH-g1gNP.d.mts +49 -0
- package/dist/sync/index.d.mts +130 -0
- package/dist/sync/index.mjs +5 -0
- package/dist/tooltip.renderer-D5wpSlBa.d.mts +210 -0
- package/dist/utils/color/index.d.mts +58 -0
- package/dist/utils/color/index.mjs +4 -0
- package/dist/utils/data/index.d.mts +180 -0
- package/dist/utils/data/index.mjs +7 -0
- package/dist/utils/export/index.d.mts +14 -0
- package/dist/utils/export/index.mjs +6 -0
- package/dist/utils/index.d.mts +49 -0
- package/dist/utils/index.mjs +29 -0
- package/dist/utils/interaction/index.d.mts +255 -0
- package/dist/utils/interaction/index.mjs +9 -0
- package/dist/utils/layout/index.d.mts +3 -0
- package/dist/utils/layout/index.mjs +10 -0
- package/dist/utils/math/index.d.mts +162 -0
- package/dist/utils/math/index.mjs +1 -0
- package/dist/utils/render/index.d.mts +19 -0
- package/dist/utils/render/index.mjs +3 -0
- package/dist/utils/specialized/index.d.mts +37 -0
- package/dist/utils/specialized/index.mjs +66 -0
- package/dist/utils/text/index.d.mts +39 -0
- package/dist/utils/text/index.mjs +8 -0
- package/dist/utils/theme/index.d.mts +295 -0
- package/dist/utils/theme/index.mjs +5 -0
- package/dist/utils/zoom/index.d.mts +90 -0
- package/dist/utils/zoom/index.mjs +3 -0
- package/package.json +56 -0
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import { normalizeCrosshairConfig } from './chunk-QWQ6HY4I.mjs';
|
|
2
|
+
import { resolveNavigatorConfig } from './chunk-BKP26M4K.mjs';
|
|
3
|
+
import { buildLegendItems, resolveLegendClickAction } from './chunk-ZT2Z7ERM.mjs';
|
|
4
|
+
import { normalizePadding, calculateTitleLayout, calculateLegendArea, calculateChartArea } from './chunk-NPDZLYIF.mjs';
|
|
5
|
+
import { generateChartTypeDescription, generateChartSummary } from './chunk-OGJ6IIBW.mjs';
|
|
6
|
+
import { DEFAULT_CHART_TITLE_PADDING, DEFAULT_LEGEND_PADDING, DEFAULT_CHART_CAPTION_PADDING } from './chunk-NKUYIWAP.mjs';
|
|
7
|
+
import { EXPORT_MENU_CONSTANTS } from './chunk-OWW3K55O.mjs';
|
|
8
|
+
|
|
9
|
+
// src/orchestrator/computeLayout.ts
|
|
10
|
+
function buildLayoutInputs(p) {
|
|
11
|
+
const { width, height, titleConfig: tc, captionConfig: cc, measuredCaptionHeight, legendConfig: lc, hoverConfig, navigatorConfig, colorLegendConfig: clc, exportMenuConfig, drilldownIsActive, isCartesian, theme, adaptive, ruleOverrides: ro } = p;
|
|
12
|
+
return {
|
|
13
|
+
width,
|
|
14
|
+
height,
|
|
15
|
+
titleConfig: tc ? { text: tc.text, position: tc.position, fontSize: tc.fontSize, padding: tc.padding, floating: tc.floating } : void 0,
|
|
16
|
+
captionConfig: cc ? { text: cc.text, position: cc.position, fontSize: cc.fontSize, padding: cc.padding, measuredHeight: measuredCaptionHeight && measuredCaptionHeight > 0 ? measuredCaptionHeight : void 0 } : void 0,
|
|
17
|
+
legendConfig: lc ? { position: lc.position, maxWidth: lc.maxWidth, maxHeight: lc.maxHeight, width: lc.width, height: lc.height } : void 0,
|
|
18
|
+
legendEnabled: ro.legend?.enabled !== false,
|
|
19
|
+
hoverOffset: hoverConfig?.offset ?? 0,
|
|
20
|
+
navigatorConfig,
|
|
21
|
+
colorLegendConfig: clc ? { position: clc.position, reservedSize: clc.reservedSize } : void 0,
|
|
22
|
+
exportMenuConfig,
|
|
23
|
+
drilldownIsActive,
|
|
24
|
+
isCartesian,
|
|
25
|
+
theme,
|
|
26
|
+
adaptive: { chartPadding: adaptive.chartPadding, chartTitleFontSize: adaptive.chartTitleFontSize, chartCaptionFontSize: adaptive.chartCaptionFontSize, legendAutoReposition: adaptive.legendAutoReposition },
|
|
27
|
+
ruleOverrides: {
|
|
28
|
+
title: ro.title ? { fontSize: ro.title.fontSize } : void 0,
|
|
29
|
+
caption: ro.caption ? { fontSize: ro.caption.fontSize } : void 0,
|
|
30
|
+
legend: ro.legend ? { enabled: ro.legend.enabled } : void 0
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function computeEffectiveLegendPosition(legendPosition, legendAutoReposition) {
|
|
35
|
+
let position = legendPosition ?? "bottom";
|
|
36
|
+
if (legendAutoReposition && (position === "left" || position === "right")) {
|
|
37
|
+
position = "bottom";
|
|
38
|
+
}
|
|
39
|
+
return position;
|
|
40
|
+
}
|
|
41
|
+
function computeTitleLayout(inputs) {
|
|
42
|
+
const { titleConfig: tc, captionConfig: cc, width, height, adaptive, ruleOverrides } = inputs;
|
|
43
|
+
const hasTitle = !!tc?.text;
|
|
44
|
+
const hasCaption = !!cc?.text;
|
|
45
|
+
if (!hasTitle && !hasCaption) {
|
|
46
|
+
return { titleArea: null, captionArea: null, totalArea: null, totalHeight: 0, captionIndependentHeight: 0, captionIndependentPosition: null };
|
|
47
|
+
}
|
|
48
|
+
const effectiveTitleFontSize = ruleOverrides.title?.fontSize ?? tc?.fontSize ?? adaptive.chartTitleFontSize;
|
|
49
|
+
const effectiveCaptionFontSize = ruleOverrides.caption?.fontSize ?? cc?.fontSize ?? adaptive.chartCaptionFontSize;
|
|
50
|
+
const titlePaddingProp = tc?.padding;
|
|
51
|
+
const titlePaddingValue = typeof titlePaddingProp === "number" ? titlePaddingProp : titlePaddingProp?.top ?? DEFAULT_CHART_TITLE_PADDING;
|
|
52
|
+
const padding = normalizePadding(adaptive.chartPadding);
|
|
53
|
+
const titleOpts = hasTitle ? { display: true, text: tc.text, position: tc.position === "top" || tc.position === "bottom" ? tc.position : "top", fontSize: effectiveTitleFontSize, padding: titlePaddingValue } : void 0;
|
|
54
|
+
const captionOpts = hasCaption ? {
|
|
55
|
+
display: true,
|
|
56
|
+
text: cc.text,
|
|
57
|
+
fontSize: effectiveCaptionFontSize,
|
|
58
|
+
padding: cc.padding,
|
|
59
|
+
position: cc.position === "top" || cc.position === "bottom" ? cc.position : void 0,
|
|
60
|
+
measuredHeight: cc.measuredHeight && cc.measuredHeight > 0 ? cc.measuredHeight : void 0
|
|
61
|
+
} : void 0;
|
|
62
|
+
return calculateTitleLayout(titleOpts, captionOpts, width, height, padding, tc?.floating);
|
|
63
|
+
}
|
|
64
|
+
var AUTO_REPOSITIONED_LEGEND_MIN_HEIGHT = 90;
|
|
65
|
+
function resolveReservedLegendHeight(lc, effectivePosition) {
|
|
66
|
+
const base = lc.height ?? lc.maxHeight ?? 40;
|
|
67
|
+
const wasAutoRepositioned = effectivePosition === "bottom" && (lc.position === "left" || lc.position === "right");
|
|
68
|
+
if (wasAutoRepositioned && lc.height == null && lc.maxHeight == null) {
|
|
69
|
+
return Math.max(base, AUTO_REPOSITIONED_LEGEND_MIN_HEIGHT);
|
|
70
|
+
}
|
|
71
|
+
return base;
|
|
72
|
+
}
|
|
73
|
+
function computeLegendArea(inputs, titleArea, effectiveLegendPosition) {
|
|
74
|
+
const { legendConfig: lc, width, height, titleConfig, adaptive, ruleOverrides } = inputs;
|
|
75
|
+
if (!lc) return null;
|
|
76
|
+
if (ruleOverrides.legend?.enabled === false) return null;
|
|
77
|
+
const position = effectiveLegendPosition;
|
|
78
|
+
const isVertical = position === "left" || position === "right";
|
|
79
|
+
const reservedWidth = lc.width ?? (isVertical ? lc.maxWidth ?? 100 : 0);
|
|
80
|
+
const reservedHeight = isVertical ? lc.height ?? 0 : resolveReservedLegendHeight(lc, position);
|
|
81
|
+
const legendOpts = { display: true, position, width: reservedWidth, height: reservedHeight, padding: DEFAULT_LEGEND_PADDING };
|
|
82
|
+
const padding = normalizePadding(adaptive.chartPadding);
|
|
83
|
+
const titlePosition = titleConfig?.position === "top" || titleConfig?.position === "bottom" ? titleConfig.position : "top";
|
|
84
|
+
return calculateLegendArea(legendOpts, width, height, padding, titleArea, titlePosition);
|
|
85
|
+
}
|
|
86
|
+
function computeChartArea(inputs, titleArea, legendArea, effectiveLegendPosition, titleLayout) {
|
|
87
|
+
const { width, height, titleConfig, adaptive, hoverOffset, navigatorConfig, drilldownIsActive, exportMenuConfig, colorLegendConfig, isCartesian, theme } = inputs;
|
|
88
|
+
const verticalPadding = adaptive.chartPadding + hoverOffset;
|
|
89
|
+
const padding = { top: verticalPadding, bottom: verticalPadding, left: verticalPadding, right: verticalPadding };
|
|
90
|
+
const titlePosition = titleConfig?.position === "top" || titleConfig?.position === "bottom" ? titleConfig.position : "top";
|
|
91
|
+
const area = calculateChartArea(width, height, padding, titleArea, legendArea, titlePosition, effectiveLegendPosition);
|
|
92
|
+
if (!area) return null;
|
|
93
|
+
if (titleLayout.captionIndependentHeight > 0) {
|
|
94
|
+
if (titleLayout.captionIndependentPosition === "top") {
|
|
95
|
+
area.y += titleLayout.captionIndependentHeight;
|
|
96
|
+
area.height -= titleLayout.captionIndependentHeight;
|
|
97
|
+
} else {
|
|
98
|
+
area.height -= titleLayout.captionIndependentHeight;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (drilldownIsActive) {
|
|
102
|
+
area.y += 28;
|
|
103
|
+
area.height -= 28;
|
|
104
|
+
}
|
|
105
|
+
if (navigatorConfig && navigatorConfig.enabled !== false && isCartesian) {
|
|
106
|
+
const navResolved = resolveNavigatorConfig(navigatorConfig, theme);
|
|
107
|
+
area.height = area.height - navResolved.height - navResolved.gap;
|
|
108
|
+
}
|
|
109
|
+
if (exportMenuConfig?.enabled !== false && exportMenuConfig?.buttons?.verticalAlign === "bottom") {
|
|
110
|
+
area.height -= EXPORT_MENU_CONSTANTS.BUTTON_SIZE + 10;
|
|
111
|
+
}
|
|
112
|
+
if (colorLegendConfig) {
|
|
113
|
+
const clPos = colorLegendConfig.position ?? "bottom";
|
|
114
|
+
const clReserved = colorLegendConfig.reservedSize ?? 36;
|
|
115
|
+
const clGap = 8;
|
|
116
|
+
if (clPos === "bottom") area.height -= clReserved + clGap;
|
|
117
|
+
else if (clPos === "top") {
|
|
118
|
+
area.y += clReserved + clGap;
|
|
119
|
+
area.height -= clReserved + clGap;
|
|
120
|
+
} else if (clPos === "right") area.width -= clReserved + clGap;
|
|
121
|
+
else if (clPos === "left") {
|
|
122
|
+
area.x += clReserved + clGap;
|
|
123
|
+
area.width -= clReserved + clGap;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
const right = Math.round(area.x + area.width);
|
|
127
|
+
const bottom = Math.round(area.y + area.height);
|
|
128
|
+
area.x = Math.round(area.x);
|
|
129
|
+
area.y = Math.round(area.y);
|
|
130
|
+
area.width = Math.max(0, right - area.x);
|
|
131
|
+
area.height = Math.max(0, bottom - area.y);
|
|
132
|
+
return area;
|
|
133
|
+
}
|
|
134
|
+
function computeNavigatorArea(chartArea, navigatorConfig, isCartesian, theme) {
|
|
135
|
+
if (!chartArea || !navigatorConfig || navigatorConfig.enabled === false || !isCartesian) return null;
|
|
136
|
+
const navResolved = resolveNavigatorConfig(navigatorConfig, theme);
|
|
137
|
+
return { x: chartArea.x, y: chartArea.y + chartArea.height + navResolved.gap, width: chartArea.width, height: navResolved.height };
|
|
138
|
+
}
|
|
139
|
+
function computeColorLegendArea(chartArea, colorLegendConfig) {
|
|
140
|
+
if (!chartArea || !colorLegendConfig) return null;
|
|
141
|
+
const pos = colorLegendConfig.position ?? "bottom";
|
|
142
|
+
const reserved = colorLegendConfig.reservedSize ?? 36;
|
|
143
|
+
const gap = 8;
|
|
144
|
+
if (pos === "bottom") return { x: chartArea.x, y: chartArea.y + chartArea.height + gap, width: chartArea.width, height: reserved };
|
|
145
|
+
if (pos === "top") return { x: chartArea.x, y: chartArea.y - reserved - gap, width: chartArea.width, height: reserved };
|
|
146
|
+
if (pos === "right") return { x: chartArea.x + chartArea.width + gap, y: chartArea.y, width: reserved, height: chartArea.height };
|
|
147
|
+
return { x: chartArea.x - reserved - gap, y: chartArea.y, width: reserved, height: chartArea.height };
|
|
148
|
+
}
|
|
149
|
+
function computeResetZoomTop(chartArea, exportMenuConfig) {
|
|
150
|
+
const baseTop = (chartArea?.y ?? 0) + 4;
|
|
151
|
+
if (!exportMenuConfig || exportMenuConfig.enabled === false) return baseTop;
|
|
152
|
+
const exportBtnAlign = exportMenuConfig.buttons?.verticalAlign ?? "top";
|
|
153
|
+
if (exportBtnAlign !== "top") return baseTop;
|
|
154
|
+
return Math.max(baseTop, (exportMenuConfig.buttons?.y ?? 10) + EXPORT_MENU_CONSTANTS.BUTTON_SIZE + 4);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/orchestrator/computeStyles.ts
|
|
158
|
+
function computeTitleStyle(inputs) {
|
|
159
|
+
const { titleConfig: tc, titleArea, height, adaptive, ruleOverrides, theme, globalFontFamily } = inputs;
|
|
160
|
+
if (!tc?.text || !titleArea) return null;
|
|
161
|
+
const position = tc.position ?? "top";
|
|
162
|
+
const alignment = tc.alignment ?? "center";
|
|
163
|
+
const effectiveFontSize = ruleOverrides.title?.fontSize ?? tc.fontSize ?? adaptive.chartTitleFontSize;
|
|
164
|
+
const baseStyle = {
|
|
165
|
+
position: "absolute",
|
|
166
|
+
left: "0",
|
|
167
|
+
right: "0",
|
|
168
|
+
textAlign: alignment === "start" ? "left" : alignment === "end" ? "right" : "center",
|
|
169
|
+
fontSize: `${effectiveFontSize}px`,
|
|
170
|
+
fontWeight: tc.fontWeight ?? "600",
|
|
171
|
+
fontFamily: tc.fontFamily ?? globalFontFamily ?? void 0,
|
|
172
|
+
color: tc.color ?? `var(--p-chart-title-color, ${theme.titleColor})`,
|
|
173
|
+
padding: `0 ${adaptive.chartPadding}px`
|
|
174
|
+
};
|
|
175
|
+
if (tc.offsetX != null || tc.offsetY != null) {
|
|
176
|
+
baseStyle.transform = `translate(${tc.offsetX ?? 0}px, ${tc.offsetY ?? 0}px)`;
|
|
177
|
+
}
|
|
178
|
+
if (position === "top") {
|
|
179
|
+
return { ...baseStyle, top: `${titleArea.y}px` };
|
|
180
|
+
}
|
|
181
|
+
return { ...baseStyle, bottom: `${height - titleArea.y - titleArea.height}px` };
|
|
182
|
+
}
|
|
183
|
+
function computeCaptionStyle(inputs) {
|
|
184
|
+
const { captionConfig: cc, titleConfig: tc, captionArea, height, adaptive, ruleOverrides, theme, globalFontFamily } = inputs;
|
|
185
|
+
if (!cc?.text || !captionArea) return null;
|
|
186
|
+
const position = cc.position === "top" || cc.position === "bottom" ? cc.position : tc?.position === "bottom" ? "bottom" : "top";
|
|
187
|
+
const alignment = cc.alignment ?? tc?.alignment ?? "center";
|
|
188
|
+
const effectiveFontSize = ruleOverrides.caption?.fontSize ?? cc.fontSize ?? adaptive.chartCaptionFontSize;
|
|
189
|
+
const baseStyle = {
|
|
190
|
+
position: "absolute",
|
|
191
|
+
left: "0",
|
|
192
|
+
right: "0",
|
|
193
|
+
textAlign: alignment === "start" ? "left" : alignment === "end" ? "right" : "center",
|
|
194
|
+
fontSize: `${effectiveFontSize}px`,
|
|
195
|
+
fontWeight: cc.fontWeight ?? "normal",
|
|
196
|
+
fontFamily: cc.fontFamily ?? globalFontFamily ?? void 0,
|
|
197
|
+
color: cc.color ?? `var(--p-chart-caption-color, ${theme.captionColor})`,
|
|
198
|
+
padding: `0 ${adaptive.chartPadding}px`,
|
|
199
|
+
paddingBottom: `${typeof cc.padding === "number" ? cc.padding : cc.padding?.bottom ?? DEFAULT_CHART_CAPTION_PADDING.bottom}px`
|
|
200
|
+
};
|
|
201
|
+
if (cc.offsetX != null || cc.offsetY != null) {
|
|
202
|
+
baseStyle.transform = `translate(${cc.offsetX ?? 0}px, ${cc.offsetY ?? 0}px)`;
|
|
203
|
+
}
|
|
204
|
+
if (position === "top") {
|
|
205
|
+
return { ...baseStyle, top: `${captionArea.y}px` };
|
|
206
|
+
}
|
|
207
|
+
return { ...baseStyle, bottom: `${height - captionArea.y - captionArea.height}px` };
|
|
208
|
+
}
|
|
209
|
+
function computeContainerStyle(width, height, hoverBrightness, hoverDimOpacity, keyboardNavEnabled, hideBrowserFocusOutline, globalFontFamily) {
|
|
210
|
+
return {
|
|
211
|
+
position: "relative",
|
|
212
|
+
isolation: "isolate",
|
|
213
|
+
width: `${width}px`,
|
|
214
|
+
height: `${height}px`,
|
|
215
|
+
userSelect: "none",
|
|
216
|
+
fontFamily: globalFontFamily ?? void 0,
|
|
217
|
+
outline: keyboardNavEnabled && hideBrowserFocusOutline !== false ? "none" : void 0,
|
|
218
|
+
...hoverBrightness != null ? { "--p-chart-hover-brightness": String(hoverBrightness) } : {},
|
|
219
|
+
...hoverDimOpacity != null ? { "--p-chart-dim-opacity": String(hoverDimOpacity) } : {}
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// src/orchestrator/extractFeatureConfigs.ts
|
|
224
|
+
function extractFeatureConfigs(features) {
|
|
225
|
+
return {
|
|
226
|
+
legend: features.get("legend")?.props,
|
|
227
|
+
tooltip: features.get("tooltip")?.props,
|
|
228
|
+
hover: features.get("hover")?.props,
|
|
229
|
+
title: features.get("title")?.props,
|
|
230
|
+
caption: features.get("caption")?.props,
|
|
231
|
+
zoom: features.get("zoom")?.props,
|
|
232
|
+
accessibility: features.get("accessibility")?.props,
|
|
233
|
+
navigator: features.get("navigator")?.props,
|
|
234
|
+
breadcrumb: features.get("breadcrumb")?.props,
|
|
235
|
+
colorLegend: features.get("colorLegend")?.props,
|
|
236
|
+
exportMenu: features.get("exportMenu")?.props,
|
|
237
|
+
responsive: features.get("responsive")?.props
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function detectDatasetTypes(datasets) {
|
|
241
|
+
let hasRadarDatasets = false;
|
|
242
|
+
let hasPolarDatasets = false;
|
|
243
|
+
let hasStackedPies = false;
|
|
244
|
+
datasets.forEach((ds) => {
|
|
245
|
+
if (ds.type === "radar") hasRadarDatasets = true;
|
|
246
|
+
if (ds.type === "polar") hasPolarDatasets = true;
|
|
247
|
+
if (ds.props.stackId !== void 0) hasStackedPies = true;
|
|
248
|
+
});
|
|
249
|
+
return { hasRadarDatasets, hasPolarDatasets, hasStackedPies };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// src/orchestrator/computeChartState.ts
|
|
253
|
+
function computeChartState(inputs) {
|
|
254
|
+
const { width, height, features, datasets, axes, rendererHint, drilldownIsActive, measuredCaptionHeight, theme, adaptive, ruleOverrides, globalFontFamily } = inputs;
|
|
255
|
+
const featureConfigs = extractFeatureConfigs(features);
|
|
256
|
+
const legendConfig = featureConfigs.legend;
|
|
257
|
+
const exportMenuConfig = featureConfigs.exportMenu;
|
|
258
|
+
const tooltipConfig = featureConfigs.tooltip;
|
|
259
|
+
const hoverConfig = featureConfigs.hover;
|
|
260
|
+
const titleConfig = featureConfigs.title;
|
|
261
|
+
const captionConfig = featureConfigs.caption;
|
|
262
|
+
const breadcrumbConfig = featureConfigs.breadcrumb;
|
|
263
|
+
const colorLegendConfig = featureConfigs.colorLegend;
|
|
264
|
+
const navigatorConfig = featureConfigs.navigator;
|
|
265
|
+
const a11yConfig = featureConfigs.accessibility;
|
|
266
|
+
const zoomConfig = featureConfigs.zoom ?? null;
|
|
267
|
+
const isCartesian = rendererHint === "cartesian" || rendererHint === "heatmap";
|
|
268
|
+
const isRect = rendererHint === "rect";
|
|
269
|
+
const crosshairConfig = isCartesian ? normalizeCrosshairConfig(tooltipConfig?.crosshair) : null;
|
|
270
|
+
const hasCrosshair = !!crosshairConfig?.enabled;
|
|
271
|
+
const isSharedMode = tooltipConfig?.mode === "shared";
|
|
272
|
+
const snapStrategy = tooltipConfig?.snap;
|
|
273
|
+
const useNearestSnap = snapStrategy !== "none" && (isSharedMode || hasCrosshair || snapStrategy != null);
|
|
274
|
+
const rb = zoomConfig?.resetButton;
|
|
275
|
+
const resetButtonConfig = rb === false ? null : typeof rb === "object" && rb !== null ? rb : {};
|
|
276
|
+
const a11yEnabled = a11yConfig?.enabled !== false;
|
|
277
|
+
const a11yHeadingLevel = a11yConfig?.headingLevel ?? "h4";
|
|
278
|
+
const keyboardNavConfig = a11yConfig?.keyboardNavigation;
|
|
279
|
+
const keyboardNavEnabled = a11yEnabled && keyboardNavConfig?.enabled !== false;
|
|
280
|
+
const xAxisTickFormat = axes.x.get("default")?.props?.tickFormat;
|
|
281
|
+
const titleRO = ruleOverrides.title;
|
|
282
|
+
const captionRO = ruleOverrides.caption;
|
|
283
|
+
const legendRO = ruleOverrides.legend;
|
|
284
|
+
const effectiveLegendPosition = computeEffectiveLegendPosition(legendConfig?.position, adaptive.legendAutoReposition);
|
|
285
|
+
const layoutInputs = buildLayoutInputs({
|
|
286
|
+
width,
|
|
287
|
+
height,
|
|
288
|
+
titleConfig,
|
|
289
|
+
captionConfig,
|
|
290
|
+
measuredCaptionHeight,
|
|
291
|
+
legendConfig,
|
|
292
|
+
hoverConfig,
|
|
293
|
+
navigatorConfig,
|
|
294
|
+
colorLegendConfig: colorLegendConfig ? { position: colorLegendConfig.position, reservedSize: colorLegendConfig.reservedSize } : void 0,
|
|
295
|
+
exportMenuConfig,
|
|
296
|
+
drilldownIsActive,
|
|
297
|
+
isCartesian,
|
|
298
|
+
theme,
|
|
299
|
+
adaptive: {
|
|
300
|
+
chartPadding: adaptive.chartPadding,
|
|
301
|
+
chartTitleFontSize: adaptive.chartTitleFontSize,
|
|
302
|
+
chartCaptionFontSize: adaptive.chartCaptionFontSize,
|
|
303
|
+
legendAutoReposition: adaptive.legendAutoReposition
|
|
304
|
+
},
|
|
305
|
+
ruleOverrides: { title: titleRO, caption: captionRO, legend: legendRO }
|
|
306
|
+
});
|
|
307
|
+
const titleLayout = computeTitleLayout(layoutInputs);
|
|
308
|
+
const titleArea = titleConfig?.floating ? null : titleLayout.totalArea;
|
|
309
|
+
const legendArea = computeLegendArea(layoutInputs, titleArea, effectiveLegendPosition);
|
|
310
|
+
const chartArea = computeChartArea(layoutInputs, titleArea, legendArea, effectiveLegendPosition, titleLayout);
|
|
311
|
+
const navigatorArea = computeNavigatorArea(chartArea, navigatorConfig, isCartesian, theme);
|
|
312
|
+
const colorLegendArea = computeColorLegendArea(chartArea, colorLegendConfig ? { position: colorLegendConfig.position, reservedSize: colorLegendConfig.reservedSize } : void 0);
|
|
313
|
+
const resetZoomTop = computeResetZoomTop(chartArea, exportMenuConfig);
|
|
314
|
+
const datasetTypes = detectDatasetTypes(datasets);
|
|
315
|
+
const chartTypeDescription = a11yEnabled ? a11yConfig?.typeDescription ?? generateChartTypeDescription(datasets) : "";
|
|
316
|
+
const chartDescription = a11yEnabled ? a11yConfig?.description ?? generateChartSummary(titleConfig?.text, captionConfig?.text, chartTypeDescription, []) : void 0;
|
|
317
|
+
const containerStyle = computeContainerStyle(
|
|
318
|
+
width,
|
|
319
|
+
height,
|
|
320
|
+
hoverConfig?.brightness,
|
|
321
|
+
hoverConfig?.dimOpacity,
|
|
322
|
+
keyboardNavEnabled,
|
|
323
|
+
keyboardNavConfig?.focusBorder?.hideBrowserFocusOutline,
|
|
324
|
+
globalFontFamily
|
|
325
|
+
);
|
|
326
|
+
const themeTail = computeThemeDependentFields(inputs, {
|
|
327
|
+
isCartesian,
|
|
328
|
+
datasetTypes,
|
|
329
|
+
titleLayout,
|
|
330
|
+
titleConfig,
|
|
331
|
+
captionConfig,
|
|
332
|
+
titleRO,
|
|
333
|
+
captionRO
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
legendConfig,
|
|
337
|
+
exportMenuConfig,
|
|
338
|
+
tooltipConfig,
|
|
339
|
+
crosshairConfig,
|
|
340
|
+
hasCrosshair,
|
|
341
|
+
isSharedMode,
|
|
342
|
+
useNearestSnap,
|
|
343
|
+
hoverConfig,
|
|
344
|
+
titleConfig,
|
|
345
|
+
captionConfig,
|
|
346
|
+
breadcrumbConfig,
|
|
347
|
+
colorLegendConfig,
|
|
348
|
+
zoomConfig,
|
|
349
|
+
resetButtonConfig,
|
|
350
|
+
navigatorConfig,
|
|
351
|
+
a11yConfig,
|
|
352
|
+
a11yEnabled,
|
|
353
|
+
a11yHeadingLevel,
|
|
354
|
+
keyboardNavEnabled,
|
|
355
|
+
keyboardNavConfig,
|
|
356
|
+
xAxisTickFormat,
|
|
357
|
+
isCartesian,
|
|
358
|
+
isRect,
|
|
359
|
+
datasetTypes,
|
|
360
|
+
effectiveLegendPosition,
|
|
361
|
+
titleLayout,
|
|
362
|
+
titleArea,
|
|
363
|
+
legendArea,
|
|
364
|
+
chartArea,
|
|
365
|
+
navigatorArea,
|
|
366
|
+
colorLegendArea,
|
|
367
|
+
resetZoomTop,
|
|
368
|
+
chartTypeDescription,
|
|
369
|
+
chartDescription,
|
|
370
|
+
containerStyle,
|
|
371
|
+
...themeTail
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function computeThemeDependentFields(inputs, ctx) {
|
|
375
|
+
const { datasets, datasetVisibility, hiddenItems, theme, adaptive, height, globalFontFamily } = inputs;
|
|
376
|
+
const { isCartesian, datasetTypes, titleLayout, titleConfig, captionConfig, titleRO, captionRO } = ctx;
|
|
377
|
+
const legendItems = buildLegendItems({
|
|
378
|
+
datasets,
|
|
379
|
+
datasetVisibility,
|
|
380
|
+
hiddenItems,
|
|
381
|
+
isCartesian,
|
|
382
|
+
hasRadarDatasets: datasetTypes.hasRadarDatasets,
|
|
383
|
+
hasPolarDatasets: datasetTypes.hasPolarDatasets,
|
|
384
|
+
hasStackedPies: datasetTypes.hasStackedPies,
|
|
385
|
+
theme
|
|
386
|
+
});
|
|
387
|
+
const titleStyle = computeTitleStyle({
|
|
388
|
+
titleConfig,
|
|
389
|
+
titleArea: titleLayout.titleArea,
|
|
390
|
+
height,
|
|
391
|
+
adaptive: { chartPadding: adaptive.chartPadding, chartTitleFontSize: adaptive.chartTitleFontSize },
|
|
392
|
+
ruleOverrides: { title: titleRO },
|
|
393
|
+
theme: { titleColor: theme.titleColor },
|
|
394
|
+
globalFontFamily
|
|
395
|
+
});
|
|
396
|
+
const captionStyle = computeCaptionStyle({
|
|
397
|
+
captionConfig,
|
|
398
|
+
titleConfig: titleConfig ? { position: titleConfig.position, alignment: titleConfig.alignment } : void 0,
|
|
399
|
+
captionArea: titleLayout.captionArea,
|
|
400
|
+
height,
|
|
401
|
+
adaptive: { chartPadding: adaptive.chartPadding, chartCaptionFontSize: adaptive.chartCaptionFontSize },
|
|
402
|
+
ruleOverrides: { caption: captionRO },
|
|
403
|
+
theme: { captionColor: theme.captionColor },
|
|
404
|
+
globalFontFamily
|
|
405
|
+
});
|
|
406
|
+
return { legendItems, titleStyle, captionStyle };
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// src/orchestrator/eventHandlers.ts
|
|
410
|
+
function processMouseMoveCore(x, y, ctx, lastHover, tooltipConfig) {
|
|
411
|
+
let hit = null;
|
|
412
|
+
let allSeriesHits;
|
|
413
|
+
if (ctx.isCartesian && ctx.useNearestSnap) {
|
|
414
|
+
const result = ctx.delegate?.findAllNearest(x, y) ?? null;
|
|
415
|
+
if (result?.primary) {
|
|
416
|
+
hit = result.primary;
|
|
417
|
+
allSeriesHits = result.allSeries;
|
|
418
|
+
}
|
|
419
|
+
} else if (ctx.isCartesian) {
|
|
420
|
+
hit = ctx.delegate?.hitTest(x, y) ?? null;
|
|
421
|
+
} else if (ctx.isRect) {
|
|
422
|
+
hit = ctx.delegate?.hitTest(x, y) ?? null;
|
|
423
|
+
ctx.delegate?.updateHoverOverlay(hit);
|
|
424
|
+
} else if (ctx.isSharedMode) {
|
|
425
|
+
const result = ctx.delegate?.findAllNearest(x, y) ?? null;
|
|
426
|
+
if (result?.primary) {
|
|
427
|
+
hit = result.primary;
|
|
428
|
+
allSeriesHits = result.allSeries;
|
|
429
|
+
} else {
|
|
430
|
+
hit = ctx.delegate?.hitTest(x, y) ?? null;
|
|
431
|
+
}
|
|
432
|
+
} else {
|
|
433
|
+
hit = ctx.delegate?.hitTest(x, y) ?? null;
|
|
434
|
+
}
|
|
435
|
+
if (!hit) {
|
|
436
|
+
const syncBroadcast2 = buildClearHighlightBroadcast(ctx.syncInfo, lastHover);
|
|
437
|
+
return {
|
|
438
|
+
hit: null,
|
|
439
|
+
tooltip: null,
|
|
440
|
+
cursor: "default",
|
|
441
|
+
hoverUpdate: lastHover.datasetId !== null ? { datasetId: null, index: null } : null,
|
|
442
|
+
syncBroadcast: syncBroadcast2
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
const hoverChanged = lastHover.datasetId !== hit.datasetId || lastHover.index !== hit.index;
|
|
446
|
+
const cartHit = "snapX" in hit ? hit : null;
|
|
447
|
+
const hoverUpdate = hoverChanged ? { datasetId: hit.datasetId, index: hit.index, axisIdx: ctx.isSharedMode ? hit.index : null, axisX: ctx.isSharedMode ? cartHit?.snapX ?? null : null } : null;
|
|
448
|
+
let tooltip = null;
|
|
449
|
+
if (tooltipConfig) {
|
|
450
|
+
const followCursor = tooltipConfig.followCursor !== false;
|
|
451
|
+
const effectiveX = followCursor ? x : cartHit?.snapX ?? x;
|
|
452
|
+
const effectiveY = followCursor ? y : cartHit?.snapY ?? y;
|
|
453
|
+
const extHit = hit;
|
|
454
|
+
tooltip = {
|
|
455
|
+
visible: true,
|
|
456
|
+
x: ctx.dir === "rtl" ? effectiveX - 10 : effectiveX + 10,
|
|
457
|
+
y: effectiveY + 10,
|
|
458
|
+
label: hit.label,
|
|
459
|
+
value: hit.value,
|
|
460
|
+
percentage: typeof extHit["percentage"] === "number" ? extHit["percentage"] : void 0,
|
|
461
|
+
color: hit.color,
|
|
462
|
+
colorGradient: extHit["colorGradient"],
|
|
463
|
+
swatchColor: extHit["swatchColor"],
|
|
464
|
+
datasetId: hit.datasetId,
|
|
465
|
+
index: hit.index,
|
|
466
|
+
formattedValue: typeof extHit["formattedValue"] === "string" ? extHit["formattedValue"] : void 0,
|
|
467
|
+
cursorFormattedValue: typeof extHit["cursorFormattedValue"] === "string" ? extHit["cursorFormattedValue"] : void 0,
|
|
468
|
+
xValue: extHit["xValue"],
|
|
469
|
+
yValue: extHit["yValue"],
|
|
470
|
+
ohlc: extHit["ohlc"],
|
|
471
|
+
bubbleValue: typeof extHit["bubbleValue"] === "number" ? extHit["bubbleValue"] : void 0,
|
|
472
|
+
snapX: ctx.hasCrosshair ? cartHit?.snapX : void 0,
|
|
473
|
+
snapY: ctx.hasCrosshair ? cartHit?.snapY : void 0,
|
|
474
|
+
cursorX: ctx.hasCrosshair ? x : void 0,
|
|
475
|
+
cursorY: ctx.hasCrosshair ? y : void 0,
|
|
476
|
+
allSeriesHits
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
const syncBroadcast = hoverChanged ? buildHighlightBroadcast(ctx, hit, x, y) : null;
|
|
480
|
+
return { hit, allSeriesHits, tooltip, cursor: "pointer", hoverUpdate, syncBroadcast };
|
|
481
|
+
}
|
|
482
|
+
function buildHighlightBroadcast(ctx, hit, x, y) {
|
|
483
|
+
if (!ctx.syncInfo?.config.highlight) return null;
|
|
484
|
+
const hlAxis = ctx.syncInfo.config.highlight;
|
|
485
|
+
const broadcasts = [];
|
|
486
|
+
const plotArea = ctx.delegate?.getPlotArea();
|
|
487
|
+
if (ctx.isCartesian && plotArea && plotArea.width > 0) {
|
|
488
|
+
const cartHit = "snapX" in hit ? hit : null;
|
|
489
|
+
const normalizedX = cartHit?.snapX != null ? (cartHit.snapX - plotArea.x) / plotArea.width : (x - plotArea.x) / plotArea.width;
|
|
490
|
+
const normalizedY = plotArea.height > 0 ? cartHit?.snapY != null ? (cartHit.snapY - plotArea.y) / plotArea.height : (y - plotArea.y) / plotArea.height : 0;
|
|
491
|
+
const extHit = hit;
|
|
492
|
+
const catIdx = (typeof extHit["col"] === "number" ? extHit["col"] : void 0) ?? hit.index;
|
|
493
|
+
if (hlAxis === "x" || hlAxis === "xy") broadcasts.push({ axis: "x", normalized: normalizedX, categoryIndex: catIdx, sourceType: "cartesian" });
|
|
494
|
+
if (hlAxis === "y" || hlAxis === "xy") broadcasts.push({ axis: "y", normalized: normalizedY, categoryIndex: catIdx, sourceType: "cartesian" });
|
|
495
|
+
} else {
|
|
496
|
+
const extHit = hit;
|
|
497
|
+
const catIdx = (typeof extHit["col"] === "number" ? extHit["col"] : void 0) ?? hit.index;
|
|
498
|
+
const ds = ctx.datasets.get(hit.datasetId);
|
|
499
|
+
const dataLen = ds?.props?.data?.length ?? 1;
|
|
500
|
+
const estNormalized = dataLen > 1 ? catIdx / (dataLen - 1) : 0.5;
|
|
501
|
+
broadcasts.push({ axis: "x", normalized: estNormalized, categoryIndex: catIdx, sourceType: "radial" });
|
|
502
|
+
}
|
|
503
|
+
return broadcasts.length > 0 ? broadcasts : null;
|
|
504
|
+
}
|
|
505
|
+
function buildClearHighlightBroadcast(syncInfo, lastHover) {
|
|
506
|
+
if (!syncInfo?.config.highlight || lastHover.datasetId === null) return null;
|
|
507
|
+
const hlAxis = syncInfo.config.highlight;
|
|
508
|
+
const broadcasts = [];
|
|
509
|
+
if (hlAxis === "x" || hlAxis === "xy") broadcasts.push({ axis: "x", normalized: null });
|
|
510
|
+
if (hlAxis === "y" || hlAxis === "xy") broadcasts.push({ axis: "y", normalized: null });
|
|
511
|
+
return broadcasts;
|
|
512
|
+
}
|
|
513
|
+
function processMouseLeaveCore(lastHover, syncInfo, isRect) {
|
|
514
|
+
let syncBroadcast = null;
|
|
515
|
+
if (syncInfo?.config.highlight && lastHover.datasetId !== null) {
|
|
516
|
+
const hlAxis = syncInfo.config.highlight;
|
|
517
|
+
const broadcasts = [];
|
|
518
|
+
if (hlAxis === "x" || hlAxis === "xy") broadcasts.push({ axis: "x", normalized: null });
|
|
519
|
+
if (hlAxis === "y" || hlAxis === "xy") broadcasts.push({ axis: "y", normalized: null });
|
|
520
|
+
syncBroadcast = broadcasts;
|
|
521
|
+
}
|
|
522
|
+
return {
|
|
523
|
+
clearHover: lastHover.datasetId !== null,
|
|
524
|
+
clearTooltip: true,
|
|
525
|
+
cursor: "default",
|
|
526
|
+
syncBroadcast,
|
|
527
|
+
clearRectOverlay: isRect
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
function processClickCore(x, y, ctx) {
|
|
531
|
+
if (!ctx.onClickCb && !ctx.isRect && !ctx.drilldownEnabled) return { kind: "none" };
|
|
532
|
+
if (ctx.isCartesian) {
|
|
533
|
+
const hit2 = ctx.delegate?.hitTest(x, y);
|
|
534
|
+
if (!hit2) return { kind: "none" };
|
|
535
|
+
if (ctx.onClickCb) {
|
|
536
|
+
return { kind: "callback", datasetId: hit2.datasetId, index: hit2.index ?? 0, label: hit2.label ?? "", value: hit2.value ?? 0, color: hit2.color ?? "" };
|
|
537
|
+
}
|
|
538
|
+
return { kind: "toggleDataset", datasetId: hit2.datasetId };
|
|
539
|
+
}
|
|
540
|
+
if (ctx.isRect) {
|
|
541
|
+
const hit2 = ctx.delegate?.hitTest(x, y);
|
|
542
|
+
if (!hit2) return { kind: "none" };
|
|
543
|
+
const drilled2 = ctx.delegate?.handleDrilldownClick(hit2);
|
|
544
|
+
if (drilled2) return { kind: "drilldown" };
|
|
545
|
+
if (ctx.onClickCb) {
|
|
546
|
+
return { kind: "callback", datasetId: hit2.datasetId, index: hit2.index ?? 0, label: hit2.label ?? "", value: hit2.value ?? 0, color: hit2.color ?? "" };
|
|
547
|
+
}
|
|
548
|
+
return { kind: "none" };
|
|
549
|
+
}
|
|
550
|
+
const hit = ctx.delegate?.hitTest(x, y);
|
|
551
|
+
if (!hit) return { kind: "none" };
|
|
552
|
+
const drilled = ctx.delegate?.handleDrilldownClick?.(hit);
|
|
553
|
+
if (drilled) return { kind: "drilldown" };
|
|
554
|
+
if (ctx.onClickCb) {
|
|
555
|
+
return { kind: "callback", datasetId: hit.datasetId, index: hit.index ?? 0, label: hit.label ?? "", value: hit.value ?? 0, color: hit.color ?? "" };
|
|
556
|
+
}
|
|
557
|
+
return { kind: "toggleItem", datasetId: hit.datasetId, index: hit.index ?? 0 };
|
|
558
|
+
}
|
|
559
|
+
function processLegendClickCore(item, onClickCb, context) {
|
|
560
|
+
if (onClickCb) {
|
|
561
|
+
onClickCb({ datasetId: item.datasetId, index: item.index, label: item.label, type: item.type });
|
|
562
|
+
return { kind: "custom" };
|
|
563
|
+
}
|
|
564
|
+
return resolveLegendClickAction(item, context);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
export { AUTO_REPOSITIONED_LEGEND_MIN_HEIGHT, buildLayoutInputs, computeCaptionStyle, computeChartArea, computeChartState, computeColorLegendArea, computeContainerStyle, computeEffectiveLegendPosition, computeLegendArea, computeNavigatorArea, computeResetZoomTop, computeThemeDependentFields, computeTitleLayout, computeTitleStyle, detectDatasetTypes, extractFeatureConfigs, processClickCore, processLegendClickCore, processMouseLeaveCore, processMouseMoveCore, resolveReservedLegendHeight };
|