@mui/x-charts-pro 8.0.0-beta.3 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/BarChartPro/BarChartPro.js +786 -9
  2. package/CHANGELOG.md +282 -96
  3. package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
  4. package/ChartDataProviderPro/ChartDataProviderPro.js +27 -22
  5. package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -2
  6. package/ChartDataProviderPro/useChartDataProviderProProps.js +0 -2
  7. package/FunnelChart/FunnelChart.js +73 -4
  8. package/FunnelChart/categoryAxis.types.d.ts +3 -2
  9. package/FunnelChart/funnelSectionClasses.d.ts +5 -0
  10. package/FunnelChart/funnelSectionClasses.js +1 -1
  11. package/FunnelChart/index.d.ts +1 -0
  12. package/FunnelChart/index.js +12 -0
  13. package/FunnelChart/useFunnelChartProps.js +3 -3
  14. package/Heatmap/Heatmap.js +1 -2
  15. package/Heatmap/heatmapClasses.d.ts +5 -0
  16. package/Heatmap/heatmapClasses.js +1 -1
  17. package/LineChartPro/LineChartPro.js +786 -9
  18. package/ScatterChartPro/ScatterChartPro.js +786 -9
  19. package/esm/BarChartPro/BarChartPro.js +786 -9
  20. package/esm/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
  21. package/esm/ChartDataProviderPro/ChartDataProviderPro.js +28 -23
  22. package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -2
  23. package/esm/ChartDataProviderPro/useChartDataProviderProProps.js +0 -2
  24. package/esm/FunnelChart/FunnelChart.js +73 -4
  25. package/esm/FunnelChart/categoryAxis.types.d.ts +3 -2
  26. package/esm/FunnelChart/funnelSectionClasses.d.ts +5 -0
  27. package/esm/FunnelChart/funnelSectionClasses.js +1 -1
  28. package/esm/FunnelChart/index.d.ts +1 -0
  29. package/esm/FunnelChart/index.js +1 -0
  30. package/esm/FunnelChart/useFunnelChartProps.js +3 -3
  31. package/esm/Heatmap/Heatmap.js +1 -2
  32. package/esm/Heatmap/heatmapClasses.d.ts +5 -0
  33. package/esm/Heatmap/heatmapClasses.js +1 -1
  34. package/esm/LineChartPro/LineChartPro.js +786 -9
  35. package/esm/ScatterChartPro/ScatterChartPro.js +786 -9
  36. package/esm/index.js +1 -1
  37. package/esm/internals/plugins/useChartProZoom/useChartProZoom.js +28 -35
  38. package/esm/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +7 -7
  39. package/index.js +1 -1
  40. package/internals/plugins/useChartProZoom/useChartProZoom.js +28 -34
  41. package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +7 -7
  42. package/package.json +6 -14
  43. package/esm/internals/utils/releaseInfo.d.ts +0 -1
  44. package/esm/internals/utils/releaseInfo.js +0 -13
  45. package/internals/utils/releaseInfo.d.ts +0 -1
  46. package/internals/utils/releaseInfo.js +0 -21
  47. package/modern/BarChartPro/BarChartPro.d.ts +0 -18
  48. package/modern/BarChartPro/BarChartPro.js +0 -406
  49. package/modern/BarChartPro/BarChartPro.plugins.d.ts +0 -4
  50. package/modern/BarChartPro/BarChartPro.plugins.js +0 -3
  51. package/modern/BarChartPro/index.d.ts +0 -1
  52. package/modern/BarChartPro/index.js +0 -1
  53. package/modern/ChartContainerPro/ChartContainerPro.d.ts +0 -35
  54. package/modern/ChartContainerPro/ChartContainerPro.js +0 -290
  55. package/modern/ChartContainerPro/index.d.ts +0 -2
  56. package/modern/ChartContainerPro/index.js +0 -2
  57. package/modern/ChartContainerPro/useChartContainerProProps.d.ts +0 -9
  58. package/modern/ChartContainerPro/useChartContainerProProps.js +0 -35
  59. package/modern/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -37
  60. package/modern/ChartDataProviderPro/ChartDataProviderPro.js +0 -106
  61. package/modern/ChartDataProviderPro/index.d.ts +0 -2
  62. package/modern/ChartDataProviderPro/index.js +0 -2
  63. package/modern/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -8
  64. package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +0 -15
  65. package/modern/FunnelChart/FunnelChart.d.ts +0 -37
  66. package/modern/FunnelChart/FunnelChart.js +0 -212
  67. package/modern/FunnelChart/FunnelPlot.d.ts +0 -16
  68. package/modern/FunnelChart/FunnelPlot.js +0 -184
  69. package/modern/FunnelChart/FunnelSection.d.ts +0 -15
  70. package/modern/FunnelChart/FunnelSection.js +0 -56
  71. package/modern/FunnelChart/categoryAxis.types.d.ts +0 -24
  72. package/modern/FunnelChart/categoryAxis.types.js +0 -1
  73. package/modern/FunnelChart/funnel.types.d.ts +0 -124
  74. package/modern/FunnelChart/funnel.types.js +0 -1
  75. package/modern/FunnelChart/funnelPlotSlots.types.d.ts +0 -20
  76. package/modern/FunnelChart/funnelPlotSlots.types.js +0 -1
  77. package/modern/FunnelChart/funnelSectionClasses.d.ts +0 -13
  78. package/modern/FunnelChart/funnelSectionClasses.js +0 -20
  79. package/modern/FunnelChart/funnelSlots.types.d.ts +0 -19
  80. package/modern/FunnelChart/funnelSlots.types.js +0 -1
  81. package/modern/FunnelChart/funnelStepCurve.d.ts +0 -4
  82. package/modern/FunnelChart/funnelStepCurve.js +0 -67
  83. package/modern/FunnelChart/index.d.ts +0 -7
  84. package/modern/FunnelChart/index.js +0 -5
  85. package/modern/FunnelChart/labelUtils.d.ts +0 -42
  86. package/modern/FunnelChart/labelUtils.js +0 -166
  87. package/modern/FunnelChart/seriesConfig/extremums.d.ts +0 -3
  88. package/modern/FunnelChart/seriesConfig/extremums.js +0 -42
  89. package/modern/FunnelChart/seriesConfig/getColor.d.ts +0 -3
  90. package/modern/FunnelChart/seriesConfig/getColor.js +0 -4
  91. package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +0 -3
  92. package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +0 -11
  93. package/modern/FunnelChart/seriesConfig/index.d.ts +0 -2
  94. package/modern/FunnelChart/seriesConfig/index.js +0 -15
  95. package/modern/FunnelChart/seriesConfig/legend.d.ts +0 -3
  96. package/modern/FunnelChart/seriesConfig/legend.js +0 -25
  97. package/modern/FunnelChart/seriesConfig/seriesProcessor.d.ts +0 -3
  98. package/modern/FunnelChart/seriesConfig/seriesProcessor.js +0 -89
  99. package/modern/FunnelChart/seriesConfig/tooltip.d.ts +0 -3
  100. package/modern/FunnelChart/seriesConfig/tooltip.js +0 -29
  101. package/modern/FunnelChart/useFunnelChartProps.d.ts +0 -30
  102. package/modern/FunnelChart/useFunnelChartProps.js +0 -161
  103. package/modern/Heatmap/Heatmap.d.ts +0 -57
  104. package/modern/Heatmap/Heatmap.js +0 -389
  105. package/modern/Heatmap/Heatmap.plugins.d.ts +0 -3
  106. package/modern/Heatmap/Heatmap.plugins.js +0 -2
  107. package/modern/Heatmap/HeatmapItem.d.ts +0 -49
  108. package/modern/Heatmap/HeatmapItem.js +0 -106
  109. package/modern/Heatmap/HeatmapPlot.d.ts +0 -8
  110. package/modern/Heatmap/HeatmapPlot.js +0 -59
  111. package/modern/Heatmap/HeatmapTooltip/HeatmapTooltip.d.ts +0 -16
  112. package/modern/Heatmap/HeatmapTooltip/HeatmapTooltip.js +0 -284
  113. package/modern/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.d.ts +0 -4
  114. package/modern/Heatmap/HeatmapTooltip/HeatmapTooltipAxesValue.js +0 -22
  115. package/modern/Heatmap/HeatmapTooltip/index.d.ts +0 -1
  116. package/modern/Heatmap/HeatmapTooltip/index.js +0 -1
  117. package/modern/Heatmap/heatmapClasses.d.ts +0 -11
  118. package/modern/Heatmap/heatmapClasses.js +0 -14
  119. package/modern/Heatmap/index.d.ts +0 -4
  120. package/modern/Heatmap/index.js +0 -4
  121. package/modern/Heatmap/seriesConfig/extremums.d.ts +0 -2
  122. package/modern/Heatmap/seriesConfig/extremums.js +0 -8
  123. package/modern/Heatmap/seriesConfig/getColor.d.ts +0 -3
  124. package/modern/Heatmap/seriesConfig/getColor.js +0 -15
  125. package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +0 -3
  126. package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +0 -8
  127. package/modern/Heatmap/seriesConfig/index.d.ts +0 -2
  128. package/modern/Heatmap/seriesConfig/index.js +0 -14
  129. package/modern/Heatmap/seriesConfig/seriesProcessor.d.ts +0 -3
  130. package/modern/Heatmap/seriesConfig/seriesProcessor.js +0 -21
  131. package/modern/Heatmap/seriesConfig/tooltip.d.ts +0 -3
  132. package/modern/Heatmap/seriesConfig/tooltip.js +0 -25
  133. package/modern/LineChartPro/LineChartPro.d.ts +0 -17
  134. package/modern/LineChartPro/LineChartPro.js +0 -403
  135. package/modern/LineChartPro/LineChartPro.plugins.d.ts +0 -4
  136. package/modern/LineChartPro/LineChartPro.plugins.js +0 -3
  137. package/modern/LineChartPro/index.d.ts +0 -1
  138. package/modern/LineChartPro/index.js +0 -1
  139. package/modern/ScatterChartPro/ScatterChartPro.d.ts +0 -17
  140. package/modern/ScatterChartPro/ScatterChartPro.js +0 -397
  141. package/modern/ScatterChartPro/ScatterChartPro.plugins.d.ts +0 -4
  142. package/modern/ScatterChartPro/ScatterChartPro.plugins.js +0 -3
  143. package/modern/ScatterChartPro/index.d.ts +0 -1
  144. package/modern/ScatterChartPro/index.js +0 -1
  145. package/modern/hooks/index.d.ts +0 -2
  146. package/modern/hooks/index.js +0 -2
  147. package/modern/hooks/useFunnelSeries.d.ts +0 -33
  148. package/modern/hooks/useFunnelSeries.js +0 -42
  149. package/modern/hooks/useHeatmapSeries.d.ts +0 -33
  150. package/modern/hooks/useHeatmapSeries.js +0 -42
  151. package/modern/hooks/zoom/index.d.ts +0 -1
  152. package/modern/hooks/zoom/index.js +0 -1
  153. package/modern/hooks/zoom/useIsZoomInteracting.d.ts +0 -6
  154. package/modern/hooks/zoom/useIsZoomInteracting.js +0 -14
  155. package/modern/index.d.ts +0 -34
  156. package/modern/index.js +0 -45
  157. package/modern/internals/plugins/allPlugins.d.ts +0 -8
  158. package/modern/internals/plugins/allPlugins.js +0 -6
  159. package/modern/internals/plugins/useChartProZoom/index.d.ts +0 -3
  160. package/modern/internals/plugins/useChartProZoom/index.js +0 -3
  161. package/modern/internals/plugins/useChartProZoom/useChartProZoom.d.ts +0 -3
  162. package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +0 -350
  163. package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +0 -203
  164. package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +0 -4
  165. package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +0 -53
  166. package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +0 -1
  167. package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +0 -45
  168. package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +0 -126
  169. package/modern/internals/utils/releaseInfo.d.ts +0 -1
  170. package/modern/internals/utils/releaseInfo.js +0 -13
  171. package/modern/models/index.d.ts +0 -2
  172. package/modern/models/index.js +0 -2
  173. package/modern/models/seriesType/heatmap.d.ts +0 -28
  174. package/modern/models/seriesType/heatmap.js +0 -1
  175. package/modern/models/seriesType/index.d.ts +0 -1
  176. package/modern/models/seriesType/index.js +0 -1
  177. package/modern/package.json +0 -1
  178. package/modern/themeAugmentation/components.d.ts +0 -23
  179. package/modern/themeAugmentation/index.d.ts +0 -4
  180. package/modern/themeAugmentation/index.js +0 -0
  181. package/modern/themeAugmentation/overrides.d.ts +0 -11
  182. package/modern/themeAugmentation/props.d.ts +0 -20
  183. package/modern/typeOverloads/index.d.ts +0 -1
  184. package/modern/typeOverloads/index.js +0 -1
  185. package/modern/typeOverloads/modules.d.ts +0 -33
  186. package/modern/typeOverloads/modules.js +0 -1
  187. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,20 +0,0 @@
