@primeui/chart-core 0.0.1-alpha.1 → 1.0.0-rc.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.
Files changed (248) hide show
  1. package/LICENSE.md +35 -0
  2. package/README.md +12 -0
  3. package/dist/animations/index.d.mts +1 -1
  4. package/dist/animations/index.mjs +19 -18
  5. package/dist/{annotation.utils-Bm0lOO1o.d.mts → annotation.utils-D-7ijAWO.d.mts} +22 -1
  6. package/dist/cartesian/index.d.mts +3 -2
  7. package/dist/cartesian/index.mjs +96 -93
  8. package/dist/{chunk-WPFUV7K3.mjs → chunks/chunk-2LLTN7T4.mjs} +23 -14
  9. package/dist/{chunk-RO4N6YFS.mjs → chunks/chunk-2T226WJI.mjs} +31 -14
  10. package/dist/{chunk-3FFJEX4A.mjs → chunks/chunk-3QQLETCJ.mjs} +13 -12
  11. package/dist/{chunk-JWFBOPM6.mjs → chunks/chunk-4N2XIMAB.mjs} +2 -2
  12. package/dist/{chunk-LVMDQ4OJ.mjs → chunks/chunk-4S3FOFCN.mjs} +2 -2
  13. package/dist/{chunk-XTVE4P3L.mjs → chunks/chunk-56MASQS2.mjs} +6 -2
  14. package/dist/{chunk-DTWTCFRG.mjs → chunks/chunk-5EQSFUBA.mjs} +41 -13
  15. package/dist/{chunk-KQIFO5I3.mjs → chunks/chunk-5QSTMSPW.mjs} +15 -10
  16. package/dist/{chunk-NKUYIWAP.mjs → chunks/chunk-6LUIVTNV.mjs} +6 -6
  17. package/dist/chunks/chunk-6MAO6I3E.mjs +6 -0
  18. package/dist/{chunk-DN6AXQYZ.mjs → chunks/chunk-72M66Y2U.mjs} +46 -41
  19. package/dist/{chunk-WFVOQ2QZ.mjs → chunks/chunk-77K3DEKL.mjs} +2 -2
  20. package/dist/{chunk-4C6EVJ54.mjs → chunks/chunk-7I2SAKHL.mjs} +7 -44
  21. package/dist/{chunk-6HSEJLSR.mjs → chunks/chunk-7I2SNJ2X.mjs} +35 -18
  22. package/dist/{chunk-66T4MRC5.mjs → chunks/chunk-7IKKWWRT.mjs} +4 -6
  23. package/dist/{chunk-BKP26M4K.mjs → chunks/chunk-7LZWQVTL.mjs} +43 -24
  24. package/dist/{chunk-NHRK5KU2.mjs → chunks/chunk-A5YBHYIS.mjs} +25 -17
  25. package/dist/{chunk-ZT2Z7ERM.mjs → chunks/chunk-AC5EAWIP.mjs} +12 -9
  26. package/dist/{chunk-ZTL2FQEW.mjs → chunks/chunk-AETETRB4.mjs} +24 -9
  27. package/dist/{chunk-NPDZLYIF.mjs → chunks/chunk-AJ24XDEK.mjs} +2 -2
  28. package/dist/chunks/chunk-ARVMVGWS.mjs +40 -0
  29. package/dist/{chunk-3IYSJ2U7.mjs → chunks/chunk-AYEAEAOV.mjs} +10 -7
  30. package/dist/{chunk-M7B3JF43.mjs → chunks/chunk-AZPJMIZE.mjs} +4 -3
  31. package/dist/{chunk-O2X6FF45.mjs → chunks/chunk-BDCNBS6W.mjs} +194 -168
  32. package/dist/{chunk-55Y3WI6S.mjs → chunks/chunk-BR4PSSPU.mjs} +6 -6
  33. package/dist/{chunk-TA4MVAEX.mjs → chunks/chunk-CFA2SUBF.mjs} +32 -24
  34. package/dist/{chunk-WH3C3Y7P.mjs → chunks/chunk-CKQ4DNNJ.mjs} +7 -18
  35. package/dist/chunks/chunk-DIJFKY6H.mjs +21 -0
  36. package/dist/{chunk-AUF4CHDP.mjs → chunks/chunk-DJOHDKTP.mjs} +18 -11
  37. package/dist/{chunk-3Z62EUJN.mjs → chunks/chunk-DKWZKYHF.mjs} +5 -5
  38. package/dist/{chunk-Y3L3D4GQ.mjs → chunks/chunk-DORUY7GR.mjs} +69 -34
  39. package/dist/chunks/chunk-DWBJKYLH.mjs +238 -0
  40. package/dist/{chunk-XQQCGFYB.mjs → chunks/chunk-EQLCJTM4.mjs} +1 -1
  41. package/dist/{chunk-VGLSBZDN.mjs → chunks/chunk-F2E2QCZM.mjs} +1 -1
  42. package/dist/{chunk-BZN2QHGP.mjs → chunks/chunk-F6AGZQDA.mjs} +4 -72
  43. package/dist/{chunk-ILUWFYGY.mjs → chunks/chunk-FNMLVZOA.mjs} +8 -8
  44. package/dist/{chunk-SXHVDJGF.mjs → chunks/chunk-FQAFGPW6.mjs} +6 -6
  45. package/dist/{chunk-N3TIT3OH.mjs → chunks/chunk-FSPE3M5E.mjs} +66 -43
  46. package/dist/{chunk-KNDZP446.mjs → chunks/chunk-FSWYYRPX.mjs} +5 -5
  47. package/dist/{chunk-KP2TWD4Z.mjs → chunks/chunk-FWNWV3H7.mjs} +1 -1
  48. package/dist/{chunk-WCG35U6M.mjs → chunks/chunk-FYVMRQFF.mjs} +35 -27
  49. package/dist/chunks/chunk-G3DIMENH.mjs +63 -0
  50. package/dist/{chunk-QQBXUDM4.mjs → chunks/chunk-G3DYNMWT.mjs} +20 -16
  51. package/dist/{chunk-J65DBT4R.mjs → chunks/chunk-GA6YZQYT.mjs} +3 -3
  52. package/dist/chunks/chunk-GAQLLQUM.mjs +20 -0
  53. package/dist/{chunk-TAHCOZHF.mjs → chunks/chunk-GN7VQCCH.mjs} +27 -30
  54. package/dist/{chunk-R6Y3R7EW.mjs → chunks/chunk-GOOBVFFH.mjs} +1 -1
  55. package/dist/chunks/chunk-GSW5OBEG.mjs +233 -0
  56. package/dist/{chunk-22ST6YPP.mjs → chunks/chunk-GTX6MLTG.mjs} +9 -9
  57. package/dist/{chunk-XUAASRXW.mjs → chunks/chunk-GWHRTGGC.mjs} +35 -27
  58. package/dist/{chunk-TQ6S34QZ.mjs → chunks/chunk-GXCLRRE5.mjs} +6 -6
  59. package/dist/{chunk-DP2IZNN3.mjs → chunks/chunk-HHBFQ6AI.mjs} +4 -3
  60. package/dist/{chunk-3OZLP4I4.mjs → chunks/chunk-HWT6UEYE.mjs} +14 -10
  61. package/dist/{chunk-X7T34OLW.mjs → chunks/chunk-I25SSZE3.mjs} +3 -3
  62. package/dist/{chunk-OGJ6IIBW.mjs → chunks/chunk-IFJPDARC.mjs} +21 -9
  63. package/dist/{chunk-CINXJIRR.mjs → chunks/chunk-ISU27QL2.mjs} +66 -6
  64. package/dist/{chunk-OXTFAWSK.mjs → chunks/chunk-J2WHJ73Y.mjs} +7 -2
  65. package/dist/{chunk-VN7CKCSE.mjs → chunks/chunk-JS47MSB2.mjs} +9 -1
  66. package/dist/{chunk-WYLILAOO.mjs → chunks/chunk-K44SD67H.mjs} +16 -7
  67. package/dist/{chunk-RQ3CKQOX.mjs → chunks/chunk-K7AGQTVK.mjs} +63 -3
  68. package/dist/{chunk-VVI3OBPJ.mjs → chunks/chunk-KCSMOAZO.mjs} +7 -9
  69. package/dist/{chunk-ARRGOEFX.mjs → chunks/chunk-L6GXEQOO.mjs} +7 -7
  70. package/dist/{chunk-7QQ6ETB4.mjs → chunks/chunk-LBNP5PJA.mjs} +14 -12
  71. package/dist/{chunk-AHYIS6EB.mjs → chunks/chunk-LC2ZEZWP.mjs} +7 -7
  72. package/dist/{chunk-3WEMHXZI.mjs → chunks/chunk-LTQH3LQJ.mjs} +2 -8
  73. package/dist/{chunk-OHGCZZPZ.mjs → chunks/chunk-M5PZVFY5.mjs} +57 -29
  74. package/dist/{chunk-A6ZQZFL2.mjs → chunks/chunk-NUHW3U7G.mjs} +14 -11
  75. package/dist/{chunk-QWQ6HY4I.mjs → chunks/chunk-O4BTKF5R.mjs} +9 -8
  76. package/dist/{chunk-WY4AURRE.mjs → chunks/chunk-P2Q4DYOS.mjs} +240 -83
  77. package/dist/{chunk-KVDEROP6.mjs → chunks/chunk-P563L7WL.mjs} +1 -1
  78. package/dist/{chunk-SDBPQ5CF.mjs → chunks/chunk-PJLFNUOW.mjs} +45 -30
  79. package/dist/{chunk-MTGMXRNF.mjs → chunks/chunk-PSDRVQSK.mjs} +7 -7
  80. package/dist/{chunk-6STOLMCA.mjs → chunks/chunk-QCBESCLG.mjs} +13 -12
  81. package/dist/{chunk-PRDVPOZX.mjs → chunks/chunk-QIYJUZ7I.mjs} +7 -2
  82. package/dist/{chunk-UPRXABX5.mjs → chunks/chunk-RH3OQ2VX.mjs} +6 -6
  83. package/dist/{chunk-QS76E3TD.mjs → chunks/chunk-RI32WIDX.mjs} +2 -2
  84. package/dist/{chunk-OWW3K55O.mjs → chunks/chunk-RIAPS5AW.mjs} +49 -7
  85. package/dist/{chunk-ERVQB2VZ.mjs → chunks/chunk-RJ3ZOZTS.mjs} +4 -4
  86. package/dist/{chunk-WFTX4AQJ.mjs → chunks/chunk-RKNL7UWZ.mjs} +19 -7
  87. package/dist/chunks/chunk-RLS3GMJ6.mjs +8 -0
  88. package/dist/{chunk-WRULPWHD.mjs → chunks/chunk-RVTEIKW5.mjs} +5 -5
  89. package/dist/{chunk-PLSDU3C2.mjs → chunks/chunk-RXQ22JQS.mjs} +67 -39
  90. package/dist/{chunk-FHTC2YDB.mjs → chunks/chunk-SVASYTK5.mjs} +70 -5
  91. package/dist/{chunk-ARB5T6MP.mjs → chunks/chunk-SWVOBJLG.mjs} +3 -100
  92. package/dist/{chunk-JGOVWSKH.mjs → chunks/chunk-TW3KLJVO.mjs} +37 -12
  93. package/dist/{chunk-RBLZRT5K.mjs → chunks/chunk-UF2TPGQB.mjs} +103 -15
  94. package/dist/{chunk-X4D7FKUS.mjs → chunks/chunk-UZWWYKL7.mjs} +2 -2
  95. package/dist/{chunk-LKC7MZKK.mjs → chunks/chunk-XECVYJE2.mjs} +16 -8
  96. package/dist/chunks/chunk-XMSAUIVL.mjs +1 -0
  97. package/dist/{chunk-J4RI2C2G.mjs → chunks/chunk-XPZTRMU2.mjs} +6 -6
  98. package/dist/{chunk-BABQKA6K.mjs → chunks/chunk-XXJRGDKE.mjs} +3 -3
  99. package/dist/{chunk-SALTGZFR.mjs → chunks/chunk-YVDVKLPR.mjs} +10 -9
  100. package/dist/circular/arc/index.mjs +3 -3
  101. package/dist/circular/index.d.mts +1 -1
  102. package/dist/circular/index.mjs +14 -13
  103. package/dist/controllers/index.mjs +113 -110
  104. package/dist/{datalabel.utils-CkjGeB8S.d.mts → datalabel.utils-CNRKHy7j.d.mts} +10 -1
  105. package/dist/{decimation.utils-CcvJVhI4.d.mts → decimation.utils-C0xpslz_.d.mts} +33 -2
  106. package/dist/geometry-BVWJedvw.d.mts +53 -0
  107. package/dist/index.d.mts +16 -17
  108. package/dist/index.mjs +113 -110
  109. package/dist/luminance-TvUgaQ91.d.mts +57 -0
  110. package/dist/orchestrator/index.d.mts +2 -2
  111. package/dist/orchestrator/index.mjs +36 -33
  112. package/dist/plugins/index.mjs +1 -1
  113. package/dist/{property-animations-D433wXzz.d.mts → property-animations-CI0zyp6V.d.mts} +6 -20
  114. package/dist/radial/index.mjs +40 -37
  115. package/dist/renderers/axis/index.mjs +9 -8
  116. package/dist/renderers/index.d.mts +8 -9
  117. package/dist/renderers/index.mjs +78 -75
  118. package/dist/renderers/navigator/index.d.mts +1 -1
  119. package/dist/renderers/navigator/index.mjs +10 -8
  120. package/dist/{ring.utils-DXvrxMkU.d.mts → ring.utils-aHt9Nqum.d.mts} +2 -7
  121. package/dist/{scale-KFv30jqZ.d.mts → scale-CFkPlyUe.d.mts} +2 -2
  122. package/dist/{scales-Drf8AIhL.d.mts → scales-BZzjlR4U.d.mts} +15 -1
  123. package/dist/series/bar/canvas/index.mjs +11 -10
  124. package/dist/series/bar/controller/index.d.mts +17 -0
  125. package/dist/series/bar/controller/index.mjs +47 -44
  126. package/dist/series/bar/controller-canvas/index.mjs +47 -44
  127. package/dist/series/bar/controller-svg/index.mjs +47 -44
  128. package/dist/series/bar/index.d.mts +2 -2
  129. package/dist/series/bar/index.mjs +16 -13
  130. package/dist/series/bar/svg/index.mjs +14 -11
  131. package/dist/series/candlestick/canvas/index.mjs +8 -8
  132. package/dist/series/candlestick/controller/index.d.mts +2 -0
  133. package/dist/series/candlestick/controller/index.mjs +43 -40
  134. package/dist/series/candlestick/controller-canvas/index.mjs +43 -40
  135. package/dist/series/candlestick/controller-svg/index.mjs +43 -40
  136. package/dist/series/candlestick/index.mjs +11 -10
  137. package/dist/series/candlestick/svg/index.mjs +8 -8
  138. package/dist/series/heatmap/canvas/index.mjs +9 -9
  139. package/dist/series/heatmap/controller/index.d.mts +9 -0
  140. package/dist/series/heatmap/controller/index.mjs +26 -23
  141. package/dist/series/heatmap/controller-canvas/index.mjs +26 -23
  142. package/dist/series/heatmap/controller-svg/index.mjs +26 -23
  143. package/dist/series/heatmap/index.mjs +14 -13
  144. package/dist/series/heatmap/svg/index.mjs +11 -10
  145. package/dist/series/line/canvas/index.mjs +9 -9
  146. package/dist/series/line/controller/index.d.mts +7 -0
  147. package/dist/series/line/controller/index.mjs +51 -47
  148. package/dist/series/line/controller-canvas/index.mjs +53 -49
  149. package/dist/series/line/controller-svg/index.mjs +53 -49
  150. package/dist/series/line/index.d.mts +1 -1
  151. package/dist/series/line/index.mjs +17 -13
  152. package/dist/series/line/svg/index.mjs +12 -9
  153. package/dist/series/pie/canvas/index.d.mts +12 -4
  154. package/dist/series/pie/canvas/index.mjs +15 -10
  155. package/dist/series/pie/controller/index.mjs +113 -110
  156. package/dist/series/pie/controller-canvas/index.mjs +113 -110
  157. package/dist/series/pie/controller-svg/index.mjs +113 -110
  158. package/dist/series/pie/index.d.mts +3 -56
  159. package/dist/series/pie/index.mjs +11 -15
  160. package/dist/series/pie/svg/index.d.mts +18 -4
  161. package/dist/series/pie/svg/index.mjs +10 -11
  162. package/dist/series/polar/canvas/index.mjs +7 -7
  163. package/dist/series/polar/controller/index.d.mts +9 -0
  164. package/dist/series/polar/controller/index.mjs +49 -46
  165. package/dist/series/polar/controller-canvas/index.mjs +50 -47
  166. package/dist/series/polar/controller-svg/index.mjs +50 -47
  167. package/dist/series/polar/index.d.mts +1 -1
  168. package/dist/series/polar/index.mjs +19 -16
  169. package/dist/series/polar/svg/index.mjs +11 -8
  170. package/dist/series/radar/canvas/index.mjs +8 -8
  171. package/dist/series/radar/controller/index.d.mts +11 -0
  172. package/dist/series/radar/controller/index.mjs +46 -43
  173. package/dist/series/radar/controller-canvas/index.mjs +49 -46
  174. package/dist/series/radar/controller-svg/index.mjs +49 -46
  175. package/dist/series/radar/index.d.mts +3 -3
  176. package/dist/series/radar/index.mjs +16 -13
  177. package/dist/series/radar/svg/index.mjs +12 -9
  178. package/dist/series/scatter/canvas/index.mjs +13 -11
  179. package/dist/series/scatter/controller/index.mjs +48 -44
  180. package/dist/series/scatter/controller-canvas/index.mjs +50 -46
  181. package/dist/series/scatter/controller-svg/index.mjs +50 -46
  182. package/dist/series/scatter/index.d.mts +1 -1
  183. package/dist/series/scatter/index.mjs +18 -14
  184. package/dist/series/scatter/svg/index.mjs +16 -12
  185. package/dist/series/treemap/canvas/index.mjs +10 -10
  186. package/dist/series/treemap/controller/index.mjs +23 -20
  187. package/dist/series/treemap/controller-canvas/index.mjs +23 -20
  188. package/dist/series/treemap/controller-svg/index.mjs +23 -20
  189. package/dist/series/treemap/index.d.mts +17 -9
  190. package/dist/series/treemap/index.mjs +12 -12
  191. package/dist/series/treemap/svg/index.mjs +9 -9
  192. package/dist/{stacking-CChuAcLN.d.mts → stacking-Dz1OBhzm.d.mts} +1 -1
  193. package/dist/sync/index.mjs +6 -5
  194. package/dist/{tooltip.renderer-D5wpSlBa.d.mts → tooltip.renderer-C3z-UKm4.d.mts} +4 -4
  195. package/dist/utils/color/index.d.mts +11 -53
  196. package/dist/utils/color/index.mjs +4 -4
  197. package/dist/utils/data/index.d.mts +2 -2
  198. package/dist/utils/data/index.mjs +7 -7
  199. package/dist/utils/export/index.mjs +6 -6
  200. package/dist/utils/index.d.mts +7 -7
  201. package/dist/utils/index.mjs +32 -29
  202. package/dist/utils/interaction/index.d.mts +1 -31
  203. package/dist/utils/interaction/index.mjs +12 -9
  204. package/dist/utils/layout/index.mjs +10 -10
  205. package/dist/utils/math/index.d.mts +1 -1
  206. package/dist/utils/math/index.mjs +1 -1
  207. package/dist/utils/render/index.mjs +3 -3
  208. package/dist/utils/specialized/index.d.mts +1 -1
  209. package/dist/utils/specialized/index.mjs +13 -15
  210. package/dist/utils/text/index.d.mts +1 -1
  211. package/dist/utils/text/index.mjs +9 -8
  212. package/dist/utils/theme/index.d.mts +6 -6
  213. package/dist/utils/theme/index.mjs +5 -5
  214. package/dist/utils/zoom/index.mjs +3 -3
  215. package/package.json +5 -10
  216. package/LICENSE +0 -23
  217. package/dist/canvas-D4vigq47.d.mts +0 -34
  218. package/dist/chunk-2QRS4YQ5.mjs +0 -18
  219. package/dist/chunk-53HW45JB.mjs +0 -102
  220. package/dist/chunk-B4FTADAZ.mjs +0 -561
  221. package/dist/chunk-IXOWSEHO.mjs +0 -114
  222. package/dist/chunk-VWF57TS3.mjs +0 -62
  223. package/dist/chunk-XIHBK5D3.mjs +0 -68
  224. package/dist/renderers/circular/index.d.mts +0 -13
  225. package/dist/renderers/circular/index.mjs +0 -13
  226. package/dist/{chunk-WA3OVISZ.mjs → chunks/chunk-4KQZXAHZ.mjs} +0 -0
  227. package/dist/{chunk-CHW4RKY3.mjs → chunks/chunk-576P5DBH.mjs} +0 -0
  228. package/dist/{chunk-EDAKJLNA.mjs → chunks/chunk-5WFF272M.mjs} +0 -0
  229. package/dist/{chunk-ADKLH73T.mjs → chunks/chunk-6XZ6U7GL.mjs} +0 -0
  230. package/dist/{chunk-2QK2KOBN.mjs → chunks/chunk-AOTUNMVD.mjs} +0 -0
  231. package/dist/{chunk-AGU3NG6D.mjs → chunks/chunk-AWMO5TS3.mjs} +0 -0
  232. package/dist/{chunk-SSLTFJ3U.mjs → chunks/chunk-BF7RP4A3.mjs} +132 -132
  233. /package/dist/{chunk-BETFQBM2.mjs → chunks/chunk-FML3QEEI.mjs} +0 -0
  234. /package/dist/{chunk-FFMT6OCO.mjs → chunks/chunk-FRVJH7ZG.mjs} +0 -0
  235. /package/dist/{chunk-HDFGCN2F.mjs → chunks/chunk-HBTCRORW.mjs} +0 -0
  236. /package/dist/{chunk-7CMVDIOU.mjs → chunks/chunk-HXDLOOCS.mjs} +0 -0
  237. /package/dist/{chunk-5JCI2DEB.mjs → chunks/chunk-JQVX6XFW.mjs} +0 -0
  238. /package/dist/{chunk-C36VWQ7A.mjs → chunks/chunk-KMKULH54.mjs} +0 -0
  239. /package/dist/{chunk-Q6PPVIHU.mjs → chunks/chunk-MT3OLVZC.mjs} +0 -0
  240. /package/dist/{chunk-WS64BZXT.mjs → chunks/chunk-OWVSSQZ4.mjs} +0 -0
  241. /package/dist/{chunk-EAMUNLRU.mjs → chunks/chunk-P2LG7GDM.mjs} +0 -0
  242. /package/dist/{chunk-IEGLX7VL.mjs → chunks/chunk-PXUXZADY.mjs} +0 -0
  243. /package/dist/{chunk-SANZPAJ4.mjs → chunks/chunk-SFUDXJKO.mjs} +0 -0
  244. /package/dist/{chunk-ZQFK6CAE.mjs → chunks/chunk-SJNUJM54.mjs} +0 -0
  245. /package/dist/{chunk-AP3UYWYT.mjs → chunks/chunk-SPU6BO3B.mjs} +0 -0
  246. /package/dist/{chunk-YBJ56XJS.mjs → chunks/chunk-T2UAEMHY.mjs} +0 -0
  247. /package/dist/{chunk-JO7VACY2.mjs → chunks/chunk-VADXCPQ4.mjs} +0 -0
  248. /package/dist/{chunk-FRST55HY.mjs → chunks/chunk-ZZCVDIU5.mjs} +0 -0
