@mantine᜵charts-umd

UMD build of @mantine/charts

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/518747/1490441/%40mantine%E1%9C%B5charts-umd.js

  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('@mantine/core'), require('react'), require('recharts'), require('@mantine/hooks')) :
  3. typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', '@mantine/core', 'react', 'recharts', '@mantine/hooks'], factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.MantineCharts = {}, global.ReactJSXRuntime, global.MantineCore, global.React, global.Recharts, global.MantineHooks));
  5. })(this, (function (exports, jsxRuntime, core, react, recharts, hooks) { 'use strict';
  6.  
  7. function getSeriesLabels(series) {
  8. if (!series) {
  9. return {};
  10. }
  11. return series.reduce((acc, item) => {
  12. const matchFound = item.name.search(/\./);
  13. if (matchFound >= 0) {
  14. const key = item.name.substring(matchFound + 1);
  15. acc[key] = item.label;
  16. return acc;
  17. }
  18. acc[item.name] = item.label;
  19. return acc;
  20. }, {});
  21. }
  22.  
  23. var classes = { "tooltip": "m_e4d36c9b", "tooltipLabel": "m_7f4bcb19", "tooltipBody": "m_3de554dd", "tooltipItemColor": "m_b30369b5", "tooltipItem": "m_3de8964e", "tooltipItemBody": "m_50186d10", "tooltipItemName": "m_501dadf9", "tooltipItemData": "m_50192318" };
  24.  
  25. function updateChartTooltipPayload(payload) {
  26. return payload.map((item) => {
  27. if (!item.payload || item.payload[item.name]) {
  28. return item;
  29. }
  30. const matchFound = item.name.search(/\./);
  31. if (matchFound >= 0) {
  32. const newDataKey = item.name.substring(0, matchFound);
  33. const nestedPayload = { ...item.payload[newDataKey] };
  34. const shallowPayload = Object.entries(item.payload).reduce((acc, current) => {
  35. const [k, v] = current;
  36. return k === newDataKey ? acc : { ...acc, [k]: v };
  37. }, {});
  38. return {
  39. ...item,
  40. name: item.name.substring(matchFound + 1),
  41. payload: {
  42. ...shallowPayload,
  43. ...nestedPayload
  44. }
  45. };
  46. }
  47. return item;
  48. });
  49. }
  50. function getFilteredChartTooltipPayload(payload, segmentId) {
  51. const duplicatesFilter = updateChartTooltipPayload(
  52. payload.filter((item) => item.fill !== "none" || !item.color)
  53. );
  54. if (!segmentId) {
  55. return duplicatesFilter;
  56. }
  57. return duplicatesFilter.filter((item) => item.name === segmentId);
  58. }
  59. function getData(item, type) {
  60. if (type === "radial" || type === "scatter") {
  61. if (Array.isArray(item.value)) {
  62. return item.value[1] - item.value[0];
  63. }
  64. return item.value;
  65. }
  66. if (Array.isArray(item.payload[item.dataKey])) {
  67. return item.payload[item.dataKey][1] - item.payload[item.dataKey][0];
  68. }
  69. return item.payload[item.name];
  70. }
  71. var defaultProps = {
  72. type: "area",
  73. showColor: true
  74. };
  75. var ChartTooltip = core.factory((_props, ref) => {
  76. const props = core.useProps("ChartTooltip", defaultProps, _props);
  77. const {
  78. classNames,
  79. className,
  80. style,
  81. styles,
  82. unstyled,
  83. vars,
  84. payload,
  85. label,
  86. unit,
  87. type,
  88. segmentId,
  89. mod,
  90. series,
  91. valueFormatter,
  92. showColor,
  93. ...others
  94. } = props;
  95. const theme = core.useMantineTheme();
  96. const getStyles = core.useStyles({
  97. name: "ChartTooltip",
  98. classes,
  99. props,
  100. className,
  101. style,
  102. classNames,
  103. styles,
  104. unstyled
  105. });
  106. if (!payload) {
  107. return null;
  108. }
  109. const filteredPayload = getFilteredChartTooltipPayload(payload, segmentId);
  110. const scatterLabel = type === "scatter" ? payload[0]?.payload?.name : null;
  111. const labels = getSeriesLabels(series);
  112. const _label = label || scatterLabel;
  113. const items = filteredPayload.map((item) => jsxRuntime.jsxs("div", { "data-type": type, ...getStyles("tooltipItem"), children: [
  114. jsxRuntime.jsxs("div", { ...getStyles("tooltipItemBody"), children: [
  115. showColor && jsxRuntime.jsx("svg", { ...getStyles("tooltipItemColor"), children: jsxRuntime.jsx(
  116. "circle",
  117. {
  118. r: 6,
  119. fill: core.getThemeColor(item.color, theme),
  120. width: 12,
  121. height: 12,
  122. cx: 6,
  123. cy: 6
  124. }
  125. ) }),
  126. jsxRuntime.jsx("div", { ...getStyles("tooltipItemName"), children: labels[item.name] || item.name })
  127. ] }),
  128. jsxRuntime.jsxs("div", { ...getStyles("tooltipItemData"), children: [
  129. typeof valueFormatter === "function" ? valueFormatter(getData(item, type)) : getData(item, type),
  130. unit || item.unit
  131. ] })
  132. ] }, item?.key ?? item.name));
  133. return jsxRuntime.jsxs(core.Box, { ...getStyles("tooltip"), mod: [{ type }, mod], ref, ...others, children: [
  134. _label && jsxRuntime.jsx("div", { ...getStyles("tooltipLabel"), children: _label }),
  135. jsxRuntime.jsx("div", { ...getStyles("tooltipBody"), children: items })
  136. ] });
  137. });
  138. ChartTooltip.displayName = "@mantine/charts/ChartTooltip";
  139.  
  140. var classes2 = { "legend": "m_847eaf", "legendItem": "m_17da7e62", "legendItemColor": "m_6e236e21", "legendItemName": "m_8ff56c0d" };
  141.  
  142. function updateChartLegendPayload(payload) {
  143. return payload.map((item) => {
  144. const newDataKey = item.dataKey?.split(".").pop();
  145. return {
  146. ...item,
  147. dataKey: newDataKey,
  148. payload: {
  149. ...item.payload,
  150. name: newDataKey,
  151. dataKey: newDataKey
  152. }
  153. };
  154. });
  155. }
  156. function getFilteredChartLegendPayload(payload) {
  157. return updateChartLegendPayload(payload.filter((item) => item.color !== "none"));
  158. }
  159. var defaultProps2 = {};
  160. var ChartLegend = core.factory((_props, ref) => {
  161. const props = core.useProps("ChartLegend", defaultProps2, _props);
  162. const {
  163. classNames,
  164. className,
  165. style,
  166. styles,
  167. unstyled,
  168. vars,
  169. payload,
  170. onHighlight,
  171. legendPosition,
  172. mod,
  173. series,
  174. showColor,
  175. centered,
  176. ...others
  177. } = props;
  178. const getStyles = core.useStyles({
  179. name: "ChartLegend",
  180. classes: classes2,
  181. props,
  182. className,
  183. style,
  184. classNames,
  185. styles,
  186. unstyled
  187. });
  188. if (!payload) {
  189. return null;
  190. }
  191. const filteredPayload = getFilteredChartLegendPayload(payload);
  192. const labels = getSeriesLabels(series);
  193. const items = filteredPayload.map((item, index) => jsxRuntime.jsxs(
  194. "div",
  195. {
  196. ...getStyles("legendItem"),
  197. onMouseEnter: () => onHighlight(item.dataKey),
  198. onMouseLeave: () => onHighlight(null),
  199. "data-without-color": showColor === false || void 0,
  200. children: [
  201. jsxRuntime.jsx(
  202. core.ColorSwatch,
  203. {
  204. color: item.color,
  205. size: 12,
  206. ...getStyles("legendItemColor"),
  207. withShadow: false
  208. }
  209. ),
  210. jsxRuntime.jsx("p", { ...getStyles("legendItemName"), children: labels[item.dataKey] || item.dataKey })
  211. ]
  212. },
  213. index
  214. ));
  215. return jsxRuntime.jsx(
  216. core.Box,
  217. {
  218. ref,
  219. mod: [{ position: legendPosition, centered }, mod],
  220. ...getStyles("legend"),
  221. ...others,
  222. children: items
  223. }
  224. );
  225. });
  226. ChartLegend.displayName = "@mantine/charts/ChartLegend";
  227. function PointLabel({ x, y, value }) {
  228. return jsxRuntime.jsx("g", { transform: `translate(${x},${y})`, children: jsxRuntime.jsx(
  229. "text",
  230. {
  231. x: 0,
  232. y: 0,
  233. dy: -8,
  234. dx: -10,
  235. textAnchor: "top",
  236. fill: "var(--chart-text-color, var(--mantine-color-dimmed))",
  237. fontSize: 8,
  238. children: value
  239. }
  240. ) });
  241. }
  242. function AreaGradient({ color, id, withGradient, fillOpacity }) {
  243. return jsxRuntime.jsx(jsxRuntime.Fragment, { children: withGradient ? jsxRuntime.jsxs("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
  244. jsxRuntime.jsx("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
  245. jsxRuntime.jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
  246. ] }) : jsxRuntime.jsx("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: jsxRuntime.jsx("stop", { stopColor: color, stopOpacity: fillOpacity ?? 0.2 }) }) });
  247. }
  248. AreaGradient.displayName = "@mantine/charts/AreaGradient";
  249. function AreaSplit({ offset, id, colors, fillOpacity }) {
  250. const theme = core.useMantineTheme();
  251. return jsxRuntime.jsxs("linearGradient", { id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
  252. jsxRuntime.jsx(
  253. "stop",
  254. {
  255. offset,
  256. stopColor: core.getThemeColor(colors[0], theme),
  257. stopOpacity: fillOpacity ?? 0.2
  258. }
  259. ),
  260. jsxRuntime.jsx(
  261. "stop",
  262. {
  263. offset,
  264. stopColor: core.getThemeColor(colors[1], theme),
  265. stopOpacity: fillOpacity ?? 0.2
  266. }
  267. )
  268. ] });
  269. }
  270. AreaSplit.displayName = "@mantine/charts/AreaSplit";
  271.  
  272. function getSplitOffset({ data, dataKey }) {
  273. const dataMax = Math.max(...data.map((item) => item[dataKey]));
  274. const dataMin = Math.min(...data.map((item) => item[dataKey]));
  275. if (dataMax <= 0) {
  276. return 0;
  277. }
  278. if (dataMin >= 0) {
  279. return 1;
  280. }
  281. return dataMax / (dataMax - dataMin);
  282. }
  283. function getDefaultSplitOffset({ data, series }) {
  284. if (series.length === 1) {
  285. const dataKey = series[0].name;
  286. return getSplitOffset({ data, dataKey });
  287. }
  288. return 0.5;
  289. }
  290.  
  291. var classes3 = { "root": "m_a50f3e58", "container": "m_af9188cb", "grid": "m_a50a48bc", "axis": "m_a507a517", "axisLabel": "m_2293801d", "tooltip": "m_92b296cd" };
  292.  
  293. function valueToPercent(value) {
  294. return `${(value * 100).toFixed(0)}%`;
  295. }
  296. var defaultProps3 = {
  297. withXAxis: true,
  298. withYAxis: true,
  299. withDots: true,
  300. withTooltip: true,
  301. connectNulls: true,
  302. strokeWidth: 2,
  303. tooltipAnimationDuration: 0,
  304. fillOpacity: 0.2,
  305. tickLine: "y",
  306. strokeDasharray: "5 5",
  307. curveType: "monotone",
  308. gridAxis: "x",
  309. type: "default",
  310. splitColors: ["green.7", "red.7"],
  311. orientation: "horizontal"
  312. };
  313. var varsResolver = core.createVarsResolver((theme, { textColor, gridColor }) => ({
  314. root: {
  315. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
  316. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
  317. }
  318. }));
  319. var AreaChart = core.factory((_props, ref) => {
  320. const props = core.useProps("AreaChart", defaultProps3, _props);
  321. const {
  322. classNames,
  323. className,
  324. style,
  325. styles,
  326. unstyled,
  327. vars,
  328. data,
  329. series,
  330. withGradient,
  331. dataKey,
  332. withXAxis,
  333. withYAxis,
  334. curveType,
  335. gridProps,
  336. withDots,
  337. tickLine,
  338. strokeDasharray,
  339. gridAxis,
  340. unit,
  341. yAxisProps,
  342. xAxisProps,
  343. dotProps,
  344. activeDotProps,
  345. strokeWidth,
  346. tooltipAnimationDuration,
  347. type,
  348. legendProps,
  349. tooltipProps,
  350. withLegend,
  351. withTooltip,
  352. areaChartProps,
  353. fillOpacity,
  354. splitColors,
  355. splitOffset,
  356. connectNulls,
  357. onMouseLeave,
  358. orientation,
  359. referenceLines,
  360. dir,
  361. valueFormatter,
  362. children,
  363. areaProps,
  364. xAxisLabel,
  365. yAxisLabel,
  366. withRightYAxis,
  367. rightYAxisLabel,
  368. rightYAxisProps,
  369. withPointLabels,
  370. ...others
  371. } = props;
  372. const theme = core.useMantineTheme();
  373. const baseId = react.useId();
  374. const splitId = `${baseId}-split`;
  375. const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
  376. const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
  377. const isAnimationActive = (tooltipAnimationDuration || 0) > 0;
  378. const _withGradient = typeof withGradient === "boolean" ? withGradient : type === "default";
  379. const stacked = type === "stacked" || type === "percent";
  380. const [highlightedArea, setHighlightedArea] = react.useState(null);
  381. const shouldHighlight = highlightedArea !== null;
  382. const handleMouseLeave = (event) => {
  383. setHighlightedArea(null);
  384. onMouseLeave?.(event);
  385. };
  386. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  387. classNames,
  388. styles,
  389. props
  390. });
  391. const getStyles = core.useStyles({
  392. name: "AreaChart",
  393. classes: classes3,
  394. props,
  395. className,
  396. style,
  397. classNames,
  398. styles,
  399. unstyled,
  400. vars,
  401. varsResolver
  402. });
  403. const dotsAreas = series.map((item) => {
  404. const color = core.getThemeColor(item.color, theme);
  405. const dimmed = shouldHighlight && highlightedArea !== item.name;
  406. return react.createElement(
  407. recharts.Area,
  408. {
  409. ...getStyles("area"),
  410. activeDot: { fill: theme.white, stroke: color, strokeWidth: 2, r: 4, ...activeDotProps },
  411. dot: { fill: color, fillOpacity: dimmed ? 0 : 1, strokeWidth: 2, r: 4, ...dotProps },
  412. key: item.name,
  413. name: item.name,
  414. type: curveType,
  415. dataKey: item.name,
  416. fill: "none",
  417. strokeWidth,
  418. stroke: "none",
  419. isAnimationActive: false,
  420. connectNulls,
  421. stackId: stacked ? "stack-dots" : void 0,
  422. yAxisId: item.yAxisId || "left",
  423. ...typeof areaProps === "function" ? areaProps(item) : areaProps
  424. }
  425. );
  426. });
  427. const areas = series.map((item) => {
  428. const id = `${baseId}-${item.color.replace(/[^a-zA-Z0-9]/g, "")}`;
  429. const color = core.getThemeColor(item.color, theme);
  430. const dimmed = shouldHighlight && highlightedArea !== item.name;
  431. return jsxRuntime.jsxs(react.Fragment, { children: [
  432. jsxRuntime.jsx("defs", { children: jsxRuntime.jsx(
  433. AreaGradient,
  434. {
  435. color,
  436. withGradient: _withGradient,
  437. id,
  438. fillOpacity
  439. }
  440. ) }),
  441. jsxRuntime.jsx(
  442. recharts.Area,
  443. {
  444. ...getStyles("area"),
  445. activeDot: false,
  446. dot: false,
  447. name: item.name,
  448. type: curveType,
  449. dataKey: item.name,
  450. fill: type === "split" ? `url(#${splitId})` : `url(#${id})`,
  451. strokeWidth,
  452. stroke: color,
  453. isAnimationActive: false,
  454. connectNulls,
  455. stackId: stacked ? "stack" : void 0,
  456. fillOpacity: dimmed ? 0 : 1,
  457. strokeOpacity: dimmed ? 0.5 : 1,
  458. strokeDasharray: item.strokeDasharray,
  459. yAxisId: item.yAxisId || "left",
  460. label: withPointLabels ? jsxRuntime.jsx(PointLabel, {}) : void 0,
  461. ...typeof areaProps === "function" ? areaProps(item) : areaProps
  462. }
  463. )
  464. ] }, item.name);
  465. });
  466. const referenceLinesItems = referenceLines?.map((line, index) => {
  467. const color = core.getThemeColor(line.color, theme);
  468. return jsxRuntime.jsx(
  469. recharts.ReferenceLine,
  470. {
  471. stroke: line.color ? color : "var(--chart-grid-color)",
  472. strokeWidth: 1,
  473. yAxisId: line.yAxisId || "left",
  474. ...line,
  475. label: {
  476. value: line.label,
  477. fill: line.color ? color : "currentColor",
  478. fontSize: 12,
  479. position: line.labelPosition ?? "insideBottomLeft"
  480. },
  481. ...getStyles("referenceLine")
  482. },
  483. index
  484. );
  485. });
  486. const tickFormatter = type === "percent" ? valueToPercent : valueFormatter;
  487. const sharedYAxisProps = {
  488. axisLine: false,
  489. ...orientation === "vertical" ? { dataKey, type: "category" } : { type: "number" },
  490. tickLine: withYTickLine ? { stroke: "currentColor" } : false,
  491. allowDecimals: true,
  492. unit,
  493. tickFormatter: orientation === "vertical" ? void 0 : tickFormatter,
  494. ...getStyles("axis")
  495. };
  496. return jsxRuntime.jsx(
  497. core.Box,
  498. {
  499. ref,
  500. ...getStyles("root"),
  501. onMouseLeave: handleMouseLeave,
  502. dir: dir || "ltr",
  503. ...others,
  504. children: jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: jsxRuntime.jsxs(
  505. recharts.AreaChart,
  506. {
  507. data,
  508. stackOffset: type === "percent" ? "expand" : void 0,
  509. layout: orientation,
  510. margin: {
  511. bottom: xAxisLabel ? 30 : void 0,
  512. left: yAxisLabel ? 10 : void 0,
  513. right: yAxisLabel ? 5 : void 0
  514. },
  515. ...areaChartProps,
  516. children: [
  517. referenceLinesItems,
  518. withLegend && jsxRuntime.jsx(
  519. recharts.Legend,
  520. {
  521. verticalAlign: "top",
  522. content: (payload) => jsxRuntime.jsx(
  523. ChartLegend,
  524. {
  525. payload: payload.payload,
  526. onHighlight: setHighlightedArea,
  527. legendPosition: legendProps?.verticalAlign || "top",
  528. classNames: resolvedClassNames,
  529. styles: resolvedStyles,
  530. series
  531. }
  532. ),
  533. ...legendProps
  534. }
  535. ),
  536. jsxRuntime.jsx(
  537. recharts.CartesianGrid,
  538. {
  539. strokeDasharray,
  540. vertical: gridAxis === "y" || gridAxis === "xy",
  541. horizontal: gridAxis === "x" || gridAxis === "xy",
  542. ...getStyles("grid"),
  543. ...gridProps
  544. }
  545. ),
  546. jsxRuntime.jsxs(
  547. recharts.XAxis,
  548. {
  549. hide: !withXAxis,
  550. ...orientation === "vertical" ? { type: "number" } : { dataKey },
  551. tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
  552. stroke: "",
  553. interval: "preserveStartEnd",
  554. tickLine: withXTickLine ? { stroke: "currentColor" } : false,
  555. minTickGap: 5,
  556. tickFormatter: orientation === "vertical" ? tickFormatter : void 0,
  557. ...getStyles("axis"),
  558. ...xAxisProps,
  559. children: [
  560. xAxisLabel && jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
  561. xAxisProps?.children
  562. ]
  563. }
  564. ),
  565. jsxRuntime.jsxs(
  566. recharts.YAxis,
  567. {
  568. yAxisId: "left",
  569. orientation: "left",
  570. tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
  571. hide: !withYAxis,
  572. ...sharedYAxisProps,
  573. ...yAxisProps,
  574. children: [
  575. yAxisLabel && jsxRuntime.jsx(
  576. recharts.Label,
  577. {
  578. position: "insideLeft",
  579. angle: -90,
  580. textAnchor: "middle",
  581. fontSize: 12,
  582. offset: -5,
  583. ...getStyles("axisLabel"),
  584. children: yAxisLabel
  585. }
  586. ),
  587. yAxisProps?.children
  588. ]
  589. }
  590. ),
  591. jsxRuntime.jsxs(
  592. recharts.YAxis,
  593. {
  594. yAxisId: "right",
  595. orientation: "right",
  596. tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
  597. hide: !withRightYAxis,
  598. ...sharedYAxisProps,
  599. ...rightYAxisProps,
  600. children: [
  601. rightYAxisLabel && jsxRuntime.jsx(
  602. recharts.Label,
  603. {
  604. position: "insideRight",
  605. angle: 90,
  606. textAnchor: "middle",
  607. fontSize: 12,
  608. offset: -5,
  609. ...getStyles("axisLabel"),
  610. children: rightYAxisLabel
  611. }
  612. ),
  613. yAxisProps?.children
  614. ]
  615. }
  616. ),
  617. withTooltip && jsxRuntime.jsx(
  618. recharts.Tooltip,
  619. {
  620. animationDuration: tooltipAnimationDuration,
  621. isAnimationActive,
  622. position: orientation === "vertical" ? {} : { y: 0 },
  623. cursor: {
  624. stroke: "var(--chart-grid-color)",
  625. strokeWidth: 1,
  626. strokeDasharray
  627. },
  628. content: ({ label, payload }) => jsxRuntime.jsx(
  629. ChartTooltip,
  630. {
  631. label,
  632. payload,
  633. unit,
  634. classNames: resolvedClassNames,
  635. styles: resolvedStyles,
  636. series,
  637. valueFormatter
  638. }
  639. ),
  640. ...tooltipProps
  641. }
  642. ),
  643. type === "split" && jsxRuntime.jsx("defs", { children: jsxRuntime.jsx(
  644. AreaSplit,
  645. {
  646. colors: splitColors,
  647. id: splitId,
  648. offset: splitOffset ?? getDefaultSplitOffset({ data, series }),
  649. fillOpacity
  650. }
  651. ) }),
  652. areas,
  653. withDots && dotsAreas,
  654. children
  655. ]
  656. }
  657. ) })
  658. }
  659. );
  660. });
  661. AreaChart.classes = classes3;
  662. AreaChart.displayName = "@mantine/charts/AreaChart";
  663. function BarLabel({
  664. value,
  665. valueFormatter,
  666. textBreakAll,
  667. parentViewBox,
  668. orientation,
  669. viewBox,
  670. width,
  671. height,
  672. ...others
  673. }) {
  674. return jsxRuntime.jsx(
  675. "text",
  676. {
  677. ...others,
  678. dy: orientation === "vertical" ? height / 2 + 4 : -10,
  679. dx: orientation === "vertical" ? width - 30 : 0,
  680. fontSize: 12,
  681. fill: "var(--chart-bar-label-color, var(--mantine-color-dimmed))",
  682. children: typeof valueFormatter === "function" ? valueFormatter(value) : value
  683. }
  684. );
  685. }
  686.  
  687. function valueToPercent2(value) {
  688. return `${(value * 100).toFixed(0)}%`;
  689. }
  690. var defaultProps4 = {
  691. withXAxis: true,
  692. withYAxis: true,
  693. withTooltip: true,
  694. tooltipAnimationDuration: 0,
  695. fillOpacity: 1,
  696. tickLine: "y",
  697. strokeDasharray: "5 5",
  698. gridAxis: "x",
  699. type: "default"
  700. };
  701. var varsResolver2 = core.createVarsResolver(
  702. (theme, { textColor, gridColor, cursorFill, barLabelColor }) => ({
  703. root: {
  704. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
  705. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0,
  706. "--chart-cursor-fill": cursorFill ? core.getThemeColor(cursorFill, theme) : void 0,
  707. "--chart-bar-label-color": barLabelColor ? core.getThemeColor(barLabelColor, theme) : void 0
  708. }
  709. })
  710. );
  711. function calculateCumulativeTotal(waterfallData, dataKey) {
  712. let start = 0;
  713. let end = 0;
  714. return waterfallData.map((item) => {
  715. if (item.standalone) {
  716. for (const prop in item) {
  717. if (typeof item[prop] === "number" && prop !== dataKey) {
  718. item[prop] = [0, item[prop]];
  719. }
  720. }
  721. } else {
  722. for (const prop in item) {
  723. if (typeof item[prop] === "number" && prop !== dataKey) {
  724. end += item[prop];
  725. item[prop] = [start, end];
  726. start = end;
  727. }
  728. }
  729. }
  730. return item;
  731. });
  732. }
  733. function getBarFill(barProps, series) {
  734. if (typeof barProps === "function") {
  735. return barProps(series).fill;
  736. }
  737. return barProps?.fill;
  738. }
  739. var BarChart = core.factory((_props, ref) => {
  740. const props = core.useProps("BarChart", defaultProps4, _props);
  741. const {
  742. classNames,
  743. className,
  744. style,
  745. styles,
  746. unstyled,
  747. vars,
  748. data,
  749. withLegend,
  750. legendProps,
  751. series,
  752. onMouseLeave,
  753. dataKey,
  754. withTooltip,
  755. withXAxis,
  756. withYAxis,
  757. gridAxis,
  758. tickLine,
  759. xAxisProps,
  760. yAxisProps,
  761. unit,
  762. tooltipAnimationDuration,
  763. strokeDasharray,
  764. gridProps,
  765. tooltipProps,
  766. referenceLines,
  767. fillOpacity,
  768. barChartProps,
  769. type,
  770. orientation,
  771. dir,
  772. valueFormatter,
  773. children,
  774. barProps,
  775. xAxisLabel,
  776. yAxisLabel,
  777. withBarValueLabel,
  778. withRightYAxis,
  779. rightYAxisLabel,
  780. rightYAxisProps,
  781. minBarSize,
  782. maxBarWidth,
  783. mod,
  784. ...others
  785. } = props;
  786. const theme = core.useMantineTheme();
  787. const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
  788. const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
  789. const [highlightedArea, setHighlightedArea] = react.useState(null);
  790. const shouldHighlight = highlightedArea !== null;
  791. const stacked = type === "stacked" || type === "percent";
  792. const handleMouseLeave = (event) => {
  793. setHighlightedArea(null);
  794. onMouseLeave?.(event);
  795. };
  796. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  797. classNames,
  798. styles,
  799. props
  800. });
  801. const inputData = type === "waterfall" ? calculateCumulativeTotal(data, dataKey) : data;
  802. const getStyles = core.useStyles({
  803. name: "BarChart",
  804. classes: classes3,
  805. props,
  806. className,
  807. style,
  808. classNames,
  809. styles,
  810. unstyled,
  811. vars,
  812. varsResolver: varsResolver2
  813. });
  814. const bars = series.map((item) => {
  815. const color = core.getThemeColor(item.color, theme);
  816. const dimmed = shouldHighlight && highlightedArea !== item.name;
  817. return react.createElement(
  818. recharts.Bar,
  819. {
  820. ...getStyles("bar"),
  821. key: item.name,
  822. name: item.name,
  823. dataKey: item.name,
  824. fill: color,
  825. stroke: color,
  826. isAnimationActive: false,
  827. fillOpacity: dimmed ? 0.1 : fillOpacity,
  828. strokeOpacity: dimmed ? 0.2 : 0,
  829. stackId: stacked ? "stack" : item.stackId || void 0,
  830. label: withBarValueLabel ? jsxRuntime.jsx(BarLabel, { valueFormatter, orientation }) : void 0,
  831. yAxisId: item.yAxisId || "left",
  832. minPointSize: minBarSize,
  833. ...typeof barProps === "function" ? barProps(item) : barProps
  834. },
  835. inputData.map((entry, index) => jsxRuntime.jsx(
  836. recharts.Cell,
  837. {
  838. fill: entry.color ? core.getThemeColor(entry.color, theme) : getBarFill(barProps, item) || color
  839. },
  840. `cell-${index}`
  841. ))
  842. );
  843. });
  844. const referenceLinesItems = referenceLines?.map((line, index) => {
  845. const color = core.getThemeColor(line.color, theme);
  846. return jsxRuntime.jsx(
  847. recharts.ReferenceLine,
  848. {
  849. stroke: line.color ? color : "var(--chart-grid-color)",
  850. strokeWidth: 1,
  851. yAxisId: line.yAxisId || "left",
  852. ...line,
  853. label: {
  854. value: line.label,
  855. fill: line.color ? color : "currentColor",
  856. fontSize: 12,
  857. position: line.labelPosition ?? "insideBottomLeft"
  858. },
  859. ...getStyles("referenceLine")
  860. },
  861. index
  862. );
  863. });
  864. const tickFormatter = type === "percent" ? valueToPercent2 : valueFormatter;
  865. const sharedYAxisProps = {
  866. axisLine: false,
  867. ...orientation === "vertical" ? { dataKey, type: "category" } : { type: "number" },
  868. tickLine: withYTickLine ? { stroke: "currentColor" } : false,
  869. allowDecimals: true,
  870. unit,
  871. tickFormatter: orientation === "vertical" ? void 0 : tickFormatter,
  872. ...getStyles("axis")
  873. };
  874. return jsxRuntime.jsx(
  875. core.Box,
  876. {
  877. ref,
  878. ...getStyles("root"),
  879. onMouseLeave: handleMouseLeave,
  880. dir: dir || "ltr",
  881. mod: [{ orientation }, mod],
  882. ...others,
  883. children: jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: jsxRuntime.jsxs(
  884. recharts.BarChart,
  885. {
  886. data: inputData,
  887. stackOffset: type === "percent" ? "expand" : void 0,
  888. layout: orientation,
  889. maxBarSize: maxBarWidth,
  890. margin: {
  891. bottom: xAxisLabel ? 30 : void 0,
  892. left: yAxisLabel ? 10 : void 0,
  893. right: yAxisLabel ? 5 : void 0
  894. },
  895. ...barChartProps,
  896. children: [
  897. withLegend && jsxRuntime.jsx(
  898. recharts.Legend,
  899. {
  900. verticalAlign: "top",
  901. content: (payload) => jsxRuntime.jsx(
  902. ChartLegend,
  903. {
  904. payload: payload.payload,
  905. onHighlight: setHighlightedArea,
  906. legendPosition: legendProps?.verticalAlign || "top",
  907. classNames: resolvedClassNames,
  908. styles: resolvedStyles,
  909. series,
  910. showColor: type !== "waterfall"
  911. }
  912. ),
  913. ...legendProps
  914. }
  915. ),
  916. jsxRuntime.jsxs(
  917. recharts.XAxis,
  918. {
  919. hide: !withXAxis,
  920. ...orientation === "vertical" ? { type: "number" } : { dataKey },
  921. tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
  922. stroke: "",
  923. interval: "preserveStartEnd",
  924. tickLine: withXTickLine ? { stroke: "currentColor" } : false,
  925. minTickGap: 5,
  926. tickFormatter: orientation === "vertical" ? tickFormatter : void 0,
  927. ...getStyles("axis"),
  928. ...xAxisProps,
  929. children: [
  930. xAxisLabel && jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
  931. xAxisProps?.children
  932. ]
  933. }
  934. ),
  935. jsxRuntime.jsxs(
  936. recharts.YAxis,
  937. {
  938. yAxisId: "left",
  939. orientation: "left",
  940. tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
  941. hide: !withYAxis,
  942. ...sharedYAxisProps,
  943. ...yAxisProps,
  944. children: [
  945. yAxisLabel && jsxRuntime.jsx(
  946. recharts.Label,
  947. {
  948. position: "insideLeft",
  949. angle: -90,
  950. textAnchor: "middle",
  951. fontSize: 12,
  952. offset: -5,
  953. ...getStyles("axisLabel"),
  954. children: yAxisLabel
  955. }
  956. ),
  957. yAxisProps?.children
  958. ]
  959. }
  960. ),
  961. jsxRuntime.jsxs(
  962. recharts.YAxis,
  963. {
  964. yAxisId: "right",
  965. orientation: "right",
  966. tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
  967. hide: !withRightYAxis,
  968. ...sharedYAxisProps,
  969. ...rightYAxisProps,
  970. children: [
  971. rightYAxisLabel && jsxRuntime.jsx(
  972. recharts.Label,
  973. {
  974. position: "insideRight",
  975. angle: 90,
  976. textAnchor: "middle",
  977. fontSize: 12,
  978. offset: -5,
  979. ...getStyles("axisLabel"),
  980. children: rightYAxisLabel
  981. }
  982. ),
  983. yAxisProps?.children
  984. ]
  985. }
  986. ),
  987. jsxRuntime.jsx(
  988. recharts.CartesianGrid,
  989. {
  990. strokeDasharray,
  991. vertical: gridAxis === "y" || gridAxis === "xy",
  992. horizontal: gridAxis === "x" || gridAxis === "xy",
  993. ...getStyles("grid"),
  994. ...gridProps
  995. }
  996. ),
  997. withTooltip && jsxRuntime.jsx(
  998. recharts.Tooltip,
  999. {
  1000. animationDuration: tooltipAnimationDuration,
  1001. isAnimationActive: tooltipAnimationDuration !== 0,
  1002. position: orientation === "vertical" ? {} : { y: 0 },
  1003. cursor: {
  1004. stroke: "var(--chart-grid-color)",
  1005. strokeWidth: 1,
  1006. strokeDasharray,
  1007. fill: "var(--chart-cursor-fill)"
  1008. },
  1009. content: ({ label, payload }) => jsxRuntime.jsx(
  1010. ChartTooltip,
  1011. {
  1012. label,
  1013. payload,
  1014. type: type === "waterfall" ? "scatter" : void 0,
  1015. unit,
  1016. classNames: resolvedClassNames,
  1017. styles: resolvedStyles,
  1018. series,
  1019. valueFormatter
  1020. }
  1021. ),
  1022. ...tooltipProps
  1023. }
  1024. ),
  1025. bars,
  1026. referenceLinesItems,
  1027. children
  1028. ]
  1029. }
  1030. ) })
  1031. }
  1032. );
  1033. });
  1034. BarChart.displayName = "@mantine/charts/BarChart";
  1035. BarChart.classes = classes3;
  1036. var defaultProps5 = {
  1037. withXAxis: true,
  1038. withYAxis: true,
  1039. withTooltip: true,
  1040. tooltipAnimationDuration: 0,
  1041. fillOpacity: 1,
  1042. tickLine: "y",
  1043. strokeDasharray: "5 5",
  1044. gridAxis: "x",
  1045. withDots: true,
  1046. connectNulls: true,
  1047. strokeWidth: 2,
  1048. curveType: "monotone",
  1049. gradientStops: [
  1050. { offset: 0, color: "red" },
  1051. { offset: 100, color: "blue" }
  1052. ]
  1053. };
  1054. var varsResolver3 = core.createVarsResolver((theme, { textColor, gridColor }) => ({
  1055. root: {
  1056. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
  1057. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
  1058. }
  1059. }));
  1060. var LineChart = core.factory((_props, ref) => {
  1061. const props = core.useProps("LineChart", defaultProps5, _props);
  1062. const {
  1063. classNames,
  1064. className,
  1065. style,
  1066. styles,
  1067. unstyled,
  1068. vars,
  1069. data,
  1070. withLegend,
  1071. legendProps,
  1072. series,
  1073. onMouseLeave,
  1074. dataKey,
  1075. withTooltip,
  1076. withXAxis,
  1077. withYAxis,
  1078. gridAxis,
  1079. tickLine,
  1080. xAxisProps,
  1081. yAxisProps,
  1082. unit,
  1083. tooltipAnimationDuration,
  1084. strokeDasharray,
  1085. gridProps,
  1086. tooltipProps,
  1087. referenceLines,
  1088. withDots,
  1089. dotProps,
  1090. activeDotProps,
  1091. strokeWidth,
  1092. lineChartProps,
  1093. connectNulls,
  1094. fillOpacity,
  1095. curveType,
  1096. orientation,
  1097. dir,
  1098. valueFormatter,
  1099. children,
  1100. lineProps,
  1101. xAxisLabel,
  1102. yAxisLabel,
  1103. type,
  1104. gradientStops,
  1105. withRightYAxis,
  1106. rightYAxisLabel,
  1107. rightYAxisProps,
  1108. withPointLabels,
  1109. ...others
  1110. } = props;
  1111. const theme = core.useMantineTheme();
  1112. const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
  1113. const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
  1114. const [highlightedArea, setHighlightedArea] = react.useState(null);
  1115. const shouldHighlight = highlightedArea !== null;
  1116. const handleMouseLeave = (event) => {
  1117. setHighlightedArea(null);
  1118. onMouseLeave?.(event);
  1119. };
  1120. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  1121. classNames,
  1122. styles,
  1123. props
  1124. });
  1125. const getStyles = core.useStyles({
  1126. name: "LineChart",
  1127. classes: classes3,
  1128. props,
  1129. className,
  1130. style,
  1131. classNames,
  1132. styles,
  1133. unstyled,
  1134. vars,
  1135. varsResolver: varsResolver3
  1136. });
  1137. const id = hooks.useId();
  1138. const gradientId = `line-chart-gradient-${id}`;
  1139. const stops = gradientStops?.map((stop) => jsxRuntime.jsx(
  1140. "stop",
  1141. {
  1142. offset: `${stop.offset}%`,
  1143. stopColor: core.getThemeColor(stop.color, theme)
  1144. },
  1145. stop.color
  1146. ));
  1147. const lines = series.map((item) => {
  1148. const color = core.getThemeColor(item.color, theme);
  1149. const dimmed = shouldHighlight && highlightedArea !== item.name;
  1150. return react.createElement(
  1151. recharts.Line,
  1152. {
  1153. ...getStyles("line"),
  1154. key: item.name,
  1155. name: item.name,
  1156. dataKey: item.name,
  1157. dot: withDots ? {
  1158. fillOpacity: dimmed ? 0 : 1,
  1159. strokeOpacity: dimmed ? 0 : 1,
  1160. strokeWidth: 1,
  1161. fill: type === "gradient" ? "var(--mantine-color-gray-7)" : color,
  1162. stroke: type === "gradient" ? "white" : color,
  1163. ...dotProps
  1164. } : false,
  1165. activeDot: withDots ? {
  1166. fill: type === "gradient" ? "var(--mantine-color-gray-7)" : color,
  1167. stroke: type === "gradient" ? "white" : color,
  1168. ...activeDotProps
  1169. } : false,
  1170. fill: color,
  1171. stroke: type === "gradient" ? `url(#${gradientId})` : color,
  1172. strokeWidth,
  1173. isAnimationActive: false,
  1174. fillOpacity: dimmed ? 0 : fillOpacity,
  1175. strokeOpacity: dimmed ? 0.5 : fillOpacity,
  1176. connectNulls,
  1177. type: curveType,
  1178. strokeDasharray: item.strokeDasharray,
  1179. yAxisId: item.yAxisId || "left",
  1180. label: withPointLabels ? jsxRuntime.jsx(PointLabel, {}) : void 0,
  1181. ...typeof lineProps === "function" ? lineProps(item) : lineProps
  1182. }
  1183. );
  1184. });
  1185. const referenceLinesItems = referenceLines?.map((line, index) => {
  1186. const color = core.getThemeColor(line.color, theme);
  1187. return jsxRuntime.jsx(
  1188. recharts.ReferenceLine,
  1189. {
  1190. stroke: line.color ? color : "var(--chart-grid-color)",
  1191. strokeWidth: 1,
  1192. yAxisId: line.yAxisId || "left",
  1193. ...line,
  1194. label: {
  1195. value: line.label,
  1196. fill: line.color ? color : "currentColor",
  1197. fontSize: 12,
  1198. position: line.labelPosition ?? "insideBottomLeft"
  1199. },
  1200. ...getStyles("referenceLine")
  1201. },
  1202. index
  1203. );
  1204. });
  1205. const sharedYAxisProps = {
  1206. axisLine: false,
  1207. ...orientation === "vertical" ? { dataKey, type: "category" } : { type: "number" },
  1208. tickLine: withYTickLine ? { stroke: "currentColor" } : false,
  1209. allowDecimals: true,
  1210. unit,
  1211. tickFormatter: orientation === "vertical" ? void 0 : valueFormatter,
  1212. ...getStyles("axis")
  1213. };
  1214. return jsxRuntime.jsx(
  1215. core.Box,
  1216. {
  1217. ref,
  1218. ...getStyles("root"),
  1219. onMouseLeave: handleMouseLeave,
  1220. dir: dir || "ltr",
  1221. ...others,
  1222. children: jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: jsxRuntime.jsxs(
  1223. recharts.LineChart,
  1224. {
  1225. data,
  1226. layout: orientation,
  1227. margin: {
  1228. bottom: xAxisLabel ? 30 : void 0,
  1229. left: yAxisLabel ? 10 : void 0,
  1230. right: yAxisLabel ? 5 : void 0
  1231. },
  1232. ...lineChartProps,
  1233. children: [
  1234. type === "gradient" && jsxRuntime.jsx("defs", { children: jsxRuntime.jsx("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: stops }) }),
  1235. withLegend && jsxRuntime.jsx(
  1236. recharts.Legend,
  1237. {
  1238. verticalAlign: "top",
  1239. content: (payload) => jsxRuntime.jsx(
  1240. ChartLegend,
  1241. {
  1242. payload: payload.payload,
  1243. onHighlight: setHighlightedArea,
  1244. legendPosition: legendProps?.verticalAlign || "top",
  1245. classNames: resolvedClassNames,
  1246. styles: resolvedStyles,
  1247. series,
  1248. showColor: type !== "gradient"
  1249. }
  1250. ),
  1251. ...legendProps
  1252. }
  1253. ),
  1254. jsxRuntime.jsxs(
  1255. recharts.XAxis,
  1256. {
  1257. hide: !withXAxis,
  1258. ...orientation === "vertical" ? { type: "number" } : { dataKey },
  1259. tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
  1260. stroke: "",
  1261. interval: "preserveStartEnd",
  1262. tickLine: withXTickLine ? { stroke: "currentColor" } : false,
  1263. minTickGap: 5,
  1264. tickFormatter: orientation === "vertical" ? valueFormatter : void 0,
  1265. ...getStyles("axis"),
  1266. ...xAxisProps,
  1267. children: [
  1268. xAxisLabel && jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
  1269. xAxisProps?.children
  1270. ]
  1271. }
  1272. ),
  1273. jsxRuntime.jsxs(
  1274. recharts.YAxis,
  1275. {
  1276. yAxisId: "left",
  1277. orientation: "left",
  1278. tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
  1279. hide: !withYAxis,
  1280. ...sharedYAxisProps,
  1281. ...yAxisProps,
  1282. children: [
  1283. yAxisLabel && jsxRuntime.jsx(
  1284. recharts.Label,
  1285. {
  1286. position: "insideLeft",
  1287. angle: -90,
  1288. textAnchor: "middle",
  1289. fontSize: 12,
  1290. offset: -5,
  1291. ...getStyles("axisLabel"),
  1292. children: yAxisLabel
  1293. }
  1294. ),
  1295. yAxisProps?.children
  1296. ]
  1297. }
  1298. ),
  1299. jsxRuntime.jsxs(
  1300. recharts.YAxis,
  1301. {
  1302. yAxisId: "right",
  1303. orientation: "right",
  1304. tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
  1305. hide: !withRightYAxis,
  1306. ...sharedYAxisProps,
  1307. ...rightYAxisProps,
  1308. children: [
  1309. rightYAxisLabel && jsxRuntime.jsx(
  1310. recharts.Label,
  1311. {
  1312. position: "insideRight",
  1313. angle: 90,
  1314. textAnchor: "middle",
  1315. fontSize: 12,
  1316. offset: -5,
  1317. ...getStyles("axisLabel"),
  1318. children: rightYAxisLabel
  1319. }
  1320. ),
  1321. yAxisProps?.children
  1322. ]
  1323. }
  1324. ),
  1325. jsxRuntime.jsx(
  1326. recharts.CartesianGrid,
  1327. {
  1328. strokeDasharray,
  1329. vertical: gridAxis === "y" || gridAxis === "xy",
  1330. horizontal: gridAxis === "x" || gridAxis === "xy",
  1331. ...getStyles("grid"),
  1332. ...gridProps
  1333. }
  1334. ),
  1335. withTooltip && jsxRuntime.jsx(
  1336. recharts.Tooltip,
  1337. {
  1338. animationDuration: tooltipAnimationDuration,
  1339. isAnimationActive: tooltipAnimationDuration !== 0,
  1340. position: orientation === "vertical" ? {} : { y: 0 },
  1341. cursor: {
  1342. stroke: "var(--chart-grid-color)",
  1343. strokeWidth: 1,
  1344. strokeDasharray
  1345. },
  1346. content: ({ label, payload }) => jsxRuntime.jsx(
  1347. ChartTooltip,
  1348. {
  1349. label,
  1350. payload,
  1351. unit,
  1352. classNames: resolvedClassNames,
  1353. styles: resolvedStyles,
  1354. series,
  1355. valueFormatter,
  1356. showColor: type !== "gradient"
  1357. }
  1358. ),
  1359. ...tooltipProps
  1360. }
  1361. ),
  1362. lines,
  1363. referenceLinesItems,
  1364. children
  1365. ]
  1366. }
  1367. ) })
  1368. }
  1369. );
  1370. });
  1371. LineChart.displayName = "@mantine/charts/LineChart";
  1372. LineChart.classes = classes3;
  1373. var classes4 = {};
  1374. var defaultProps6 = {
  1375. withGradient: true,
  1376. connectNulls: true,
  1377. fillOpacity: 0.6,
  1378. strokeWidth: 2,
  1379. curveType: "linear"
  1380. };
  1381. function getTrendColor(data, trendColors) {
  1382. const first = data[0];
  1383. const last = data[data.length - 1];
  1384. if (first === null || last === null) {
  1385. return trendColors.neutral || trendColors.positive;
  1386. }
  1387. if (first < last) {
  1388. return trendColors.positive;
  1389. }
  1390. if (first > last) {
  1391. return trendColors.negative;
  1392. }
  1393. return trendColors.neutral || trendColors.positive;
  1394. }
  1395. var varsResolver4 = core.createVarsResolver(
  1396. (theme, { color, data, trendColors }) => ({
  1397. root: {
  1398. "--chart-color": trendColors ? core.getThemeColor(getTrendColor(data, trendColors), theme) : color ? core.getThemeColor(color, theme) : void 0
  1399. }
  1400. })
  1401. );
  1402. var Sparkline = core.factory((_props, ref) => {
  1403. const props = core.useProps("Sparkline", defaultProps6, _props);
  1404. const {
  1405. classNames,
  1406. className,
  1407. style,
  1408. styles,
  1409. unstyled,
  1410. vars,
  1411. data,
  1412. withGradient,
  1413. fillOpacity,
  1414. curveType,
  1415. strokeWidth,
  1416. trendColors,
  1417. connectNulls,
  1418. areaProps,
  1419. ...others
  1420. } = props;
  1421. const getStyles = core.useStyles({
  1422. name: "Sparkline",
  1423. classes: classes4,
  1424. props,
  1425. className,
  1426. style,
  1427. classNames,
  1428. styles,
  1429. unstyled,
  1430. vars,
  1431. varsResolver: varsResolver4
  1432. });
  1433. const id = react.useId();
  1434. const mappedData = react.useMemo(() => data.map((value, index) => ({ value, index })), [data]);
  1435. return jsxRuntime.jsx(core.Box, { ref, ...getStyles("root"), ...others, dir: "ltr", children: jsxRuntime.jsx(recharts.ResponsiveContainer, { children: jsxRuntime.jsxs(recharts.AreaChart, { data: mappedData, children: [
  1436. jsxRuntime.jsx(
  1437. recharts.Area,
  1438. {
  1439. dataKey: "value",
  1440. type: curveType,
  1441. fill: `url(#${id})`,
  1442. stroke: "var(--chart-color, var(--mantine-color-blue-filled))",
  1443. isAnimationActive: false,
  1444. connectNulls,
  1445. strokeWidth,
  1446. fillOpacity: 1,
  1447. ...areaProps
  1448. }
  1449. ),
  1450. jsxRuntime.jsx("defs", { children: jsxRuntime.jsx(
  1451. AreaGradient,
  1452. {
  1453. id,
  1454. color: "var(--chart-color, var(--mantine-color-blue-filled))",
  1455. fillOpacity,
  1456. withGradient
  1457. }
  1458. ) })
  1459. ] }) }) });
  1460. });
  1461. Sparkline.displayName = "@mantine/charts/Sparkline";
  1462. Sparkline.classes = classes4;
  1463.  
  1464. var classes5 = { "root": "m_a410e613", "label": "m_ddb0bfe3" };
  1465.  
  1466. var defaultProps7 = {
  1467. withTooltip: true,
  1468. withLabelsLine: true,
  1469. paddingAngle: 0,
  1470. thickness: 20,
  1471. size: 160,
  1472. strokeWidth: 1,
  1473. startAngle: 0,
  1474. endAngle: 360,
  1475. tooltipDataSource: "all"
  1476. };
  1477. var varsResolver5 = core.createVarsResolver(
  1478. (theme, { strokeColor, labelColor, withLabels, size }) => ({
  1479. root: {
  1480. "--chart-stroke-color": strokeColor ? core.getThemeColor(strokeColor, theme) : void 0,
  1481. "--chart-labels-color": labelColor ? core.getThemeColor(labelColor, theme) : void 0,
  1482. "--chart-size": withLabels ? core.rem(size + 80) : core.rem(size)
  1483. }
  1484. })
  1485. );
  1486. var DonutChart = core.factory((_props, ref) => {
  1487. const props = core.useProps("DonutChart", defaultProps7, _props);
  1488. const {
  1489. classNames,
  1490. className,
  1491. style,
  1492. styles,
  1493. unstyled,
  1494. vars,
  1495. data,
  1496. withTooltip,
  1497. tooltipAnimationDuration,
  1498. tooltipProps,
  1499. pieProps,
  1500. paddingAngle,
  1501. withLabels,
  1502. withLabelsLine,
  1503. size,
  1504. thickness,
  1505. strokeWidth,
  1506. startAngle,
  1507. endAngle,
  1508. tooltipDataSource,
  1509. chartLabel,
  1510. children,
  1511. pieChartProps,
  1512. valueFormatter,
  1513. strokeColor,
  1514. ...others
  1515. } = props;
  1516. const theme = core.useMantineTheme();
  1517. const getStyles = core.useStyles({
  1518. name: "DonutChart",
  1519. classes: classes5,
  1520. props,
  1521. className,
  1522. style,
  1523. classNames,
  1524. styles,
  1525. unstyled,
  1526. vars,
  1527. varsResolver: varsResolver5
  1528. });
  1529. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  1530. classNames,
  1531. styles,
  1532. props
  1533. });
  1534. const cells = data.map((item, index) => jsxRuntime.jsx(
  1535. recharts.Cell,
  1536. {
  1537. fill: core.getThemeColor(item.color, theme),
  1538. stroke: "var(--chart-stroke-color, var(--mantine-color-body))",
  1539. strokeWidth
  1540. },
  1541. index
  1542. ));
  1543. return jsxRuntime.jsx(core.Box, { ref, size, ...getStyles("root"), ...others, children: jsxRuntime.jsx(recharts.ResponsiveContainer, { children: jsxRuntime.jsxs(recharts.PieChart, { ...pieChartProps, children: [
  1544. jsxRuntime.jsx(
  1545. recharts.Pie,
  1546. {
  1547. data,
  1548. innerRadius: size / 2 - thickness,
  1549. outerRadius: size / 2,
  1550. dataKey: "value",
  1551. isAnimationActive: false,
  1552. paddingAngle,
  1553. startAngle,
  1554. endAngle,
  1555. label: withLabels ? {
  1556. fill: "var(--chart-labels-color, var(--mantine-color-dimmed))",
  1557. fontSize: 12,
  1558. fontFamily: "var(--mantine-font-family)"
  1559. } : false,
  1560. labelLine: withLabelsLine ? {
  1561. stroke: "var(--chart-label-color, var(--mantine-color-dimmed))",
  1562. strokeWidth: 1
  1563. } : false,
  1564. ...pieProps,
  1565. children: cells
  1566. }
  1567. ),
  1568. chartLabel && jsxRuntime.jsx(
  1569. "text",
  1570. {
  1571. x: "50%",
  1572. y: "50%",
  1573. textAnchor: "middle",
  1574. dominantBaseline: "middle",
  1575. ...getStyles("label"),
  1576. children: chartLabel
  1577. }
  1578. ),
  1579. withTooltip && jsxRuntime.jsx(
  1580. recharts.Tooltip,
  1581. {
  1582. animationDuration: tooltipAnimationDuration,
  1583. isAnimationActive: false,
  1584. content: ({ payload }) => jsxRuntime.jsx(
  1585. ChartTooltip,
  1586. {
  1587. payload: data,
  1588. classNames: resolvedClassNames,
  1589. styles: resolvedStyles,
  1590. type: "radial",
  1591. segmentId: tooltipDataSource === "segment" ? payload?.[0]?.name : void 0,
  1592. valueFormatter
  1593. }
  1594. ),
  1595. ...tooltipProps
  1596. }
  1597. ),
  1598. children
  1599. ] }) }) });
  1600. });
  1601. DonutChart.displayName = "@mantine/charts/DonutChart";
  1602. DonutChart.classes = classes5;
  1603.  
  1604. var classes6 = { "root": "m_cd8943fd" };
  1605.  
  1606. var defaultProps8 = {
  1607. withTooltip: false,
  1608. withLabelsLine: true,
  1609. paddingAngle: 0,
  1610. size: 160,
  1611. strokeWidth: 1,
  1612. startAngle: 0,
  1613. endAngle: 360,
  1614. tooltipDataSource: "all",
  1615. labelsPosition: "outside",
  1616. labelsType: "value"
  1617. };
  1618. var varsResolver6 = core.createVarsResolver(
  1619. (theme, { strokeColor, labelColor, withLabels, size, labelsPosition }) => ({
  1620. root: {
  1621. "--chart-stroke-color": strokeColor ? core.getThemeColor(strokeColor, theme) : void 0,
  1622. "--chart-labels-color": labelColor ? core.getThemeColor(labelColor, theme) : void 0,
  1623. "--chart-size": withLabels && labelsPosition === "outside" ? core.rem(size + 80) : core.rem(size)
  1624. }
  1625. })
  1626. );
  1627. var getLabelValue = (labelsType, value, percent, valueFormatter) => {
  1628. if (labelsType === "percent") {
  1629. return `${(percent * 100).toFixed(0)}%`;
  1630. }
  1631. if (typeof valueFormatter === "function") {
  1632. return valueFormatter(value);
  1633. }
  1634. return value;
  1635. };
  1636. var getInsideLabel = (labelsType, valueFormatter) => ({ cx, cy, midAngle, innerRadius, outerRadius, value, percent }) => {
  1637. const RADIAN = Math.PI / 180;
  1638. const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
  1639. const x = cx + radius * Math.cos(-midAngle * RADIAN);
  1640. const y = cy + radius * Math.sin(-midAngle * RADIAN);
  1641. return jsxRuntime.jsx(
  1642. "text",
  1643. {
  1644. x,
  1645. y,
  1646. textAnchor: x > cx ? "start" : "end",
  1647. dominantBaseline: "central",
  1648. className: classes6.label,
  1649. children: getLabelValue(labelsType, value, percent, valueFormatter)
  1650. }
  1651. );
  1652. };
  1653. var getOutsideLabel = (labelsType, valueFormatter) => ({ x, y, cx, cy, percent, value }) => jsxRuntime.jsx(
  1654. "text",
  1655. {
  1656. x,
  1657. y,
  1658. cx,
  1659. cy,
  1660. textAnchor: x > cx ? "start" : "end",
  1661. fill: "var(--chart-labels-color, var(--mantine-color-dimmed))",
  1662. fontFamily: "var(--mantine-font-family)",
  1663. fontSize: 12,
  1664. children: jsxRuntime.jsx("tspan", { x, children: getLabelValue(labelsType, value, percent, valueFormatter) })
  1665. }
  1666. );
  1667. var PieChart2 = core.factory((_props, ref) => {
  1668. const props = core.useProps("PieChart", defaultProps8, _props);
  1669. const {
  1670. classNames,
  1671. className,
  1672. style,
  1673. styles,
  1674. unstyled,
  1675. vars,
  1676. data,
  1677. withTooltip,
  1678. tooltipAnimationDuration,
  1679. tooltipProps,
  1680. pieProps,
  1681. paddingAngle,
  1682. withLabels,
  1683. withLabelsLine,
  1684. size,
  1685. strokeWidth,
  1686. startAngle,
  1687. endAngle,
  1688. tooltipDataSource,
  1689. children,
  1690. pieChartProps,
  1691. labelsPosition,
  1692. valueFormatter,
  1693. labelsType,
  1694. strokeColor,
  1695. ...others
  1696. } = props;
  1697. const theme = core.useMantineTheme();
  1698. const getStyles = core.useStyles({
  1699. name: "PieChart",
  1700. classes: classes6,
  1701. props,
  1702. className,
  1703. style,
  1704. classNames,
  1705. styles,
  1706. unstyled,
  1707. vars,
  1708. varsResolver: varsResolver6
  1709. });
  1710. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  1711. classNames,
  1712. styles,
  1713. props
  1714. });
  1715. const cells = data.map((item, index) => jsxRuntime.jsx(
  1716. recharts.Cell,
  1717. {
  1718. fill: core.getThemeColor(item.color, theme),
  1719. stroke: "var(--chart-stroke-color, var(--mantine-color-body))",
  1720. strokeWidth
  1721. },
  1722. index
  1723. ));
  1724. return jsxRuntime.jsx(core.Box, { ref, size, ...getStyles("root"), ...others, children: jsxRuntime.jsx(recharts.ResponsiveContainer, { children: jsxRuntime.jsxs(recharts.PieChart, { ...pieChartProps, children: [
  1725. jsxRuntime.jsx(
  1726. recharts.Pie,
  1727. {
  1728. data,
  1729. innerRadius: 0,
  1730. outerRadius: size / 2,
  1731. dataKey: "value",
  1732. isAnimationActive: false,
  1733. paddingAngle,
  1734. startAngle,
  1735. endAngle,
  1736. label: withLabels ? labelsPosition === "inside" ? getInsideLabel(labelsType || "value", valueFormatter) : getOutsideLabel(labelsType || "value", valueFormatter) : false,
  1737. labelLine: withLabelsLine && labelsPosition === "outside" ? {
  1738. stroke: "var(--chart-label-color, var(--mantine-color-dimmed))",
  1739. strokeWidth: 1
  1740. } : false,
  1741. ...pieProps,
  1742. children: cells
  1743. }
  1744. ),
  1745. withTooltip && jsxRuntime.jsx(
  1746. recharts.Tooltip,
  1747. {
  1748. animationDuration: tooltipAnimationDuration,
  1749. isAnimationActive: false,
  1750. content: ({ payload }) => jsxRuntime.jsx(
  1751. ChartTooltip,
  1752. {
  1753. payload: data,
  1754. classNames: resolvedClassNames,
  1755. styles: resolvedStyles,
  1756. type: "radial",
  1757. segmentId: tooltipDataSource === "segment" ? payload?.[0]?.name : void 0,
  1758. valueFormatter
  1759. }
  1760. ),
  1761. ...tooltipProps
  1762. }
  1763. ),
  1764. children
  1765. ] }) }) });
  1766. });
  1767. PieChart2.displayName = "@mantine/charts/PieChart";
  1768. PieChart2.classes = classes6;
  1769.  
  1770. var classes7 = { "root": "m_1f271cf7", "container": "m_cf06f58c" };
  1771.  
  1772. var defaultProps9 = {
  1773. withPolarGrid: true,
  1774. withPolarAngleAxis: true,
  1775. withPolarRadiusAxis: false
  1776. };
  1777. var varsResolver7 = core.createVarsResolver((theme, { gridColor, textColor }) => ({
  1778. root: {
  1779. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0,
  1780. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0
  1781. }
  1782. }));
  1783. var RadarChart = core.factory((_props, ref) => {
  1784. const props = core.useProps("RadarChart", defaultProps9, _props);
  1785. const {
  1786. classNames,
  1787. className,
  1788. style,
  1789. styles,
  1790. unstyled,
  1791. vars,
  1792. data,
  1793. series,
  1794. dataKey,
  1795. gridColor,
  1796. textColor,
  1797. radarProps,
  1798. radarChartProps,
  1799. polarGridProps,
  1800. polarAngleAxisProps,
  1801. polarRadiusAxisProps,
  1802. withPolarGrid,
  1803. withPolarAngleAxis,
  1804. withPolarRadiusAxis,
  1805. children,
  1806. withLegend,
  1807. legendProps,
  1808. ...others
  1809. } = props;
  1810. const theme = core.useMantineTheme();
  1811. const getStyles = core.useStyles({
  1812. name: "RadarChart",
  1813. classes: classes7,
  1814. props,
  1815. className,
  1816. style,
  1817. classNames,
  1818. styles,
  1819. unstyled,
  1820. vars,
  1821. varsResolver: varsResolver7
  1822. });
  1823. const [highlightedArea, setHighlightedArea] = react.useState(null);
  1824. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  1825. classNames,
  1826. styles,
  1827. props
  1828. });
  1829. const radars = series.map((item, index) => jsxRuntime.jsx(
  1830. recharts.Radar,
  1831. {
  1832. name: item.name,
  1833. dataKey: item.name,
  1834. stroke: core.getThemeColor(item.strokeColor || item.color, theme),
  1835. fill: core.getThemeColor(item.color, theme),
  1836. fillOpacity: highlightedArea ? highlightedArea === item.name ? item.opacity || 0.4 : 0.05 : item.opacity || 0.4,
  1837. strokeOpacity: highlightedArea ? highlightedArea === item.name ? 1 : 0.1 : 1,
  1838. isAnimationActive: false,
  1839. ...typeof radarProps === "function" ? radarProps(item) : radarProps
  1840. },
  1841. index
  1842. ));
  1843. return jsxRuntime.jsx(core.Box, { ref, ...getStyles("root"), ...others, children: jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: jsxRuntime.jsxs(recharts.RadarChart, { data, ...radarChartProps, children: [
  1844. withPolarGrid && jsxRuntime.jsx(recharts.PolarGrid, { stroke: "var(--chart-grid-color)", ...polarGridProps }),
  1845. withPolarAngleAxis && jsxRuntime.jsx(recharts.PolarAngleAxis, { dataKey, ...polarAngleAxisProps }),
  1846. withPolarRadiusAxis && jsxRuntime.jsx(recharts.PolarRadiusAxis, { stroke: "var(--chart-grid-color)", ...polarRadiusAxisProps }),
  1847. radars,
  1848. withLegend && jsxRuntime.jsx(
  1849. recharts.Legend,
  1850. {
  1851. verticalAlign: "bottom",
  1852. content: (payload) => jsxRuntime.jsx(
  1853. ChartLegend,
  1854. {
  1855. payload: payload.payload,
  1856. onHighlight: setHighlightedArea,
  1857. legendPosition: legendProps?.verticalAlign || "bottom",
  1858. classNames: resolvedClassNames,
  1859. styles: resolvedStyles,
  1860. series,
  1861. centered: true
  1862. }
  1863. ),
  1864. ...legendProps
  1865. }
  1866. ),
  1867. children
  1868. ] }) }) });
  1869. });
  1870. RadarChart.displayName = "@mantine/charts/RadarChart";
  1871. RadarChart.classes = classes7;
  1872. function getAxis(key, dataKey) {
  1873. return key === dataKey.x ? "x" : "y";
  1874. }
  1875. var defaultProps10 = {
  1876. withXAxis: true,
  1877. withYAxis: true,
  1878. withTooltip: true,
  1879. tooltipAnimationDuration: 0,
  1880. tickLine: "y",
  1881. strokeDasharray: "5 5",
  1882. gridAxis: "x"
  1883. };
  1884. var varsResolver8 = core.createVarsResolver((theme, { textColor, gridColor }) => ({
  1885. root: {
  1886. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
  1887. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
  1888. }
  1889. }));
  1890. var ScatterChart = core.factory((_props, ref) => {
  1891. const props = core.useProps("ScatterChart", defaultProps10, _props);
  1892. const {
  1893. classNames,
  1894. className,
  1895. style,
  1896. styles,
  1897. unstyled,
  1898. vars,
  1899. referenceLines,
  1900. dir,
  1901. withLegend,
  1902. withTooltip,
  1903. withXAxis,
  1904. withYAxis,
  1905. xAxisProps,
  1906. yAxisProps,
  1907. orientation,
  1908. scatterChartProps,
  1909. legendProps,
  1910. data,
  1911. gridAxis,
  1912. tickLine,
  1913. strokeDasharray,
  1914. gridProps,
  1915. tooltipAnimationDuration,
  1916. tooltipProps,
  1917. children,
  1918. onMouseLeave,
  1919. dataKey,
  1920. textColor,
  1921. gridColor,
  1922. xAxisLabel,
  1923. yAxisLabel,
  1924. unit,
  1925. labels,
  1926. valueFormatter,
  1927. scatterProps,
  1928. pointLabels,
  1929. ...others
  1930. } = props;
  1931. const getFormatter = (axis) => typeof valueFormatter === "function" ? valueFormatter : valueFormatter?.[axis];
  1932. const xFormatter = getFormatter("x");
  1933. const yFormatter = getFormatter("y");
  1934. const theme = core.useMantineTheme();
  1935. const mappedData = data.map((item) => ({
  1936. ...item,
  1937. data: item.data.map((point) => ({ ...point, name: item.name }))
  1938. }));
  1939. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  1940. classNames,
  1941. styles,
  1942. props
  1943. });
  1944. const getStyles = core.useStyles({
  1945. name: "ScatterChart",
  1946. classes: classes3,
  1947. props,
  1948. className,
  1949. style,
  1950. classNames,
  1951. styles,
  1952. unstyled,
  1953. vars,
  1954. varsResolver: varsResolver8
  1955. });
  1956. const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
  1957. const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
  1958. const [highlightedArea, setHighlightedArea] = react.useState(null);
  1959. const shouldHighlight = highlightedArea !== null;
  1960. const handleMouseLeave = (event) => {
  1961. setHighlightedArea(null);
  1962. onMouseLeave?.(event);
  1963. };
  1964. const referenceLinesItems = referenceLines?.map((line, index) => {
  1965. const color = core.getThemeColor(line.color, theme);
  1966. return jsxRuntime.jsx(
  1967. recharts.ReferenceLine,
  1968. {
  1969. stroke: line.color ? color : "var(--chart-grid-color)",
  1970. strokeWidth: 1,
  1971. ...line,
  1972. label: {
  1973. value: line.label,
  1974. fill: line.color ? color : "currentColor",
  1975. fontSize: 12,
  1976. position: line.labelPosition ?? "insideBottomLeft"
  1977. },
  1978. ...getStyles("referenceLine")
  1979. },
  1980. index
  1981. );
  1982. });
  1983. const scatters = mappedData.map((item, index) => {
  1984. const dimmed = shouldHighlight && highlightedArea !== item.name;
  1985. return jsxRuntime.jsxs(
  1986. recharts.Scatter,
  1987. {
  1988. data: item.data,
  1989. fill: core.getThemeColor(item.color, theme),
  1990. isAnimationActive: false,
  1991. fillOpacity: dimmed ? 0.1 : 1,
  1992. ...scatterProps,
  1993. children: [
  1994. pointLabels && jsxRuntime.jsx(recharts.LabelList, { dataKey: dataKey[pointLabels], fontSize: 8, dy: 10 }),
  1995. scatterProps?.children
  1996. ]
  1997. },
  1998. index
  1999. );
  2000. });
  2001. return jsxRuntime.jsx(
  2002. core.Box,
  2003. {
  2004. ref,
  2005. ...getStyles("root"),
  2006. onMouseLeave: handleMouseLeave,
  2007. dir: dir || "ltr",
  2008. ...others,
  2009. children: jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: jsxRuntime.jsxs(
  2010. recharts.ScatterChart,
  2011. {
  2012. margin: {
  2013. bottom: xAxisLabel ? 30 : void 0,
  2014. left: yAxisLabel ? 10 : void 0,
  2015. right: yAxisLabel ? 5 : void 0
  2016. },
  2017. ...scatterChartProps,
  2018. children: [
  2019. jsxRuntime.jsx(
  2020. recharts.CartesianGrid,
  2021. {
  2022. strokeDasharray,
  2023. vertical: gridAxis === "y" || gridAxis === "xy",
  2024. horizontal: gridAxis === "x" || gridAxis === "xy",
  2025. ...getStyles("grid"),
  2026. ...gridProps
  2027. }
  2028. ),
  2029. jsxRuntime.jsxs(
  2030. recharts.XAxis,
  2031. {
  2032. type: "number",
  2033. hide: !withXAxis,
  2034. dataKey: dataKey.x,
  2035. tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
  2036. stroke: "",
  2037. interval: "preserveStartEnd",
  2038. tickLine: withXTickLine ? { stroke: "currentColor" } : false,
  2039. minTickGap: 5,
  2040. unit: unit?.x,
  2041. tickFormatter: xFormatter,
  2042. ...getStyles("axis"),
  2043. ...xAxisProps,
  2044. children: [
  2045. xAxisLabel && jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
  2046. xAxisProps?.children
  2047. ]
  2048. }
  2049. ),
  2050. jsxRuntime.jsxs(
  2051. recharts.YAxis,
  2052. {
  2053. type: "number",
  2054. hide: !withYAxis,
  2055. axisLine: false,
  2056. dataKey: dataKey.y,
  2057. tickLine: withYTickLine ? { stroke: "currentColor" } : false,
  2058. tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
  2059. allowDecimals: true,
  2060. unit: unit?.y,
  2061. tickFormatter: yFormatter,
  2062. ...getStyles("axis"),
  2063. ...yAxisProps,
  2064. children: [
  2065. yAxisLabel && jsxRuntime.jsx(
  2066. recharts.Label,
  2067. {
  2068. position: "insideLeft",
  2069. angle: -90,
  2070. textAnchor: "middle",
  2071. fontSize: 12,
  2072. offset: -5,
  2073. ...getStyles("axisLabel"),
  2074. children: yAxisLabel
  2075. }
  2076. ),
  2077. yAxisProps?.children
  2078. ]
  2079. }
  2080. ),
  2081. withTooltip && jsxRuntime.jsx(
  2082. recharts.Tooltip,
  2083. {
  2084. animationDuration: tooltipAnimationDuration,
  2085. isAnimationActive: tooltipAnimationDuration !== 0,
  2086. position: { y: 0 },
  2087. cursor: {
  2088. stroke: "var(--chart-grid-color)",
  2089. strokeWidth: 1,
  2090. strokeDasharray
  2091. },
  2092. content: ({ label, payload }) => jsxRuntime.jsx(
  2093. ChartTooltip,
  2094. {
  2095. type: "scatter",
  2096. label,
  2097. payload: labels ? payload?.map((item) => ({
  2098. ...item,
  2099. name: labels[getAxis(item.name, dataKey)] || item.name,
  2100. value: getFormatter(getAxis(item.name, dataKey))?.(item.value) ?? item.value
  2101. })) : payload?.map((item) => ({
  2102. ...item,
  2103. value: getFormatter(getAxis(item.name, dataKey))?.(item.value) ?? item.value
  2104. })),
  2105. classNames: resolvedClassNames,
  2106. styles: resolvedStyles,
  2107. series: data
  2108. }
  2109. ),
  2110. ...tooltipProps
  2111. }
  2112. ),
  2113. withLegend && jsxRuntime.jsx(
  2114. recharts.Legend,
  2115. {
  2116. verticalAlign: "top",
  2117. content: (payload) => jsxRuntime.jsx(
  2118. ChartLegend,
  2119. {
  2120. payload: payload.payload?.map((item, index) => ({
  2121. ...item,
  2122. dataKey: data[index].name
  2123. })),
  2124. onHighlight: setHighlightedArea,
  2125. legendPosition: legendProps?.verticalAlign || "top",
  2126. classNames: resolvedClassNames,
  2127. styles: resolvedStyles,
  2128. series: data
  2129. }
  2130. ),
  2131. height: 44,
  2132. ...legendProps
  2133. }
  2134. ),
  2135. referenceLinesItems,
  2136. scatters
  2137. ]
  2138. }
  2139. ) })
  2140. }
  2141. );
  2142. });
  2143. ScatterChart.displayName = "@mantine/charts/ScatterChart";
  2144. ScatterChart.classes = classes3;
  2145. function getDomain(data, key) {
  2146. const values = data.map((item) => item[key]);
  2147. return [Math.min(...values), Math.max(...values)];
  2148. }
  2149. function BubbleChartTooltip({
  2150. active,
  2151. payload,
  2152. getStyles,
  2153. dataKey,
  2154. valueFormatter
  2155. }) {
  2156. if (active && payload && payload.length) {
  2157. const data = payload[0] && payload[0].payload;
  2158. return jsxRuntime.jsx("div", { ...getStyles("tooltip"), children: jsxRuntime.jsxs(core.Group, { justify: "space-between", children: [
  2159. jsxRuntime.jsx(core.Text, { fz: "sm", children: data[dataKey.x] }),
  2160. jsxRuntime.jsx(core.Text, { fz: "sm", children: valueFormatter ? valueFormatter(data[dataKey.z]) : data[dataKey.z] })
  2161. ] }) });
  2162. }
  2163. return null;
  2164. }
  2165. var defaultProps11 = {
  2166. color: "blue.6",
  2167. withTooltip: true
  2168. };
  2169. var varsResolver9 = core.createVarsResolver((theme, { textColor, gridColor }) => ({
  2170. root: {
  2171. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
  2172. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
  2173. }
  2174. }));
  2175. var BubbleChart = core.factory((_props, ref) => {
  2176. const props = core.useProps("BubbleChart", defaultProps11, _props);
  2177. const {
  2178. classNames,
  2179. className,
  2180. style,
  2181. styles,
  2182. unstyled,
  2183. vars,
  2184. data,
  2185. xAxisProps,
  2186. yAxisProps,
  2187. zAxisProps,
  2188. tooltipProps,
  2189. scatterProps,
  2190. color,
  2191. label,
  2192. withTooltip,
  2193. dataKey,
  2194. range,
  2195. valueFormatter,
  2196. ...others
  2197. } = props;
  2198. const theme = core.useMantineTheme();
  2199. const getStyles = core.useStyles({
  2200. name: "BubbleChart",
  2201. classes: classes3,
  2202. props,
  2203. className,
  2204. style,
  2205. classNames,
  2206. styles,
  2207. unstyled,
  2208. vars,
  2209. varsResolver: varsResolver9
  2210. });
  2211. return jsxRuntime.jsx(core.Box, { ref, ...getStyles("root"), ...others, children: jsxRuntime.jsx(recharts.ResponsiveContainer, { children: jsxRuntime.jsxs(recharts.ScatterChart, { children: [
  2212. jsxRuntime.jsx(
  2213. recharts.XAxis,
  2214. {
  2215. type: "category",
  2216. dataKey: dataKey.x,
  2217. interval: 0,
  2218. tick: { fontSize: 12, fill: "currentColor" },
  2219. tickLine: { transform: "translate(0, -6)", stroke: "currentColor" },
  2220. stroke: "currentColor",
  2221. ...getStyles("axis"),
  2222. ...xAxisProps
  2223. }
  2224. ),
  2225. jsxRuntime.jsx(
  2226. recharts.YAxis,
  2227. {
  2228. type: "number",
  2229. dataKey: dataKey.y,
  2230. height: 10,
  2231. width: label ? void 0 : 0,
  2232. tick: false,
  2233. tickLine: false,
  2234. axisLine: false,
  2235. label: { value: label, position: "insideRight", fontSize: 12, fill: "currentColor" },
  2236. ...getStyles("axis"),
  2237. ...yAxisProps
  2238. }
  2239. ),
  2240. jsxRuntime.jsx(
  2241. recharts.ZAxis,
  2242. {
  2243. type: "number",
  2244. dataKey: dataKey.z,
  2245. domain: getDomain(data, dataKey.z),
  2246. range,
  2247. ...zAxisProps
  2248. }
  2249. ),
  2250. withTooltip && jsxRuntime.jsx(
  2251. recharts.Tooltip,
  2252. {
  2253. animationDuration: 100,
  2254. isAnimationActive: false,
  2255. cursor: { stroke: "var(--chart-grid-color)", strokeWidth: 1, strokeDasharray: "3 3" },
  2256. content: (payload) => jsxRuntime.jsx(
  2257. BubbleChartTooltip,
  2258. {
  2259. dataKey,
  2260. active: payload.active,
  2261. payload: payload.payload,
  2262. getStyles,
  2263. valueFormatter
  2264. }
  2265. ),
  2266. ...tooltipProps
  2267. }
  2268. ),
  2269. jsxRuntime.jsx(
  2270. recharts.Scatter,
  2271. {
  2272. data,
  2273. fill: core.getThemeColor(color, theme),
  2274. isAnimationActive: false,
  2275. ...scatterProps
  2276. }
  2277. )
  2278. ] }) }) });
  2279. });
  2280. BubbleChart.displayName = "@mantine/charts/BubbleChart";
  2281. BubbleChart.classes = classes3;
  2282. var defaultProps12 = {
  2283. withXAxis: true,
  2284. withYAxis: true,
  2285. withTooltip: true,
  2286. tooltipAnimationDuration: 0,
  2287. tickLine: "y",
  2288. strokeDasharray: "5 5",
  2289. gridAxis: "x",
  2290. withDots: true,
  2291. connectNulls: true,
  2292. strokeWidth: 2,
  2293. curveType: "monotone"
  2294. };
  2295. var varsResolver10 = core.createVarsResolver(
  2296. (theme, { textColor, gridColor }) => ({
  2297. root: {
  2298. "--chart-text-color": textColor ? core.getThemeColor(textColor, theme) : void 0,
  2299. "--chart-grid-color": gridColor ? core.getThemeColor(gridColor, theme) : void 0
  2300. }
  2301. })
  2302. );
  2303. var CompositeChart = core.factory((_props, ref) => {
  2304. const props = core.useProps("CompositeChart", defaultProps12, _props);
  2305. const {
  2306. classNames,
  2307. className,
  2308. style,
  2309. styles,
  2310. unstyled,
  2311. vars,
  2312. data,
  2313. withLegend,
  2314. legendProps,
  2315. series,
  2316. onMouseLeave,
  2317. dataKey,
  2318. withTooltip,
  2319. withXAxis,
  2320. withYAxis,
  2321. gridAxis,
  2322. tickLine,
  2323. xAxisProps,
  2324. yAxisProps,
  2325. unit,
  2326. tooltipAnimationDuration,
  2327. strokeDasharray,
  2328. gridProps,
  2329. tooltipProps,
  2330. referenceLines,
  2331. withDots,
  2332. dotProps,
  2333. activeDotProps,
  2334. strokeWidth,
  2335. connectNulls,
  2336. curveType,
  2337. dir,
  2338. valueFormatter,
  2339. children,
  2340. lineProps,
  2341. xAxisLabel,
  2342. yAxisLabel,
  2343. withRightYAxis,
  2344. rightYAxisLabel,
  2345. rightYAxisProps,
  2346. withPointLabels,
  2347. areaProps,
  2348. barProps,
  2349. withBarValueLabel,
  2350. minBarSize,
  2351. maxBarWidth,
  2352. composedChartProps,
  2353. ...others
  2354. } = props;
  2355. const theme = core.useMantineTheme();
  2356. const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
  2357. const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
  2358. const [highlightedArea, setHighlightedArea] = react.useState(null);
  2359. const shouldHighlight = highlightedArea !== null;
  2360. const handleMouseLeave = (event) => {
  2361. setHighlightedArea(null);
  2362. onMouseLeave?.(event);
  2363. };
  2364. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  2365. classNames,
  2366. styles,
  2367. props
  2368. });
  2369. const getStyles = core.useStyles({
  2370. name: "CompositeChart",
  2371. classes: classes3,
  2372. props,
  2373. className,
  2374. style,
  2375. classNames,
  2376. styles,
  2377. unstyled,
  2378. vars,
  2379. varsResolver: varsResolver10
  2380. });
  2381. const lines = series.map((item) => {
  2382. const color = core.getThemeColor(item.color, theme);
  2383. const dimmed = shouldHighlight && highlightedArea !== item.name;
  2384. if (item.type === "line") {
  2385. return react.createElement(
  2386. recharts.Line,
  2387. {
  2388. ...getStyles("line"),
  2389. key: item.name,
  2390. name: item.name,
  2391. dataKey: item.name,
  2392. dot: withDots ? {
  2393. fillOpacity: dimmed ? 0 : 1,
  2394. strokeOpacity: dimmed ? 0 : 1,
  2395. strokeWidth: 1,
  2396. fill: color,
  2397. stroke: color,
  2398. ...dotProps
  2399. } : false,
  2400. activeDot: withDots ? { fill: "var(--mantine-color-white)", stroke: color, ...activeDotProps } : false,
  2401. fill: color,
  2402. stroke: color,
  2403. strokeWidth,
  2404. isAnimationActive: false,
  2405. fillOpacity: dimmed ? 0 : 1,
  2406. strokeOpacity: dimmed ? 0.5 : 1,
  2407. connectNulls,
  2408. type: curveType,
  2409. strokeDasharray: item.strokeDasharray,
  2410. yAxisId: item.yAxisId || "left",
  2411. label: withPointLabels ? jsxRuntime.jsx(PointLabel, {}) : void 0,
  2412. ...typeof lineProps === "function" ? lineProps(item) : lineProps
  2413. }
  2414. );
  2415. }
  2416. if (item.type === "area") {
  2417. return react.createElement(
  2418. recharts.Area,
  2419. {
  2420. ...getStyles("area"),
  2421. key: item.name,
  2422. name: item.name,
  2423. type: curveType,
  2424. dataKey: item.name,
  2425. fill: color,
  2426. strokeWidth,
  2427. stroke: color,
  2428. isAnimationActive: false,
  2429. connectNulls,
  2430. dot: withDots ? {
  2431. fillOpacity: dimmed ? 0 : 1,
  2432. strokeOpacity: dimmed ? 0 : 1,
  2433. strokeWidth: 1,
  2434. fill: color,
  2435. stroke: color,
  2436. ...dotProps
  2437. } : false,
  2438. activeDot: withDots ? {
  2439. fill: theme.white,
  2440. stroke: color,
  2441. strokeWidth: 2,
  2442. r: 4,
  2443. ...activeDotProps
  2444. } : false,
  2445. fillOpacity: dimmed ? 0 : 0.2,
  2446. strokeOpacity: dimmed ? 0.5 : 1,
  2447. strokeDasharray: item.strokeDasharray,
  2448. yAxisId: item.yAxisId || "left",
  2449. label: withPointLabels ? jsxRuntime.jsx(PointLabel, {}) : void 0,
  2450. ...typeof areaProps === "function" ? areaProps(item) : areaProps
  2451. }
  2452. );
  2453. }
  2454. if (item.type === "bar") {
  2455. return react.createElement(
  2456. recharts.Bar,
  2457. {
  2458. ...getStyles("bar"),
  2459. key: item.name,
  2460. name: item.name,
  2461. dataKey: item.name,
  2462. fill: color,
  2463. stroke: color,
  2464. isAnimationActive: false,
  2465. fillOpacity: dimmed ? 0.1 : 1,
  2466. strokeOpacity: dimmed ? 0.2 : 0,
  2467. label: withBarValueLabel ? jsxRuntime.jsx(BarLabel, { valueFormatter }) : void 0,
  2468. yAxisId: item.yAxisId || "left",
  2469. minPointSize: minBarSize,
  2470. ...typeof barProps === "function" ? barProps(item) : barProps
  2471. }
  2472. );
  2473. }
  2474. return null;
  2475. });
  2476. const referenceLinesItems = referenceLines?.map((line, index) => {
  2477. const color = core.getThemeColor(line.color, theme);
  2478. return jsxRuntime.jsx(
  2479. recharts.ReferenceLine,
  2480. {
  2481. stroke: line.color ? color : "var(--chart-grid-color)",
  2482. strokeWidth: 1,
  2483. yAxisId: line.yAxisId || "left",
  2484. ...line,
  2485. label: {
  2486. value: line.label,
  2487. fill: line.color ? color : "currentColor",
  2488. fontSize: 12,
  2489. position: line.labelPosition ?? "insideBottomLeft"
  2490. },
  2491. ...getStyles("referenceLine")
  2492. },
  2493. index
  2494. );
  2495. });
  2496. const sharedYAxisProps = {
  2497. axisLine: false,
  2498. type: "number",
  2499. tickLine: withYTickLine ? { stroke: "currentColor" } : false,
  2500. allowDecimals: true,
  2501. unit,
  2502. tickFormatter: valueFormatter,
  2503. ...getStyles("axis")
  2504. };
  2505. return jsxRuntime.jsx(
  2506. core.Box,
  2507. {
  2508. ref,
  2509. ...getStyles("root"),
  2510. onMouseLeave: handleMouseLeave,
  2511. dir: dir || "ltr",
  2512. ...others,
  2513. children: jsxRuntime.jsx(recharts.ResponsiveContainer, { ...getStyles("container"), children: jsxRuntime.jsxs(
  2514. recharts.ComposedChart,
  2515. {
  2516. data,
  2517. maxBarSize: maxBarWidth,
  2518. margin: {
  2519. bottom: xAxisLabel ? 30 : void 0,
  2520. left: yAxisLabel ? 10 : void 0,
  2521. right: yAxisLabel ? 5 : void 0
  2522. },
  2523. ...composedChartProps,
  2524. children: [
  2525. withLegend && jsxRuntime.jsx(
  2526. recharts.Legend,
  2527. {
  2528. verticalAlign: "top",
  2529. content: (payload) => jsxRuntime.jsx(
  2530. ChartLegend,
  2531. {
  2532. payload: payload.payload,
  2533. onHighlight: setHighlightedArea,
  2534. legendPosition: legendProps?.verticalAlign || "top",
  2535. classNames: resolvedClassNames,
  2536. styles: resolvedStyles,
  2537. series
  2538. }
  2539. ),
  2540. ...legendProps
  2541. }
  2542. ),
  2543. jsxRuntime.jsxs(
  2544. recharts.XAxis,
  2545. {
  2546. hide: !withXAxis,
  2547. dataKey,
  2548. tick: { transform: "translate(0, 10)", fontSize: 12, fill: "currentColor" },
  2549. stroke: "",
  2550. interval: "preserveStartEnd",
  2551. tickLine: withXTickLine ? { stroke: "currentColor" } : false,
  2552. minTickGap: 5,
  2553. ...getStyles("axis"),
  2554. ...xAxisProps,
  2555. children: [
  2556. xAxisLabel && jsxRuntime.jsx(recharts.Label, { position: "insideBottom", offset: -20, fontSize: 12, ...getStyles("axisLabel"), children: xAxisLabel }),
  2557. xAxisProps?.children
  2558. ]
  2559. }
  2560. ),
  2561. jsxRuntime.jsxs(
  2562. recharts.YAxis,
  2563. {
  2564. yAxisId: "left",
  2565. orientation: "left",
  2566. tick: { transform: "translate(-10, 0)", fontSize: 12, fill: "currentColor" },
  2567. hide: !withYAxis,
  2568. ...sharedYAxisProps,
  2569. ...yAxisProps,
  2570. children: [
  2571. yAxisLabel && jsxRuntime.jsx(
  2572. recharts.Label,
  2573. {
  2574. position: "insideLeft",
  2575. angle: -90,
  2576. textAnchor: "middle",
  2577. fontSize: 12,
  2578. offset: -5,
  2579. ...getStyles("axisLabel"),
  2580. children: yAxisLabel
  2581. }
  2582. ),
  2583. yAxisProps?.children
  2584. ]
  2585. }
  2586. ),
  2587. jsxRuntime.jsxs(
  2588. recharts.YAxis,
  2589. {
  2590. yAxisId: "right",
  2591. orientation: "right",
  2592. tick: { transform: "translate(10, 0)", fontSize: 12, fill: "currentColor" },
  2593. hide: !withRightYAxis,
  2594. ...sharedYAxisProps,
  2595. ...rightYAxisProps,
  2596. children: [
  2597. rightYAxisLabel && jsxRuntime.jsx(
  2598. recharts.Label,
  2599. {
  2600. position: "insideRight",
  2601. angle: 90,
  2602. textAnchor: "middle",
  2603. fontSize: 12,
  2604. offset: -5,
  2605. ...getStyles("axisLabel"),
  2606. children: rightYAxisLabel
  2607. }
  2608. ),
  2609. yAxisProps?.children
  2610. ]
  2611. }
  2612. ),
  2613. jsxRuntime.jsx(
  2614. recharts.CartesianGrid,
  2615. {
  2616. strokeDasharray,
  2617. vertical: gridAxis === "y" || gridAxis === "xy",
  2618. horizontal: gridAxis === "x" || gridAxis === "xy",
  2619. ...getStyles("grid"),
  2620. ...gridProps
  2621. }
  2622. ),
  2623. withTooltip && jsxRuntime.jsx(
  2624. recharts.Tooltip,
  2625. {
  2626. animationDuration: tooltipAnimationDuration,
  2627. isAnimationActive: tooltipAnimationDuration !== 0,
  2628. position: { y: 0 },
  2629. cursor: {
  2630. stroke: "var(--chart-grid-color)",
  2631. strokeWidth: 1,
  2632. strokeDasharray
  2633. },
  2634. content: ({ label, payload }) => jsxRuntime.jsx(
  2635. ChartTooltip,
  2636. {
  2637. label,
  2638. payload,
  2639. unit,
  2640. classNames: resolvedClassNames,
  2641. styles: resolvedStyles,
  2642. series,
  2643. valueFormatter
  2644. }
  2645. ),
  2646. ...tooltipProps
  2647. }
  2648. ),
  2649. lines,
  2650. referenceLinesItems,
  2651. children
  2652. ]
  2653. }
  2654. ) })
  2655. }
  2656. );
  2657. });
  2658. CompositeChart.displayName = "@mantine/charts/CompositeChart";
  2659. CompositeChart.classes = classes3;
  2660.  
  2661. var classes8 = { "root": "m_cd2bd9e5", "tooltip": "m_6bcc3420" };
  2662.  
  2663. var defaultProps13 = {
  2664. barSize: 20,
  2665. startAngle: 90,
  2666. endAngle: -270,
  2667. withBackground: true,
  2668. withTooltip: true
  2669. };
  2670. var varsResolver11 = core.createVarsResolver(
  2671. (theme, { emptyBackgroundColor }) => ({
  2672. root: {
  2673. "--chart-empty-background": emptyBackgroundColor ? core.getThemeColor(emptyBackgroundColor, theme) : void 0
  2674. }
  2675. })
  2676. );
  2677. var RadialBarChart = core.factory((_props, ref) => {
  2678. const props = core.useProps("RadialBarChart", defaultProps13, _props);
  2679. const {
  2680. classNames,
  2681. className,
  2682. style,
  2683. styles,
  2684. unstyled,
  2685. vars,
  2686. data,
  2687. barSize,
  2688. withBackground,
  2689. dataKey,
  2690. radialBarProps,
  2691. radialBarChartProps,
  2692. withLabels,
  2693. withLegend,
  2694. legendProps,
  2695. withTooltip,
  2696. tooltipProps,
  2697. startAngle,
  2698. endAngle,
  2699. ...others
  2700. } = props;
  2701. const [highlightedArea, setHighlightedArea] = react.useState(null);
  2702. const getStyles = core.useStyles({
  2703. name: "RadialBarChart",
  2704. classes: classes8,
  2705. props,
  2706. className,
  2707. style,
  2708. classNames,
  2709. styles,
  2710. unstyled,
  2711. vars,
  2712. varsResolver: varsResolver11
  2713. });
  2714. const theme = core.useMantineTheme();
  2715. const dataWithResolvedColor = data.map(({ color, ...item }) => {
  2716. const resolvedColor = core.getThemeColor(color, theme);
  2717. return {
  2718. ...item,
  2719. fill: resolvedColor,
  2720. fillOpacity: highlightedArea ? highlightedArea === item.name ? item.opacity || 1 : 0.05 : item.opacity || 1
  2721. };
  2722. });
  2723. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  2724. classNames,
  2725. styles,
  2726. props
  2727. });
  2728. return jsxRuntime.jsx(core.Box, { ref, ...getStyles("root"), ...others, children: jsxRuntime.jsx(recharts.ResponsiveContainer, { children: jsxRuntime.jsxs(
  2729. recharts.RadialBarChart,
  2730. {
  2731. margin: { top: 0, bottom: 0, left: 0, right: 0 },
  2732. innerRadius: "10%",
  2733. outerRadius: "100%",
  2734. cx: "50%",
  2735. cy: "50%",
  2736. barSize,
  2737. startAngle,
  2738. endAngle,
  2739. data: dataWithResolvedColor,
  2740. ...radialBarChartProps,
  2741. children: [
  2742. jsxRuntime.jsx(
  2743. recharts.RadialBar,
  2744. {
  2745. label: withLabels ? {
  2746. position: "insideStart",
  2747. fill: "var(--mantine-color-white)",
  2748. fontSize: 12
  2749. } : void 0,
  2750. background: withBackground ? { fill: "var(--chart-empty-background)" } : void 0,
  2751. dataKey,
  2752. isAnimationActive: false,
  2753. ...radialBarProps
  2754. }
  2755. ),
  2756. withLegend && jsxRuntime.jsx(
  2757. recharts.Legend,
  2758. {
  2759. verticalAlign: "bottom",
  2760. content: (payload) => jsxRuntime.jsx(
  2761. ChartLegend,
  2762. {
  2763. payload: payload.payload?.map((item) => ({
  2764. ...item,
  2765. dataKey: item.payload?.name
  2766. })),
  2767. onHighlight: setHighlightedArea,
  2768. legendPosition: legendProps?.verticalAlign || "bottom",
  2769. classNames: resolvedClassNames,
  2770. styles: resolvedStyles,
  2771. centered: true
  2772. }
  2773. ),
  2774. ...legendProps
  2775. }
  2776. ),
  2777. withTooltip && jsxRuntime.jsx(
  2778. recharts.Tooltip,
  2779. {
  2780. animationDuration: 0,
  2781. isAnimationActive: false,
  2782. cursor: { stroke: "var(--chart-cursor-color)" },
  2783. content: ({ payload }) => jsxRuntime.jsxs(core.Paper, { ...getStyles("tooltip"), children: [
  2784. jsxRuntime.jsxs(core.Group, { gap: "sm", children: [
  2785. jsxRuntime.jsx(core.ColorSwatch, { color: payload?.[0]?.payload.fill, size: 12, withShadow: false }),
  2786. jsxRuntime.jsx("span", { children: payload?.[0]?.payload.name })
  2787. ] }),
  2788. jsxRuntime.jsx("span", { children: payload?.[0]?.payload[dataKey] })
  2789. ] }),
  2790. ...tooltipProps
  2791. }
  2792. )
  2793. ]
  2794. }
  2795. ) }) });
  2796. });
  2797. RadialBarChart.displayName = "@mantine/core/RadialBarChart";
  2798. RadialBarChart.classes = classes8;
  2799.  
  2800. var classes9 = { "root": "m_80d531e7" };
  2801.  
  2802. var defaultProps14 = {
  2803. withTooltip: true,
  2804. size: 300,
  2805. strokeWidth: 1,
  2806. withLabels: false,
  2807. labelsPosition: "right",
  2808. tooltipDataSource: "all"
  2809. };
  2810. var varsResolver12 = core.createVarsResolver(
  2811. (theme, { strokeColor, labelColor, size }) => ({
  2812. root: {
  2813. "--chart-stroke-color": strokeColor ? core.getThemeColor(strokeColor, theme) : void 0,
  2814. "--chart-labels-color": labelColor ? core.getThemeColor(labelColor, theme) : void 0,
  2815. "--chart-size": core.rem(size)
  2816. }
  2817. })
  2818. );
  2819. var FunnelChart = core.factory((_props, ref) => {
  2820. const props = core.useProps("FunnelChart", defaultProps14, _props);
  2821. const {
  2822. classNames,
  2823. className,
  2824. style,
  2825. styles,
  2826. unstyled,
  2827. vars,
  2828. data,
  2829. withTooltip,
  2830. tooltipAnimationDuration,
  2831. tooltipProps,
  2832. strokeWidth,
  2833. withLabels,
  2834. size,
  2835. valueFormatter,
  2836. children,
  2837. funnelChartProps,
  2838. funnelProps,
  2839. labelsPosition,
  2840. tooltipDataSource,
  2841. ...others
  2842. } = props;
  2843. const theme = core.useMantineTheme();
  2844. const getStyles = core.useStyles({
  2845. name: "FunnelChart",
  2846. classes: classes9,
  2847. props,
  2848. className,
  2849. style,
  2850. classNames,
  2851. styles,
  2852. unstyled,
  2853. vars,
  2854. varsResolver: varsResolver12
  2855. });
  2856. const { resolvedClassNames, resolvedStyles } = core.useResolvedStylesApi({
  2857. classNames,
  2858. styles,
  2859. props
  2860. });
  2861. return jsxRuntime.jsx(core.Box, { ref, size, ...getStyles("root"), ...others, children: jsxRuntime.jsx(recharts.ResponsiveContainer, { children: jsxRuntime.jsxs(recharts.FunnelChart, { ...funnelChartProps, children: [
  2862. jsxRuntime.jsxs(
  2863. recharts.Funnel,
  2864. {
  2865. data,
  2866. dataKey: "value",
  2867. isAnimationActive: false,
  2868. stroke: "var(--chart-stroke-color, var(--mantine-color-body))",
  2869. strokeWidth,
  2870. ...funnelProps,
  2871. children: [
  2872. withLabels && jsxRuntime.jsx(
  2873. recharts.LabelList,
  2874. {
  2875. position: labelsPosition,
  2876. fill: labelsPosition === "inside" ? "var(--chart-labels-color, var(--mantine-color-white))" : "var(--chart-labels-color, var(--mantine-color-dimmed))",
  2877. stroke: "none",
  2878. fontFamily: "var(--mantine-font-family)",
  2879. fontSize: 14,
  2880. dataKey: (entry) => {
  2881. return typeof valueFormatter === "function" ? valueFormatter(entry.value) : entry.value;
  2882. }
  2883. }
  2884. ),
  2885. data.map((entry, index) => jsxRuntime.jsx(
  2886. recharts.Cell,
  2887. {
  2888. fill: core.getThemeColor(entry.color, theme),
  2889. stroke: "var(--chart-stroke-color, var(--mantine-color-body))",
  2890. strokeWidth
  2891. },
  2892. index
  2893. ))
  2894. ]
  2895. }
  2896. ),
  2897. withTooltip && jsxRuntime.jsx(
  2898. recharts.Tooltip,
  2899. {
  2900. animationDuration: tooltipAnimationDuration,
  2901. isAnimationActive: false,
  2902. content: ({ payload }) => jsxRuntime.jsx(
  2903. ChartTooltip,
  2904. {
  2905. payload: data,
  2906. classNames: resolvedClassNames,
  2907. styles: resolvedStyles,
  2908. type: "radial",
  2909. segmentId: tooltipDataSource === "segment" ? payload?.[0]?.name : void 0,
  2910. valueFormatter
  2911. }
  2912. ),
  2913. ...tooltipProps
  2914. }
  2915. ),
  2916. children
  2917. ] }) }) });
  2918. });
  2919. FunnelChart.displayName = "@mantine/charts/FunnelChart";
  2920. FunnelChart.classes = classes9;
  2921. exports.AreaChart = AreaChart;
  2922. exports.AreaGradient = AreaGradient;
  2923. exports.BarChart = BarChart;
  2924. exports.BubbleChart = BubbleChart;
  2925. exports.ChartLegend = ChartLegend;
  2926. exports.ChartTooltip = ChartTooltip;
  2927. exports.CompositeChart = CompositeChart;
  2928. exports.DonutChart = DonutChart;
  2929. exports.FunnelChart = FunnelChart;
  2930. exports.LineChart = LineChart;
  2931. exports.PieChart = PieChart2;
  2932. exports.RadarChart = RadarChart;
  2933. exports.RadialBarChart = RadialBarChart;
  2934. exports.ScatterChart = ScatterChart;
  2935. exports.Sparkline = Sparkline;
  2936. exports.getFilteredChartLegendPayload = getFilteredChartLegendPayload;
  2937. exports.getFilteredChartTooltipPayload = getFilteredChartTooltipPayload;
  2938. exports.getSplitOffset = getSplitOffset;
  2939. }));

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址