@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,403 @@
|
|
|
1
|
+
import { calculatePolarLayout, hitTestPolar } from './chunk-WCG35U6M.mjs';
|
|
2
|
+
import { resolvePolarLabels } from './chunk-UPRXABX5.mjs';
|
|
3
|
+
import { resolveSharedRadialGrid } from './chunk-TA4MVAEX.mjs';
|
|
4
|
+
import { renderResolvedLabels } from './chunk-QQBXUDM4.mjs';
|
|
5
|
+
import { AnimatedScene, resolveAnimatedProps, POLAR_ANIMATABLE_PROPS } from './chunk-VN7CKCSE.mjs';
|
|
6
|
+
import { reconcileSvgChildren } from './chunk-KP2TWD4Z.mjs';
|
|
7
|
+
import { parseAnimationConfig } from './chunk-3WEMHXZI.mjs';
|
|
8
|
+
import { cancelRaf, raf } from './chunk-EDAKJLNA.mjs';
|
|
9
|
+
import { buildAccessibilityRenderContext, generateSeriesDescription } from './chunk-OGJ6IIBW.mjs';
|
|
10
|
+
import { collectItems } from './chunk-FFMT6OCO.mjs';
|
|
11
|
+
import { DEFAULT_HOVER_DIM_OPACITY, DEFAULT_HOVER_BRIGHTNESS } from './chunk-NKUYIWAP.mjs';
|
|
12
|
+
import { interpolateRadialGrid } from './chunk-WH3C3Y7P.mjs';
|
|
13
|
+
import { defaultLightTheme, resolveSwatchColor, getDefaultColor } from './chunk-O2X6FF45.mjs';
|
|
14
|
+
import { setAttr, createSvgGroup, materializeSvgNode } from './chunk-SSLTFJ3U.mjs';
|
|
15
|
+
|
|
16
|
+
// src/series/polar/controller/index.ts
|
|
17
|
+
var POLAR_BAR_REGISTRY = {
|
|
18
|
+
number: ["innerRadius", "outerRadius", "startAngle", "endAngle"],
|
|
19
|
+
color: []
|
|
20
|
+
};
|
|
21
|
+
function polarBarKey(b) {
|
|
22
|
+
return b.dataKey != null ? `${b.datasetId}:key:${b.dataKey}` : `${b.datasetId}:cat:${b.category}`;
|
|
23
|
+
}
|
|
24
|
+
var PolarRendererController = class {
|
|
25
|
+
constructor(paint) {
|
|
26
|
+
this._animRafId = null;
|
|
27
|
+
this._lastFingerprint = "";
|
|
28
|
+
/**
|
|
29
|
+
* Per-dataset property-animation overrides resolved from AnimatedPropertyStore.
|
|
30
|
+
* Set by `applyPropertyAnimations()` each property-animation tick and merged
|
|
31
|
+
* into each bar's rendered fields at scene-build time. Cleared by `destroy()`.
|
|
32
|
+
*
|
|
33
|
+
* Polar's animatable props (innerRadius, outerRadius, startAngle, endAngle,
|
|
34
|
+
* spacing, opacity, borderStrokeWidth, valueRadius) all sit on PolarBarData,
|
|
35
|
+
* so the merge is a shallow spread on each bar belonging to the dataset.
|
|
36
|
+
*/
|
|
37
|
+
this._propertyOverrides = /* @__PURE__ */ new Map();
|
|
38
|
+
// Grid lerp (radial axis rings + tick labels). Separate from the bar scene
|
|
39
|
+
// because it's a layout-level lerp on `domain`, not per-element.
|
|
40
|
+
this._gridLerp = null;
|
|
41
|
+
// Last settled domain — start point for the next grid lerp.
|
|
42
|
+
this._lastSettledDomain = null;
|
|
43
|
+
// Target layout (computed each update; reference data for renders).
|
|
44
|
+
this._layout = null;
|
|
45
|
+
// Last frame's rendered layout (reused by hover, hit-testing, grid consumers).
|
|
46
|
+
this.lastRenderedLayout = null;
|
|
47
|
+
this.hoverState = { datasetId: null, index: null };
|
|
48
|
+
this.effectConfig = { hoverBrightness: 1, dimOpacity: 1 };
|
|
49
|
+
this.lastInput = null;
|
|
50
|
+
this.svgGroup = null;
|
|
51
|
+
this._hasPolarDatasets = false;
|
|
52
|
+
this.onFrame = null;
|
|
53
|
+
this._paint = paint;
|
|
54
|
+
this._scene = new AnimatedScene({
|
|
55
|
+
// ENTER: bar grows from its inner radius (zero radial height) at its final angles.
|
|
56
|
+
// Matches old createPolarEntranceLayout: outerRadius = innerRadius.
|
|
57
|
+
emptyState: (target) => ({ ...target, outerRadius: target.innerRadius }),
|
|
58
|
+
// EXIT: bar shrinks back to inner radius. Matches the exiting-bar branch of
|
|
59
|
+
// interpolatePolarLayout where outerRadius collapsed to innerRadius.
|
|
60
|
+
exitEmptyState: (target) => ({ ...target, outerRadius: target.innerRadius }),
|
|
61
|
+
registry: POLAR_BAR_REGISTRY
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
// ================================================================
|
|
65
|
+
// PUBLIC API
|
|
66
|
+
// ================================================================
|
|
67
|
+
update(input) {
|
|
68
|
+
this.lastInput = input;
|
|
69
|
+
this.svgGroup = input.svgGroup ?? null;
|
|
70
|
+
const { datasets, datasetVisibility, chartArea, features, globalFont, sharedContext, yAxes } = input;
|
|
71
|
+
this._hasPolarDatasets = Array.from(datasets.values()).some((ds) => ds.type === "polar");
|
|
72
|
+
if (!this._hasPolarDatasets) {
|
|
73
|
+
this._layout = null;
|
|
74
|
+
this.lastRenderedLayout = null;
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const sortedDatasets = Array.from(datasets.entries()).sort(([, a], [, b]) => a.order - b.order);
|
|
78
|
+
const polarEntries = collectItems(sortedDatasets, datasetVisibility).polar;
|
|
79
|
+
if (polarEntries.length === 0) {
|
|
80
|
+
this._layout = null;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const anyVisible = polarEntries.some((e) => e.visible);
|
|
84
|
+
if (!anyVisible) {
|
|
85
|
+
const liveCount = this._scene.getElements().length;
|
|
86
|
+
if (liveCount === 0) {
|
|
87
|
+
this._layout = null;
|
|
88
|
+
this.lastRenderedLayout = null;
|
|
89
|
+
if (this._animRafId !== null) {
|
|
90
|
+
cancelRaf(this._animRafId);
|
|
91
|
+
this._animRafId = null;
|
|
92
|
+
}
|
|
93
|
+
this._gridLerp = null;
|
|
94
|
+
this._lastFingerprint = "|EMPTY";
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const animConfig2 = features.get("animation")?.props;
|
|
98
|
+
const { enabled: animEnabled2, duration: duration2, easing: easing2 } = parseAnimationConfig(animConfig2);
|
|
99
|
+
const shouldAnimate2 = animEnabled2 && duration2 > 0;
|
|
100
|
+
const fingerprint2 = "|EMPTY";
|
|
101
|
+
const dataChanged2 = fingerprint2 !== this._lastFingerprint;
|
|
102
|
+
if (!dataChanged2 && this._animRafId !== null) return;
|
|
103
|
+
if (!dataChanged2) return;
|
|
104
|
+
this._lastFingerprint = fingerprint2;
|
|
105
|
+
if (this._animRafId !== null) {
|
|
106
|
+
cancelRaf(this._animRafId);
|
|
107
|
+
this._animRafId = null;
|
|
108
|
+
}
|
|
109
|
+
const opts2 = { numbers: { duration: shouldAnimate2 ? duration2 : 0, easing: easing2 } };
|
|
110
|
+
this._scene.diff(/* @__PURE__ */ new Map(), opts2);
|
|
111
|
+
this._gridLerp = null;
|
|
112
|
+
if (shouldAnimate2) {
|
|
113
|
+
this._renderSceneFrame();
|
|
114
|
+
this._startAnimLoop();
|
|
115
|
+
} else {
|
|
116
|
+
this._scene.tick(performance.now());
|
|
117
|
+
if (this._scene.getElements().length === 0) {
|
|
118
|
+
this._layout = null;
|
|
119
|
+
}
|
|
120
|
+
this._renderSceneFrame();
|
|
121
|
+
}
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const isStacked = polarEntries.some((e) => e.props.stackId !== void 0);
|
|
125
|
+
const stackingFeature = features.get("stacking")?.props;
|
|
126
|
+
let stackConfig;
|
|
127
|
+
if (isStacked) {
|
|
128
|
+
stackConfig = { mode: stackingFeature?.mode === "percent" ? "percent" : "normal" };
|
|
129
|
+
}
|
|
130
|
+
const targetLayout = {
|
|
131
|
+
...calculatePolarLayout(polarEntries, chartArea, stackConfig, globalFont, sharedContext?.categories, sharedContext?.domain),
|
|
132
|
+
datasetIndex: 0
|
|
133
|
+
};
|
|
134
|
+
this._layout = targetLayout;
|
|
135
|
+
const animConfig = features.get("animation")?.props;
|
|
136
|
+
const { enabled: animEnabled, duration, easing } = parseAnimationConfig(animConfig);
|
|
137
|
+
const fingerprint = targetLayout.bars.map((b) => `${polarBarKey(b)}:${b.value}:${Math.round(b.outerRadius)}:${Math.round(b.startAngle)}`).join("|") + `|dom:${targetLayout.domain[0]},${targetLayout.domain[1]}`;
|
|
138
|
+
const dataChanged = fingerprint !== this._lastFingerprint;
|
|
139
|
+
const shouldAnimate = animEnabled && duration > 0 && dataChanged;
|
|
140
|
+
if (!dataChanged) return;
|
|
141
|
+
const sceneTargets = /* @__PURE__ */ new Map();
|
|
142
|
+
for (const b of targetLayout.bars) {
|
|
143
|
+
sceneTargets.set(polarBarKey(b), b);
|
|
144
|
+
}
|
|
145
|
+
if (this._animRafId !== null) {
|
|
146
|
+
cancelRaf(this._animRafId);
|
|
147
|
+
this._animRafId = null;
|
|
148
|
+
}
|
|
149
|
+
const opts = { numbers: { duration: shouldAnimate ? duration : 0, easing } };
|
|
150
|
+
this._scene.diff(sceneTargets, opts);
|
|
151
|
+
this._lastFingerprint = fingerprint;
|
|
152
|
+
const tickCount = yAxes ? Array.from(yAxes.values())[0]?.props?.tickCount : void 0;
|
|
153
|
+
const resolved = resolveSharedRadialGrid(targetLayout.grid, targetLayout.domain, targetLayout.rawDataMax, targetLayout.maxRadius, tickCount);
|
|
154
|
+
const targetDomain = resolved.domain;
|
|
155
|
+
const prevSettled = this._lastSettledDomain;
|
|
156
|
+
const domainChanged = !prevSettled || prevSettled[0] !== targetDomain[0] || prevSettled[1] !== targetDomain[1];
|
|
157
|
+
if (shouldAnimate && domainChanged && prevSettled) {
|
|
158
|
+
const fromDomain = this._gridLerp ? this._currentGridDomain() : prevSettled;
|
|
159
|
+
this._gridLerp = {
|
|
160
|
+
fromDomain,
|
|
161
|
+
toDomain: targetDomain,
|
|
162
|
+
targetGrid: { ...targetLayout.grid, levels: resolved.levelValues.length, levelValues: resolved.levelValues, levelRadii: resolved.levelRadii },
|
|
163
|
+
targetRadius: targetLayout.maxRadius,
|
|
164
|
+
startTime: -1,
|
|
165
|
+
duration,
|
|
166
|
+
easing
|
|
167
|
+
};
|
|
168
|
+
} else {
|
|
169
|
+
this._gridLerp = null;
|
|
170
|
+
this._lastSettledDomain = targetDomain;
|
|
171
|
+
}
|
|
172
|
+
if (shouldAnimate) {
|
|
173
|
+
this._renderSceneFrame();
|
|
174
|
+
this._startAnimLoop();
|
|
175
|
+
} else {
|
|
176
|
+
this._scene.tick(performance.now());
|
|
177
|
+
this._renderSceneFrame();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
applyHover(hover) {
|
|
181
|
+
const hoverConfig = this.lastInput?.hoverConfig;
|
|
182
|
+
this.hoverState = hoverConfig ? { datasetId: hover.datasetId, index: hover.index, axisIndex: hover.axisIndex ?? null } : { datasetId: null, index: null, axisIndex: null };
|
|
183
|
+
this.effectConfig = hoverConfig ? { hoverBrightness: hoverConfig.brightness ?? DEFAULT_HOVER_BRIGHTNESS, dimOpacity: hoverConfig.dimOpacity ?? DEFAULT_HOVER_DIM_OPACITY } : { hoverBrightness: 1, dimOpacity: 1 };
|
|
184
|
+
const layout = this.lastRenderedLayout ?? this._layout;
|
|
185
|
+
if (!layout || !this.lastInput) return;
|
|
186
|
+
if (this.lastInput.renderer === "svg" && this.svgGroup) {
|
|
187
|
+
if (this._animRafId !== null) return;
|
|
188
|
+
reconcileSvgChildren(this.svgGroup, this.buildPolarSvgChildren(layout, this.lastInput));
|
|
189
|
+
} else if (this.lastInput.renderer === "canvas") {
|
|
190
|
+
this.lastInput.requestRedraw?.();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
hitTest(x, y) {
|
|
194
|
+
if (!this._layout) return null;
|
|
195
|
+
return hitTestPolar(x, y, this._layout, this.lastInput?.theme ?? defaultLightTheme);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Shared-mode lookup: find the wedge under the cursor, then return all
|
|
199
|
+
* stacked bars that share its categoryIndex as `allSeries` (parity with
|
|
200
|
+
* cartesian bar/line shared tooltip).
|
|
201
|
+
*/
|
|
202
|
+
findAllNearest(x, y) {
|
|
203
|
+
const layout = this.lastRenderedLayout ?? this._layout;
|
|
204
|
+
if (!layout) return null;
|
|
205
|
+
const primary = hitTestPolar(x, y, layout, this.lastInput?.theme ?? defaultLightTheme);
|
|
206
|
+
if (!primary) return null;
|
|
207
|
+
const label = layout.categories[primary.index] ?? primary.label;
|
|
208
|
+
const allSeries = [];
|
|
209
|
+
for (const bar of layout.bars) {
|
|
210
|
+
if (bar.categoryIndex !== primary.index) continue;
|
|
211
|
+
if (bar.hidden) continue;
|
|
212
|
+
const gradColor = layout.gradientColors.get(bar.datasetId);
|
|
213
|
+
allSeries.push({
|
|
214
|
+
datasetId: bar.datasetId,
|
|
215
|
+
name: bar.name,
|
|
216
|
+
label,
|
|
217
|
+
color: bar.color ?? getDefaultColor(bar.seriesIdx, this.lastInput?.theme ?? defaultLightTheme),
|
|
218
|
+
colorGradient: gradColor,
|
|
219
|
+
swatchColor: resolveSwatchColor({ color: bar.color ?? gradColor }, bar.seriesIdx, void 0, this.lastInput?.theme),
|
|
220
|
+
value: bar.value,
|
|
221
|
+
formattedValue: String(bar.value),
|
|
222
|
+
cursorFormattedValue: String(bar.value),
|
|
223
|
+
snapPixel: bar.outerRadius
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
return { primary: { ...primary, label }, allSeries };
|
|
227
|
+
}
|
|
228
|
+
renderCanvasContent(ctx) {
|
|
229
|
+
const layout = this.lastRenderedLayout ?? this._layout;
|
|
230
|
+
if (!layout) return;
|
|
231
|
+
this._paint.renderCanvas(ctx, layout, this.hoverState, this.effectConfig, this.lastInput?.theme ?? defaultLightTheme);
|
|
232
|
+
const lc = this.lastInput?.labelConfig;
|
|
233
|
+
if (lc) {
|
|
234
|
+
const dsTotal = layout.bars.reduce((sum, b) => sum + Math.abs(b.value), 0);
|
|
235
|
+
const labels = resolvePolarLabels(layout.bars, dsTotal, layout.center, lc);
|
|
236
|
+
renderResolvedLabels(labels, lc, { renderer: "canvas", ctx, theme: this.lastInput?.theme ?? defaultLightTheme });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
get hasData() {
|
|
240
|
+
return this._hasPolarDatasets;
|
|
241
|
+
}
|
|
242
|
+
get layout() {
|
|
243
|
+
return this.lastRenderedLayout ?? this._layout;
|
|
244
|
+
}
|
|
245
|
+
get center() {
|
|
246
|
+
return this.lastRenderedLayout?.center ?? this._layout?.center ?? null;
|
|
247
|
+
}
|
|
248
|
+
destroy() {
|
|
249
|
+
if (this._animRafId !== null) {
|
|
250
|
+
cancelRaf(this._animRafId);
|
|
251
|
+
this._animRafId = null;
|
|
252
|
+
}
|
|
253
|
+
this._scene.reset();
|
|
254
|
+
this._gridLerp = null;
|
|
255
|
+
this._lastSettledDomain = null;
|
|
256
|
+
this._lastFingerprint = "";
|
|
257
|
+
this._propertyOverrides.clear();
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Apply animated property values without triggering a full layout cycle.
|
|
261
|
+
* Called from the property-animation framework wrapper each animation tick.
|
|
262
|
+
*
|
|
263
|
+
* Per-dataset: writes overrides into `_propertyOverrides` (or deletes the
|
|
264
|
+
* entry when the store has no live values for it), then triggers a frame
|
|
265
|
+
* rebuild so `_buildLayoutFromScene` re-merges into the rendered bars.
|
|
266
|
+
*
|
|
267
|
+
* SVG: re-renders bars imperatively via `renderToSvg`. Canvas: calls
|
|
268
|
+
* `requestRedraw` so the canvas pipeline repaints with the merged props
|
|
269
|
+
* already baked into `lastRenderedLayout.bars`.
|
|
270
|
+
*/
|
|
271
|
+
applyPropertyAnimations(store) {
|
|
272
|
+
const layout = this._layout;
|
|
273
|
+
const input = this.lastInput;
|
|
274
|
+
if (!layout || !input) return;
|
|
275
|
+
let appliedAny = false;
|
|
276
|
+
const seenDatasets = /* @__PURE__ */ new Set();
|
|
277
|
+
for (const bar of layout.bars) {
|
|
278
|
+
if (seenDatasets.has(bar.datasetId)) continue;
|
|
279
|
+
seenDatasets.add(bar.datasetId);
|
|
280
|
+
const overrides = resolveAnimatedProps(store, "polar", bar.datasetId, POLAR_ANIMATABLE_PROPS);
|
|
281
|
+
if (Object.keys(overrides).length === 0) {
|
|
282
|
+
if (this._propertyOverrides.delete(bar.datasetId)) appliedAny = true;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
appliedAny = true;
|
|
286
|
+
this._propertyOverrides.set(bar.datasetId, overrides);
|
|
287
|
+
}
|
|
288
|
+
if (!appliedAny) return;
|
|
289
|
+
this._renderSceneFrame();
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Full re-render of the current scene state.
|
|
293
|
+
*
|
|
294
|
+
* Used by the property-animation framework wrapper: when a property
|
|
295
|
+
* animation completes and its override is released from the store,
|
|
296
|
+
* `_renderSceneFrame()` rebuilds the bars from `_propertyOverrides`-cleared
|
|
297
|
+
* base values so SVG attributes snap back to the layout-derived defaults.
|
|
298
|
+
*/
|
|
299
|
+
renderFrameCycle() {
|
|
300
|
+
this._renderSceneFrame();
|
|
301
|
+
}
|
|
302
|
+
// ================================================================
|
|
303
|
+
// PRIVATE — ANIMATION HELPERS
|
|
304
|
+
// ================================================================
|
|
305
|
+
_currentGridDomain() {
|
|
306
|
+
if (!this._gridLerp) return this._lastSettledDomain ?? [0, 0];
|
|
307
|
+
const { fromDomain, toDomain, startTime, duration, easing } = this._gridLerp;
|
|
308
|
+
if (startTime === -1) return fromDomain;
|
|
309
|
+
const elapsed = performance.now() - startTime;
|
|
310
|
+
const raw = Math.max(0, Math.min(1, elapsed / duration));
|
|
311
|
+
const p = easing(raw);
|
|
312
|
+
return [fromDomain[0] + (toDomain[0] - fromDomain[0]) * p, fromDomain[1] + (toDomain[1] - fromDomain[1]) * p];
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Build a PolarRenderData snapshot for the current frame: bars from scene
|
|
316
|
+
* elements, grid from in-flight lerp (or target).
|
|
317
|
+
*/
|
|
318
|
+
_buildLayoutFromScene(now) {
|
|
319
|
+
if (!this._layout) return null;
|
|
320
|
+
const bars = [];
|
|
321
|
+
const hasOverrides = this._propertyOverrides.size > 0;
|
|
322
|
+
for (const el of this._scene.getElements()) {
|
|
323
|
+
const base = el.current;
|
|
324
|
+
const overrides = hasOverrides ? this._propertyOverrides.get(base.datasetId) : void 0;
|
|
325
|
+
bars.push(overrides ? { ...base, ...overrides } : { ...base });
|
|
326
|
+
}
|
|
327
|
+
let grid = this._layout.grid;
|
|
328
|
+
let gridAnimating = false;
|
|
329
|
+
if (this._gridLerp) {
|
|
330
|
+
if (this._gridLerp.startTime === -1) this._gridLerp.startTime = now;
|
|
331
|
+
const elapsed = now - this._gridLerp.startTime;
|
|
332
|
+
const raw = Math.max(0, Math.min(1, elapsed / this._gridLerp.duration));
|
|
333
|
+
const p = this._gridLerp.easing(raw);
|
|
334
|
+
grid = interpolateRadialGrid(this._gridLerp.fromDomain, this._gridLerp.toDomain, this._gridLerp.targetGrid, this._gridLerp.targetRadius, p);
|
|
335
|
+
gridAnimating = true;
|
|
336
|
+
if (raw >= 1) {
|
|
337
|
+
this._lastSettledDomain = this._gridLerp.toDomain;
|
|
338
|
+
this._gridLerp = null;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return { ...this._layout, bars, grid, gridAnimating };
|
|
342
|
+
}
|
|
343
|
+
_renderSceneFrame() {
|
|
344
|
+
const layout = this._buildLayoutFromScene(performance.now());
|
|
345
|
+
if (!layout || !this.lastInput) return;
|
|
346
|
+
this.lastRenderedLayout = layout;
|
|
347
|
+
if (this.lastInput.renderer === "svg" && this.svgGroup) {
|
|
348
|
+
this.renderToSvg(this.svgGroup, layout, this.lastInput);
|
|
349
|
+
} else if (this.lastInput.renderer === "canvas") {
|
|
350
|
+
this.lastInput.requestRedraw?.();
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
_startAnimLoop() {
|
|
354
|
+
if (this._animRafId !== null) {
|
|
355
|
+
cancelRaf(this._animRafId);
|
|
356
|
+
}
|
|
357
|
+
const tick = (now) => {
|
|
358
|
+
this._animRafId = null;
|
|
359
|
+
const { allIdle } = this._scene.tick(now);
|
|
360
|
+
this._renderSceneFrame();
|
|
361
|
+
this.onFrame?.();
|
|
362
|
+
if (!allIdle || this._gridLerp !== null) {
|
|
363
|
+
this._animRafId = raf(tick);
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
this._animRafId = raf(tick);
|
|
367
|
+
}
|
|
368
|
+
// ================================================================
|
|
369
|
+
// PRIVATE — RENDERING
|
|
370
|
+
// ================================================================
|
|
371
|
+
/**
|
|
372
|
+
* Build the keyed children of `svgGroup`: the bars group (`data-layer="bars"`)
|
|
373
|
+
* and the optional labels group (`data-layer="labels"`). Shared by the full
|
|
374
|
+
* render (materialize → replace) and hover (reconcile) so the two stay
|
|
375
|
+
* structurally identical and the reconciler can match nodes by key.
|
|
376
|
+
*/
|
|
377
|
+
buildPolarSvgChildren(layout, input) {
|
|
378
|
+
const children = [];
|
|
379
|
+
const barsNode = this._paint.renderSvg(layout, this.hoverState, this.effectConfig, input.theme);
|
|
380
|
+
setAttr(barsNode, "data-layer", "bars");
|
|
381
|
+
const a11y = buildAccessibilityRenderContext(input.features);
|
|
382
|
+
if (a11y?.enabled && a11y.landmarkVerbosity === "all") {
|
|
383
|
+
setAttr(barsNode, "role", "region");
|
|
384
|
+
setAttr(barsNode, "aria-label", generateSeriesDescription(layout.bars[0]?.name ?? "Polar", "polar", layout.bars.length));
|
|
385
|
+
}
|
|
386
|
+
children.push(barsNode);
|
|
387
|
+
const lc = input.labelConfig;
|
|
388
|
+
if (lc) {
|
|
389
|
+
const dsTotal = layout.bars.reduce((sum, b) => sum + Math.abs(b.value), 0);
|
|
390
|
+
const labels = resolvePolarLabels(layout.bars, dsTotal, layout.center, lc);
|
|
391
|
+
const labelGroup = createSvgGroup();
|
|
392
|
+
renderResolvedLabels(labels, lc, { renderer: "svg", svgGroup: labelGroup, theme: input.theme });
|
|
393
|
+
setAttr(labelGroup, "data-layer", "labels");
|
|
394
|
+
children.push(labelGroup);
|
|
395
|
+
}
|
|
396
|
+
return children;
|
|
397
|
+
}
|
|
398
|
+
renderToSvg(group, layout, input) {
|
|
399
|
+
group.replaceChildren(...this.buildPolarSvgChildren(layout, input).map(materializeSvgNode));
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
export { PolarRendererController };
|