1
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
- import composeClasses from '@mui/utils/composeClasses';
4
- function getFunnelSectionUtilityClass(slot) {
5
- return generateUtilityClass('MuiFunnelSection', slot);
6
- }
7
- export const useUtilityClasses = props => {
8
- const {
9
- classes,
10
- seriesId
11
- } = props;
12
- const slots = {
13
- root: ['root', `series-${seriesId}`],
14
- highlighted: ['highlighted'],
15
- faded: ['faded'],
16
- label: ['label']
17
- };
18
- return composeClasses(slots, getFunnelSectionUtilityClass, classes);
19
- };
20
- export const funnelSectionClasses = generateUtilityClasses('MuiFunnelSection', ['root', 'highlighted', 'faded', 'label']);
@@ -1,19 +0,0 @@
1
- import { ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
2
- import { ChartsTooltipSlotProps, ChartsTooltipSlots } from '@mui/x-charts/ChartsTooltip';
3
- import { ChartsAxisSlotProps, ChartsAxisSlots } from '@mui/x-charts/internals';
4
- import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
5
- import { FunnelPlotSlotProps, FunnelPlotSlots } from "./funnelPlotSlots.types.js";
6
- export interface FunnelChartSlots extends ChartsAxisSlots, FunnelPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots, ChartsAxisSlots {}
7
- export interface FunnelChartSlotProps extends ChartsAxisSlotProps, FunnelPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsAxisSlotProps {}
8
- export interface FunnelChartSlotExtension {
9
- /**
10
- * Overridable component slots.
11
- * @default {}
12
- */
13
- slots?: FunnelChartSlots;
14
- /**
15
- * The props used for each component slot.
16
- * @default {}
17
- */
18
- slotProps?: FunnelChartSlotProps;
19
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,4 +0,0 @@
1
- import { CurveFactory } from '@mui/x-charts-vendor/d3-shape';
2
- declare const funnelHorizontalStepCurve: CurveFactory;
3
- declare const funnelVerticalStepCurve: CurveFactory;
4
- export { funnelHorizontalStepCurve, funnelVerticalStepCurve };
@@ -1,67 +0,0 @@
1
- /**
2
- * This is a custom "step" curve generator for the funnel chart.
3
- * It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
4
- *
5
- * It is based on the d3-shape step curve generator.
6
- * https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
7
- */
8
- class FunnelStep {
9
- constructor(context, isHorizontal) {
10
- this.context = void 0;
11
- this.line = NaN;
12
- this.x = NaN;
13
- this.y = NaN;
14
- this.currentPoint = 0;
15
- this.isHorizontal = false;
16
- this.context = context;
17
- this.isHorizontal = isHorizontal;
18
- }
19
- areaStart() {
20
- this.line = 0;
21
- }
22
- areaEnd() {
23
- this.line = NaN;
24
- }
25
- lineStart() {
26
- this.x = NaN;
27
- this.y = NaN;
28
- this.currentPoint = 0;
29
- }
30
- lineEnd() {
31
- if (this.currentPoint === 2) {
32
- this.context.lineTo(this.x, this.y);
33
- }
34
- if (this.line || this.line !== 0 && this.currentPoint === 1) {
35
- this.context.closePath();
36
- }
37
- if (this.line >= 0) {
38
- this.line = 1 - this.line;
39
- }
40
- }
41
- point(x, y) {
42
- x = +x;
43
- y = +y;
44
- if (this.currentPoint === 0) {
45
- this.context.moveTo(x, y);
46
- } else if (this.isHorizontal && (this.currentPoint === 2 || this.currentPoint === 1)) {
47
- this.context.lineTo(x, this.y);
48
- this.context.lineTo(x, y);
49
- } else if (this.currentPoint === 3 && !this.isHorizontal) {
50
- this.context.lineTo(x, this.y);
51
- this.context.lineTo(x, y);
52
- } else {
53
- this.context.lineTo(this.x, y);
54
- this.context.lineTo(x, y);
55
- }
56
- this.currentPoint += 1;
57
- this.x = x;
58
- this.y = y;
59
- }
60
- }
61
- const funnelHorizontalStepCurve = context => {
62
- return new FunnelStep(context, true);
63
- };
64
- const funnelVerticalStepCurve = context => {
65
- return new FunnelStep(context, false);
66
- };
67
- export { funnelHorizontalStepCurve, funnelVerticalStepCurve };
@@ -1,7 +0,0 @@
1
- export { FunnelChart as Unstable_FunnelChart } from "./FunnelChart.js";
2
- export type { FunnelChartProps } from './FunnelChart';
3
- export * from "./FunnelPlot.js";
4
- export * from "./funnel.types.js";
5
- export * from "./funnelSlots.types.js";
6
- export { funnelSectionClasses } from "./funnelSectionClasses.js";
7
- export type { FunnelSectionClasses } from './funnelSectionClasses';
@@ -1,5 +0,0 @@
1
- export { FunnelChart as Unstable_FunnelChart } from "./FunnelChart.js";
2
- export * from "./FunnelPlot.js";
3
- export * from "./funnel.types.js";
4
- export * from "./funnelSlots.types.js";
5
- export { funnelSectionClasses } from "./funnelSectionClasses.js";
@@ -1,42 +0,0 @@
1
- import { FunnelDataPoints, FunnelLabelOptions } from "./funnel.types.js";
2
- /**
3
- * It tries to keep the label inside the bounds of the section based on the position.
4
- *
5
- * @returns The text anchor and dominant baseline of the label.
6
- */
7
- export declare const alignLabel: ({
8
- position,
9
- textAnchor,
10
- dominantBaseline
11
- }: Omit<FunnelLabelOptions, "margin">) => {
12
- textAnchor: string;
13
- dominantBaseline: string;
14
- };
15
- /**
16
- * This function calculates the position of the label based on the position and margin.
17
- *
18
- * It is quite complex, because it needs to calculate the position based on the position of the points of a rectangle.
19
- * And we are manually calculating each possible position of the label.
20
- *
21
- * @returns The x and y position of the label.
22
- */
23
- export declare const positionLabel: ({
24
- position,
25
- offset,
26
- xPosition,
27
- yPosition,
28
- isHorizontal,
29
- values,
30
- dataIndex,
31
- baseScaleData
32
- }: Omit<FunnelLabelOptions, "textAnchor" | "dominantBaseline"> & {
33
- xPosition: (value: number, bandIndex: number, stackOffset?: number, useBand?: boolean) => number | undefined;
34
- yPosition: (value: number, bandIndex: number, stackOffset?: number, useBand?: boolean) => number | undefined;
35
- isHorizontal: boolean;
36
- values: readonly FunnelDataPoints[];
37
- dataIndex: number;
38
- baseScaleData: readonly number[];
39
- }) => {
40
- x: number;
41
- y: number;
42
- };
@@ -1,166 +0,0 @@
1
- /**
2
- * It tries to keep the label inside the bounds of the section based on the position.
3
- *
4
- * @returns The text anchor and dominant baseline of the label.
5
- */
6
- export const alignLabel = ({
7
- position,
8
- textAnchor,
9
- dominantBaseline
10
- }) => {
11
- const vertical = position?.vertical ?? 'middle';
12
- const horizontal = position?.horizontal ?? 'center';
13
- let anchor = 'middle';
14
- let baseline = 'central';
15
- if (vertical === 'top') {
16
- baseline = 'hanging';
17
- } else if (vertical === 'bottom') {
18
- baseline = 'baseline';
19
- }
20
- if (horizontal === 'start') {
21
- anchor = 'start';
22
- } else if (horizontal === 'end') {
23
- anchor = 'end';
24
- }
25
- return {
26
- textAnchor: textAnchor ?? anchor,
27
- dominantBaseline: dominantBaseline ?? baseline
28
- };
29
- };
30
-
31
- /**
32
- * This function calculates the position of the label based on the position and margin.
33
- *
34
- * It is quite complex, because it needs to calculate the position based on the position of the points of a rectangle.
35
- * And we are manually calculating each possible position of the label.
36
- *
37
- * @returns The x and y position of the label.
38
- */
39
- export const positionLabel = ({
40
- position,
41
- offset,
42
- xPosition,
43
- yPosition,
44
- isHorizontal,
45
- values,
46
- dataIndex,
47
- baseScaleData
48
- }) => {
49
- const vertical = position?.vertical ?? 'middle';
50
- const horizontal = position?.horizontal ?? 'center';
51
- let x = 0;
52
- let y = 0;
53
- let minTop = 0;
54
- let maxTop = 0;
55
- let minBottom = 0;
56
- let maxBottom = 0;
57
- let minLeft = 0;
58
- let maxLeft = 0;
59
- let minRight = 0;
60
- let maxRight = 0;
61
- let center = 0;
62
- let leftCenter = 0;
63
- let rightCenter = 0;
64
- let middle = 0;
65
- let topMiddle = 0;
66
- let bottomMiddle = 0;
67
- const mv = typeof offset === 'number' ? offset : offset?.y ?? 0;
68
- const mh = typeof offset === 'number' ? offset : offset?.x ?? 0;
69
- const stackOffset = values[0].stackOffset;
70
- if (isHorizontal) {
71
- maxTop = yPosition(values[0].y, baseScaleData[dataIndex], stackOffset) - mv;
72
- minTop = yPosition(values[1].y, baseScaleData[dataIndex], stackOffset) - mv;
73
- minBottom = yPosition(values[2].y, baseScaleData[dataIndex], stackOffset) + mv;
74
- maxBottom = yPosition(values[3].y, baseScaleData[dataIndex], stackOffset) + mv;
75
- minRight = 0;
76
- maxRight = xPosition(Math.min(...values.map(v => v.x)), baseScaleData[dataIndex], stackOffset, true) + mh;
77
- minLeft = 0;
78
- maxLeft = xPosition(Math.max(...values.map(v => v.x)), baseScaleData[dataIndex], stackOffset) + mh;
79
- center = maxRight - (maxRight - maxLeft) / 2;
80
- leftCenter = 0;
81
- rightCenter = 0;
82
- middle = yPosition(0, baseScaleData[dataIndex], stackOffset) - mv;
83
- topMiddle = yPosition(values[0].y - (values[0].y - values[1].y) / 2, baseScaleData[dataIndex], stackOffset) - mv;
84
- bottomMiddle = yPosition(values[3].y - (values[3].y - values[2].y) / 2, baseScaleData[dataIndex], stackOffset) + mv;
85
- } else {
86
- minTop = 0;
87
- maxTop = yPosition(Math.max(...values.map(v => v.y)), baseScaleData[dataIndex], stackOffset) - mv;
88
- minBottom = 0;
89
- maxBottom = yPosition(Math.min(...values.map(v => v.y)), baseScaleData[dataIndex], stackOffset, true) - mv;
90
- maxRight = xPosition(values[0].x, baseScaleData[dataIndex], stackOffset) + mh;
91
- minRight = xPosition(values[1].x, baseScaleData[dataIndex], stackOffset) + mh;
92
- minLeft = xPosition(values[2].x, baseScaleData[dataIndex], stackOffset) - mh;
93
- maxLeft = xPosition(values[3].x, baseScaleData[dataIndex], stackOffset) - mh;
94
- center = xPosition(0, baseScaleData[dataIndex], stackOffset) - mh;
95
- rightCenter = xPosition(values[0].x - (values[0].x - values[1].x) / 2, baseScaleData[dataIndex], stackOffset) + mh;
96
- leftCenter = xPosition(values[3].x - (values[3].x - values[2].x) / 2, baseScaleData[dataIndex], stackOffset) - mh;
97
- middle = yPosition(values[0].y - (values[0].y - values[1].y) / 2, baseScaleData[dataIndex], stackOffset);
98
- middle = maxTop - (maxTop - maxBottom) / 2;
99
- topMiddle = 0;
100
- bottomMiddle = 0;
101
- }
102
- if (isHorizontal) {
103
- if (horizontal === 'center') {
104
- x = center;
105
- if (vertical === 'top') {
106
- y = topMiddle;
107
- } else if (vertical === 'middle') {
108
- y = middle;
109
- } else if (vertical === 'bottom') {
110
- y = bottomMiddle;
111
- }
112
- } else if (horizontal === 'start') {
113
- x = maxLeft;
114
- if (vertical === 'top') {
115
- y = maxTop;
116
- } else if (vertical === 'middle') {
117
- y = middle;
118
- } else if (vertical === 'bottom') {
119
- y = maxBottom;
120
- }
121
- } else if (horizontal === 'end') {
122
- x = maxRight;
123
- if (vertical === 'top') {
124
- y = minTop;
125
- } else if (vertical === 'middle') {
126
- y = middle;
127
- } else if (vertical === 'bottom') {
128
- y = minBottom;
129
- }
130
- }
131
- }
132
- if (!isHorizontal) {
133
- if (vertical === 'middle') {
134
- y = middle;
135
- if (horizontal === 'start') {
136
- x = leftCenter;
137
- } else if (horizontal === 'center') {
138
- x = center;
139
- } else if (horizontal === 'end') {
140
- x = rightCenter;
141
- }
142
- } else if (vertical === 'top') {
143
- y = maxTop;
144
- if (horizontal === 'start') {
145
- x = maxLeft;
146
- } else if (horizontal === 'center') {
147
- x = center;
148
- } else if (horizontal === 'end') {
149
- x = maxRight;
150
- }
151
- } else if (vertical === 'bottom') {
152
- y = maxBottom;
153
- if (horizontal === 'start') {
154
- x = minLeft;
155
- } else if (horizontal === 'center') {
156
- x = center;
157
- } else if (horizontal === 'end') {
158
- x = minRight;
159
- }
160
- }
161
- }
162
- return {
163
- x,
164
- y
165
- };
166
- };
@@ -1,3 +0,0 @@
1
- import { CartesianExtremumGetter } from '@mui/x-charts/internals';
2
- export declare const getExtremumX: CartesianExtremumGetter<'funnel'>;
3
- export declare const getExtremumY: CartesianExtremumGetter<'funnel'>;
@@ -1,42 +0,0 @@
1
- const getValueExtremum = (direction, isHorizontal, params) => {
2
- const {
3
- series,
4
- axis,
5
- isDefaultAxis
6
- } = params;
7
- return Object.keys(series)
8
- // Keep only series that are associated with the current axis
9
- .reduce((acc, seriesId) => {
10
- const yAxisId = series[seriesId].yAxisId;
11
- const xAxisId = series[seriesId].xAxisId;
12
- const {
13
- dataPoints
14
- } = series[seriesId];
15
- if (
16
- // We skip except if the axis id is not defined for the direction and we are on the default one.
17
- !(isDefaultAxis && yAxisId === undefined && direction === 'y') && !(isDefaultAxis && xAxisId === undefined && direction === 'x')) {
18
- return acc;
19
- }
20
- if (axis.scaleType === 'band' || !isHorizontal && direction === 'x' || isHorizontal && direction === 'y') {
21
- const [seriesMin, seriesMax] = dataPoints.map(v => v.map(t => t[direction]))?.reduce((seriesAcc, values) => {
22
- return [Math.min(...values, seriesAcc[0]), Math.max(...values, seriesAcc[1])];
23
- }, [Infinity, -Infinity]) ?? [Infinity, -Infinity];
24
- return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
25
- }
26
- const seriesMin = dataPoints.flatMap(v => v.map(t => t[direction]).reduce((min, value) => Math.min(value, min), Infinity)).reduce((sumAcc, value) => sumAcc + value, 0);
27
- const seriesMax = dataPoints.flatMap(v => v.map(t => t[direction]).reduce((max, value) => Math.max(value, max), -Infinity)).reduce((sumAcc, value) => sumAcc + value, 0);
28
- return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
29
- }, [Infinity, -Infinity]);
30
- };
31
- export const getExtremumX = params => {
32
- const isHorizontal = Object.keys(params.series).some(seriesId => params.series[seriesId].layout === 'horizontal');
33
- if (isHorizontal) {
34
- const [min, max] = getValueExtremum('x', isHorizontal, params);
35
- return [max, min];
36
- }
37
- return getValueExtremum('x', isHorizontal, params);
38
- };
39
- export const getExtremumY = params => {
40
- const isHorizontal = Object.keys(params.series).some(seriesId => params.series[seriesId].layout === 'horizontal');
41
- return getValueExtremum('y', isHorizontal, params);
42
- };
@@ -1,3 +0,0 @@
1
- import { ColorProcessor } from '@mui/x-charts/internals';
2
- declare const getColor: ColorProcessor<'funnel'>;
3
- export default getColor;
@@ -1,4 +0,0 @@
1
- const getColor = series => {
2
- return dataIndex => series.data[dataIndex].color;
3
- };
4
- export default getColor;
@@ -1,3 +0,0 @@
1
- import { GetSeriesWithDefaultValues } from '@mui/x-charts/internals';
2
- declare const getSeriesWithDefaultValues: GetSeriesWithDefaultValues<'funnel'>;
3
- export default getSeriesWithDefaultValues;
@@ -1,11 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => {
3
- return _extends({
4
- id: seriesData.id ?? `auto-generated-id-${seriesIndex}`
5
- }, seriesData, {
6
- data: seriesData.data.map((d, index) => _extends({
7
- color: colors[index % colors.length]
8
- }, d))
9
- });
10
- };
11
- export default getSeriesWithDefaultValues;
@@ -1,2 +0,0 @@
1
- import type { ChartSeriesTypeConfig } from '@mui/x-charts/internals';
2
- export declare const seriesConfig: ChartSeriesTypeConfig<'funnel'>;
@@ -1,15 +0,0 @@
1
- import { getExtremumX, getExtremumY } from "./extremums.js";
2
- import seriesProcessor from "./seriesProcessor.js";
3
- import getColor from "./getColor.js";
4
- import legendGetter from "./legend.js";
5
- import tooltipGetter from "./tooltip.js";
6
- import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
7
- export const seriesConfig = {
8
- seriesProcessor,
9
- colorProcessor: getColor,
10
- legendGetter,
11
- tooltipGetter,
12
- xExtremumGetter: getExtremumX,
13
- yExtremumGetter: getExtremumY,
14
- getSeriesWithDefaultValues
15
- };
@@ -1,3 +0,0 @@
1
- import { LegendGetter } from '@mui/x-charts/internals';
2
- declare const legendGetter: LegendGetter<'funnel'>;
3
- export default legendGetter;
@@ -1,25 +0,0 @@
1
- import { getLabel } from '@mui/x-charts/internals';
2
- const legendGetter = params => {
3
- const {
4
- seriesOrder,
5
- series
6
- } = params;
7
- return seriesOrder.reduce((acc, seriesId) => {
8
- series[seriesId].data.forEach(item => {
9
- const formattedLabel = getLabel(item.label, 'legend');
10
- if (formattedLabel === undefined) {
11
- return;
12
- }
13
- acc.push({
14
- markType: item.labelMarkType ?? series[seriesId].labelMarkType,
15
- seriesId,
16
- id: item.id,
17
- itemId: item.id,
18
- color: item.color,
19
- label: formattedLabel
20
- });
21
- });
22
- return acc;
23
- }, []);
24
- };
25
- export default legendGetter;
@@ -1,3 +0,0 @@
1
- import { SeriesProcessor } from '@mui/x-charts/internals';
2
- declare const seriesProcessor: SeriesProcessor<'funnel'>;
3
- export default seriesProcessor;
@@ -1,89 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- const createPoint = ({
3
- main,
4
- other,
5
- inverse,
6
- useBandWidth,
7
- stackOffset
8
- }) => inverse ? {
9
- x: other,
10
- y: main,
11
- useBandWidth,
12
- stackOffset
13
- } : {
14
- x: main,
15
- y: other,
16
- useBandWidth,
17
- stackOffset
18
- };
19
- const seriesProcessor = params => {
20
- const {
21
- seriesOrder,
22
- series
23
- } = params;
24
- const completedSeries = {};
25
- const isHorizontal = seriesOrder.some(seriesId => series[seriesId].layout === 'horizontal');
26
- seriesOrder.forEach(seriesId => {
27
- const currentSeries = series[seriesId];
28
- completedSeries[seriesId] = _extends({
29
- labelMarkType: 'square',
30
- layout: isHorizontal ? 'horizontal' : 'vertical',
31
- valueFormatter: item => item == null ? '' : item.value.toLocaleString()
32
- }, currentSeries, {
33
- data: currentSeries.data.map((v, i) => _extends({
34
- id: `${seriesId}-funnel-item-${v.id ?? i}`
35
- }, v)),
36
- dataPoints: []
37
- });
38
- const stackOffsets = completedSeries[seriesId].data.toReversed().map((_, i, array) => array.slice(0, i).reduce((acc, item) => acc + item.value, 0)).toReversed();
39
- completedSeries[seriesId].dataPoints = completedSeries[seriesId].data.map((item, dataIndex, array) => {
40
- // Main = main axis, Other = other axis
41
- // For horizontal layout, main is y, other is x
42
- // For vertical layout, main is x, other is y
43
- const currentMaxMain = item.value;
44
- const nextDataIndex = dataIndex === array.length - 1 ? dataIndex : dataIndex + 1;
45
- const nextMaxMain = array[nextDataIndex].value ?? 0;
46
- const nextMaxOther = 0;
47
- const currentMaxOther = completedSeries[seriesId].data[dataIndex].value;
48
- const stackOffset = stackOffsets[dataIndex];
49
- return [
50
- // Top right (vertical) or Top left (horizontal)
51
- createPoint({
52
- main: currentMaxMain,
53
- other: currentMaxOther,
54
- inverse: isHorizontal,
55
- useBandWidth: false,
56
- stackOffset
57
- }),
58
- // Bottom right (vertical) or Top right (horizontal)
59
- createPoint({
60
- main: nextMaxMain,
61
- other: nextMaxOther,
62
- inverse: isHorizontal,
63
- useBandWidth: true,
64
- stackOffset
65
- }),
66
- // Bottom left (vertical) or Bottom right (horizontal)
67
- createPoint({
68
- main: -nextMaxMain,
69
- other: nextMaxOther,
70
- inverse: isHorizontal,
71
- useBandWidth: true,
72
- stackOffset
73
- }),
74
- // Top left (vertical) or Bottom left (horizontal)
75
- createPoint({
76
- main: -currentMaxMain,
77
- other: currentMaxOther,
78
- inverse: isHorizontal,
79
- useBandWidth: false,
80
- stackOffset
81
- })];
82
- });
83
- });
84
- return {
85
- seriesOrder,
86
- series: completedSeries
87
- };
88
- };
89
- export default seriesProcessor;
@@ -1,3 +0,0 @@
1
- import { TooltipGetter } from '@mui/x-charts/internals';
2
- declare const tooltipGetter: TooltipGetter<'funnel'>;
3
- export default tooltipGetter;
@@ -1,29 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { getLabel } from '@mui/x-charts/internals';
3
- const tooltipGetter = params => {
4
- const {
5
- series,
6
- getColor,
7
- identifier
8
- } = params;
9
- if (!identifier || identifier.dataIndex === undefined) {
10
- return null;
11
- }
12
- const point = series.data[identifier.dataIndex];
13
- const label = getLabel(point.label, 'tooltip');
14
- const value = _extends({}, point, {
15
- label
16
- });
17
- const formattedValue = series.valueFormatter(value, {
18
- dataIndex: identifier.dataIndex
19
- });
20
- return {
21
- identifier,
22
- color: getColor(identifier.dataIndex),
23
- label,
24
- value,
25
- formattedValue,
26
- markType: point.labelMarkType ?? series.labelMarkType
27
- };
28
- };
29
- export default tooltipGetter;
@@ -1,30 +0,0 @@
1
- import { ChartsOverlayProps } from '@mui/x-charts/ChartsOverlay';
2
- import { ChartsAxisProps } from '@mui/x-charts/ChartsAxis';
3
- import { ChartsLegendSlotExtension } from '@mui/x-charts/ChartsLegend';
4
- import { ChartsClipPathProps } from '@mui/x-charts/ChartsClipPath';
5
- import { ChartsWrapperProps } from '@mui/x-charts/internals';
6
- import { ChartsAxisHighlightProps } from '@mui/x-charts/ChartsAxisHighlight';
7
- import { FunnelPlotProps } from "./FunnelPlot.js";
8
- import type { FunnelChartProps } from './FunnelChart';
9
- import { ChartContainerProProps } from "../ChartContainerPro/index.js";
10
- /**
11
- * A helper function that extracts FunnelChartProps from the input props
12
- * and returns an object with props for the children components of FunnelChart.
13
- *
14
- * @param props The input props for FunnelChart
15
- * @returns An object with props for the children components of FunnelChart
16
- */
17
- export declare const useFunnelChartProps: (props: FunnelChartProps) => {
18
- chartContainerProps: ChartContainerProProps<"funnel">;
19
- funnelPlotProps: FunnelPlotProps;
20
- overlayProps: ChartsOverlayProps;
21
- chartsAxisProps: ChartsAxisProps;
22
- legendProps: ChartsLegendSlotExtension;
23
- clipPathGroupProps: {
24
- clipPath: string;
25
- };
26
- clipPathProps: ChartsClipPathProps;
27
- chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
28
- axisHighlightProps: ChartsAxisHighlightProps;
29
- children: import("react").ReactNode;
30
- };