@mui/x-charts 8.14.1 → 8.15.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.
- package/BarChart/BarChart.js +8 -0
- package/BarChart/BarChart.plugins.d.ts +2 -1
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/useBarChartProps.js +4 -2
- package/CHANGELOG.md +107 -0
- package/ChartContainer/ChartContainer.js +8 -0
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +9 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +102 -0
- package/ChartsBrushOverlay/index.d.ts +4 -0
- package/ChartsBrushOverlay/index.js +19 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +13 -8
- package/ChartsReferenceLine/ChartsYReferenceLine.js +13 -8
- package/ChartsReferenceLine/common.d.ts +3 -1
- package/ChartsReferenceLine/common.js +3 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +20 -2
- package/ChartsXAxis/getVisibleLabels.js +45 -25
- package/LineChart/LineChart.js +8 -0
- package/LineChart/LineChart.plugins.d.ts +2 -1
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/useLineChartProps.js +4 -2
- package/ScatterChart/ScatterChart.js +8 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/useScatterChartProps.js +5 -3
- package/SparkLineChart/SparkLineChart.js +8 -0
- package/esm/BarChart/BarChart.js +8 -0
- package/esm/BarChart/BarChart.plugins.d.ts +2 -1
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/useBarChartProps.js +4 -2
- package/esm/ChartContainer/ChartContainer.js +8 -0
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +2 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +95 -0
- package/esm/ChartsBrushOverlay/index.d.ts +4 -0
- package/esm/ChartsBrushOverlay/index.js +2 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/common.d.ts +3 -1
- package/esm/ChartsReferenceLine/common.js +2 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +20 -2
- package/esm/ChartsXAxis/getVisibleLabels.js +45 -25
- package/esm/LineChart/LineChart.js +8 -0
- package/esm/LineChart/LineChart.plugins.d.ts +2 -1
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/useLineChartProps.js +4 -2
- package/esm/ScatterChart/ScatterChart.js +8 -0
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
- package/esm/ScatterChart/useScatterChartProps.js +5 -3
- package/esm/SparkLineChart/SparkLineChart.js +8 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useBrush.d.ts +18 -0
- package/esm/hooks/useBrush.js +16 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/domUtils.d.ts +9 -4
- package/esm/internals/domUtils.js +115 -52
- package/esm/internals/index.d.ts +1 -0
- package/esm/internals/index.js +1 -0
- package/esm/internals/plugins/allPlugins.d.ts +4 -3
- package/esm/internals/plugins/allPlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -10
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +109 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +75 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +72 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/esm/internals/plugins/utils/selectors.d.ts +1 -1
- package/esm/locales/elGR.js +97 -99
- package/esm/tests/constants.js +1 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +12 -0
- package/hooks/useBrush.d.ts +18 -0
- package/hooks/useBrush.js +21 -0
- package/index.d.ts +2 -1
- package/index.js +13 -1
- package/internals/domUtils.d.ts +9 -4
- package/internals/domUtils.js +119 -54
- package/internals/index.d.ts +1 -0
- package/internals/index.js +12 -0
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -10
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/index.js +38 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +117 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +72 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/internals/plugins/utils/selectors.d.ts +1 -1
- package/locales/elGR.js +97 -99
- package/package.json +3 -3
- package/tests/constants.js +7 -0
- package/esm/internals/Flatbush.bench.js +0 -42
- package/internals/Flatbush.bench.d.ts +0 -1
- package/internals/Flatbush.bench.js +0 -44
- /package/esm/internals/{Flatbush.bench.d.ts → plugins/featurePlugins/useChartBrush/useChartBrush.types.js} +0 -0
|
@@ -4,8 +4,12 @@ import { selectorChartXAxis, selectorChartYAxis } from "./useChartCartesianAxisR
|
|
|
4
4
|
import { selectorChartsInteractionXAxisIndex, selectorChartsInteractionXAxisValue, selectorChartsInteractionYAxisIndex, selectorChartsInteractionYAxisValue } from "./useChartCartesianInteraction.selectors.js";
|
|
5
5
|
import { selectorChartsKeyboardXAxisIndex, selectorChartsKeyboardYAxisIndex } from "../useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js";
|
|
6
6
|
import { selectorChartsLastInteraction } from "../useChartInteraction/useChartInteraction.selectors.js";
|
|
7
|
+
import { selectorBrushShouldPreventAxisHighlight } from "../useChartBrush/index.js";
|
|
7
8
|
const selectorChartControlledCartesianAxisHighlight = state => state.controlledCartesianAxisHighlight;
|
|
8
|
-
const selectAxisHighlight = (computedIndex, axis, axisItems) => {
|
|
9
|
+
const selectAxisHighlight = (computedIndex, axis, axisItems, isBrushSelectionActive) => {
|
|
10
|
+
if (isBrushSelectionActive) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
9
13
|
if (axisItems !== undefined) {
|
|
10
14
|
return axisItems.filter(item => axis.axis[item.axisId] !== undefined).map(item => item);
|
|
11
15
|
}
|
|
@@ -14,9 +18,12 @@ const selectAxisHighlight = (computedIndex, axis, axisItems) => {
|
|
|
14
18
|
dataIndex: computedIndex
|
|
15
19
|
}];
|
|
16
20
|
};
|
|
17
|
-
export const selectorChartsHighlightXAxisIndex = createSelector([selectorChartsInteractionXAxisIndex, selectorChartXAxis, selectorChartControlledCartesianAxisHighlight], selectAxisHighlight);
|
|
18
|
-
export const selectorChartsHighlightYAxisIndex = createSelector([selectorChartsInteractionYAxisIndex, selectorChartYAxis, selectorChartControlledCartesianAxisHighlight], selectAxisHighlight);
|
|
19
|
-
const selectAxisHighlightWithValue = (computedIndex, computedValue, axis, controlledAxisItems, keyboardAxisItem, lastInteractionUpdate) => {
|
|
21
|
+
export const selectorChartsHighlightXAxisIndex = createSelector([selectorChartsInteractionXAxisIndex, selectorChartXAxis, selectorChartControlledCartesianAxisHighlight, selectorBrushShouldPreventAxisHighlight], selectAxisHighlight);
|
|
22
|
+
export const selectorChartsHighlightYAxisIndex = createSelector([selectorChartsInteractionYAxisIndex, selectorChartYAxis, selectorChartControlledCartesianAxisHighlight, selectorBrushShouldPreventAxisHighlight], selectAxisHighlight);
|
|
23
|
+
const selectAxisHighlightWithValue = (computedIndex, computedValue, axis, controlledAxisItems, keyboardAxisItem, lastInteractionUpdate, isBrushSelectionActive) => {
|
|
24
|
+
if (isBrushSelectionActive) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
20
27
|
if (controlledAxisItems !== undefined) {
|
|
21
28
|
return controlledAxisItems.map(item => _extends({}, item, {
|
|
22
29
|
value: axis.axis[item.axisId]?.data?.[item.dataIndex]
|
|
@@ -51,8 +58,8 @@ const selectAxisHighlightWithValue = (computedIndex, computedValue, axis, contro
|
|
|
51
58
|
}
|
|
52
59
|
return [];
|
|
53
60
|
};
|
|
54
|
-
export const selectorChartsHighlightXAxisValue = createSelector([selectorChartsInteractionXAxisIndex, selectorChartsInteractionXAxisValue, selectorChartXAxis, selectorChartControlledCartesianAxisHighlight, selectorChartsKeyboardXAxisIndex, selectorChartsLastInteraction], selectAxisHighlightWithValue);
|
|
55
|
-
export const selectorChartsHighlightYAxisValue = createSelector([selectorChartsInteractionYAxisIndex, selectorChartsInteractionYAxisValue, selectorChartYAxis, selectorChartControlledCartesianAxisHighlight, selectorChartsKeyboardYAxisIndex, selectorChartsLastInteraction], selectAxisHighlightWithValue);
|
|
61
|
+
export const selectorChartsHighlightXAxisValue = createSelector([selectorChartsInteractionXAxisIndex, selectorChartsInteractionXAxisValue, selectorChartXAxis, selectorChartControlledCartesianAxisHighlight, selectorChartsKeyboardXAxisIndex, selectorChartsLastInteraction, selectorBrushShouldPreventAxisHighlight], selectAxisHighlightWithValue);
|
|
62
|
+
export const selectorChartsHighlightYAxisValue = createSelector([selectorChartsInteractionYAxisIndex, selectorChartsInteractionYAxisValue, selectorChartYAxis, selectorChartControlledCartesianAxisHighlight, selectorChartsKeyboardYAxisIndex, selectorChartsLastInteraction, selectorBrushShouldPreventAxisHighlight], selectAxisHighlightWithValue);
|
|
56
63
|
|
|
57
64
|
/**
|
|
58
65
|
* Get the scale of the axis with highlight if controlled. The default axis otherwise.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectorArray, Combiner, Selector, GetStateFromSelectors, GetParamsFromSelectors, CreateSelectorOptions } from 'reselect';
|
|
2
2
|
import { ChartAnyPluginSignature, ChartState, ChartStateCacheKey } from "../models/index.js";
|
|
3
|
-
export type ChartRootSelector<TSignature extends ChartAnyPluginSignature> = Selector<ChartState<[TSignature]>, TSignature['state'][
|
|
3
|
+
export type ChartRootSelector<TSignature extends ChartAnyPluginSignature, T extends keyof TSignature['state'] = keyof TSignature['state']> = Selector<ChartState<[TSignature]>, TSignature['state'][T]>;
|
|
4
4
|
export type ChartOptionalRootSelector<TSignature extends ChartAnyPluginSignature> = Selector<ChartState<[], [TSignature]>, TSignature['state'][keyof TSignature['state']] | undefined>;
|
|
5
5
|
export type ChartsSelector<Signatures extends readonly ChartAnyPluginSignature[] = [], OptionalSignatures extends readonly ChartAnyPluginSignature[] = [], Result = unknown, Args extends readonly any[] = []> = Selector<ChartState<Signatures, OptionalSignatures>, Result, Args>;
|
|
6
6
|
type InterruptRecursion = NonNullable<unknown>;
|
package/esm/locales/elGR.js
CHANGED
|
@@ -10,106 +10,104 @@ export const elGRLocaleText = {
|
|
|
10
10
|
toolbarExport: 'Εξαγωγή',
|
|
11
11
|
// Toolbar Export Menu
|
|
12
12
|
toolbarExportPrint: 'Εκτύπωση',
|
|
13
|
-
toolbarExportImage: mimeType => `Εξαγωγή ως ${imageMimeTypes[mimeType] ?? mimeType}
|
|
14
|
-
|
|
13
|
+
toolbarExportImage: mimeType => `Εξαγωγή ως ${imageMimeTypes[mimeType] ?? mimeType}`,
|
|
15
14
|
// Charts renderer configuration
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
15
|
+
chartTypeBar: 'Μπάρα',
|
|
16
|
+
chartTypeColumn: 'Στήλη',
|
|
17
|
+
chartTypeLine: 'Γραμμή',
|
|
18
|
+
chartTypeArea: 'Περιοχή',
|
|
19
|
+
chartTypePie: 'Πίτα',
|
|
20
|
+
chartPaletteLabel: 'Παλέτα χρωμάτων',
|
|
21
|
+
chartPaletteNameRainbowSurge: 'Έκρηξη Ουράνιου Τόξου',
|
|
22
|
+
chartPaletteNameBlueberryTwilight: 'Λυκόφως Μύρτιλου',
|
|
23
|
+
chartPaletteNameMangoFusion: 'Ένωση Μάνγκο',
|
|
24
|
+
chartPaletteNameCheerfulFiesta: 'Χαρούμενη Γιορτή',
|
|
25
|
+
chartPaletteNameStrawberrySky: 'Φραουλένιος Ουρανός',
|
|
26
|
+
chartPaletteNameBlue: 'Μπλέ',
|
|
27
|
+
chartPaletteNameGreen: 'Πράσινο',
|
|
28
|
+
chartPaletteNamePurple: 'Μώβ',
|
|
29
|
+
chartPaletteNameRed: 'Κόκκινο',
|
|
30
|
+
chartPaletteNameOrange: 'Πορτοκαλί',
|
|
31
|
+
chartPaletteNameYellow: 'Κίτρινο',
|
|
32
|
+
chartPaletteNameCyan: 'Κυανό',
|
|
33
|
+
chartPaletteNamePink: 'Ρόζ',
|
|
34
|
+
chartConfigurationSectionChart: 'Γράφημα',
|
|
35
|
+
chartConfigurationSectionColumns: 'Στήλες',
|
|
36
|
+
chartConfigurationSectionBars: 'Μπάρες',
|
|
37
|
+
chartConfigurationSectionAxes: 'Άξονες',
|
|
38
|
+
chartConfigurationGrid: 'Πλέγμα',
|
|
39
|
+
chartConfigurationBorderRadius: 'Ακτίνα περιγράμματος',
|
|
40
|
+
chartConfigurationCategoryGapRatio: 'Λόγος κενών κατηγορίας',
|
|
41
|
+
chartConfigurationBarGapRatio: 'Λόγος κενών Σειράς',
|
|
42
|
+
chartConfigurationStacked: 'Στοίβαγμα',
|
|
43
|
+
chartConfigurationShowToolbar: 'Εμφάνιση γραμμής εργαλείων',
|
|
44
|
+
chartConfigurationSkipAnimation: 'Παράξειψη Animation',
|
|
45
|
+
chartConfigurationInnerRadius: 'Εσωτερική ακτίνα',
|
|
46
|
+
chartConfigurationOuterRadius: 'Εξωτερική ακτίνα',
|
|
47
|
+
chartConfigurationColors: 'Χρώματα',
|
|
48
|
+
chartConfigurationHideLegend: 'Απόκρυψη Υπομνήματος',
|
|
49
|
+
chartConfigurationShowMark: 'Εμφάνιση Σημείωσης',
|
|
50
|
+
chartConfigurationHeight: 'Ύψος',
|
|
51
|
+
chartConfigurationWidth: 'Πλάτος',
|
|
52
|
+
chartConfigurationSeriesGap: 'Κενό Σειράς',
|
|
53
|
+
chartConfigurationTickPlacement: 'Τοποθέτηση Σημείων',
|
|
54
|
+
chartConfigurationTickLabelPlacement: 'Τοποθέτηση Ετικετών Σημείων',
|
|
55
|
+
chartConfigurationCategoriesAxisLabel: 'Ετικέτα άξονα κατηγοριών',
|
|
56
|
+
chartConfigurationSeriesAxisLabel: 'Ετικέτα άξονα σειρών',
|
|
57
|
+
chartConfigurationXAxisPosition: 'Θέση άξονα Χ',
|
|
58
|
+
chartConfigurationYAxisPosition: 'Θέση άξονα Υ',
|
|
59
|
+
chartConfigurationSeriesAxisReverse: 'Αντιστροφή άξονα σειρών',
|
|
60
|
+
chartConfigurationTooltipPlacement: 'Τοποθέτηση',
|
|
61
|
+
chartConfigurationTooltipTrigger: 'Τρόπος ενεργοποίησης του tooltip',
|
|
62
|
+
chartConfigurationLegendPosition: 'Θέση',
|
|
63
|
+
chartConfigurationLegendDirection: 'Κατεύθυνση',
|
|
64
|
+
chartConfigurationBarLabels: 'Ετικέτες μπαρών',
|
|
65
|
+
chartConfigurationColumnLabels: 'Ετικέτες στηλών',
|
|
66
|
+
chartConfigurationInterpolation: 'Διαμεσολάβηση',
|
|
67
|
+
chartConfigurationSectionTooltip: 'Tooltip',
|
|
68
|
+
chartConfigurationSectionLegend: 'Υπόμνημα',
|
|
69
|
+
chartConfigurationSectionLines: 'Γραμμές',
|
|
70
|
+
chartConfigurationSectionAreas: 'Περιοχές',
|
|
71
|
+
chartConfigurationSectionArcs: 'Τόξα',
|
|
72
|
+
chartConfigurationPaddingAngle: 'Γωνία περιθωρίου',
|
|
73
|
+
chartConfigurationCornerRadius: 'Ακτίνα γωνίας',
|
|
74
|
+
chartConfigurationArcLabels: 'Ετικέτες τόξων',
|
|
75
|
+
chartConfigurationStartAngle: 'Γωνία εκκίνησης',
|
|
76
|
+
chartConfigurationEndAngle: 'Γωνία λήξης',
|
|
77
|
+
chartConfigurationPieTooltipTrigger: 'Τρόπος ενεργοποίησης του tooltip',
|
|
78
|
+
chartConfigurationPieLegendPosition: 'Θέση',
|
|
79
|
+
chartConfigurationPieLegendDirection: 'Κατεύθυνση',
|
|
82
80
|
// Common option labels
|
|
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
|
-
|
|
81
|
+
chartConfigurationOptionNone: 'Κανένα',
|
|
82
|
+
chartConfigurationOptionValue: 'Τιμή',
|
|
83
|
+
chartConfigurationOptionAuto: 'Αυτόματο',
|
|
84
|
+
chartConfigurationOptionTop: 'Πάνω',
|
|
85
|
+
chartConfigurationOptionTopLeft: 'Πάνω Αριστερά',
|
|
86
|
+
chartConfigurationOptionTopRight: 'Πάνω Δεξιά',
|
|
87
|
+
chartConfigurationOptionBottom: 'Κάτω',
|
|
88
|
+
chartConfigurationOptionBottomLeft: 'Κάτω Αριστερά',
|
|
89
|
+
chartConfigurationOptionBottomRight: 'Κάτω Δεξιά',
|
|
90
|
+
chartConfigurationOptionLeft: 'Αριστερά',
|
|
91
|
+
chartConfigurationOptionRight: 'Δεξιά',
|
|
92
|
+
chartConfigurationOptionAxis: 'Άξονας',
|
|
93
|
+
chartConfigurationOptionItem: 'Στοιχείο',
|
|
94
|
+
chartConfigurationOptionHorizontal: 'Οριζόντιο',
|
|
95
|
+
chartConfigurationOptionVertical: 'Κάθετο',
|
|
96
|
+
chartConfigurationOptionBoth: 'Και τα δύο',
|
|
97
|
+
chartConfigurationOptionStart: 'Αρχή',
|
|
98
|
+
chartConfigurationOptionMiddle: 'Κέντρο',
|
|
99
|
+
chartConfigurationOptionEnd: 'Τέλος',
|
|
100
|
+
chartConfigurationOptionExtremities: 'Ακρότατα',
|
|
101
|
+
chartConfigurationOptionTick: 'Σημείο',
|
|
102
|
+
chartConfigurationOptionMonotoneX: 'Μονοτονικό Χ',
|
|
103
|
+
chartConfigurationOptionMonotoneY: 'Μονοτονικό Υ',
|
|
104
|
+
chartConfigurationOptionCatmullRom: 'Catmull-Rom',
|
|
105
|
+
chartConfigurationOptionLinear: 'Γραμμικό',
|
|
106
|
+
chartConfigurationOptionNatural: 'Φυσικό',
|
|
107
|
+
chartConfigurationOptionStep: 'Βήμα',
|
|
108
|
+
chartConfigurationOptionStepBefore: 'Βήμα Πριν',
|
|
109
|
+
chartConfigurationOptionStepAfter: 'Βήμα Μετά',
|
|
110
|
+
chartConfigurationOptionBumpX: 'Κυρτότητα Χ',
|
|
111
|
+
chartConfigurationOptionBumpY: 'Κυρτότητα Υ'
|
|
114
112
|
};
|
|
115
113
|
export const elGR = getChartsLocalization(elGRLocaleText);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHART_SELECTOR = 'svg:not([aria-hidden="true"])';
|
package/hooks/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@ export * from "./useLegend.js";
|
|
|
17
17
|
export { useChartGradientId, useChartGradientIdObjectBound } from "./useChartGradientId.js";
|
|
18
18
|
export * from "./animation/index.js";
|
|
19
19
|
export * from "./useChartRootRef.js";
|
|
20
|
-
export * from "./useChartsLocalization.js";
|
|
20
|
+
export * from "./useChartsLocalization.js";
|
|
21
|
+
export * from "./useBrush.js";
|
package/hooks/index.js
CHANGED
|
@@ -247,4 +247,16 @@ Object.keys(_useChartsLocalization).forEach(function (key) {
|
|
|
247
247
|
return _useChartsLocalization[key];
|
|
248
248
|
}
|
|
249
249
|
});
|
|
250
|
+
});
|
|
251
|
+
var _useBrush = require("./useBrush");
|
|
252
|
+
Object.keys(_useBrush).forEach(function (key) {
|
|
253
|
+
if (key === "default" || key === "__esModule") return;
|
|
254
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
255
|
+
if (key in exports && exports[key] === _useBrush[key]) return;
|
|
256
|
+
Object.defineProperty(exports, key, {
|
|
257
|
+
enumerable: true,
|
|
258
|
+
get: function () {
|
|
259
|
+
return _useBrush[key];
|
|
260
|
+
}
|
|
261
|
+
});
|
|
250
262
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current brush state.
|
|
3
|
+
*
|
|
4
|
+
* - `start` is the starting point of the brush selection.
|
|
5
|
+
* - `current` is the current point of the brush selection.
|
|
6
|
+
*
|
|
7
|
+
* @returns `{ start, current }` - The brush state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useBrush(): {
|
|
10
|
+
start: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
current: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
} | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useBrush = useBrush;
|
|
7
|
+
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
8
|
+
var _useSelector = require("../internals/store/useSelector");
|
|
9
|
+
var _useStore = require("../internals/store/useStore");
|
|
10
|
+
/**
|
|
11
|
+
* Get the current brush state.
|
|
12
|
+
*
|
|
13
|
+
* - `start` is the starting point of the brush selection.
|
|
14
|
+
* - `current` is the current point of the brush selection.
|
|
15
|
+
*
|
|
16
|
+
* @returns `{ start, current }` - The brush state.
|
|
17
|
+
*/
|
|
18
|
+
function useBrush() {
|
|
19
|
+
const store = (0, _useStore.useStore)();
|
|
20
|
+
return (0, _useSelector.useSelector)(store, _useChartBrush.selectorBrushState);
|
|
21
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -28,4 +28,5 @@ export { ChartContainer } from "./ChartContainer/index.js";
|
|
|
28
28
|
export type { ChartContainerProps } from "./ChartContainer/index.js";
|
|
29
29
|
export * from "./ChartDataProvider/index.js";
|
|
30
30
|
export * from "./Toolbar/index.js";
|
|
31
|
-
export * from "./ChartsWrapper/index.js";
|
|
31
|
+
export * from "./ChartsWrapper/index.js";
|
|
32
|
+
export * from "./ChartsBrushOverlay/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.
|
|
2
|
+
* @mui/x-charts v8.15.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -367,4 +367,16 @@ Object.keys(_ChartsWrapper).forEach(function (key) {
|
|
|
367
367
|
return _ChartsWrapper[key];
|
|
368
368
|
}
|
|
369
369
|
});
|
|
370
|
+
});
|
|
371
|
+
var _ChartsBrushOverlay = require("./ChartsBrushOverlay");
|
|
372
|
+
Object.keys(_ChartsBrushOverlay).forEach(function (key) {
|
|
373
|
+
if (key === "default" || key === "__esModule") return;
|
|
374
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
375
|
+
if (key in exports && exports[key] === _ChartsBrushOverlay[key]) return;
|
|
376
|
+
Object.defineProperty(exports, key, {
|
|
377
|
+
enumerable: true,
|
|
378
|
+
get: function () {
|
|
379
|
+
return _ChartsBrushOverlay[key];
|
|
380
|
+
}
|
|
381
|
+
});
|
|
370
382
|
});
|
package/internals/domUtils.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare function clearStringMeasurementCache(): void;
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Converts a style object into a string to be used as a cache key
|
|
4
5
|
* @param style React style object
|
|
5
6
|
* @returns CSS styling string
|
|
6
7
|
*/
|
|
7
|
-
export declare
|
|
8
|
+
export declare function getStyleString(style: React.CSSProperties): string;
|
|
8
9
|
/**
|
|
9
10
|
*
|
|
10
11
|
* @param text The string to estimate
|
|
@@ -14,4 +15,8 @@ export declare const getStyleString: (style: React.CSSProperties) => string;
|
|
|
14
15
|
export declare const getStringSize: (text: string | number, style?: React.CSSProperties) => {
|
|
15
16
|
width: number;
|
|
16
17
|
height: number;
|
|
17
|
-
};
|
|
18
|
+
};
|
|
19
|
+
export declare function batchMeasureStrings(texts: Iterable<string | number>, style?: React.CSSProperties): Map<string | number, {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}>;
|
package/internals/domUtils.js
CHANGED
|
@@ -4,65 +4,65 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.batchMeasureStrings = batchMeasureStrings;
|
|
8
|
+
exports.clearStringMeasurementCache = clearStringMeasurementCache;
|
|
9
|
+
exports.getStringSize = void 0;
|
|
10
|
+
exports.getStyleString = getStyleString;
|
|
8
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
-
// DOM utils
|
|
12
|
+
// DOM utils adapted from
|
|
10
13
|
// https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
|
|
11
14
|
|
|
12
15
|
function isSsr() {
|
|
13
16
|
return typeof window === 'undefined';
|
|
14
17
|
}
|
|
15
18
|
const stringCache = new Map();
|
|
19
|
+
function clearStringMeasurementCache() {
|
|
20
|
+
stringCache.clear();
|
|
21
|
+
}
|
|
16
22
|
const MAX_CACHE_NUM = 2000;
|
|
17
|
-
const
|
|
18
|
-
position: 'absolute',
|
|
19
|
-
top: '-20000px',
|
|
20
|
-
left: 0,
|
|
21
|
-
padding: 0,
|
|
22
|
-
margin: 0,
|
|
23
|
-
border: 'none',
|
|
24
|
-
whiteSpace: 'pre'
|
|
25
|
-
};
|
|
26
|
-
const STYLE_LIST = ['minWidth', 'maxWidth', 'width', 'minHeight', 'maxHeight', 'height', 'top', 'left', 'fontSize', 'padding', 'margin', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom'];
|
|
27
|
-
const MEASUREMENT_SPAN_ID = exports.MEASUREMENT_SPAN_ID = 'mui_measurement_span';
|
|
23
|
+
const PIXEL_STYLES = new Set(['minWidth', 'maxWidth', 'width', 'minHeight', 'maxHeight', 'height', 'top', 'left', 'fontSize', 'padding', 'margin', 'paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom', 'marginLeft', 'marginRight', 'marginTop', 'marginBottom']);
|
|
28
24
|
|
|
29
25
|
/**
|
|
30
|
-
*
|
|
26
|
+
* Convert number value to pixel value for certain CSS properties
|
|
31
27
|
* @param name CSS property name
|
|
32
28
|
* @param value
|
|
33
29
|
* @returns add 'px' for distance properties
|
|
34
30
|
*/
|
|
35
|
-
function
|
|
36
|
-
if (
|
|
31
|
+
function convertPixelValue(name, value) {
|
|
32
|
+
if (PIXEL_STYLES.has(name) && value === +value) {
|
|
37
33
|
return `${value}px`;
|
|
38
34
|
}
|
|
39
35
|
return value;
|
|
40
36
|
}
|
|
41
37
|
|
|
42
38
|
/**
|
|
43
|
-
*
|
|
39
|
+
* Converts camelcase to dash-case
|
|
44
40
|
* @param text camelcase css property
|
|
45
|
-
* @returns css property
|
|
46
41
|
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (entry === entry.toUpperCase()) {
|
|
51
|
-
return [...result, '-', entry.toLowerCase()];
|
|
52
|
-
}
|
|
53
|
-
return [...result, entry];
|
|
54
|
-
}, []);
|
|
55
|
-
return formatStrs.join('');
|
|
42
|
+
const AZ = /([A-Z])/g;
|
|
43
|
+
function camelCaseToDashCase(text) {
|
|
44
|
+
return String(text).replace(AZ, match => `-${match.toLowerCase()}`);
|
|
56
45
|
}
|
|
57
46
|
|
|
58
47
|
/**
|
|
59
|
-
*
|
|
48
|
+
* Converts a style object into a string to be used as a cache key
|
|
60
49
|
* @param style React style object
|
|
61
50
|
* @returns CSS styling string
|
|
62
51
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
function getStyleString(style) {
|
|
53
|
+
let result = '';
|
|
54
|
+
for (const key in style) {
|
|
55
|
+
if (Object.hasOwn(style, key)) {
|
|
56
|
+
const k = key;
|
|
57
|
+
const value = style[k];
|
|
58
|
+
if (value === undefined) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
result += `${camelCaseToDashCase(k)}:${convertPixelValue(k, value)};`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
*
|
|
@@ -77,7 +77,7 @@ const getStringSize = (text, style = {}) => {
|
|
|
77
77
|
height: 0
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
const str =
|
|
80
|
+
const str = String(text);
|
|
81
81
|
const styleString = getStyleString(style);
|
|
82
82
|
const cacheKey = `${str}-${styleString}`;
|
|
83
83
|
const size = stringCache.get(cacheKey);
|
|
@@ -85,22 +85,18 @@ const getStringSize = (text, style = {}) => {
|
|
|
85
85
|
return size;
|
|
86
86
|
}
|
|
87
87
|
try {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
|
92
|
-
measurementSpan.setAttribute('aria-hidden', 'true');
|
|
93
|
-
document.body.appendChild(measurementSpan);
|
|
94
|
-
}
|
|
88
|
+
const measurementSpanContainer = getMeasurementContainer();
|
|
89
|
+
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
90
|
+
|
|
95
91
|
// Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)
|
|
96
92
|
// https://en.wikipedia.org/wiki/Content_Security_Policy
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
measurementSpan.style[camelToMiddleLine(styleKey)] = autoCompleteStyle(styleKey, measurementSpanStyle[styleKey]);
|
|
93
|
+
Object.keys(style).map(styleKey => {
|
|
94
|
+
measurementElem.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, style[styleKey]);
|
|
100
95
|
return styleKey;
|
|
101
96
|
});
|
|
102
|
-
|
|
103
|
-
|
|
97
|
+
measurementElem.textContent = str;
|
|
98
|
+
measurementSpanContainer.replaceChildren(measurementElem);
|
|
99
|
+
const rect = measurementElem.getBoundingClientRect();
|
|
104
100
|
const result = {
|
|
105
101
|
width: rect.width,
|
|
106
102
|
height: rect.height
|
|
@@ -111,15 +107,7 @@ const getStringSize = (text, style = {}) => {
|
|
|
111
107
|
}
|
|
112
108
|
if (process.env.NODE_ENV === 'test') {
|
|
113
109
|
// In test environment, we clean the measurement span immediately
|
|
114
|
-
|
|
115
|
-
} else {
|
|
116
|
-
if (domCleanTimeout) {
|
|
117
|
-
clearTimeout(domCleanTimeout);
|
|
118
|
-
}
|
|
119
|
-
domCleanTimeout = setTimeout(() => {
|
|
120
|
-
// Limit node cleaning to once per render cycle
|
|
121
|
-
measurementSpan.textContent = '';
|
|
122
|
-
}, 0);
|
|
110
|
+
measurementSpanContainer.replaceChildren();
|
|
123
111
|
}
|
|
124
112
|
return result;
|
|
125
113
|
} catch {
|
|
@@ -129,4 +117,81 @@ const getStringSize = (text, style = {}) => {
|
|
|
129
117
|
};
|
|
130
118
|
}
|
|
131
119
|
};
|
|
132
|
-
exports.getStringSize = getStringSize;
|
|
120
|
+
exports.getStringSize = getStringSize;
|
|
121
|
+
function batchMeasureStrings(texts, style = {}) {
|
|
122
|
+
if (isSsr()) {
|
|
123
|
+
return new Map(Array.from(texts).map(text => [text, {
|
|
124
|
+
width: 0,
|
|
125
|
+
height: 0
|
|
126
|
+
}]));
|
|
127
|
+
}
|
|
128
|
+
const sizeMap = new Map();
|
|
129
|
+
const textToMeasure = [];
|
|
130
|
+
const styleString = getStyleString(style);
|
|
131
|
+
for (const text of texts) {
|
|
132
|
+
const cacheKey = `${text}-${styleString}`;
|
|
133
|
+
const size = stringCache.get(cacheKey);
|
|
134
|
+
if (size) {
|
|
135
|
+
sizeMap.set(text, size);
|
|
136
|
+
} else {
|
|
137
|
+
textToMeasure.push(text);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const measurementContainer = getMeasurementContainer();
|
|
141
|
+
// Need to use CSS Object Model (CSSOM) to be able to comply with Content Security Policy (CSP)
|
|
142
|
+
// https://en.wikipedia.org/wiki/Content_Security_Policy
|
|
143
|
+
const measurementSpanStyle = (0, _extends2.default)({}, style);
|
|
144
|
+
Object.keys(measurementSpanStyle).map(styleKey => {
|
|
145
|
+
measurementContainer.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, measurementSpanStyle[styleKey]);
|
|
146
|
+
return styleKey;
|
|
147
|
+
});
|
|
148
|
+
const measurementElems = [];
|
|
149
|
+
for (const string of textToMeasure) {
|
|
150
|
+
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
151
|
+
measurementElem.textContent = `${string}`;
|
|
152
|
+
measurementElems.push(measurementElem);
|
|
153
|
+
}
|
|
154
|
+
measurementContainer.replaceChildren(...measurementElems);
|
|
155
|
+
for (let i = 0; i < textToMeasure.length; i += 1) {
|
|
156
|
+
const text = textToMeasure[i];
|
|
157
|
+
const measurementSpan = measurementContainer.children[i];
|
|
158
|
+
const rect = measurementSpan.getBoundingClientRect();
|
|
159
|
+
const result = {
|
|
160
|
+
width: rect.width,
|
|
161
|
+
height: rect.height
|
|
162
|
+
};
|
|
163
|
+
const cacheKey = `${text}-${styleString}`;
|
|
164
|
+
stringCache.set(cacheKey, result);
|
|
165
|
+
sizeMap.set(text, result);
|
|
166
|
+
}
|
|
167
|
+
if (stringCache.size + 1 > MAX_CACHE_NUM) {
|
|
168
|
+
stringCache.clear();
|
|
169
|
+
}
|
|
170
|
+
if (process.env.NODE_ENV === 'test') {
|
|
171
|
+
// In test environment, we clean the measurement span immediately
|
|
172
|
+
measurementContainer.replaceChildren();
|
|
173
|
+
}
|
|
174
|
+
return sizeMap;
|
|
175
|
+
}
|
|
176
|
+
let measurementContainer = null;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get (or create) a hidden span element to measure text size.
|
|
180
|
+
*/
|
|
181
|
+
function getMeasurementContainer() {
|
|
182
|
+
if (measurementContainer === null) {
|
|
183
|
+
measurementContainer = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
184
|
+
measurementContainer.setAttribute('aria-hidden', 'true');
|
|
185
|
+
measurementContainer.style.position = 'absolute';
|
|
186
|
+
measurementContainer.style.top = '-20000px';
|
|
187
|
+
measurementContainer.style.left = '0';
|
|
188
|
+
measurementContainer.style.padding = '0';
|
|
189
|
+
measurementContainer.style.margin = '0';
|
|
190
|
+
measurementContainer.style.border = 'none';
|
|
191
|
+
measurementContainer.style.pointerEvents = 'none';
|
|
192
|
+
measurementContainer.style.visibility = 'hidden';
|
|
193
|
+
measurementContainer.style.contain = 'strict';
|
|
194
|
+
document.body.appendChild(measurementContainer);
|
|
195
|
+
}
|
|
196
|
+
return measurementContainer;
|
|
197
|
+
}
|
package/internals/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./plugins/featurePlugins/useChartInteraction/index.js";
|
|
|
27
27
|
export * from "./plugins/featurePlugins/useChartHighlight/index.js";
|
|
28
28
|
export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
29
29
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
30
|
+
export * from "./plugins/featurePlugins/useChartBrush/index.js";
|
|
30
31
|
export * from "./plugins/utils/selectors.js";
|
|
31
32
|
export { getAxisTriggerTooltip as getCartesianAxisTriggerTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js";
|
|
32
33
|
export { getAxisIndex as getCartesianAxisIndex } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js";
|