@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,18 @@
|
|
|
1
|
+
import { renderScatterSvg } from './chunk-6STOLMCA.mjs';
|
|
2
|
+
import { renderScatterCanvas } from './chunk-AHYIS6EB.mjs';
|
|
3
|
+
import { hitTestScatter, calculateScatterLayout } from './chunk-DTWTCFRG.mjs';
|
|
4
|
+
import { batchResolveRequired } from './chunk-O2X6FF45.mjs';
|
|
5
|
+
|
|
6
|
+
// src/series/scatter/index.ts
|
|
7
|
+
var scatterRenderer = {
|
|
8
|
+
calculateLayout: calculateScatterLayout,
|
|
9
|
+
renderSvg: renderScatterSvg,
|
|
10
|
+
renderCanvas: renderScatterCanvas,
|
|
11
|
+
hitTest: hitTestScatter,
|
|
12
|
+
getAxisHints(props, data) {
|
|
13
|
+
const domainValues = props.yField ? batchResolveRequired(props.yField, data, "yField") : [];
|
|
14
|
+
return { domainValues };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { scatterRenderer };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { resolveBoostActive, MARKER_SHAPE_NAMES, buildMarkerShapePath, renderMarkerShapeSvg } from './chunk-PRDVPOZX.mjs';
|
|
2
|
+
import { computeItemHoverState, applyHoverEffects, resolveSvgHoverFill } from './chunk-BZN2QHGP.mjs';
|
|
3
|
+
import { formatPointDescription } from './chunk-OGJ6IIBW.mjs';
|
|
4
|
+
import { SVG_ELEMENT_CEILING_WARNING, DEFAULT_LINE_WIDTH, DEFAULT_LINE_MARKER_SIZE, DEFAULT_AREA_FILL_OPACITY, DEFAULT_HOVER_DIM_OPACITY, LINE_BOOST_AUTO_THRESHOLD, DEFAULT_HOVER_POINT_RADIUS_MULTIPLIER } from './chunk-NKUYIWAP.mjs';
|
|
5
|
+
import { makeItemContext, resolveDash, resolveAccessor, isGradientColor, createSvgGradientFromColor, getPrimaryColor } from './chunk-O2X6FF45.mjs';
|
|
6
|
+
import { createSvgGroup, createSvgDefs, appendChild, svgClass, createSvgPath, setAttr, prependChild } from './chunk-SSLTFJ3U.mjs';
|
|
7
|
+
import { warnChartDevOnce } from './chunk-RQ3CKQOX.mjs';
|
|
8
|
+
|
|
9
|
+
// src/series/line/svg/index.ts
|
|
10
|
+
var DEFAULT_SHOW_MARKERS = true;
|
|
11
|
+
var DEFAULT_MARKER_SHAPE = "circle";
|
|
12
|
+
function renderLineSvg(props, layout, context) {
|
|
13
|
+
if (layout.visiblePoints.length >= SVG_ELEMENT_CEILING_WARNING) {
|
|
14
|
+
warnChartDevOnce("line-svg-ceiling", `SVG line is rendering ${layout.visiblePoints.length.toLocaleString()} points. Above ~8k elements, prefer <ChartCanvas> or <ChartDecimation> for materially better performance.`);
|
|
15
|
+
}
|
|
16
|
+
const lineWidth = props.lineStrokeWidth ?? DEFAULT_LINE_WIDTH;
|
|
17
|
+
const borderColor = typeof props.borderColor === "string" ? props.borderColor : void 0;
|
|
18
|
+
const borderWidth = typeof props.borderStrokeWidth === "number" ? props.borderStrokeWidth : 0;
|
|
19
|
+
const lineStyle = props.lineStyle ?? "solid";
|
|
20
|
+
const showMarkers = props.showMarkers ?? DEFAULT_SHOW_MARKERS;
|
|
21
|
+
const markerSizeAccessor = props.markerSize;
|
|
22
|
+
const defaultMarkerSize = props.pointRadius ?? DEFAULT_LINE_MARKER_SIZE;
|
|
23
|
+
const resolveMarkerSize = (ctx) => markerSizeAccessor === void 0 ? defaultMarkerSize : resolveAccessor(markerSizeAccessor, ctx, { arrayMode: "clip", fallback: defaultMarkerSize }) ?? defaultMarkerSize;
|
|
24
|
+
const resolveMarkerShape = (ctx, size) => props.markerShape === void 0 ? DEFAULT_MARKER_SHAPE : resolveAccessor(props.markerShape, typeof props.markerShape === "function" ? { ...ctx, size } : ctx, { arrayMode: "clip" }) ?? DEFAULT_MARKER_SHAPE;
|
|
25
|
+
const rotationAccessor = props.pointRotation;
|
|
26
|
+
const resolveMarkerRotation = (ctx) => rotationAccessor === void 0 ? 0 : resolveAccessor(rotationAccessor, ctx, { arrayMode: "clip", fallback: 0 }) ?? 0;
|
|
27
|
+
const seriesDashCtx = makeItemContext(props.data?.[0], 0);
|
|
28
|
+
const seriesBorderDash = resolveDash(props.borderDash, seriesDashCtx);
|
|
29
|
+
const seriesBorderDashOffset = resolveAccessor(props.borderDashOffset, seriesDashCtx, { arrayMode: "clip", fallback: 0 }) ?? 0;
|
|
30
|
+
const resolvePointDash = (ctx) => props.pointBorderDash === void 0 ? void 0 : resolveDash(props.pointBorderDash, ctx);
|
|
31
|
+
const resolvePointDashOffset = (ctx) => props.pointBorderDashOffset === void 0 ? 0 : resolveAccessor(props.pointBorderDashOffset, ctx, { arrayMode: "clip", fallback: 0 }) ?? 0;
|
|
32
|
+
const fillOpacity = props.fillOpacity ?? DEFAULT_AREA_FILL_OPACITY;
|
|
33
|
+
const hoveredIndex = props.interaction?.hoveredIndex ?? null;
|
|
34
|
+
const isSeriesDimmed = props.interaction?.isSeriesDimmed ?? false;
|
|
35
|
+
const effects = props.effects;
|
|
36
|
+
const seriesDimOpacity = isSeriesDimmed ? effects?.dimOpacity ?? context.theme.dimOpacity ?? DEFAULT_HOVER_DIM_OPACITY : 1;
|
|
37
|
+
const a11y = context.accessibility;
|
|
38
|
+
const a11yEnabled = !!(a11y?.enabled && layout.visiblePoints.length <= (a11y.pointDescriptionThreshold ?? 200));
|
|
39
|
+
const group = createSvgGroup(void 0, seriesDimOpacity < 1 ? { opacity: String(seriesDimOpacity) } : void 0);
|
|
40
|
+
const defs = createSvgDefs();
|
|
41
|
+
let defsUsed = false;
|
|
42
|
+
let strokeDasharray;
|
|
43
|
+
if (props.lineDash && props.lineDash.length > 0) {
|
|
44
|
+
strokeDasharray = props.lineDash.join(" ");
|
|
45
|
+
} else if (lineStyle === "dashed") {
|
|
46
|
+
strokeDasharray = `${lineWidth * 4} ${lineWidth * 3}`;
|
|
47
|
+
} else if (lineStyle === "dotted") {
|
|
48
|
+
strokeDasharray = `${lineWidth} ${lineWidth * 2}`;
|
|
49
|
+
}
|
|
50
|
+
let strokeColor;
|
|
51
|
+
const lineColor = layout.lineColor;
|
|
52
|
+
const seriesIdx = layout.seriesIdx;
|
|
53
|
+
const colorClassN = `p-chart-color-${seriesIdx % 10}`;
|
|
54
|
+
const seriesExtras = { seriesIndex: layout.seriesIdx, seriesId: layout.datasetId };
|
|
55
|
+
if (lineColor && isGradientColor(lineColor)) {
|
|
56
|
+
const gradId = `line-stroke-${context.chartId}-${layout.datasetIndex}`;
|
|
57
|
+
const cx = layout.chartArea.x + layout.chartArea.width / 2;
|
|
58
|
+
const cy = layout.chartArea.y + layout.chartArea.height / 2;
|
|
59
|
+
const r = Math.max(layout.chartArea.width, layout.chartArea.height) / 2;
|
|
60
|
+
appendChild(defs, createSvgGradientFromColor(lineColor, gradId, { x: cx, y: cy }, r, layout.chartArea, "horizontal"));
|
|
61
|
+
defsUsed = true;
|
|
62
|
+
strokeColor = `url(#${gradId})`;
|
|
63
|
+
} else if (typeof lineColor === "string") {
|
|
64
|
+
strokeColor = lineColor;
|
|
65
|
+
}
|
|
66
|
+
if (layout.isArea) {
|
|
67
|
+
const areaGroup = createSvgGroup(void 0, { class: "line-area", "data-layer": "area" });
|
|
68
|
+
const areaGradCache = /* @__PURE__ */ new Map();
|
|
69
|
+
for (const seg of layout.segments) {
|
|
70
|
+
if (!seg.fillPath) continue;
|
|
71
|
+
const segFill = seg.style?.segmentFillColor;
|
|
72
|
+
let fill = segFill ?? strokeColor;
|
|
73
|
+
if (!segFill && lineColor && isGradientColor(lineColor)) {
|
|
74
|
+
const cacheKey = lineColor.stops.map((s) => `${s.offset}:${s.color}:${s.opacity ?? ""}`).join("|");
|
|
75
|
+
let areaGradId = areaGradCache.get(cacheKey);
|
|
76
|
+
if (!areaGradId) {
|
|
77
|
+
areaGradId = `line-area-${context.chartId}-${layout.datasetIndex}-grad`;
|
|
78
|
+
const acx = layout.chartArea.x + layout.chartArea.width / 2;
|
|
79
|
+
const acy = layout.chartArea.y + layout.chartArea.height / 2;
|
|
80
|
+
const ar = Math.max(layout.chartArea.width, layout.chartArea.height) / 2;
|
|
81
|
+
appendChild(defs, createSvgGradientFromColor(lineColor, areaGradId, { x: acx, y: acy }, ar, layout.chartArea, "vertical"));
|
|
82
|
+
defsUsed = true;
|
|
83
|
+
areaGradCache.set(cacheKey, areaGradId);
|
|
84
|
+
}
|
|
85
|
+
fill = `url(#${areaGradId})`;
|
|
86
|
+
}
|
|
87
|
+
const attrs = {
|
|
88
|
+
d: seg.fillPath,
|
|
89
|
+
"fill-opacity": fillOpacity,
|
|
90
|
+
stroke: "none",
|
|
91
|
+
fill: fill ?? context.theme.series[seriesIdx % context.theme.series.length],
|
|
92
|
+
class: svgClass("p-chart-area", `p-chart-series-${seriesIdx}`, !fill && colorClassN)
|
|
93
|
+
};
|
|
94
|
+
appendChild(areaGroup, createSvgPath(seg.fillPath, attrs));
|
|
95
|
+
}
|
|
96
|
+
appendChild(group, areaGroup);
|
|
97
|
+
}
|
|
98
|
+
if (borderColor && borderWidth > 0) {
|
|
99
|
+
const borderGroup = createSvgGroup(void 0, { class: "line-border", "data-layer": "border" });
|
|
100
|
+
const usingLineDash = !!strokeDasharray;
|
|
101
|
+
const effectiveBorderDash = strokeDasharray ?? (seriesBorderDash && seriesBorderDash.length > 0 ? seriesBorderDash.join(" ") : void 0);
|
|
102
|
+
const borderDashArray = effectiveBorderDash;
|
|
103
|
+
const effectiveBorderDashOffset = usingLineDash ? props.lineDashOffset ?? seriesBorderDashOffset : seriesBorderDashOffset;
|
|
104
|
+
for (const seg of layout.segments) {
|
|
105
|
+
if (!seg.linePath || seg.points.length === 0) continue;
|
|
106
|
+
const pathAttrs = {
|
|
107
|
+
d: seg.linePath,
|
|
108
|
+
fill: "none",
|
|
109
|
+
stroke: borderColor,
|
|
110
|
+
"stroke-width": lineWidth + borderWidth * 2,
|
|
111
|
+
"stroke-linecap": props.borderCapStyle ?? props.lineCapStyle ?? "round",
|
|
112
|
+
"stroke-linejoin": props.borderJoinStyle ?? props.lineJoinStyle ?? "round"
|
|
113
|
+
};
|
|
114
|
+
if (borderDashArray) pathAttrs["stroke-dasharray"] = borderDashArray;
|
|
115
|
+
if (effectiveBorderDashOffset) pathAttrs["stroke-dashoffset"] = effectiveBorderDashOffset;
|
|
116
|
+
appendChild(borderGroup, createSvgPath(seg.linePath, pathAttrs));
|
|
117
|
+
}
|
|
118
|
+
appendChild(group, borderGroup);
|
|
119
|
+
}
|
|
120
|
+
const lineGroup = createSvgGroup(void 0, { class: "line-strokes", "data-layer": "strokes" });
|
|
121
|
+
for (const seg of layout.segments) {
|
|
122
|
+
if (!seg.linePath || seg.points.length === 0) continue;
|
|
123
|
+
const segStroke = seg.style?.segmentColor ?? strokeColor;
|
|
124
|
+
const segWidth = seg.style?.segmentStrokeWidth ?? lineWidth;
|
|
125
|
+
const segDash = seg.style?.segmentDash ? seg.style.segmentDash.join(" ") : strokeDasharray;
|
|
126
|
+
const pathAttrs = {
|
|
127
|
+
d: seg.linePath,
|
|
128
|
+
fill: "none",
|
|
129
|
+
"stroke-width": segWidth,
|
|
130
|
+
"stroke-linecap": props.lineCapStyle ?? "round",
|
|
131
|
+
"stroke-linejoin": props.lineJoinStyle ?? "round",
|
|
132
|
+
stroke: segStroke ?? context.theme.series[seriesIdx % context.theme.series.length],
|
|
133
|
+
class: svgClass("p-chart-line", `p-chart-series-${seriesIdx}`, !segStroke && colorClassN)
|
|
134
|
+
};
|
|
135
|
+
if (segDash) pathAttrs["stroke-dasharray"] = segDash;
|
|
136
|
+
if (props.lineDashOffset) pathAttrs["stroke-dashoffset"] = props.lineDashOffset;
|
|
137
|
+
appendChild(lineGroup, createSvgPath(seg.linePath, pathAttrs));
|
|
138
|
+
}
|
|
139
|
+
appendChild(group, lineGroup);
|
|
140
|
+
const hasCustomRenderMarker = !!props.renderMarker;
|
|
141
|
+
if ((showMarkers || hoveredIndex !== null) && !hasCustomRenderMarker) {
|
|
142
|
+
const markerGroup = createSvgGroup(void 0, { class: "line-markers", "data-layer": "markers" });
|
|
143
|
+
const anyHovered = hoveredIndex !== null && !!effects;
|
|
144
|
+
let boostBatched = false;
|
|
145
|
+
if (resolveBoostActive(props.boost, layout.visiblePoints.length, LINE_BOOST_AUTO_THRESHOLD) && showMarkers && typeof props.markerShape !== "function" && layout.visiblePoints.length > 0) {
|
|
146
|
+
const first = layout.visiblePoints[0];
|
|
147
|
+
const firstCtx = makeItemContext(props.data?.[first.dataIndex], first.dataIndex, { value: first.value, category: first.category, ...seriesExtras });
|
|
148
|
+
const seriesShape = resolveMarkerShape(firstCtx, resolveMarkerSize(firstCtx));
|
|
149
|
+
if (MARKER_SHAPE_NAMES.has(seriesShape)) {
|
|
150
|
+
const themedSeriesColor = context.theme.series[seriesIdx % context.theme.series.length];
|
|
151
|
+
const CLASS_KEY = "__class__";
|
|
152
|
+
const batches = /* @__PURE__ */ new Map();
|
|
153
|
+
for (const pt of layout.visiblePoints) {
|
|
154
|
+
const ptCtx = makeItemContext(props.data?.[pt.dataIndex], pt.dataIndex, { value: pt.value, category: pt.category, ...seriesExtras });
|
|
155
|
+
const markerColor = props.pointColors?.[pt.dataIndex] ?? resolveAccessor(props.pointBackgroundColor, ptCtx, { arrayMode: "cycle" }) ?? lineColor;
|
|
156
|
+
const key = markerColor != null ? getPrimaryColor(markerColor) : CLASS_KEY;
|
|
157
|
+
let bucket = batches.get(key);
|
|
158
|
+
if (!bucket) batches.set(key, bucket = []);
|
|
159
|
+
bucket.push(pt);
|
|
160
|
+
}
|
|
161
|
+
const boostBorderWidth = resolveAccessor(props.pointBorderStrokeWidth, firstCtx, { arrayMode: "clip", fallback: 0 }) ?? 0;
|
|
162
|
+
for (const [key, pts] of batches) {
|
|
163
|
+
let d = "";
|
|
164
|
+
for (const pt of pts) {
|
|
165
|
+
const ptCtx = makeItemContext(props.data?.[pt.dataIndex], pt.dataIndex, { value: pt.value, category: pt.category, ...seriesExtras });
|
|
166
|
+
d += buildMarkerShapePath(seriesShape, pt.x, pt.y, resolveMarkerSize(ptCtx));
|
|
167
|
+
}
|
|
168
|
+
const classDriven = key === CLASS_KEY;
|
|
169
|
+
const pathAttrs = {
|
|
170
|
+
"stroke-width": boostBorderWidth,
|
|
171
|
+
fill: classDriven ? themedSeriesColor : key,
|
|
172
|
+
stroke: boostBorderWidth <= 0 ? "none" : classDriven ? themedSeriesColor : key,
|
|
173
|
+
class: svgClass("p-chart-marker", `p-chart-series-${seriesIdx}`, classDriven && colorClassN)
|
|
174
|
+
};
|
|
175
|
+
appendChild(markerGroup, createSvgPath(d, pathAttrs));
|
|
176
|
+
}
|
|
177
|
+
boostBatched = true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (!boostBatched)
|
|
181
|
+
for (const pt of layout.visiblePoints) {
|
|
182
|
+
const hoverState = computeItemHoverState(pt.dataIndex, hoveredIndex, anyHovered);
|
|
183
|
+
if (!showMarkers && !hoverState.isHovered) continue;
|
|
184
|
+
const pointColor = props.pointColors?.[pt.dataIndex];
|
|
185
|
+
const ptCtx = makeItemContext(props.data?.[pt.dataIndex], pt.dataIndex, { value: pt.value, category: pt.category, ...seriesExtras });
|
|
186
|
+
const userMarkerColor = pointColor ?? resolveAccessor(props.pointBackgroundColor, ptCtx, { arrayMode: "cycle" }) ?? (typeof lineColor === "string" ? lineColor : strokeColor);
|
|
187
|
+
const userBorderColor = resolveAccessor(props.pointBorderColor, ptCtx, { arrayMode: "cycle" }) ?? userMarkerColor;
|
|
188
|
+
const baseBorderWidth = resolveAccessor(props.pointBorderStrokeWidth, ptCtx, { arrayMode: "clip", fallback: 0 }) ?? 0;
|
|
189
|
+
const ptHoverBg = resolveAccessor(props.pointHoverBackgroundColor, ptCtx, { arrayMode: "cycle" });
|
|
190
|
+
const ptHoverBorder = resolveAccessor(props.pointHoverBorderColor, ptCtx, { arrayMode: "cycle" });
|
|
191
|
+
const ptHoverBorderWidth = resolveAccessor(props.pointHoverBorderStrokeWidth, ptCtx, { arrayMode: "clip" });
|
|
192
|
+
const effectConfig = effects ? {
|
|
193
|
+
hoverBrightness: effects.hoverBrightness,
|
|
194
|
+
dimOpacity: effects.dimOpacity,
|
|
195
|
+
hoverBackgroundColor: ptHoverBg ?? effects.hoverBackgroundColor,
|
|
196
|
+
hoverBorderColor: ptHoverBorder ?? effects.hoverBorderColor,
|
|
197
|
+
hoverBorderStrokeWidth: ptHoverBorderWidth ?? effects.hoverBorderStrokeWidth
|
|
198
|
+
} : void 0;
|
|
199
|
+
const isInactive = hoverState.hasAnyHover && !hoverState.isHovered;
|
|
200
|
+
let renderFill;
|
|
201
|
+
let renderStroke;
|
|
202
|
+
let renderBorderWidth = baseBorderWidth;
|
|
203
|
+
let renderOpacity;
|
|
204
|
+
if (userMarkerColor !== void 0) {
|
|
205
|
+
const effectResult = applyHoverEffects(userMarkerColor, userBorderColor, baseBorderWidth, props.lineDash, props.lineDashOffset ?? 0, hoverState, effectConfig, context.theme);
|
|
206
|
+
renderFill = effectResult.color;
|
|
207
|
+
renderStroke = effectResult.borderColor;
|
|
208
|
+
renderBorderWidth = effectResult.borderStrokeWidth;
|
|
209
|
+
renderOpacity = effectResult.opacity;
|
|
210
|
+
} else if (hoverState.isHovered && effectConfig?.hoverBorderStrokeWidth !== void 0) {
|
|
211
|
+
renderBorderWidth = effectConfig.hoverBorderStrokeWidth;
|
|
212
|
+
}
|
|
213
|
+
const ptMarkerSize = resolveMarkerSize(ptCtx);
|
|
214
|
+
const currentSize = hoverState.isHovered ? effects?.hoverPointRadius ?? ptMarkerSize * (effects?.hoverRadiusMultiplier ?? DEFAULT_HOVER_POINT_RADIUS_MULTIPLIER) : ptMarkerSize;
|
|
215
|
+
const { fill: overrideFill, overridden: fillOverridden } = resolveSvgHoverFill(renderFill, hoverState.isHovered, effectConfig?.hoverBackgroundColor);
|
|
216
|
+
renderFill = overrideFill;
|
|
217
|
+
const themedSeriesColor = context.theme.series[seriesIdx % context.theme.series.length];
|
|
218
|
+
const cssClassApplied = renderFill === void 0;
|
|
219
|
+
const inlineStroke = cssClassApplied && userBorderColor !== void 0 ? userBorderColor : void 0;
|
|
220
|
+
const markerAttrs = {
|
|
221
|
+
"data-index": pt.dataIndex,
|
|
222
|
+
"stroke-width": renderBorderWidth,
|
|
223
|
+
"stroke-linejoin": props.pointBorderJoinStyle ?? "miter",
|
|
224
|
+
fill: renderFill ?? themedSeriesColor,
|
|
225
|
+
stroke: renderStroke ?? themedSeriesColor,
|
|
226
|
+
...inlineStroke !== void 0 && { style: `stroke: ${inlineStroke}` },
|
|
227
|
+
...renderOpacity !== void 0 && renderOpacity < 1 && { opacity: renderOpacity },
|
|
228
|
+
class: svgClass("p-chart-marker", `p-chart-series-${seriesIdx}`, renderFill === void 0 && colorClassN, hoverState.isHovered && !fillOverridden && "p-chart-point-hover", isInactive && "p-chart-point-inactive")
|
|
229
|
+
};
|
|
230
|
+
const ptDash = resolvePointDash(ptCtx);
|
|
231
|
+
if (ptDash && ptDash.length > 0) markerAttrs["stroke-dasharray"] = ptDash.join(" ");
|
|
232
|
+
const ptDashOffset = resolvePointDashOffset(ptCtx);
|
|
233
|
+
if (ptDashOffset) markerAttrs["stroke-dashoffset"] = ptDashOffset;
|
|
234
|
+
let markerEl;
|
|
235
|
+
const ptShape = resolveMarkerShape(ptCtx, currentSize);
|
|
236
|
+
const ptRotation = resolveMarkerRotation(ptCtx);
|
|
237
|
+
if (MARKER_SHAPE_NAMES.has(ptShape)) {
|
|
238
|
+
if (ptRotation !== 0) {
|
|
239
|
+
markerAttrs.transform = `rotate(${ptRotation}, ${pt.x}, ${pt.y})`;
|
|
240
|
+
}
|
|
241
|
+
markerEl = renderMarkerShapeSvg(ptShape, pt.x, pt.y, currentSize, markerAttrs);
|
|
242
|
+
} else {
|
|
243
|
+
const transformParts = [`translate(${pt.x}, ${pt.y})`];
|
|
244
|
+
if (ptRotation !== 0) transformParts.push(`rotate(${ptRotation})`);
|
|
245
|
+
markerAttrs.transform = transformParts.join(" ");
|
|
246
|
+
markerEl = createSvgPath(ptShape, markerAttrs);
|
|
247
|
+
}
|
|
248
|
+
if (a11yEnabled) {
|
|
249
|
+
const desc = formatPointDescription({ category: pt.category ?? `Point ${pt.dataIndex + 1}`, value: pt.value ?? 0, seriesName: props.name ?? "Series", index: pt.dataIndex }, a11y.pointDescriptionFormatter);
|
|
250
|
+
setAttr(markerEl, "role", "img");
|
|
251
|
+
setAttr(markerEl, "aria-label", desc);
|
|
252
|
+
}
|
|
253
|
+
appendChild(markerGroup, markerEl);
|
|
254
|
+
}
|
|
255
|
+
appendChild(group, markerGroup);
|
|
256
|
+
}
|
|
257
|
+
if (defsUsed) prependChild(group, defs);
|
|
258
|
+
return group;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export { renderLineSvg };
|