@mantine/charts 9.0.0-alpha.5 → 9.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/AreaChart/AreaChart.cjs +305 -376
- package/cjs/AreaChart/AreaChart.cjs.map +1 -1
- package/cjs/AreaChart/AreaGradient.cjs +33 -11
- package/cjs/AreaChart/AreaGradient.cjs.map +1 -1
- package/cjs/AreaChart/AreaSplit.cjs +25 -27
- package/cjs/AreaChart/AreaSplit.cjs.map +1 -1
- package/cjs/AreaChart/get-split-offset.cjs +18 -19
- package/cjs/AreaChart/get-split-offset.cjs.map +1 -1
- package/cjs/BarChart/BarChart.cjs +283 -364
- package/cjs/BarChart/BarChart.cjs.map +1 -1
- package/cjs/BarsList/BarsList.cjs +86 -115
- package/cjs/BarsList/BarsList.cjs.map +1 -1
- package/cjs/BarsList/BarsList.module.cjs +13 -0
- package/cjs/BarsList/BarsList.module.cjs.map +1 -0
- package/cjs/BubbleChart/BubbleChart.cjs +124 -143
- package/cjs/BubbleChart/BubbleChart.cjs.map +1 -1
- package/cjs/ChartLegend/ChartLegend.cjs +66 -83
- package/cjs/ChartLegend/ChartLegend.cjs.map +1 -1
- package/cjs/ChartLegend/ChartLegend.module.cjs +12 -0
- package/cjs/ChartLegend/ChartLegend.module.cjs.map +1 -0
- package/cjs/ChartTooltip/ChartTooltip.cjs +101 -116
- package/cjs/ChartTooltip/ChartTooltip.cjs.map +1 -1
- package/cjs/ChartTooltip/ChartTooltip.module.cjs +16 -0
- package/cjs/ChartTooltip/ChartTooltip.module.cjs.map +1 -0
- package/cjs/CompositeChart/CompositeChart.cjs +301 -389
- package/cjs/CompositeChart/CompositeChart.cjs.map +1 -1
- package/cjs/DonutChart/DonutChart.cjs +122 -168
- package/cjs/DonutChart/DonutChart.cjs.map +1 -1
- package/cjs/DonutChart/DonutChart.module.cjs +10 -0
- package/cjs/DonutChart/DonutChart.module.cjs.map +1 -0
- package/cjs/FunnelChart/FunnelChart.cjs +91 -129
- package/cjs/FunnelChart/FunnelChart.cjs.map +1 -1
- package/cjs/FunnelChart/FunnelChart.module.cjs +7 -0
- package/cjs/FunnelChart/FunnelChart.module.cjs.map +1 -0
- package/cjs/Heatmap/Heatmap.cjs +156 -188
- package/cjs/Heatmap/Heatmap.cjs.map +1 -1
- package/cjs/Heatmap/Heatmap.module.cjs +12 -0
- package/cjs/Heatmap/Heatmap.module.cjs.map +1 -0
- package/cjs/Heatmap/HeatmapSplitWeeks.cjs +48 -72
- package/cjs/Heatmap/HeatmapSplitWeeks.cjs.map +1 -1
- package/cjs/Heatmap/HeatmapWeeks.cjs +45 -57
- package/cjs/Heatmap/HeatmapWeeks.cjs.map +1 -1
- package/cjs/Heatmap/get-boundaries/get-boundaries.cjs +8 -10
- package/cjs/Heatmap/get-boundaries/get-boundaries.cjs.map +1 -1
- package/cjs/Heatmap/get-columns/get-columns.cjs +74 -64
- package/cjs/Heatmap/get-columns/get-columns.cjs.map +1 -1
- package/cjs/Heatmap/get-dates-range/get-dates-range.cjs +43 -54
- package/cjs/Heatmap/get-dates-range/get-dates-range.cjs.map +1 -1
- package/cjs/Heatmap/get-heat-color/get-heat-color.cjs +7 -8
- package/cjs/Heatmap/get-heat-color/get-heat-color.cjs.map +1 -1
- package/cjs/Heatmap/get-months-range/get-months-range.cjs +23 -19
- package/cjs/Heatmap/get-months-range/get-months-range.cjs.map +1 -1
- package/cjs/Heatmap/rotate-weekdays-names/rotate-weekdays-names.cjs +8 -10
- package/cjs/Heatmap/rotate-weekdays-names/rotate-weekdays-names.cjs.map +1 -1
- package/cjs/LineChart/LineChart.cjs +275 -341
- package/cjs/LineChart/LineChart.cjs.map +1 -1
- package/cjs/PieChart/PieChart.cjs +125 -171
- package/cjs/PieChart/PieChart.cjs.map +1 -1
- package/cjs/PieChart/PieChart.module.cjs +7 -0
- package/cjs/PieChart/PieChart.module.cjs.map +1 -0
- package/cjs/PointLabel/PointLabel.cjs +20 -20
- package/cjs/PointLabel/PointLabel.cjs.map +1 -1
- package/cjs/RadarChart/RadarChart.cjs +128 -157
- package/cjs/RadarChart/RadarChart.cjs.map +1 -1
- package/cjs/RadarChart/RadarChart.module.cjs +10 -0
- package/cjs/RadarChart/RadarChart.module.cjs.map +1 -0
- package/cjs/RadialBarChart/RadialBarChart.cjs +117 -147
- package/cjs/RadialBarChart/RadialBarChart.cjs.map +1 -1
- package/cjs/RadialBarChart/RadialBarChart.module.cjs +10 -0
- package/cjs/RadialBarChart/RadialBarChart.module.cjs.map +1 -0
- package/cjs/ScatterChart/ScatterChart.cjs +219 -278
- package/cjs/ScatterChart/ScatterChart.cjs.map +1 -1
- package/cjs/Sparkline/Sparkline.cjs +71 -99
- package/cjs/Sparkline/Sparkline.cjs.map +1 -1
- package/cjs/Sparkline/Sparkline.module.cjs +7 -0
- package/cjs/Sparkline/Sparkline.module.cjs.map +1 -0
- package/cjs/_virtual/_rolldown/runtime.cjs +24 -0
- package/cjs/grid-chart.module.cjs +14 -0
- package/cjs/grid-chart.module.cjs.map +1 -0
- package/cjs/index.cjs +39 -44
- package/cjs/utils/get-series-labels/get-series-labels.cjs +16 -18
- package/cjs/utils/get-series-labels/get-series-labels.cjs.map +1 -1
- package/esm/AreaChart/AreaChart.mjs +306 -376
- package/esm/AreaChart/AreaChart.mjs.map +1 -1
- package/esm/AreaChart/AreaGradient.mjs +32 -9
- package/esm/AreaChart/AreaGradient.mjs.map +1 -1
- package/esm/AreaChart/AreaSplit.mjs +24 -25
- package/esm/AreaChart/AreaSplit.mjs.map +1 -1
- package/esm/AreaChart/get-split-offset.mjs +18 -17
- package/esm/AreaChart/get-split-offset.mjs.map +1 -1
- package/esm/BarChart/BarChart.mjs +283 -364
- package/esm/BarChart/BarChart.mjs.map +1 -1
- package/esm/BarsList/BarsList.mjs +84 -112
- package/esm/BarsList/BarsList.mjs.map +1 -1
- package/esm/BarsList/BarsList.module.mjs +13 -0
- package/esm/BarsList/BarsList.module.mjs.map +1 -0
- package/esm/BubbleChart/BubbleChart.mjs +122 -140
- package/esm/BubbleChart/BubbleChart.mjs.map +1 -1
- package/esm/ChartLegend/ChartLegend.mjs +64 -80
- package/esm/ChartLegend/ChartLegend.mjs.map +1 -1
- package/esm/ChartLegend/ChartLegend.module.mjs +12 -0
- package/esm/ChartLegend/ChartLegend.module.mjs.map +1 -0
- package/esm/ChartTooltip/ChartTooltip.mjs +99 -113
- package/esm/ChartTooltip/ChartTooltip.mjs.map +1 -1
- package/esm/ChartTooltip/ChartTooltip.module.mjs +16 -0
- package/esm/ChartTooltip/ChartTooltip.module.mjs.map +1 -0
- package/esm/CompositeChart/CompositeChart.mjs +299 -386
- package/esm/CompositeChart/CompositeChart.mjs.map +1 -1
- package/esm/DonutChart/DonutChart.mjs +120 -165
- package/esm/DonutChart/DonutChart.mjs.map +1 -1
- package/esm/DonutChart/DonutChart.module.mjs +10 -0
- package/esm/DonutChart/DonutChart.module.mjs.map +1 -0
- package/esm/FunnelChart/FunnelChart.mjs +92 -129
- package/esm/FunnelChart/FunnelChart.mjs.map +1 -1
- package/esm/FunnelChart/FunnelChart.module.mjs +7 -0
- package/esm/FunnelChart/FunnelChart.module.mjs.map +1 -0
- package/esm/Heatmap/Heatmap.mjs +154 -185
- package/esm/Heatmap/Heatmap.mjs.map +1 -1
- package/esm/Heatmap/Heatmap.module.mjs +12 -0
- package/esm/Heatmap/Heatmap.module.mjs.map +1 -0
- package/esm/Heatmap/HeatmapSplitWeeks.mjs +47 -70
- package/esm/Heatmap/HeatmapSplitWeeks.mjs.map +1 -1
- package/esm/Heatmap/HeatmapWeeks.mjs +44 -55
- package/esm/Heatmap/HeatmapWeeks.mjs.map +1 -1
- package/esm/Heatmap/get-boundaries/get-boundaries.mjs +8 -8
- package/esm/Heatmap/get-boundaries/get-boundaries.mjs.map +1 -1
- package/esm/Heatmap/get-columns/get-columns.mjs +74 -62
- package/esm/Heatmap/get-columns/get-columns.mjs.map +1 -1
- package/esm/Heatmap/get-dates-range/get-dates-range.mjs +43 -52
- package/esm/Heatmap/get-dates-range/get-dates-range.mjs.map +1 -1
- package/esm/Heatmap/get-heat-color/get-heat-color.mjs +7 -6
- package/esm/Heatmap/get-heat-color/get-heat-color.mjs.map +1 -1
- package/esm/Heatmap/get-months-range/get-months-range.mjs +23 -17
- package/esm/Heatmap/get-months-range/get-months-range.mjs.map +1 -1
- package/esm/Heatmap/rotate-weekdays-names/rotate-weekdays-names.mjs +8 -8
- package/esm/Heatmap/rotate-weekdays-names/rotate-weekdays-names.mjs.map +1 -1
- package/esm/LineChart/LineChart.mjs +276 -341
- package/esm/LineChart/LineChart.mjs.map +1 -1
- package/esm/PieChart/PieChart.mjs +126 -171
- package/esm/PieChart/PieChart.mjs.map +1 -1
- package/esm/PieChart/PieChart.module.mjs +7 -0
- package/esm/PieChart/PieChart.module.mjs.map +1 -0
- package/esm/PointLabel/PointLabel.mjs +19 -18
- package/esm/PointLabel/PointLabel.mjs.map +1 -1
- package/esm/RadarChart/RadarChart.mjs +129 -157
- package/esm/RadarChart/RadarChart.mjs.map +1 -1
- package/esm/RadarChart/RadarChart.module.mjs +10 -0
- package/esm/RadarChart/RadarChart.module.mjs.map +1 -0
- package/esm/RadialBarChart/RadialBarChart.mjs +118 -147
- package/esm/RadialBarChart/RadialBarChart.mjs.map +1 -1
- package/esm/RadialBarChart/RadialBarChart.module.mjs +10 -0
- package/esm/RadialBarChart/RadialBarChart.module.mjs.map +1 -0
- package/esm/ScatterChart/ScatterChart.mjs +220 -278
- package/esm/ScatterChart/ScatterChart.mjs.map +1 -1
- package/esm/Sparkline/Sparkline.mjs +69 -96
- package/esm/Sparkline/Sparkline.mjs.map +1 -1
- package/esm/Sparkline/Sparkline.module.mjs +7 -0
- package/esm/Sparkline/Sparkline.module.mjs.map +1 -0
- package/esm/grid-chart.module.mjs +14 -0
- package/esm/grid-chart.module.mjs.map +1 -0
- package/esm/index.mjs +19 -19
- package/esm/utils/get-series-labels/get-series-labels.mjs +16 -16
- package/esm/utils/get-series-labels/get-series-labels.mjs.map +1 -1
- package/lib/BarChart/BarChart.d.ts +1 -0
- package/lib/DonutChart/DonutChart.d.ts +3 -3
- package/lib/PieChart/PieChart.d.ts +3 -3
- package/package.json +3 -3
- package/cjs/BarsList/BarsList.module.css.cjs +0 -7
- package/cjs/BarsList/BarsList.module.css.cjs.map +0 -1
- package/cjs/ChartLegend/ChartLegend.module.css.cjs +0 -7
- package/cjs/ChartLegend/ChartLegend.module.css.cjs.map +0 -1
- package/cjs/ChartTooltip/ChartTooltip.module.css.cjs +0 -7
- package/cjs/ChartTooltip/ChartTooltip.module.css.cjs.map +0 -1
- package/cjs/DonutChart/DonutChart.module.css.cjs +0 -7
- package/cjs/DonutChart/DonutChart.module.css.cjs.map +0 -1
- package/cjs/FunnelChart/FunnelChart.module.css.cjs +0 -7
- package/cjs/FunnelChart/FunnelChart.module.css.cjs.map +0 -1
- package/cjs/Heatmap/Heatmap.module.css.cjs +0 -7
- package/cjs/Heatmap/Heatmap.module.css.cjs.map +0 -1
- package/cjs/PieChart/PieChart.module.css.cjs +0 -7
- package/cjs/PieChart/PieChart.module.css.cjs.map +0 -1
- package/cjs/RadarChart/RadarChart.module.css.cjs +0 -7
- package/cjs/RadarChart/RadarChart.module.css.cjs.map +0 -1
- package/cjs/RadialBarChart/RadialBarChart.module.css.cjs +0 -7
- package/cjs/RadialBarChart/RadialBarChart.module.css.cjs.map +0 -1
- package/cjs/SankeyChart/SankeyChart.cjs +0 -276
- package/cjs/SankeyChart/SankeyChart.cjs.map +0 -1
- package/cjs/SankeyChart/SankeyChart.module.css.cjs +0 -7
- package/cjs/SankeyChart/SankeyChart.module.css.cjs.map +0 -1
- package/cjs/Sparkline/Sparkline.module.css.cjs +0 -7
- package/cjs/Sparkline/Sparkline.module.css.cjs.map +0 -1
- package/cjs/Treemap/Treemap.cjs +0 -198
- package/cjs/Treemap/Treemap.cjs.map +0 -1
- package/cjs/Treemap/Treemap.module.css.cjs +0 -7
- package/cjs/Treemap/Treemap.module.css.cjs.map +0 -1
- package/cjs/grid-chart.module.css.cjs +0 -7
- package/cjs/grid-chart.module.css.cjs.map +0 -1
- package/cjs/index.cjs.map +0 -1
- package/esm/BarsList/BarsList.module.css.mjs +0 -5
- package/esm/BarsList/BarsList.module.css.mjs.map +0 -1
- package/esm/ChartLegend/ChartLegend.module.css.mjs +0 -5
- package/esm/ChartLegend/ChartLegend.module.css.mjs.map +0 -1
- package/esm/ChartTooltip/ChartTooltip.module.css.mjs +0 -5
- package/esm/ChartTooltip/ChartTooltip.module.css.mjs.map +0 -1
- package/esm/DonutChart/DonutChart.module.css.mjs +0 -5
- package/esm/DonutChart/DonutChart.module.css.mjs.map +0 -1
- package/esm/FunnelChart/FunnelChart.module.css.mjs +0 -5
- package/esm/FunnelChart/FunnelChart.module.css.mjs.map +0 -1
- package/esm/Heatmap/Heatmap.module.css.mjs +0 -5
- package/esm/Heatmap/Heatmap.module.css.mjs.map +0 -1
- package/esm/PieChart/PieChart.module.css.mjs +0 -5
- package/esm/PieChart/PieChart.module.css.mjs.map +0 -1
- package/esm/RadarChart/RadarChart.module.css.mjs +0 -5
- package/esm/RadarChart/RadarChart.module.css.mjs.map +0 -1
- package/esm/RadialBarChart/RadialBarChart.module.css.mjs +0 -5
- package/esm/RadialBarChart/RadialBarChart.module.css.mjs.map +0 -1
- package/esm/SankeyChart/SankeyChart.mjs +0 -274
- package/esm/SankeyChart/SankeyChart.mjs.map +0 -1
- package/esm/SankeyChart/SankeyChart.module.css.mjs +0 -5
- package/esm/SankeyChart/SankeyChart.module.css.mjs.map +0 -1
- package/esm/Sparkline/Sparkline.module.css.mjs +0 -5
- package/esm/Sparkline/Sparkline.module.css.mjs.map +0 -1
- package/esm/Treemap/Treemap.mjs +0 -196
- package/esm/Treemap/Treemap.mjs.map +0 -1
- package/esm/Treemap/Treemap.module.css.mjs +0 -5
- package/esm/Treemap/Treemap.module.css.mjs.map +0 -1
- package/esm/grid-chart.module.css.mjs +0 -5
- package/esm/grid-chart.module.css.mjs.map +0 -1
- package/esm/index.mjs.map +0 -1
- package/lib/SankeyChart/SankeyChart.d.ts +0 -71
- package/lib/SankeyChart/index.d.ts +0 -12
- package/lib/Treemap/Treemap.d.ts +0 -57
- package/lib/Treemap/index.d.ts +0 -10
|
@@ -1,284 +1,226 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { ChartTooltip } from "../ChartTooltip/ChartTooltip.mjs";
|
|
3
|
+
import { ChartLegend } from "../ChartLegend/ChartLegend.mjs";
|
|
4
|
+
import grid_chart_module_default from "../grid-chart.module.mjs";
|
|
5
|
+
import { Box, createVarsResolver, factory, getThemeColor, useMantineTheme, useProps, useResolvedStylesApi, useStyles } from "@mantine/core";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { CartesianGrid, Label, LabelList, Legend, ReferenceLine, ResponsiveContainer, Scatter, ScatterChart, Tooltip as Tooltip$1, XAxis, YAxis } from "recharts";
|
|
9
|
+
//#region packages/@mantine/charts/src/ScatterChart/ScatterChart.tsx
|
|
10
10
|
function getAxis(key, dataKey) {
|
|
11
|
-
|
|
11
|
+
return key === dataKey.x ? "x" : "y";
|
|
12
12
|
}
|
|
13
13
|
const defaultProps = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
withXAxis: true,
|
|
15
|
+
withYAxis: true,
|
|
16
|
+
withTooltip: true,
|
|
17
|
+
tooltipAnimationDuration: 0,
|
|
18
|
+
tickLine: "y",
|
|
19
|
+
strokeDasharray: "5 5",
|
|
20
|
+
gridAxis: "x"
|
|
21
21
|
};
|
|
22
|
-
const varsResolver = createVarsResolver((theme, { textColor, gridColor }) => ({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
cursor: {
|
|
220
|
-
stroke: "var(--chart-grid-color)",
|
|
221
|
-
strokeWidth: 1,
|
|
222
|
-
strokeDasharray
|
|
223
|
-
},
|
|
224
|
-
content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsx(
|
|
225
|
-
ChartTooltip,
|
|
226
|
-
{
|
|
227
|
-
type: "scatter",
|
|
228
|
-
label: labelFormatter && payload ? labelFormatter(label, payload) : label,
|
|
229
|
-
payload: labels ? payload?.map((item) => ({
|
|
230
|
-
...item,
|
|
231
|
-
name: labels[getAxis(item.name, dataKey)] || item.name,
|
|
232
|
-
value: getFormatter(getAxis(item.name, dataKey))?.(
|
|
233
|
-
item.value
|
|
234
|
-
) ?? item.value
|
|
235
|
-
})) : payload?.map((item) => ({
|
|
236
|
-
...item,
|
|
237
|
-
value: getFormatter(getAxis(item.name, dataKey))?.(
|
|
238
|
-
item.value
|
|
239
|
-
) ?? item.value
|
|
240
|
-
})),
|
|
241
|
-
classNames: resolvedClassNames,
|
|
242
|
-
styles: resolvedStyles,
|
|
243
|
-
series: data,
|
|
244
|
-
attributes
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
...tooltipProps
|
|
248
|
-
}
|
|
249
|
-
),
|
|
250
|
-
withLegend && /* @__PURE__ */ jsx(
|
|
251
|
-
Legend,
|
|
252
|
-
{
|
|
253
|
-
verticalAlign: "top",
|
|
254
|
-
content: (payload) => /* @__PURE__ */ jsx(
|
|
255
|
-
ChartLegend,
|
|
256
|
-
{
|
|
257
|
-
payload: payload.payload?.map((item, index) => ({
|
|
258
|
-
...item,
|
|
259
|
-
dataKey: data[index].name
|
|
260
|
-
})),
|
|
261
|
-
onHighlight: setHighlightedArea,
|
|
262
|
-
legendPosition: legendProps?.verticalAlign || "top",
|
|
263
|
-
classNames: resolvedClassNames,
|
|
264
|
-
styles: resolvedStyles,
|
|
265
|
-
series: data,
|
|
266
|
-
attributes
|
|
267
|
-
}
|
|
268
|
-
),
|
|
269
|
-
height: 44,
|
|
270
|
-
...legendProps
|
|
271
|
-
}
|
|
272
|
-
),
|
|
273
|
-
referenceLinesItems,
|
|
274
|
-
scatters
|
|
275
|
-
]
|
|
276
|
-
}
|
|
277
|
-
) }) });
|
|
22
|
+
const varsResolver = createVarsResolver((theme, { textColor, gridColor }) => ({ root: {
|
|
23
|
+
"--chart-text-color": textColor ? getThemeColor(textColor, theme) : void 0,
|
|
24
|
+
"--chart-grid-color": gridColor ? getThemeColor(gridColor, theme) : void 0
|
|
25
|
+
} }));
|
|
26
|
+
const ScatterChart$1 = factory((_props) => {
|
|
27
|
+
const props = useProps("ScatterChart", defaultProps, _props);
|
|
28
|
+
const { classNames, className, style, styles, unstyled, vars, referenceLines, dir, withLegend, withTooltip, withXAxis, withYAxis, xAxisProps, yAxisProps, orientation, scatterChartProps, legendProps, data, gridAxis, tickLine, strokeDasharray, gridProps, tooltipAnimationDuration, tooltipProps, children, onMouseLeave, dataKey, textColor, gridColor, xAxisLabel, yAxisLabel, unit, labels, valueFormatter, scatterProps, pointLabels, attributes, ...others } = props;
|
|
29
|
+
const getFormatter = (axis) => typeof valueFormatter === "function" ? valueFormatter : valueFormatter?.[axis];
|
|
30
|
+
const xFormatter = getFormatter("x");
|
|
31
|
+
const yFormatter = getFormatter("y");
|
|
32
|
+
const theme = useMantineTheme();
|
|
33
|
+
const mappedData = data.map((item) => ({
|
|
34
|
+
...item,
|
|
35
|
+
data: item.data.map((point) => ({
|
|
36
|
+
...point,
|
|
37
|
+
name: item.name
|
|
38
|
+
}))
|
|
39
|
+
}));
|
|
40
|
+
const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi({
|
|
41
|
+
classNames,
|
|
42
|
+
styles,
|
|
43
|
+
props
|
|
44
|
+
});
|
|
45
|
+
const getStyles = useStyles({
|
|
46
|
+
name: "ScatterChart",
|
|
47
|
+
classes: grid_chart_module_default,
|
|
48
|
+
props,
|
|
49
|
+
className,
|
|
50
|
+
style,
|
|
51
|
+
classNames,
|
|
52
|
+
styles,
|
|
53
|
+
unstyled,
|
|
54
|
+
attributes,
|
|
55
|
+
vars,
|
|
56
|
+
varsResolver
|
|
57
|
+
});
|
|
58
|
+
const withXTickLine = gridAxis !== "none" && (tickLine === "x" || tickLine === "xy");
|
|
59
|
+
const withYTickLine = gridAxis !== "none" && (tickLine === "y" || tickLine === "xy");
|
|
60
|
+
const [highlightedArea, setHighlightedArea] = useState(null);
|
|
61
|
+
const shouldHighlight = highlightedArea !== null;
|
|
62
|
+
const handleMouseLeave = (event) => {
|
|
63
|
+
setHighlightedArea(null);
|
|
64
|
+
onMouseLeave?.(event);
|
|
65
|
+
};
|
|
66
|
+
const referenceLinesItems = referenceLines?.map((line, index) => {
|
|
67
|
+
const color = getThemeColor(line.color, theme);
|
|
68
|
+
return /* @__PURE__ */ jsx(ReferenceLine, {
|
|
69
|
+
stroke: line.color ? color : "var(--chart-grid-color)",
|
|
70
|
+
strokeWidth: 1,
|
|
71
|
+
...line,
|
|
72
|
+
label: {
|
|
73
|
+
value: line.label,
|
|
74
|
+
fill: line.color ? color : "currentColor",
|
|
75
|
+
fontSize: 12,
|
|
76
|
+
position: line.labelPosition ?? "insideBottomLeft"
|
|
77
|
+
},
|
|
78
|
+
...getStyles("referenceLine")
|
|
79
|
+
}, index);
|
|
80
|
+
});
|
|
81
|
+
const scatters = mappedData.map((item, index) => {
|
|
82
|
+
const dimmed = shouldHighlight && highlightedArea !== item.name;
|
|
83
|
+
return /* @__PURE__ */ jsxs(Scatter, {
|
|
84
|
+
data: item.data,
|
|
85
|
+
fill: getThemeColor(item.color, theme),
|
|
86
|
+
isAnimationActive: false,
|
|
87
|
+
fillOpacity: dimmed ? .1 : 1,
|
|
88
|
+
...scatterProps,
|
|
89
|
+
children: [pointLabels && /* @__PURE__ */ jsx(LabelList, {
|
|
90
|
+
dataKey: dataKey[pointLabels],
|
|
91
|
+
fontSize: 8,
|
|
92
|
+
dy: 10
|
|
93
|
+
}), scatterProps?.children]
|
|
94
|
+
}, index);
|
|
95
|
+
});
|
|
96
|
+
return /* @__PURE__ */ jsx(Box, {
|
|
97
|
+
...getStyles("root"),
|
|
98
|
+
onMouseLeave: handleMouseLeave,
|
|
99
|
+
dir: dir || "ltr",
|
|
100
|
+
...others,
|
|
101
|
+
children: /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
102
|
+
...getStyles("container"),
|
|
103
|
+
children: /* @__PURE__ */ jsxs(ScatterChart, {
|
|
104
|
+
margin: {
|
|
105
|
+
bottom: xAxisLabel ? 30 : void 0,
|
|
106
|
+
left: yAxisLabel ? 10 : void 0,
|
|
107
|
+
right: yAxisLabel ? 5 : void 0
|
|
108
|
+
},
|
|
109
|
+
...scatterChartProps,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(CartesianGrid, {
|
|
112
|
+
strokeDasharray,
|
|
113
|
+
vertical: gridAxis === "y" || gridAxis === "xy",
|
|
114
|
+
horizontal: gridAxis === "x" || gridAxis === "xy",
|
|
115
|
+
...getStyles("grid"),
|
|
116
|
+
...gridProps
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ jsxs(XAxis, {
|
|
119
|
+
type: "number",
|
|
120
|
+
hide: !withXAxis,
|
|
121
|
+
dataKey: dataKey.x,
|
|
122
|
+
tick: {
|
|
123
|
+
transform: "translate(0, 10)",
|
|
124
|
+
fontSize: 12,
|
|
125
|
+
fill: "currentColor"
|
|
126
|
+
},
|
|
127
|
+
stroke: "",
|
|
128
|
+
interval: "preserveStartEnd",
|
|
129
|
+
tickLine: withXTickLine ? { stroke: "currentColor" } : false,
|
|
130
|
+
minTickGap: 5,
|
|
131
|
+
unit: unit?.x,
|
|
132
|
+
tickFormatter: xFormatter,
|
|
133
|
+
...getStyles("axis"),
|
|
134
|
+
...xAxisProps,
|
|
135
|
+
children: [xAxisLabel && /* @__PURE__ */ jsx(Label, {
|
|
136
|
+
position: "insideBottom",
|
|
137
|
+
offset: -20,
|
|
138
|
+
fontSize: 12,
|
|
139
|
+
...getStyles("axisLabel"),
|
|
140
|
+
children: xAxisLabel
|
|
141
|
+
}), xAxisProps?.children]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsxs(YAxis, {
|
|
144
|
+
type: "number",
|
|
145
|
+
hide: !withYAxis,
|
|
146
|
+
axisLine: false,
|
|
147
|
+
dataKey: dataKey.y,
|
|
148
|
+
tickLine: withYTickLine ? { stroke: "currentColor" } : false,
|
|
149
|
+
tick: {
|
|
150
|
+
transform: "translate(-10, 0)",
|
|
151
|
+
fontSize: 12,
|
|
152
|
+
fill: "currentColor"
|
|
153
|
+
},
|
|
154
|
+
allowDecimals: true,
|
|
155
|
+
unit: unit?.y,
|
|
156
|
+
tickFormatter: yFormatter,
|
|
157
|
+
...getStyles("axis"),
|
|
158
|
+
...yAxisProps,
|
|
159
|
+
children: [yAxisLabel && /* @__PURE__ */ jsx(Label, {
|
|
160
|
+
position: "insideLeft",
|
|
161
|
+
angle: -90,
|
|
162
|
+
textAnchor: "middle",
|
|
163
|
+
fontSize: 12,
|
|
164
|
+
offset: -5,
|
|
165
|
+
...getStyles("axisLabel"),
|
|
166
|
+
children: yAxisLabel
|
|
167
|
+
}), yAxisProps?.children]
|
|
168
|
+
}),
|
|
169
|
+
withTooltip && /* @__PURE__ */ jsx(Tooltip$1, {
|
|
170
|
+
animationDuration: tooltipAnimationDuration,
|
|
171
|
+
isAnimationActive: tooltipAnimationDuration !== 0,
|
|
172
|
+
position: { y: 0 },
|
|
173
|
+
cursor: {
|
|
174
|
+
stroke: "var(--chart-grid-color)",
|
|
175
|
+
strokeWidth: 1,
|
|
176
|
+
strokeDasharray
|
|
177
|
+
},
|
|
178
|
+
content: ({ label, payload, labelFormatter }) => /* @__PURE__ */ jsx(ChartTooltip, {
|
|
179
|
+
type: "scatter",
|
|
180
|
+
label: labelFormatter && payload ? labelFormatter(label, payload) : label,
|
|
181
|
+
payload: labels ? payload?.map((item) => ({
|
|
182
|
+
...item,
|
|
183
|
+
name: labels[getAxis(item.name, dataKey)] || item.name,
|
|
184
|
+
value: getFormatter(getAxis(item.name, dataKey))?.(item.value) ?? item.value
|
|
185
|
+
})) : payload?.map((item) => ({
|
|
186
|
+
...item,
|
|
187
|
+
value: getFormatter(getAxis(item.name, dataKey))?.(item.value) ?? item.value
|
|
188
|
+
})),
|
|
189
|
+
classNames: resolvedClassNames,
|
|
190
|
+
styles: resolvedStyles,
|
|
191
|
+
series: data,
|
|
192
|
+
attributes
|
|
193
|
+
}),
|
|
194
|
+
...tooltipProps
|
|
195
|
+
}),
|
|
196
|
+
withLegend && /* @__PURE__ */ jsx(Legend, {
|
|
197
|
+
verticalAlign: "top",
|
|
198
|
+
content: (payload) => /* @__PURE__ */ jsx(ChartLegend, {
|
|
199
|
+
payload: payload.payload?.map((item, index) => ({
|
|
200
|
+
...item,
|
|
201
|
+
dataKey: data[index].name
|
|
202
|
+
})),
|
|
203
|
+
onHighlight: setHighlightedArea,
|
|
204
|
+
legendPosition: legendProps?.verticalAlign || "top",
|
|
205
|
+
classNames: resolvedClassNames,
|
|
206
|
+
styles: resolvedStyles,
|
|
207
|
+
series: data,
|
|
208
|
+
attributes
|
|
209
|
+
}),
|
|
210
|
+
height: 44,
|
|
211
|
+
...legendProps
|
|
212
|
+
}),
|
|
213
|
+
referenceLinesItems,
|
|
214
|
+
scatters
|
|
215
|
+
]
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
});
|
|
278
219
|
});
|
|
279
|
-
ScatterChart.displayName = "@mantine/charts/ScatterChart";
|
|
280
|
-
ScatterChart.classes =
|
|
281
|
-
ScatterChart.varsResolver = varsResolver;
|
|
220
|
+
ScatterChart$1.displayName = "@mantine/charts/ScatterChart";
|
|
221
|
+
ScatterChart$1.classes = grid_chart_module_default;
|
|
222
|
+
ScatterChart$1.varsResolver = varsResolver;
|
|
223
|
+
//#endregion
|
|
224
|
+
export { ScatterChart$1 as ScatterChart };
|
|
282
225
|
|
|
283
|
-
|
|
284
|
-
//# sourceMappingURL=ScatterChart.mjs.map
|
|
226
|
+
//# sourceMappingURL=ScatterChart.mjs.map
|