@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,167 @@
|
|
|
1
|
+
import { SvgNode, GradientStop, SvgGradientOptions, SvgElementFactory } from '@primeui/chart-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Create a virtual SVG node.
|
|
5
|
+
* All attribute values are coerced to strings; `undefined` values are skipped.
|
|
6
|
+
*/
|
|
7
|
+
declare function svgNode(tag: string, attributes?: Record<string, string | number | undefined>, children?: (SvgNode | string)[]): SvgNode;
|
|
8
|
+
/** Set an attribute on a virtual node. Returns the node for chaining. */
|
|
9
|
+
declare function setAttr(node: SvgNode, key: string, value: string | number): SvgNode;
|
|
10
|
+
/** Append one or more children to a virtual node. */
|
|
11
|
+
declare function appendChild(parent: SvgNode, ...children: (SvgNode | string)[]): SvgNode;
|
|
12
|
+
/** Prepend a child (equivalent of `parent.insertBefore(child, parent.firstChild)`). */
|
|
13
|
+
declare function prependChild(parent: SvgNode, child: SvgNode): SvgNode;
|
|
14
|
+
/** Add a CSS class to the `class` attribute. */
|
|
15
|
+
declare function addClass(node: SvgNode, cls: string): SvgNode;
|
|
16
|
+
/**
|
|
17
|
+
* Build a space-separated CSS class string from mixed truthy/falsy parts.
|
|
18
|
+
* Falsy values (`false`, `''`, `null`, `undefined`) are dropped — lets renderers
|
|
19
|
+
* conditionally include state classes without if/else churn.
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* const cls = svgClass('p-chart-bar', `p-chart-color-${idx}`, isHovered && 'p-chart-point-hover');
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare function svgClass(...parts: (string | false | null | undefined)[]): string;
|
|
26
|
+
/**
|
|
27
|
+
* Create SVG group node
|
|
28
|
+
*/
|
|
29
|
+
declare function createSvgGroup(transform?: string, attributes?: Record<string, string | number>): SvgNode;
|
|
30
|
+
/**
|
|
31
|
+
* Create SVG path node
|
|
32
|
+
*/
|
|
33
|
+
declare function createSvgPath(d: string, attributes?: Record<string, string | number>): SvgNode;
|
|
34
|
+
/**
|
|
35
|
+
* Create SVG text node
|
|
36
|
+
*/
|
|
37
|
+
declare function createSvgText(x: number, y: number, content?: string, attributes?: Record<string, string | number | undefined>): SvgNode;
|
|
38
|
+
/**
|
|
39
|
+
* Create SVG rect node
|
|
40
|
+
*/
|
|
41
|
+
declare function createSvgRect(x: number, y: number, width: number, height: number, attributes?: Record<string, string | number>): SvgNode;
|
|
42
|
+
/**
|
|
43
|
+
* Create SVG circle node
|
|
44
|
+
*/
|
|
45
|
+
declare function createSvgCircle(cx: number, cy: number, r: number, attributes?: Record<string, string | number>): SvgNode;
|
|
46
|
+
/**
|
|
47
|
+
* Create SVG line node
|
|
48
|
+
*/
|
|
49
|
+
declare function createSvgLine(x1: number, y1: number, x2: number, y2: number, attributes?: Record<string, string | number>): SvgNode;
|
|
50
|
+
/**
|
|
51
|
+
* Create SVG defs node for gradient/pattern definitions
|
|
52
|
+
*/
|
|
53
|
+
declare function createSvgDefs(): SvgNode;
|
|
54
|
+
/**
|
|
55
|
+
* Create SVG linear gradient node
|
|
56
|
+
* @param id - Unique ID for the gradient
|
|
57
|
+
* @param x1, y1 - Start point (0-1 for percentage, or absolute coords if useAbsoluteCoords)
|
|
58
|
+
* @param x2, y2 - End point (0-1 for percentage, or absolute coords if useAbsoluteCoords)
|
|
59
|
+
* @param stops - Color stops
|
|
60
|
+
* @param options - Additional options
|
|
61
|
+
*/
|
|
62
|
+
declare function createSvgLinearGradient(id: string, x1: number, y1: number, x2: number, y2: number, stops: GradientStop[], options?: SvgGradientOptions): SvgNode;
|
|
63
|
+
/**
|
|
64
|
+
* Create SVG radial gradient node
|
|
65
|
+
* @param id - Unique ID for the gradient
|
|
66
|
+
* @param cx, cy - Center point (0-1 for percentage, or absolute coords if useAbsoluteCoords)
|
|
67
|
+
* @param r - Radius (0-1 for percentage, or absolute value if useAbsoluteCoords)
|
|
68
|
+
* @param stops - Color stops
|
|
69
|
+
* @param options - Additional options
|
|
70
|
+
*/
|
|
71
|
+
declare function createSvgRadialGradient(id: string, cx: number, cy: number, r: number, stops: GradientStop[], options?: SvgGradientOptions): SvgNode;
|
|
72
|
+
/**
|
|
73
|
+
* Override how the engine creates SVG DOM elements. Inject a factory for SSR or
|
|
74
|
+
* non-DOM environments (e.g. a React/Angular/Lit adapter running in Node), or pass
|
|
75
|
+
* `null` to restore the browser default.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // SSR / Node: route creation through your DOM shim
|
|
79
|
+
* setSvgElementFactory({ createElement: (tag) => myDom.createElementNS(SVG_NS, tag) });
|
|
80
|
+
*
|
|
81
|
+
* // Reset to browser default
|
|
82
|
+
* setSvgElementFactory(null);
|
|
83
|
+
*/
|
|
84
|
+
declare function setSvgElementFactory(factory: SvgElementFactory | null): void;
|
|
85
|
+
/**
|
|
86
|
+
* Create a single SVG element through the active factory. Renderers and controllers
|
|
87
|
+
* use this instead of `document.createElementNS` so element creation has one seam.
|
|
88
|
+
*/
|
|
89
|
+
declare function createSvgElement(tag: string): SVGElement;
|
|
90
|
+
/**
|
|
91
|
+
* Recursively convert a virtual SvgNode tree into real SVG DOM elements via the
|
|
92
|
+
* active SVG element factory (browser by default).
|
|
93
|
+
*/
|
|
94
|
+
declare function materializeSvgNode(node: SvgNode): SVGElement;
|
|
95
|
+
/**
|
|
96
|
+
* Materialize and cast as SVGGElement.
|
|
97
|
+
* Safe because all top-level renderer outputs are `<g>` elements.
|
|
98
|
+
*/
|
|
99
|
+
declare function materializeSvgGroup(node: SvgNode): SVGGElement;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Execute a function with automatic canvas state save/restore.
|
|
103
|
+
* Ensures context state is properly restored even if an error occurs.
|
|
104
|
+
*
|
|
105
|
+
* @param ctx - Canvas 2D rendering context
|
|
106
|
+
* @param fn - Function to execute with saved state
|
|
107
|
+
* @returns The return value of fn
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* withCanvasState(ctx, () => {
|
|
112
|
+
* ctx.fillStyle = 'red';
|
|
113
|
+
* ctx.translate(100, 100);
|
|
114
|
+
* ctx.fillRect(0, 0, 50, 50);
|
|
115
|
+
* });
|
|
116
|
+
* // Context state is now restored to before the call
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
declare function withCanvasState<T>(ctx: CanvasRenderingContext2D, fn: () => T): T;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Read a numeric CSS variable off an element via `getComputedStyle`. The chart
|
|
123
|
+
* canvas is part of the document, so CSS variables defined on `:root`, the
|
|
124
|
+
* chart container, or inline on the canvas itself all cascade through.
|
|
125
|
+
*
|
|
126
|
+
* Lets canvas renderers consume the same `chart-style` tokens that drive SVG
|
|
127
|
+
* via class rules — so a global override like `--p-chart-bar-stroke-width: 2`
|
|
128
|
+
* affects both renderers identically.
|
|
129
|
+
*
|
|
130
|
+
* Returns `fallback` when the variable is unset, empty, or non-numeric, or
|
|
131
|
+
* when running outside a browser environment (SSR).
|
|
132
|
+
*/
|
|
133
|
+
declare function readCssNumber(el: Element | null | undefined, varName: string, fallback: number): number;
|
|
134
|
+
/**
|
|
135
|
+
* Get the current device pixel ratio, clamped to a safe maximum.
|
|
136
|
+
*/
|
|
137
|
+
declare function getDevicePixelRatio(): number;
|
|
138
|
+
/**
|
|
139
|
+
* Configure a canvas for HiDPI rendering.
|
|
140
|
+
* Sets the buffer size to (width * dpr, height * dpr), the CSS display size to (width, height),
|
|
141
|
+
* and applies ctx.setTransform so all drawing uses logical (CSS) pixel coordinates.
|
|
142
|
+
*
|
|
143
|
+
* @param canvas - The canvas element to configure
|
|
144
|
+
* @param width - Logical width in CSS pixels
|
|
145
|
+
* @param height - Logical height in CSS pixels
|
|
146
|
+
* @param overrideDpr - Optional device pixel ratio override. Defaults to window.devicePixelRatio.
|
|
147
|
+
* @returns The device pixel ratio that was applied
|
|
148
|
+
*/
|
|
149
|
+
declare function configureCanvasHiDPI(canvas: HTMLCanvasElement, width: number, height: number, overrideDpr?: number): number;
|
|
150
|
+
/**
|
|
151
|
+
* Create a linear gradient for canvas
|
|
152
|
+
*/
|
|
153
|
+
declare function createCanvasLinearGradient(ctx: CanvasRenderingContext2D, x1: number, y1: number, x2: number, y2: number, stops: Array<{
|
|
154
|
+
offset: number;
|
|
155
|
+
color: string;
|
|
156
|
+
opacity?: number;
|
|
157
|
+
}>): CanvasGradient;
|
|
158
|
+
/**
|
|
159
|
+
* Create a radial gradient for canvas
|
|
160
|
+
*/
|
|
161
|
+
declare function createCanvasRadialGradient(ctx: CanvasRenderingContext2D, cx: number, cy: number, innerRadius: number, outerRadius: number, stops: Array<{
|
|
162
|
+
offset: number;
|
|
163
|
+
color: string;
|
|
164
|
+
opacity?: number;
|
|
165
|
+
}>): CanvasGradient;
|
|
166
|
+
|
|
167
|
+
export { addClass as a, appendChild as b, configureCanvasHiDPI as c, createCanvasLinearGradient as d, createCanvasRadialGradient as e, createSvgCircle as f, createSvgDefs as g, createSvgElement as h, createSvgGroup as i, createSvgLine as j, createSvgLinearGradient as k, createSvgPath as l, createSvgRadialGradient as m, createSvgRect as n, createSvgText as o, getDevicePixelRatio as p, materializeSvgGroup as q, materializeSvgNode as r, prependChild as s, readCssNumber as t, setAttr as u, setSvgElementFactory as v, svgClass as w, svgNode as x, withCanvasState as y };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { StyledGroupBoundary, BandScale, BoxArea, FillRect, StyledRangeBoundary, SvgNode, AxisGroupDefinition, BarRenderProps, CartesianLayoutData, FeatureType, AnyFeatureProps, AxisGroupFeatureProps } from '@primeui/chart-types';
|
|
2
|
+
export { I as BASELINE_TO_CANVAS, b as barFindAllNearest, a as barFindNearest, c as barHitTest, d as buildAnimatedFrame, J as buildFrameParams, e as buildStaticFrame, f as calculateCartesianArea, g as cancelDriverRafs, h as candlestickFindAllNearest, i as candlestickHitTest, j as collectLineMarkerOverlays, k as collectScatterMarkerOverlays, l as computeCartesianLayout, m as computeCategoryBracketGeometry, n as computeCrosshairLayout, o as computeNaturalAxisWidths, K as computeRangeBracketGeometry, p as computeStackBases, L as computeWaterfallBases, q as createAnimationDriver, M as detectCartesianMode, r as driveCartesianUpdate, s as isLayoutCriticalFeature, t as lineFindAllNearest, u as lineHitTest, v as mergeAllNearestResults, w as needsAxisPadding, x as normalizeCrosshairConfig, y as registerDatasetLayers, z as renderBracketsCanvas, N as renderBracketsSvg, A as renderWithCompositor, B as resolveBarLabels, C as resolveHoverRepaintFrame, D as resolveNearestHit, E as resolvePointLabels, F as resolveScatterLabels, G as scatterHitTest, O as transformValues, H as triggerCompositorRepaint } from '../stacking-CChuAcLN.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Compute fill rectangles for category partition boundaries.
|
|
6
|
+
*
|
|
7
|
+
* @param boundaries - Styled group boundaries with optional fill config
|
|
8
|
+
* @param categoryScale - Band scale mapping categories to pixel positions
|
|
9
|
+
* @param cartesianArea - The chart plot area
|
|
10
|
+
* @param orientation - Chart orientation ('vertical' = categories on X, 'horizontal' = categories on Y)
|
|
11
|
+
*/
|
|
12
|
+
declare function computeCategoryFills(boundaries: StyledGroupBoundary[], categoryScale: BandScale, cartesianArea: BoxArea, orientation: 'horizontal' | 'vertical'): FillRect[];
|
|
13
|
+
/**
|
|
14
|
+
* Compute fill rectangles for value range boundaries.
|
|
15
|
+
*
|
|
16
|
+
* @param boundaries - Styled range boundaries with optional fill config
|
|
17
|
+
* @param valueDomain - Value axis domain [min, max]
|
|
18
|
+
* @param valueScaleRange - Value axis pixel range [start, end]
|
|
19
|
+
* @param cartesianArea - The chart plot area
|
|
20
|
+
* @param orientation - Chart orientation ('vertical' = value on Y, 'horizontal' = value on X)
|
|
21
|
+
*/
|
|
22
|
+
declare function computeRangeFills(boundaries: StyledRangeBoundary[], valueDomain: [number, number], valueScaleRange: [number, number], cartesianArea: BoxArea, orientation: 'horizontal' | 'vertical'): FillRect[];
|
|
23
|
+
/**
|
|
24
|
+
* Render fill rectangles as an SVG group element.
|
|
25
|
+
* Returns null if there are no fills.
|
|
26
|
+
*/
|
|
27
|
+
declare function renderFillsSvg(fills: FillRect[]): SvgNode | null;
|
|
28
|
+
/**
|
|
29
|
+
* Render fill rectangles onto a canvas context.
|
|
30
|
+
*/
|
|
31
|
+
declare function renderFillsCanvas(ctx: CanvasRenderingContext2D, fills: FillRect[]): void;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Build sorted categories and styled boundaries from declarative AxisGroup definitions.
|
|
35
|
+
* Used by the AxisGroup (template-driven) approach.
|
|
36
|
+
*
|
|
37
|
+
* Supports nested grouping: leaf groups (highest depth) define category ordering,
|
|
38
|
+
* parent groups (lower depth) span across their children's categories.
|
|
39
|
+
*
|
|
40
|
+
* Categories are reordered to match the group definitions (group order, then category order within each group).
|
|
41
|
+
* Categories present in data but not in any group definition are appended at the end ungrouped.
|
|
42
|
+
*/
|
|
43
|
+
declare function buildBoundariesFromAxisGroups(groups: AxisGroupDefinition[], dataCategories: string[]): {
|
|
44
|
+
sortedCategories: string[];
|
|
45
|
+
styledBoundaries: StyledGroupBoundary[];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Build styled range boundaries from AxisGroupDefinition entries that have range fields.
|
|
49
|
+
* Filters out category-based groups and resolves style shorthands.
|
|
50
|
+
*/
|
|
51
|
+
declare function buildStyledRanges(groups: AxisGroupDefinition[]): StyledRangeBoundary[];
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Resolve the actual axis ID for a dataset's value axis.
|
|
55
|
+
* When yAxisId is explicitly set (multi-axis), use it directly.
|
|
56
|
+
* When undefined (single-axis), route to the first value scale.
|
|
57
|
+
*/
|
|
58
|
+
declare function resolveValueAxisId(barProps: BarRenderProps<unknown>, layoutData: CartesianLayoutData): string;
|
|
59
|
+
/**
|
|
60
|
+
* Resolve the tickFormat function for a dataset's value axis.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveValueAxisFormat(barProps: BarRenderProps<unknown>, orientation: 'vertical' | 'horizontal', layoutData: CartesianLayoutData | null): ((v: number) => string) | null;
|
|
63
|
+
/**
|
|
64
|
+
* Format a numeric value using the dataset's value axis tickFormat function.
|
|
65
|
+
* Falls back to String(value) if no formatter is available.
|
|
66
|
+
*/
|
|
67
|
+
declare function formatHitValue(value: number, barProps: BarRenderProps<unknown>, orientation: 'vertical' | 'horizontal', layoutData: CartesianLayoutData | null): string;
|
|
68
|
+
/**
|
|
69
|
+
* Format the value at the cursor's pixel position on the value axis.
|
|
70
|
+
* Uses scale.invert() to convert pixel → data value, then formats with tickFormat.
|
|
71
|
+
*/
|
|
72
|
+
declare function formatCursorValue(cursorX: number, cursorY: number, barProps: BarRenderProps<unknown>, orientation: 'vertical' | 'horizontal', layoutData: CartesianLayoutData | null): string;
|
|
73
|
+
/**
|
|
74
|
+
* Format a raw category label as a readable date when the chart uses a time axis.
|
|
75
|
+
* Returns the original label unchanged if the chart doesn't use time axis.
|
|
76
|
+
*/
|
|
77
|
+
declare function formatTimeLabel(rawLabel: string, layoutData: CartesianLayoutData | null, locale?: string): string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Find all axis group features matching a prefix.
|
|
81
|
+
* e.g., prefix 'axisGroup:x' matches 'axisGroup:x' and 'axisGroup:x:bottom'
|
|
82
|
+
*/
|
|
83
|
+
declare function findAxisGroupFeatures(features: Map<FeatureType, {
|
|
84
|
+
type: FeatureType;
|
|
85
|
+
props: AnyFeatureProps;
|
|
86
|
+
}>, prefix: string): AxisGroupFeatureProps[];
|
|
87
|
+
/**
|
|
88
|
+
* Create an offset chart area for secondary axes.
|
|
89
|
+
* Extends the box area in the given direction by the offset amount,
|
|
90
|
+
* so that secondary axis layout calculations have the correct coordinate space.
|
|
91
|
+
*/
|
|
92
|
+
declare function createOffsetChartArea(area: BoxArea, position: string, offset: number): BoxArea;
|
|
93
|
+
|
|
94
|
+
export { buildBoundariesFromAxisGroups, buildStyledRanges, computeCategoryFills, computeRangeFills, createOffsetChartArea, findAxisGroupFeatures, formatCursorValue, formatHitValue, formatTimeLabel, renderFillsCanvas, renderFillsSvg, resolveValueAxisFormat, resolveValueAxisId };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export { buildAnimatedFrame, buildBoundariesFromAxisGroups, buildFrameParams, buildStaticFrame, buildStyledRanges, calculateCartesianArea, cancelDriverRafs, computeCartesianLayout, computeNaturalAxisWidths, createAnimationDriver, createOffsetChartArea, driveCartesianUpdate, findAxisGroupFeatures, isLayoutCriticalFeature, mergeAllNearestResults, needsAxisPadding, renderWithCompositor, resolveHoverRepaintFrame, resolveNearestHit } from '../chunk-WY4AURRE.mjs';
|
|
2
|
+
export { computeCrosshairLayout, normalizeCrosshairConfig } from '../chunk-QWQ6HY4I.mjs';
|
|
3
|
+
import '../chunk-KNDZP446.mjs';
|
|
4
|
+
export { barFindAllNearest, barFindNearest, barHitTest } from '../chunk-JGOVWSKH.mjs';
|
|
5
|
+
import '../chunk-FRST55HY.mjs';
|
|
6
|
+
import '../chunk-DN6AXQYZ.mjs';
|
|
7
|
+
import '../chunk-EAMUNLRU.mjs';
|
|
8
|
+
import '../chunk-BKP26M4K.mjs';
|
|
9
|
+
import '../chunk-B4FTADAZ.mjs';
|
|
10
|
+
import '../chunk-4C6EVJ54.mjs';
|
|
11
|
+
export { candlestickFindAllNearest, candlestickHitTest } from '../chunk-M7B3JF43.mjs';
|
|
12
|
+
import '../chunk-JO7VACY2.mjs';
|
|
13
|
+
import '../chunk-3OZLP4I4.mjs';
|
|
14
|
+
import '../chunk-CINXJIRR.mjs';
|
|
15
|
+
import '../chunk-FHTC2YDB.mjs';
|
|
16
|
+
import '../chunk-CHW4RKY3.mjs';
|
|
17
|
+
import '../chunk-SANZPAJ4.mjs';
|
|
18
|
+
import '../chunk-WFVOQ2QZ.mjs';
|
|
19
|
+
import '../chunk-MTGMXRNF.mjs';
|
|
20
|
+
import '../chunk-TQ6S34QZ.mjs';
|
|
21
|
+
import '../chunk-3Z62EUJN.mjs';
|
|
22
|
+
import '../chunk-J65DBT4R.mjs';
|
|
23
|
+
import '../chunk-3FFJEX4A.mjs';
|
|
24
|
+
import '../chunk-KQIFO5I3.mjs';
|
|
25
|
+
export { computeStackBases, computeWaterfallBases, detectCartesianMode, lineFindAllNearest, lineHitTest, transformValues } from '../chunk-WFTX4AQJ.mjs';
|
|
26
|
+
export { formatCursorValue, formatHitValue, formatTimeLabel, resolveValueAxisFormat, resolveValueAxisId } from '../chunk-DP2IZNN3.mjs';
|
|
27
|
+
import '../chunk-6HSEJLSR.mjs';
|
|
28
|
+
import '../chunk-HDFGCN2F.mjs';
|
|
29
|
+
import '../chunk-ZQFK6CAE.mjs';
|
|
30
|
+
import '../chunk-SXHVDJGF.mjs';
|
|
31
|
+
import '../chunk-WCG35U6M.mjs';
|
|
32
|
+
import '../chunk-ERVQB2VZ.mjs';
|
|
33
|
+
import '../chunk-RBLZRT5K.mjs';
|
|
34
|
+
import '../chunk-VWF57TS3.mjs';
|
|
35
|
+
import '../chunk-IXOWSEHO.mjs';
|
|
36
|
+
import '../chunk-53HW45JB.mjs';
|
|
37
|
+
import '../chunk-LVMDQ4OJ.mjs';
|
|
38
|
+
import '../chunk-TA4MVAEX.mjs';
|
|
39
|
+
import '../chunk-AGU3NG6D.mjs';
|
|
40
|
+
import '../chunk-2QRS4YQ5.mjs';
|
|
41
|
+
import '../chunk-6STOLMCA.mjs';
|
|
42
|
+
import '../chunk-AHYIS6EB.mjs';
|
|
43
|
+
export { scatterHitTest } from '../chunk-LKC7MZKK.mjs';
|
|
44
|
+
export { collectLineMarkerOverlays, collectScatterMarkerOverlays } from '../chunk-X4D7FKUS.mjs';
|
|
45
|
+
export { registerDatasetLayers, triggerCompositorRepaint } from '../chunk-Q6PPVIHU.mjs';
|
|
46
|
+
export { BASELINE_TO_CANVAS, resolveBarLabels, resolvePointLabels, resolveScatterLabels } from '../chunk-66T4MRC5.mjs';
|
|
47
|
+
export { computeCategoryBracketGeometry, computeCategoryFills, computeRangeBracketGeometry, computeRangeFills, renderBracketsCanvas, renderBracketsSvg, renderFillsCanvas, renderFillsSvg } from '../chunk-QQBXUDM4.mjs';
|
|
48
|
+
import '../chunk-7QQ6ETB4.mjs';
|
|
49
|
+
import '../chunk-X7T34OLW.mjs';
|
|
50
|
+
import '../chunk-SALTGZFR.mjs';
|
|
51
|
+
import '../chunk-AUF4CHDP.mjs';
|
|
52
|
+
import '../chunk-ZTL2FQEW.mjs';
|
|
53
|
+
import '../chunk-VN7CKCSE.mjs';
|
|
54
|
+
import '../chunk-AP3UYWYT.mjs';
|
|
55
|
+
import '../chunk-DTWTCFRG.mjs';
|
|
56
|
+
import '../chunk-PRDVPOZX.mjs';
|
|
57
|
+
import '../chunk-VGLSBZDN.mjs';
|
|
58
|
+
import '../chunk-XIHBK5D3.mjs';
|
|
59
|
+
import '../chunk-55Y3WI6S.mjs';
|
|
60
|
+
import '../chunk-RO4N6YFS.mjs';
|
|
61
|
+
import '../chunk-VVI3OBPJ.mjs';
|
|
62
|
+
import '../chunk-ZT2Z7ERM.mjs';
|
|
63
|
+
import '../chunk-KP2TWD4Z.mjs';
|
|
64
|
+
import '../chunk-3WEMHXZI.mjs';
|
|
65
|
+
import '../chunk-KVDEROP6.mjs';
|
|
66
|
+
import '../chunk-YBJ56XJS.mjs';
|
|
67
|
+
import '../chunk-NPDZLYIF.mjs';
|
|
68
|
+
import '../chunk-EDAKJLNA.mjs';
|
|
69
|
+
import '../chunk-JWFBOPM6.mjs';
|
|
70
|
+
import '../chunk-5JCI2DEB.mjs';
|
|
71
|
+
import '../chunk-BZN2QHGP.mjs';
|
|
72
|
+
import '../chunk-OGJ6IIBW.mjs';
|
|
73
|
+
import '../chunk-ARRGOEFX.mjs';
|
|
74
|
+
import '../chunk-22ST6YPP.mjs';
|
|
75
|
+
import '../chunk-FFMT6OCO.mjs';
|
|
76
|
+
import '../chunk-7CMVDIOU.mjs';
|
|
77
|
+
import '../chunk-ADKLH73T.mjs';
|
|
78
|
+
import '../chunk-OXTFAWSK.mjs';
|
|
79
|
+
import '../chunk-R6Y3R7EW.mjs';
|
|
80
|
+
import '../chunk-XTVE4P3L.mjs';
|
|
81
|
+
import '../chunk-NKUYIWAP.mjs';
|
|
82
|
+
import '../chunk-XQQCGFYB.mjs';
|
|
83
|
+
import '../chunk-WH3C3Y7P.mjs';
|
|
84
|
+
import '../chunk-OWW3K55O.mjs';
|
|
85
|
+
import '../chunk-WA3OVISZ.mjs';
|
|
86
|
+
import '../chunk-C36VWQ7A.mjs';
|
|
87
|
+
import '../chunk-BETFQBM2.mjs';
|
|
88
|
+
import '../chunk-WRULPWHD.mjs';
|
|
89
|
+
import '../chunk-QS76E3TD.mjs';
|
|
90
|
+
import '../chunk-O2X6FF45.mjs';
|
|
91
|
+
import '../chunk-IEGLX7VL.mjs';
|
|
92
|
+
import '../chunk-SSLTFJ3U.mjs';
|
|
93
|
+
import '../chunk-RQ3CKQOX.mjs';
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { DEFAULT_LABEL_SPACING } from './chunk-NKUYIWAP.mjs';
|
|
2
|
+
import { batchResolveAccessor } from './chunk-O2X6FF45.mjs';
|
|
3
|
+
import { TICK_INTERVALS, intervalSpanMs, toTimestamp, floorToUnit, calculateNiceDomain, generateNiceTicks } from './chunk-RQ3CKQOX.mjs';
|
|
4
|
+
|
|
5
|
+
// src/utils/data/time/grouping.ts
|
|
6
|
+
function buildOrdinalTimeMapping(timestamps) {
|
|
7
|
+
const sorted = [...new Set(timestamps)].sort((a, b) => a - b);
|
|
8
|
+
const indexOf = (ts) => {
|
|
9
|
+
let lo = 0;
|
|
10
|
+
let hi = sorted.length - 1;
|
|
11
|
+
while (lo <= hi) {
|
|
12
|
+
const mid = lo + hi >> 1;
|
|
13
|
+
if (sorted[mid] === ts) return mid;
|
|
14
|
+
if (sorted[mid] < ts) lo = mid + 1;
|
|
15
|
+
else hi = mid - 1;
|
|
16
|
+
}
|
|
17
|
+
if (lo >= sorted.length) return sorted.length - 1;
|
|
18
|
+
if (hi < 0) return 0;
|
|
19
|
+
return Math.abs(sorted[lo] - ts) < Math.abs(sorted[hi] - ts) ? lo : hi;
|
|
20
|
+
};
|
|
21
|
+
const timestampAt = (index) => {
|
|
22
|
+
return sorted[Math.max(0, Math.min(index, sorted.length - 1))];
|
|
23
|
+
};
|
|
24
|
+
return { sortedTimestamps: sorted, indexOf, timestampAt };
|
|
25
|
+
}
|
|
26
|
+
function selectGroupingInterval(domainSpanMs, dataLength, targetPoints) {
|
|
27
|
+
for (const interval of TICK_INTERVALS) {
|
|
28
|
+
const bucketCount = domainSpanMs / intervalSpanMs(interval);
|
|
29
|
+
if (bucketCount <= targetPoints) return interval;
|
|
30
|
+
}
|
|
31
|
+
return TICK_INTERVALS[TICK_INTERVALS.length - 1];
|
|
32
|
+
}
|
|
33
|
+
function groupTimeData(data, categoryAccessor, valueAccessor, interval, method) {
|
|
34
|
+
if (data.length === 0) return [];
|
|
35
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
36
|
+
for (const item of data) {
|
|
37
|
+
const ts = toTimestamp(item[categoryAccessor]);
|
|
38
|
+
if (isNaN(ts)) continue;
|
|
39
|
+
const bucketKey = floorToUnit(ts, interval.unit, interval.count);
|
|
40
|
+
let bucket = buckets.get(bucketKey);
|
|
41
|
+
if (!bucket) {
|
|
42
|
+
bucket = { timestamp: bucketKey, values: [], firstItem: item };
|
|
43
|
+
buckets.set(bucketKey, bucket);
|
|
44
|
+
}
|
|
45
|
+
const val = Number(item[valueAccessor]);
|
|
46
|
+
if (!isNaN(val)) {
|
|
47
|
+
bucket.values.push(val);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const result = [];
|
|
51
|
+
for (const [, bucket] of buckets) {
|
|
52
|
+
const aggregated = aggregate(bucket.values, method);
|
|
53
|
+
result.push({
|
|
54
|
+
...bucket.firstItem,
|
|
55
|
+
[categoryAccessor]: new Date(bucket.timestamp),
|
|
56
|
+
[valueAccessor]: aggregated
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
result.sort((a, b) => toTimestamp(a[categoryAccessor]) - toTimestamp(b[categoryAccessor]));
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
function aggregate(values, method) {
|
|
63
|
+
if (values.length === 0) return 0;
|
|
64
|
+
switch (method) {
|
|
65
|
+
case "sum":
|
|
66
|
+
return values.reduce((a, b) => a + b, 0);
|
|
67
|
+
case "min":
|
|
68
|
+
return Math.min(...values);
|
|
69
|
+
case "max":
|
|
70
|
+
return Math.max(...values);
|
|
71
|
+
case "first":
|
|
72
|
+
return values[0];
|
|
73
|
+
case "last":
|
|
74
|
+
return values[values.length - 1];
|
|
75
|
+
case "ohlc":
|
|
76
|
+
return values[values.length - 1];
|
|
77
|
+
case "average":
|
|
78
|
+
default:
|
|
79
|
+
return values.reduce((a, b) => a + b, 0) / values.length;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/utils/data/domain.utils.ts
|
|
84
|
+
function mergeDomainContributions(baseDomains, contributions) {
|
|
85
|
+
const mergedCategoryDomains = /* @__PURE__ */ new Map();
|
|
86
|
+
const includeZeroAxes = /* @__PURE__ */ new Set();
|
|
87
|
+
for (const c of contributions) {
|
|
88
|
+
if (c.includeZeroAxes) {
|
|
89
|
+
for (const axisId of c.includeZeroAxes) includeZeroAxes.add(axisId);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const c of contributions) {
|
|
93
|
+
for (const [axisId, domain] of c.valueDomains) {
|
|
94
|
+
const existing = baseDomains.get(axisId);
|
|
95
|
+
const includeZero = includeZeroAxes.has(axisId);
|
|
96
|
+
if (existing) {
|
|
97
|
+
const newMin = Math.min(existing[0], domain[0]);
|
|
98
|
+
const newMax = Math.max(existing[1], domain[1]);
|
|
99
|
+
baseDomains.set(axisId, calculateNiceDomain([newMin, newMax], { includeZero }));
|
|
100
|
+
} else {
|
|
101
|
+
baseDomains.set(axisId, [domain[0], domain[1]]);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (const c of contributions) {
|
|
106
|
+
if (!c.categoryDomains) continue;
|
|
107
|
+
for (const [axisId, domain] of c.categoryDomains) {
|
|
108
|
+
const existing = mergedCategoryDomains.get(axisId);
|
|
109
|
+
if (existing) {
|
|
110
|
+
mergedCategoryDomains.set(axisId, calculateNiceDomain([Math.min(existing[0], domain[0]), Math.max(existing[1], domain[1])], { includeZero: false }));
|
|
111
|
+
} else {
|
|
112
|
+
mergedCategoryDomains.set(axisId, [domain[0], domain[1]]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return mergedCategoryDomains;
|
|
117
|
+
}
|
|
118
|
+
function computeCartesianDomain(params) {
|
|
119
|
+
const { valuesPerDataset, visibleMask, categoryCount, mode, waterfallBases, tickCount = 5, exactTickCount = false, includeZero = true } = params;
|
|
120
|
+
const hasVisible = visibleMask.some(Boolean);
|
|
121
|
+
if (!hasVisible) {
|
|
122
|
+
return [0, 1];
|
|
123
|
+
}
|
|
124
|
+
let valueDomain;
|
|
125
|
+
if (mode.isPercentStacked) {
|
|
126
|
+
valueDomain = [0, 100];
|
|
127
|
+
} else if (mode.isWaterfall) {
|
|
128
|
+
const endpoints = [0];
|
|
129
|
+
for (let i = 0; i < categoryCount; i++) {
|
|
130
|
+
const base = waterfallBases[i];
|
|
131
|
+
let catSum = 0;
|
|
132
|
+
for (const vals of valuesPerDataset) {
|
|
133
|
+
catSum += vals[i];
|
|
134
|
+
}
|
|
135
|
+
endpoints.push(base, base + catSum);
|
|
136
|
+
}
|
|
137
|
+
valueDomain = calculateNiceDomain(endpoints, { includeZero });
|
|
138
|
+
} else if (mode.isStacked) {
|
|
139
|
+
const endpoints = [0];
|
|
140
|
+
for (let catIdx = 0; catIdx < categoryCount; catIdx++) {
|
|
141
|
+
let posSum = 0;
|
|
142
|
+
let negSum = 0;
|
|
143
|
+
for (const values of valuesPerDataset) {
|
|
144
|
+
const v = values[catIdx] ?? 0;
|
|
145
|
+
if (v >= 0) posSum += v;
|
|
146
|
+
else negSum += v;
|
|
147
|
+
}
|
|
148
|
+
endpoints.push(posSum, negSum);
|
|
149
|
+
}
|
|
150
|
+
valueDomain = calculateNiceDomain(endpoints, { includeZero });
|
|
151
|
+
} else {
|
|
152
|
+
const visibleValues = valuesPerDataset.filter((_, i) => visibleMask[i]).flat();
|
|
153
|
+
valueDomain = calculateNiceDomain(visibleValues, { includeZero });
|
|
154
|
+
}
|
|
155
|
+
if (!mode.isPercentStacked) {
|
|
156
|
+
const ticks = generateNiceTicks(valueDomain[0], valueDomain[1], tickCount, exactTickCount);
|
|
157
|
+
if (ticks.length > 0) {
|
|
158
|
+
valueDomain = [Math.min(valueDomain[0], ticks[0]), Math.max(valueDomain[1], ticks[ticks.length - 1])];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return valueDomain;
|
|
162
|
+
}
|
|
163
|
+
function expandDomainWithValues(valueDomains, axisId, values, includeZero) {
|
|
164
|
+
if (values.length === 0) return;
|
|
165
|
+
const existing = valueDomains.get(axisId);
|
|
166
|
+
if (existing) {
|
|
167
|
+
const newMin = Math.min(existing[0], ...values);
|
|
168
|
+
const newMax = Math.max(existing[1], ...values);
|
|
169
|
+
valueDomains.set(axisId, calculateNiceDomain([newMin, newMax], { includeZero }));
|
|
170
|
+
} else {
|
|
171
|
+
valueDomains.set(axisId, calculateNiceDomain(values, { includeZero }));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
function resolveIncludeZero(targetAxisId, valueAxes, barAxisIds) {
|
|
175
|
+
const targetAxisConfig = valueAxes.get(targetAxisId);
|
|
176
|
+
const explicitStartFromZero = targetAxisConfig?.props?.startFromZero;
|
|
177
|
+
return explicitStartFromZero ?? barAxisIds.has(targetAxisId);
|
|
178
|
+
}
|
|
179
|
+
function computeDomainContribution(valueSeries, categorySeries) {
|
|
180
|
+
const valueRaw = /* @__PURE__ */ new Map();
|
|
181
|
+
const includeZeroAxes = /* @__PURE__ */ new Set();
|
|
182
|
+
for (const s of valueSeries) {
|
|
183
|
+
if (s.values.length === 0) continue;
|
|
184
|
+
if (s.includeZero) includeZeroAxes.add(s.axisId);
|
|
185
|
+
const sMin = Math.min(...s.values);
|
|
186
|
+
const sMax = Math.max(...s.values);
|
|
187
|
+
const existing = valueRaw.get(s.axisId);
|
|
188
|
+
if (existing) {
|
|
189
|
+
existing.min = Math.min(existing.min, sMin);
|
|
190
|
+
existing.max = Math.max(existing.max, sMax);
|
|
191
|
+
if (s.includeZero) existing.includeZero = true;
|
|
192
|
+
} else {
|
|
193
|
+
valueRaw.set(s.axisId, { min: sMin, max: sMax, includeZero: s.includeZero });
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const valueDomains = /* @__PURE__ */ new Map();
|
|
197
|
+
for (const [axisId, raw] of valueRaw) {
|
|
198
|
+
valueDomains.set(axisId, calculateNiceDomain([raw.min, raw.max], { includeZero: raw.includeZero }));
|
|
199
|
+
}
|
|
200
|
+
let categoryDomains;
|
|
201
|
+
if (categorySeries && categorySeries.length > 0) {
|
|
202
|
+
const categoryRaw = /* @__PURE__ */ new Map();
|
|
203
|
+
for (const s of categorySeries) {
|
|
204
|
+
if (s.values.length === 0) continue;
|
|
205
|
+
const sMin = Math.min(...s.values);
|
|
206
|
+
const sMax = Math.max(...s.values);
|
|
207
|
+
const existing = categoryRaw.get(s.axisId);
|
|
208
|
+
if (existing) {
|
|
209
|
+
existing.min = Math.min(existing.min, sMin);
|
|
210
|
+
existing.max = Math.max(existing.max, sMax);
|
|
211
|
+
} else {
|
|
212
|
+
categoryRaw.set(s.axisId, { min: sMin, max: sMax, includeZero: s.includeZero });
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
categoryDomains = /* @__PURE__ */ new Map();
|
|
216
|
+
for (const [axisId, raw] of categoryRaw) {
|
|
217
|
+
categoryDomains.set(axisId, calculateNiceDomain([raw.min, raw.max], { includeZero: raw.includeZero }));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
valueDomains,
|
|
222
|
+
includeZeroAxes: includeZeroAxes.size > 0 ? includeZeroAxes : void 0,
|
|
223
|
+
categoryDomains: categoryDomains?.size ? categoryDomains : void 0
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function computeVisibleValues(series, xMin, xMax) {
|
|
227
|
+
const result = /* @__PURE__ */ new Map();
|
|
228
|
+
for (const s of series) {
|
|
229
|
+
const vals = result.get(s.axisId) ?? [];
|
|
230
|
+
for (let i = 0; i < s.xValues.length; i++) {
|
|
231
|
+
if (s.xValues[i] >= xMin && s.xValues[i] <= xMax && !isNaN(s.yValues[i])) {
|
|
232
|
+
vals.push(s.yValues[i]);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (vals.length > 0) result.set(s.axisId, vals);
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
function expandScatterBubblePadding(params) {
|
|
240
|
+
const { scatterDatasets, valueDomains, scatterXDomains, firstValueAxisId, firstCategoryAxisId, chartArea, isLogValueAxis, isLogCategoryAxis } = params;
|
|
241
|
+
const expandLog = ([lo, hi], r, axisLen) => {
|
|
242
|
+
if (lo <= 0 || hi <= 0 || axisLen <= 0 || axisLen <= 2 * r) return [lo, hi];
|
|
243
|
+
const logSpan = Math.log10(hi) - Math.log10(lo);
|
|
244
|
+
const logPad = r * logSpan / (axisLen - 2 * r);
|
|
245
|
+
return [Math.pow(10, Math.log10(lo) - logPad), Math.pow(10, Math.log10(hi) + logPad)];
|
|
246
|
+
};
|
|
247
|
+
const maxRadiusByXAxis = /* @__PURE__ */ new Map();
|
|
248
|
+
const maxRadiusByYAxis = /* @__PURE__ */ new Map();
|
|
249
|
+
for (const sd of scatterDatasets) {
|
|
250
|
+
if (!sd.visible) continue;
|
|
251
|
+
let maxRadius = typeof sd.props.markerSize === "number" ? sd.props.markerSize : Array.isArray(sd.props.markerSize) ? Math.max(...sd.props.markerSize.filter((v) => typeof v === "number")) : 6;
|
|
252
|
+
if (sd.props.sizeField) {
|
|
253
|
+
const sizeValues = batchResolveAccessor(sd.props.sizeField, sd.props.data ?? []).filter((v) => v != null && !isNaN(v));
|
|
254
|
+
if (sizeValues.length > 0) {
|
|
255
|
+
maxRadius = sd.props.maxSize ?? 40;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
const targetXAxisId = sd.props.xAxisId ?? firstCategoryAxisId;
|
|
259
|
+
const targetYAxisId = sd.props.yAxisId ?? firstValueAxisId;
|
|
260
|
+
maxRadiusByXAxis.set(targetXAxisId, Math.max(maxRadiusByXAxis.get(targetXAxisId) ?? 0, maxRadius));
|
|
261
|
+
maxRadiusByYAxis.set(targetYAxisId, Math.max(maxRadiusByYAxis.get(targetYAxisId) ?? 0, maxRadius));
|
|
262
|
+
}
|
|
263
|
+
for (const [axisId, r] of maxRadiusByXAxis) {
|
|
264
|
+
const xDomain = scatterXDomains.get(axisId);
|
|
265
|
+
if (!xDomain || chartArea.width <= 0) continue;
|
|
266
|
+
if (isLogCategoryAxis?.(axisId)) {
|
|
267
|
+
scatterXDomains.set(axisId, expandLog(xDomain, r, chartArea.width));
|
|
268
|
+
} else if (chartArea.width > 2 * r) {
|
|
269
|
+
const xRange = xDomain[1] - xDomain[0];
|
|
270
|
+
const xPadding = r * xRange / (chartArea.width - 2 * r);
|
|
271
|
+
scatterXDomains.set(axisId, [xDomain[0] - xPadding, xDomain[1] + xPadding]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
for (const [axisId, r] of maxRadiusByYAxis) {
|
|
275
|
+
const yDomain = valueDomains.get(axisId);
|
|
276
|
+
if (!yDomain || chartArea.height <= 0) continue;
|
|
277
|
+
if (isLogValueAxis?.(axisId)) {
|
|
278
|
+
valueDomains.set(axisId, expandLog(yDomain, r, chartArea.height));
|
|
279
|
+
} else if (chartArea.height > 2 * r) {
|
|
280
|
+
const yRange = yDomain[1] - yDomain[0];
|
|
281
|
+
const yPadding = r * yRange / (chartArea.height - 2 * r);
|
|
282
|
+
valueDomains.set(axisId, [yDomain[0] - yPadding, yDomain[1] + yPadding]);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function expandDataLabelPadding(params) {
|
|
287
|
+
const { valueDomains, dataLabelFontSize, orientation, chartArea, axisIds, isLogAxis, isPercentStackedAxis } = params;
|
|
288
|
+
const labelPx = dataLabelFontSize + DEFAULT_LABEL_SPACING;
|
|
289
|
+
const axisLen = orientation === "vertical" ? chartArea.height : chartArea.width;
|
|
290
|
+
if (axisLen <= labelPx) return;
|
|
291
|
+
for (const axisId of axisIds) {
|
|
292
|
+
if (isLogAxis?.(axisId) || isPercentStackedAxis?.(axisId)) continue;
|
|
293
|
+
const domain = valueDomains.get(axisId);
|
|
294
|
+
if (!domain) continue;
|
|
295
|
+
const [lo, hi] = domain;
|
|
296
|
+
const span = hi - lo;
|
|
297
|
+
if (span <= 0) continue;
|
|
298
|
+
const dataPad = labelPx * span / axisLen;
|
|
299
|
+
domain[1] = hi + dataPad;
|
|
300
|
+
if (lo < 0) domain[0] = lo - dataPad;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
export { buildOrdinalTimeMapping, computeCartesianDomain, computeDomainContribution, computeVisibleValues, expandDataLabelPadding, expandDomainWithValues, expandScatterBubblePadding, groupTimeData, mergeDomainContributions, resolveIncludeZero, selectGroupingInterval };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { definePlugin } from '@primeui/core';
|
|
2
|
+
|
|
3
|
+
// src/plugins/defineChartPlugin.ts
|
|
4
|
+
function defineChartPlugin(name, install, opts) {
|
|
5
|
+
const plugin = definePlugin(name, (ctx) => install(ctx));
|
|
6
|
+
if (opts) plugin.chartPluginOptions = opts;
|
|
7
|
+
return plugin;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { defineChartPlugin };
|