@@ -1,102 +0,0 @@
1
- import { computeItemHoverState, applyHoverEffects } from './chunk-BZN2QHGP.mjs';
2
- import { FIELD_DEFAULTS, getDefaultColor, resolveDash, resolveAccessor, makeItemContext } from './chunk-O2X6FF45.mjs';
3
- import { toRad } from './chunk-RQ3CKQOX.mjs';
4
-
5
- // src/series/pie/shared.ts
6
- function computeSliceRenderStates(props, layout, theme) {
7
- const { interaction, effects } = props;
8
- const { visibleSlices, center, outerRadius, innerRadius, colors, borderColors, isFullCircle: fullCircle } = layout;
9
- const borderWidth = typeof props.borderStrokeWidth === "number" ? props.borderStrokeWidth : 0;
10
- const dataArr = props.data ?? [];
11
- const seriesExtras = { seriesIndex: props.order ?? 0, seriesId: props.id ?? "" };
12
- const valueAccessor = props.valueField ?? FIELD_DEFAULTS.valueField;
13
- const categoryAccessor = props.categoryField ?? props.labelField ?? FIELD_DEFAULTS.categoryField;
14
- const ctxFor = (i) => {
15
- const value = valueAccessor ? resolveAccessor(valueAccessor, makeItemContext(dataArr[i], i)) ?? null : null;
16
- const category = categoryAccessor ? resolveAccessor(categoryAccessor, makeItemContext(dataArr[i], i)) ?? void 0 : void 0;
17
- return makeItemContext(dataArr[i], i, { value, category, ...seriesExtras });
18
- };
19
- const resolveSliceBorderDash = (i) => resolveDash(props.borderDash, ctxFor(i));
20
- const resolveSliceBorderDashOffset = (i) => resolveAccessor(props.borderDashOffset, ctxFor(i), { arrayMode: "clip", fallback: 0 }) ?? 0;
21
- const resolveSliceOpacity = (i) => resolveAccessor(props.opacity, ctxFor(i), { arrayMode: "clip" });
22
- const resolveSliceHoverColor = (i) => resolveAccessor(props.hoverColor, ctxFor(i), { arrayMode: "cycle" });
23
- const resolveSliceHoverBorderColor = (i) => resolveAccessor(props.hoverBorderColor, ctxFor(i), { arrayMode: "cycle" });
24
- const resolveSliceOffset = (i) => resolveAccessor(props.offset, ctxFor(i), { arrayMode: "clip", fallback: 0 }) ?? 0;
25
- const borderRadius = typeof props.borderRadius === "number" ? props.borderRadius : typeof props.borderRadius === "object" && props.borderRadius !== null && !Array.isArray(props.borderRadius) ? props.borderRadius : void 0;
26
- const hoverEnabled = effects !== void 0;
27
- const slices = visibleSlices.map((slice) => {
28
- const dataIndex = slice.dataIndex;
29
- const userFill = colors[dataIndex];
30
- const borderColor = borderColors[dataIndex];
31
- const canvasFill = userFill ?? getDefaultColor(dataIndex, theme);
32
- const hoverState = computeItemHoverState(dataIndex, interaction?.hoveredIndex, hoverEnabled);
33
- const isInactive = hoverState.hasAnyHover && !hoverState.isHovered;
34
- const itemHoverColor = resolveSliceHoverColor(dataIndex);
35
- const itemHoverBorderColor = resolveSliceHoverBorderColor(dataIndex);
36
- const itemEffects = hoverEnabled && effects && (itemHoverColor !== void 0 || itemHoverBorderColor !== void 0) ? {
37
- ...effects,
38
- hoverBackgroundColor: itemHoverColor ?? effects.hoverBackgroundColor,
39
- hoverBorderColor: itemHoverBorderColor ?? effects.hoverBorderColor
40
- } : hoverEnabled ? effects : void 0;
41
- const {
42
- color: effectColor,
43
- opacity: hoverOpacity,
44
- borderColor: effectBorderColor,
45
- borderStrokeWidth: effectBorderWidth,
46
- borderDash: effectBorderDash,
47
- borderDashOffset: effectBorderDashOffset
48
- } = applyHoverEffects(canvasFill, borderColor, borderWidth, resolveSliceBorderDash(dataIndex), resolveSliceBorderDashOffset(dataIndex), hoverState, itemEffects, theme);
49
- const userOpacity = resolveSliceOpacity(dataIndex);
50
- const opacity = userOpacity !== void 0 ? hoverOpacity * userOpacity : hoverOpacity;
51
- const finalEffectColor = effectColor;
52
- const baseSliceOffset = resolveSliceOffset(dataIndex);
53
- const offset = baseSliceOffset > 0 || hoverEnabled && effects ? calculateSliceOffset(slice, hoverState.isHovered, hoverEnabled ? effects : void 0, baseSliceOffset) : { dx: 0, dy: 0 };
54
- const scale = hoverEnabled && hoverState.isHovered && effects?.hoverScale ? effects.hoverScale : 1;
55
- const arcConfig = {
56
- rotation: slice.rotation,
57
- endAngle: slice.endAngle,
58
- outerRadius,
59
- innerRadius,
60
- borderRadius
61
- };
62
- return {
63
- slice,
64
- dataIndex,
65
- effectColor: finalEffectColor,
66
- effectBorderColor,
67
- effectBorderWidth,
68
- effectBorderDash,
69
- effectBorderDashOffset,
70
- opacity,
71
- // SVG state — class composition + inline overrides
72
- userFill,
73
- userBorder: borderColor === "transparent" ? void 0 : borderColor,
74
- isInactive,
75
- offset,
76
- scale,
77
- arcConfig,
78
- isHovered: hoverState.isHovered
79
- };
80
- });
81
- return {
82
- slices,
83
- center,
84
- outerRadius,
85
- innerRadius,
86
- isFullCircle: fullCircle
87
- };
88
- }
89
- function calculateSliceOffset(slice, isHovered, effects, baseOffset = 0) {
90
- let offset = baseOffset;
91
- if (isHovered && effects?.hoverOffset) {
92
- offset = Math.max(offset, effects.hoverOffset);
93
- }
94
- if (offset === 0) return { dx: 0, dy: 0 };
95
- const angleRad = toRad(slice.valueAngle);
96
- return {
97
- dx: Math.cos(angleRad) * offset,
98
- dy: Math.sin(angleRad) * offset
99
- };
100
- }
101
-
102
- export { computeSliceRenderStates };
@@ -1,561 +0,0 @@
1
- import { computeSliceGeometry, buildPieDataLabelLayout, drawCanvasStraightLeaderLine, drawCanvasLeaderLine, drawCanvasLabelLines } from './chunk-4C6EVJ54.mjs';
2
- import { buildSvgArcPath, CLIP_PIXEL_MARGIN } from './chunk-LVMDQ4OJ.mjs';
3
- import { computeSliceHoverEffects, applySvgHoverFill, applySvgHoverStroke, computeLeaderLineHoverEffects } from './chunk-BZN2QHGP.mjs';
4
- import { createDrawImage } from './chunk-7CMVDIOU.mjs';
5
- import { DEFAULT_FALLBACK_COLOR, DEFAULT_HOVER_BRIGHTNESS } from './chunk-NKUYIWAP.mjs';
6
- import { getDefaultColor, makeItemContext, resolveAccessor, getColor, isGradientColor, remapStopsForDonut, createSvgGradientFromColor } from './chunk-O2X6FF45.mjs';
7
- import { adjustBrightness, svgNode, svgClass, withCanvasState, brightenGradientStops } from './chunk-SSLTFJ3U.mjs';
8
- import { toRad, pointOnCircle } from './chunk-RQ3CKQOX.mjs';
9
-
10
- // src/renderers/circular/svg.ts
11
- function buildSliceRenderContext(slice, renderInfo, position, geo, theme, chartCenter, fontFamily) {
12
- const item = renderInfo.data[slice.originalIndex];
13
- const angle = slice.endAngle - slice.rotation;
14
- const sliceCtx = makeItemContext(item, slice.originalIndex);
15
- const originalValue = Number(resolveAccessor(renderInfo.props.valueField, sliceCtx)) || slice.value;
16
- const sliceLabel = String(resolveAccessor(renderInfo.props.categoryField, sliceCtx) ?? "");
17
- return {
18
- index: slice.originalIndex,
19
- data: item,
20
- value: originalValue,
21
- percentage: slice.percentage,
22
- label: sliceLabel,
23
- color: slice.color ?? getColor(renderInfo.props, slice.originalIndex, item, theme, { value: originalValue, category: sliceLabel }),
24
- center: chartCenter ?? position,
25
- x: position.x,
26
- y: position.y,
27
- angle: geo.midAngle,
28
- isHovered: geo.isHovered,
29
- isVisible: angle > 0.1,
30
- fontFamily: fontFamily ?? "sans-serif"
31
- };
32
- }
33
- function applyGradientBrightness(pathEl, brightness) {
34
- const fill = pathEl.getAttribute("fill") || "";
35
- const match = fill.match(/url\(#([^)]+)\)/);
36
- if (!match) return;
37
- const svgEl = pathEl.ownerSVGElement;
38
- const gradientEl = svgEl?.querySelector(`#${match[1]}`);
39
- if (!gradientEl) return;
40
- const stops = gradientEl.querySelectorAll("stop");
41
- stops.forEach((stop) => {
42
- if (!stop.hasAttribute("data-original-color")) {
43
- stop.setAttribute("data-original-color", stop.getAttribute("stop-color") || "");
44
- }
45
- const originalColor = stop.getAttribute("data-original-color") || "";
46
- if (originalColor) {
47
- stop.setAttribute("stop-color", adjustBrightness(originalColor, brightness));
48
- }
49
- });
50
- }
51
- function restoreGradientBrightness(pathEl) {
52
- const fill = pathEl.getAttribute("data-original-fill") || pathEl.getAttribute("fill") || "";
53
- const match = fill.match(/url\(#([^)]+)\)/);
54
- if (!match) return;
55
- const svgEl = pathEl.ownerSVGElement;
56
- const gradientEl = svgEl?.querySelector(`#${match[1]}`);
57
- if (!gradientEl) return;
58
- const stops = gradientEl.querySelectorAll("stop");
59
- stops.forEach((stop) => {
60
- const originalColor = stop.getAttribute("data-original-color");
61
- if (originalColor) {
62
- stop.setAttribute("stop-color", originalColor);
63
- }
64
- });
65
- }
66
- function updateSvgSlices(frame, refs, hoverConfig, theme, fontFamily) {
67
- const { slices, center, fullCircle, hoverState } = frame;
68
- const hasAnyHover = hoverState.index !== null;
69
- const activeCustomKeys = /* @__PURE__ */ new Set();
70
- for (const slice of slices) {
71
- const key = `${slice.datasetIndex}-${slice.originalIndex}`;
72
- const angle = slice.endAngle - slice.rotation;
73
- const geo = computeSliceGeometry(slice, slice.rotation, frame);
74
- const pathEl = refs.pathElements.get(key);
75
- if (pathEl && angle > 1e-3) {
76
- const pathD = buildSvgArcPath(
77
- {
78
- rotation: geo.renderRotation,
79
- endAngle: geo.renderRotation + geo.renderAngle,
80
- outerRadius: geo.sliceOuterRadius,
81
- innerRadius: geo.sliceInnerRadius,
82
- borderRadius: slice.borderRadius
83
- },
84
- fullCircle
85
- );
86
- pathEl.setAttribute("d", pathD);
87
- const sliceGroup2 = refs.sliceGroups.get(key);
88
- if (sliceGroup2) {
89
- const strokePath = sliceGroup2.querySelector("[data-stroke-path]");
90
- if (strokePath) {
91
- strokePath.setAttribute("d", pathD);
92
- const {
93
- borderStrokeWidth: bw,
94
- borderColor: computedBorderColor,
95
- borderDash: hoverBorderDash
96
- } = computeSliceHoverEffects(slice.color ?? DEFAULT_FALLBACK_COLOR, slice.borderColor ?? "transparent", slice.borderStrokeWidth ?? 0, geo.isHovered, hasAnyHover, hoverConfig, theme);
97
- const bc = geo.isHovered && slice.hoverBorderColor ? slice.hoverBorderColor : computedBorderColor;
98
- const isInner = (frame.borderAlign ?? "inner") === "inner";
99
- if (bw > 0 && bc !== "transparent") {
100
- const joinStyle = frame.borderJoinStyle ?? "miter";
101
- strokePath.setAttribute("stroke", bc);
102
- strokePath.setAttribute("stroke-width", String(isInner ? bw * 2 : bw));
103
- strokePath.setAttribute("stroke-linejoin", joinStyle);
104
- const bd = hoverBorderDash ?? slice.borderDash;
105
- if (bd && bd.length > 0) {
106
- strokePath.setAttribute("stroke-dasharray", bd.join(" "));
107
- strokePath.setAttribute("stroke-dashoffset", String(slice.borderDashOffset ?? 0));
108
- } else {
109
- strokePath.removeAttribute("stroke-dasharray");
110
- strokePath.removeAttribute("stroke-dashoffset");
111
- }
112
- if (isInner) {
113
- const clipId = strokePath.getAttribute("data-clip-id");
114
- if (clipId && !strokePath.getAttribute("clip-path")) {
115
- strokePath.setAttribute("clip-path", `url(#${clipId})`);
116
- }
117
- } else {
118
- strokePath.removeAttribute("clip-path");
119
- }
120
- } else {
121
- strokePath.setAttribute("stroke", "transparent");
122
- strokePath.setAttribute("stroke-width", "0");
123
- strokePath.removeAttribute("stroke-dasharray");
124
- strokePath.removeAttribute("stroke-dashoffset");
125
- }
126
- const clipRef = strokePath.getAttribute("clip-path");
127
- const clipMatch = clipRef?.match(/url\(#([^)]+)\)/);
128
- if (clipMatch) {
129
- const svgEl = strokePath.ownerSVGElement;
130
- const clipPathEl = svgEl?.querySelector(`#${clipMatch[1]} path`);
131
- if (clipPathEl) {
132
- const PIXEL_MARGIN = CLIP_PIXEL_MARGIN;
133
- const angleDelta = geo.sliceOuterRadius > 0 ? PIXEL_MARGIN / geo.sliceOuterRadius * (180 / Math.PI) : 0;
134
- const expandedPath = buildSvgArcPath(
135
- {
136
- rotation: geo.renderRotation - angleDelta,
137
- endAngle: geo.renderRotation + geo.renderAngle + angleDelta,
138
- outerRadius: geo.sliceOuterRadius,
139
- innerRadius: geo.sliceInnerRadius,
140
- borderRadius: slice.borderRadius
141
- },
142
- fullCircle
143
- );
144
- clipPathEl.setAttribute("d", expandedPath);
145
- }
146
- }
147
- }
148
- }
149
- }
150
- const sliceGroup = refs.sliceGroups.get(key);
151
- if (sliceGroup) {
152
- sliceGroup.style.opacity = angle < 0.1 ? "0" : String(slice.userOpacity ?? 1);
153
- const hasOffset = geo.offsetX !== 0 || geo.offsetY !== 0;
154
- const hasScale = geo.scale !== 1;
155
- if (hasOffset || hasScale) {
156
- const parts = [];
157
- if (hasOffset) parts.push(`translate(${geo.offsetX}, ${geo.offsetY})`);
158
- if (hasScale) parts.push(`scale(${geo.scale})`);
159
- sliceGroup.setAttribute("transform", parts.join(" "));
160
- } else {
161
- sliceGroup.removeAttribute("transform");
162
- }
163
- if (pathEl) {
164
- const fillHoverConfig = geo.isHovered && slice.hoverColor ? { ...hoverConfig, backgroundColor: slice.hoverColor } : hoverConfig;
165
- applySvgHoverFill(pathEl, geo.isHovered, hasAnyHover, fillHoverConfig, applyGradientBrightness, restoreGradientBrightness, theme);
166
- applySvgHoverStroke(pathEl, geo.isHovered, hoverConfig);
167
- }
168
- }
169
- const contentSlot = refs.contentSlots.get(key);
170
- if (contentSlot) {
171
- const x = Math.cos(toRad(geo.midAngle)) * geo.midRadius;
172
- const y = Math.sin(toRad(geo.midAngle)) * geo.midRadius;
173
- contentSlot.setAttribute("transform", `translate(${x}, ${y})`);
174
- contentSlot.style.opacity = angle < 0.1 ? "0" : "1";
175
- }
176
- const customEl = refs.customContent.get(key);
177
- if (customEl) {
178
- const pt = pointOnCircle(center.x + geo.offsetX, center.y + geo.offsetY, geo.midAngle, geo.midRadius);
179
- customEl.setAttribute("transform", `translate(${pt.x}, ${pt.y})`);
180
- customEl.style.opacity = String(Math.min(1, angle / 10));
181
- activeCustomKeys.add(key);
182
- let renderInfo;
183
- for (const [, info] of refs.renderFns) {
184
- if (info.datasetIndex === slice.datasetIndex) {
185
- renderInfo = info;
186
- break;
187
- }
188
- }
189
- if (renderInfo && renderInfo.data[slice.originalIndex]) {
190
- const result = renderInfo.fn(buildSliceRenderContext(slice, renderInfo, pt, geo, theme, void 0, fontFamily));
191
- if (result && typeof result === "object" && "text" in result) {
192
- const textEl = customEl.querySelector("text");
193
- if (textEl) {
194
- textEl.textContent = result.text;
195
- }
196
- }
197
- }
198
- }
199
- }
200
- if (activeCustomKeys.size > 0) {
201
- for (const [key, el] of refs.customContent) {
202
- if (!activeCustomKeys.has(key)) {
203
- el.style.opacity = "0";
204
- }
205
- }
206
- }
207
- }
208
- function updatePieCustomContent(frame, refs, theme, fontFamily) {
209
- const { slices, center } = frame;
210
- const activeCustomKeys = /* @__PURE__ */ new Set();
211
- for (const slice of slices) {
212
- const key = `${slice.datasetIndex}-${slice.originalIndex}`;
213
- const angle = slice.endAngle - slice.rotation;
214
- const geo = computeSliceGeometry(slice, slice.rotation, frame);
215
- const customEl = refs.customContent.get(key);
216
- if (!customEl) continue;
217
- const pt = pointOnCircle(center.x + geo.offsetX, center.y + geo.offsetY, geo.midAngle, geo.midRadius);
218
- customEl.setAttribute("transform", `translate(${pt.x}, ${pt.y})`);
219
- customEl.style.opacity = String(Math.min(1, angle / 10));
220
- activeCustomKeys.add(key);
221
- let renderInfo;
222
- for (const [, info] of refs.renderFns) {
223
- if (info.datasetIndex === slice.datasetIndex) {
224
- renderInfo = info;
225
- break;
226
- }
227
- }
228
- if (renderInfo && renderInfo.data[slice.originalIndex]) {
229
- const result = renderInfo.fn(buildSliceRenderContext(slice, renderInfo, pt, geo, theme, void 0, fontFamily));
230
- if (result && typeof result === "object" && "text" in result) {
231
- const textEl = customEl.querySelector("text");
232
- if (textEl) {
233
- textEl.textContent = result.text;
234
- }
235
- }
236
- }
237
- }
238
- if (activeCustomKeys.size > 0) {
239
- for (const [key, el] of refs.customContent) {
240
- if (!activeCustomKeys.has(key)) {
241
- el.style.opacity = "0";
242
- }
243
- }
244
- }
245
- }
246
- function resolveSliceFillDescriptor(slice, isHovered, hasAnyHover, hoverConfig, theme, gradientId, innerRadius, outerRadius) {
247
- const colorValue = slice.colorValue;
248
- const isGradient = colorValue !== void 0 && isGradientColor(colorValue);
249
- let baseFill;
250
- if (isGradient) {
251
- baseFill = `url(#${gradientId})`;
252
- } else if (typeof colorValue === "string") {
253
- baseFill = colorValue;
254
- } else if (typeof slice.color === "string") {
255
- baseFill = slice.color;
256
- } else {
257
- baseFill = theme.series[slice.originalIndex % theme.series.length];
258
- }
259
- const originalFill = baseFill;
260
- const fillHoverConfig = isHovered && slice.hoverColor ? { ...hoverConfig, backgroundColor: slice.hoverColor } : hoverConfig;
261
- let fill = baseFill;
262
- let opacityAttr;
263
- let gradStops = isGradient ? colorValue.stops : void 0;
264
- if (!fillHoverConfig) {
265
- fill = baseFill;
266
- } else {
267
- const brightness = fillHoverConfig.brightness ?? theme.hoverBrightness ?? DEFAULT_HOVER_BRIGHTNESS;
268
- if (isHovered) {
269
- if (fillHoverConfig.backgroundColor) {
270
- fill = fillHoverConfig.backgroundColor;
271
- } else if (isGradient) {
272
- gradStops = brightenGradientStops(colorValue, brightness).stops;
273
- fill = baseFill;
274
- } else {
275
- fill = adjustBrightness(baseFill, brightness);
276
- }
277
- } else if (hasAnyHover && fillHoverConfig.dimOpacity !== void 0 && fillHoverConfig.dimOpacity < 1) {
278
- opacityAttr = String(fillHoverConfig.dimOpacity);
279
- fill = baseFill;
280
- } else {
281
- fill = baseFill;
282
- }
283
- }
284
- let gradientDef;
285
- if (isGradient) {
286
- const cv = colorValue;
287
- const remapped = innerRadius > 0 && cv.radialGradient ? remapStopsForDonut(gradStops ?? cv.stops, innerRadius / outerRadius) : gradStops ?? cv.stops;
288
- const gradientColor = { ...cv, stops: remapped };
289
- gradientDef = createSvgGradientFromColor(gradientColor, gradientId, { x: 0, y: 0 }, outerRadius);
290
- }
291
- return { fill, opacityAttr, originalFill, gradientDef };
292
- }
293
- function buildPieSvgChildren(frame, hoverConfig, theme, chartId, datasetIndex) {
294
- const { fullCircle, hoverState } = frame;
295
- const hasAnyHover = hoverState.index !== null;
296
- const defsChildren = [];
297
- const sliceGroups = [];
298
- for (const slice of frame.slices) {
299
- if (slice.datasetIndex !== datasetIndex) continue;
300
- const dataIndex = slice.originalIndex;
301
- const angle = slice.endAngle - slice.rotation;
302
- const geo = computeSliceGeometry(slice, slice.rotation, frame);
303
- const isHovered = geo.isHovered;
304
- const gradientId = `${chartId}-pie-${datasetIndex}-grad-${dataIndex}`;
305
- const clipId = `${chartId}-pie-${datasetIndex}-clip-${dataIndex}`;
306
- const pathD = buildSvgArcPath(
307
- {
308
- rotation: geo.renderRotation,
309
- endAngle: geo.renderRotation + geo.renderAngle,
310
- outerRadius: geo.sliceOuterRadius,
311
- innerRadius: geo.sliceInnerRadius,
312
- borderRadius: slice.borderRadius
313
- },
314
- fullCircle
315
- );
316
- const PIXEL_MARGIN = CLIP_PIXEL_MARGIN;
317
- const angleDelta = geo.sliceOuterRadius > 0 ? PIXEL_MARGIN / geo.sliceOuterRadius * (180 / Math.PI) : 0;
318
- const expandedClipPath = buildSvgArcPath(
319
- {
320
- rotation: geo.renderRotation - angleDelta,
321
- endAngle: geo.renderRotation + geo.renderAngle + angleDelta,
322
- outerRadius: geo.sliceOuterRadius,
323
- innerRadius: geo.sliceInnerRadius,
324
- borderRadius: slice.borderRadius
325
- },
326
- fullCircle
327
- );
328
- defsChildren.push(svgNode("clipPath", { id: clipId }, [svgNode("path", { d: expandedClipPath })]));
329
- const { fill, opacityAttr, originalFill, gradientDef } = resolveSliceFillDescriptor(slice, isHovered, hasAnyHover, hoverConfig, theme, gradientId, frame.innerRadius, frame.outerRadius);
330
- if (gradientDef) defsChildren.push(gradientDef);
331
- const {
332
- borderStrokeWidth: bw,
333
- borderColor: computedBorderColor,
334
- borderDash: hoverBorderDash
335
- } = computeSliceHoverEffects(slice.color ?? DEFAULT_FALLBACK_COLOR, slice.borderColor ?? "transparent", slice.borderStrokeWidth ?? 0, isHovered, hasAnyHover, hoverConfig, theme);
336
- const bc = isHovered && slice.hoverBorderColor ? slice.hoverBorderColor : computedBorderColor;
337
- const isInner = (frame.borderAlign ?? "inner") === "inner";
338
- const joinStyle = frame.borderJoinStyle ?? "miter";
339
- const strokeAttrs = {
340
- d: pathD,
341
- fill: "none",
342
- "stroke-linejoin": joinStyle,
343
- "data-stroke-path": "true",
344
- "data-clip-id": clipId,
345
- ...isInner ? { "clip-path": `url(#${clipId})` } : {}
346
- };
347
- if (bw > 0 && bc !== "transparent") {
348
- strokeAttrs.stroke = bc;
349
- strokeAttrs["stroke-width"] = String(isInner ? bw * 2 : bw);
350
- const bd = hoverBorderDash ?? slice.borderDash;
351
- if (bd && bd.length > 0) {
352
- strokeAttrs["stroke-dasharray"] = bd.join(" ");
353
- strokeAttrs["stroke-dashoffset"] = String(slice.borderDashOffset ?? 0);
354
- }
355
- } else {
356
- strokeAttrs.stroke = "transparent";
357
- strokeAttrs["stroke-width"] = "0";
358
- }
359
- const colorClassN = `p-chart-color-${dataIndex % 10}`;
360
- const usesColorClass = slice.colorValue === getDefaultColor(slice.originalIndex, theme);
361
- const fillCls = svgClass("p-chart-arc", `p-chart-series-${dataIndex}`, usesColorClass && colorClassN);
362
- const fillAttrs = {
363
- d: pathD,
364
- fill,
365
- "data-index": dataIndex,
366
- class: fillCls,
367
- "data-fill-path": "true",
368
- // applySvgHoverFill / applySvgHoverStroke bookkeeping (only written when a hoverConfig is
369
- // present). applySvgHoverStroke runs on the FILL path (updateSvgSlices:286); on its first
370
- // call it seeds `data-original-stroke` / `data-original-stroke-width` from the fill path's
371
- // (absent) stroke attrs → empty strings. `data-original-stroke-dasharray` is only seeded
372
- // when a base dasharray exists (the fill path never has one), so it stays absent here.
373
- ...hoverConfig ? { "data-original-fill": originalFill, "data-original-stroke": "", "data-original-stroke-width": "" } : {},
374
- ...opacityAttr !== void 0 ? { opacity: opacityAttr } : {}
375
- };
376
- if (isHovered && hoverConfig && (hoverConfig.borderColor || hoverConfig.borderStrokeWidth !== void 0)) {
377
- if (hoverConfig.borderColor) fillAttrs.stroke = hoverConfig.borderColor;
378
- if (hoverConfig.borderStrokeWidth !== void 0) fillAttrs["stroke-width"] = String(hoverConfig.borderStrokeWidth * 2);
379
- if (hoverConfig.borderDash) fillAttrs["stroke-dasharray"] = hoverConfig.borderDash.join(" ");
380
- fillAttrs["paint-order"] = "stroke fill";
381
- }
382
- const fillPath = svgNode("path", fillAttrs);
383
- const strokePath = svgNode("path", strokeAttrs);
384
- const slotX = Math.cos(toRad(geo.midAngle)) * geo.midRadius;
385
- const slotY = Math.sin(toRad(geo.midAngle)) * geo.midRadius;
386
- const contentSlot = svgNode("g", {
387
- class: "slice-content",
388
- "data-content-index": dataIndex,
389
- transform: `translate(${slotX}, ${slotY})`,
390
- opacity: angle < 0.1 ? "0" : "1"
391
- });
392
- const hasOffset = geo.offsetX !== 0 || geo.offsetY !== 0;
393
- const hasScale = geo.scale !== 1;
394
- const transformParts = [];
395
- if (hasOffset) transformParts.push(`translate(${geo.offsetX}, ${geo.offsetY})`);
396
- if (hasScale) transformParts.push(`scale(${geo.scale})`);
397
- const groupAttrs = {
398
- "data-slice-index": dataIndex,
399
- "data-index": dataIndex,
400
- // userOpacity + span<0.1 hide, as an ATTRIBUTE (normalized vs style in the parity test).
401
- opacity: angle < 0.1 ? "0" : String(slice.userOpacity ?? 1),
402
- ...transformParts.length > 0 ? { transform: transformParts.join(" ") } : {}
403
- };
404
- sliceGroups.push(svgNode("g", groupAttrs, [fillPath, strokePath, contentSlot]));
405
- }
406
- return defsChildren.length > 0 ? [svgNode("defs", void 0, defsChildren), ...sliceGroups] : sliceGroups;
407
- }
408
-
409
- // src/renderers/circular/shared.ts
410
- function buildSliceRenderContext2(slice, renderInfo, position, geo, chartCenter, fontFamily) {
411
- const item = renderInfo.data[slice.originalIndex];
412
- const angle = slice.endAngle - slice.rotation;
413
- const sliceCtx = makeItemContext(item, slice.originalIndex);
414
- const originalValue = Number(resolveAccessor(renderInfo.props.valueField, sliceCtx)) || slice.value;
415
- return {
416
- index: slice.originalIndex,
417
- data: item,
418
- value: originalValue,
419
- percentage: slice.percentage,
420
- label: String(resolveAccessor(renderInfo.props.categoryField, sliceCtx) ?? ""),
421
- color: slice.color ?? getColor(renderInfo.props, slice.originalIndex, item),
422
- center: chartCenter ?? position,
423
- x: position.x,
424
- y: position.y,
425
- angle: geo.midAngle,
426
- isHovered: geo.isHovered,
427
- isVisible: angle > 0.1,
428
- fontFamily: fontFamily ?? "sans-serif"
429
- };
430
- }
431
-
432
- // src/renderers/circular/canvas.ts
433
- function buildSliceRenderContext3(slice, renderInfo, position, geo, theme, chartCenter, fontFamily) {
434
- const item = renderInfo.data[slice.originalIndex];
435
- const angle = slice.endAngle - slice.rotation;
436
- const sliceCtx = makeItemContext(item, slice.originalIndex);
437
- const originalValue = Number(resolveAccessor(renderInfo.props.valueField, sliceCtx)) || slice.value;
438
- const sliceLabel = String(resolveAccessor(renderInfo.props.categoryField, sliceCtx) ?? "");
439
- return {
440
- index: slice.originalIndex,
441
- data: item,
442
- value: originalValue,
443
- percentage: slice.percentage,
444
- label: sliceLabel,
445
- color: slice.color ?? getColor(renderInfo.props, slice.originalIndex, item, theme, { value: originalValue, category: sliceLabel }),
446
- center: position,
447
- x: position.x,
448
- y: position.y,
449
- angle: geo.midAngle,
450
- isHovered: geo.isHovered,
451
- isVisible: angle > 0.1,
452
- fontFamily: fontFamily ?? "sans-serif"
453
- };
454
- }
455
- function renderCanvasDataLabels(ctx, frame, viewportBounds, labelConfig, textColor, datasetPropsMap, hoverConfig, theme, onImageLoad) {
456
- const { center, hoverState } = frame;
457
- const built = buildPieDataLabelLayout(frame, labelConfig, { width: viewportBounds.width, height: viewportBounds.height }, datasetPropsMap);
458
- if (!built) return;
459
- const { labelLayout, configsByIndex: labelConfigByIndex, labelSlices: sliceMap } = built;
460
- const hasAnyHover = hoverState.index !== null;
461
- const drawOptions = {
462
- fontSize: labelConfig.fontSize,
463
- fontFamily: labelConfig.fontFamily,
464
- fontWeight: labelConfig.fontWeight,
465
- lineHeight: labelConfig.lineHeight,
466
- textOffset: labelConfig.textOffset,
467
- centered: labelConfig.lineStyle === "none"
468
- };
469
- for (const labelItem of labelLayout.labels) {
470
- const { index, color: lineColor, side } = labelItem;
471
- const slice = sliceMap.get(index);
472
- const isSliceHovered = slice ? hoverState.datasetIndex === slice.datasetIndex && hoverState.index === slice.originalIndex : false;
473
- const { strokeColor, strokeWidth } = computeLeaderLineHoverEffects(lineColor, isSliceHovered, hasAnyHover, hoverConfig, theme);
474
- const absLeaderLine = {
475
- x1: center.x + labelItem.leaderLine.x1,
476
- y1: center.y + labelItem.leaderLine.y1,
477
- x2: center.x + labelItem.leaderLine.x2,
478
- y2: center.y + labelItem.leaderLine.y2,
479
- x3: center.x + labelItem.leaderLine.x3,
480
- y3: center.y + labelItem.leaderLine.y3
481
- };
482
- if (labelConfig.render) {
483
- const originalConfig = labelConfigByIndex.get(index);
484
- const textX = center.x + labelItem.x + (side === "right" ? drawOptions.textOffset : -drawOptions.textOffset);
485
- const textY = center.y + labelItem.y;
486
- let handled = false;
487
- withCanvasState(ctx, () => {
488
- ctx.translate(textX, textY);
489
- const renderContext = {
490
- index,
491
- value: originalConfig?.value ?? 0,
492
- percentage: originalConfig?.percentage ?? 0,
493
- formattedText: originalConfig?.text ?? "",
494
- label: originalConfig?.label ?? "",
495
- // Per-label color override wins over the leader-line/slice color in the custom render context.
496
- color: labelItem.textColor ?? textColor ?? lineColor,
497
- x: textX,
498
- y: textY,
499
- side,
500
- leaderLine: absLeaderLine,
501
- center: { x: center.x, y: center.y },
502
- ctx,
503
- drawImage: onImageLoad ? createDrawImage(ctx, onImageLoad) : void 0
504
- };
505
- labelConfig.render(renderContext);
506
- handled = true;
507
- });
508
- if (handled) continue;
509
- }
510
- const lineStrokeColor = labelItem.connectorColor ?? strokeColor;
511
- const lineStrokeWidth = labelItem.connectorWidth ?? strokeWidth;
512
- if (labelConfig.lineStyle === "straight") {
513
- drawCanvasStraightLeaderLine(ctx, labelItem, center.x, center.y, lineStrokeColor, lineStrokeWidth);
514
- } else if (labelConfig.lineStyle !== "none") {
515
- drawCanvasLeaderLine(ctx, labelItem, center.x, center.y, lineStrokeColor, lineStrokeWidth);
516
- }
517
- const perLabelDrawOptions = labelItem.fontSize !== void 0 ? { ...drawOptions, fontSize: labelItem.fontSize } : drawOptions;
518
- const perLabelTextColor = labelItem.textColor ?? textColor;
519
- drawCanvasLabelLines(ctx, labelItem, center.x, center.y, perLabelTextColor, perLabelDrawOptions);
520
- }
521
- }
522
- function renderCanvasCustomContent(ctx, frame, canvasRenderFns, onImageLoad, theme, fontFamily) {
523
- const { slices, center } = frame;
524
- for (const slice of slices) {
525
- let renderInfo;
526
- for (const [, info] of canvasRenderFns) {
527
- if (info.datasetIndex === slice.datasetIndex) {
528
- renderInfo = info;
529
- break;
530
- }
531
- }
532
- if (renderInfo && renderInfo.data[slice.originalIndex]) {
533
- const angle = slice.endAngle - slice.rotation;
534
- const geo = computeSliceGeometry(slice, slice.rotation, frame);
535
- const x = center.x + Math.cos(toRad(geo.midAngle)) * geo.midRadius + geo.offsetX;
536
- const y = center.y + Math.sin(toRad(geo.midAngle)) * geo.midRadius + geo.offsetY;
537
- const opacity = Math.min(1, angle / 10);
538
- const renderContext = buildSliceRenderContext3(slice, renderInfo, { x, y }, geo, theme, void 0, fontFamily);
539
- if (renderContext.isVisible) {
540
- withCanvasState(ctx, () => {
541
- ctx.globalAlpha = opacity;
542
- ctx.translate(x, y);
543
- renderContext.ctx = ctx;
544
- renderContext.drawImage = createDrawImage(ctx, onImageLoad);
545
- const result = renderInfo.fn(renderContext);
546
- if (result && typeof result === "object" && "text" in result) {
547
- const { text, style } = result;
548
- const ff = style?.fontFamily ?? fontFamily ?? "sans-serif";
549
- ctx.font = `${style?.fontWeight ?? "normal"} ${style?.fontSize ?? "12px"} ${ff}`;
550
- ctx.fillStyle = style?.fill ?? style?.color ?? "#fff";
551
- ctx.textAlign = "center";
552
- ctx.textBaseline = "middle";
553
- ctx.fillText(text, 0, 0);
554
- }
555
- });
556
- }
557
- }
558
- }
559
- }
560
-
561
- export { applyGradientBrightness, buildPieSvgChildren, buildSliceRenderContext2 as buildSliceRenderContext, renderCanvasCustomContent, renderCanvasDataLabels, restoreGradientBrightness, updatePieCustomContent, updateSvgSlices };