@mui/x-charts-premium 9.8.0 → 9.9.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/BarChartPremium/BarChartPremium.d.mts +1 -1
- package/BarChartPremium/BarChartPremium.d.ts +1 -1
- package/BarChartPremium/BarChartPremium.js +14 -3
- package/BarChartPremium/BarChartPremium.mjs +14 -3
- package/BarChartPremium/RangeBar/AnimatedRangeBarElement.d.mts +2 -1
- package/BarChartPremium/RangeBar/AnimatedRangeBarElement.d.ts +2 -1
- package/BarChartPremium/RangeBar/FocusedRangeBar.d.mts +1 -1
- package/BarChartPremium/RangeBar/FocusedRangeBar.d.ts +1 -1
- package/BarChartPremium/RangeBar/seriesConfig/index.js +2 -2
- package/BarChartPremium/RangeBar/seriesConfig/index.mjs +2 -2
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.d.mts +2 -3
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.d.ts +2 -3
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.js +12 -15
- package/BarChartPremium/RangeBar/seriesConfig/tooltipPosition.mjs +11 -14
- package/CHANGELOG.md +119 -0
- package/CandlestickChart/CandlestickPlot.d.mts +2 -1
- package/CandlestickChart/CandlestickPlot.d.ts +2 -1
- package/CandlestickChart/seriesConfig/OHLCTooltipContent.d.mts +2 -1
- package/CandlestickChart/seriesConfig/OHLCTooltipContent.d.ts +2 -1
- package/CandlestickChart/seriesConfig/index.js +2 -2
- package/CandlestickChart/seriesConfig/index.mjs +2 -2
- package/CandlestickChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/CandlestickChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/CandlestickChart/seriesConfig/tooltipPosition.js +10 -14
- package/CandlestickChart/seriesConfig/tooltipPosition.mjs +10 -14
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.d.mts +1 -1
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.d.ts +1 -1
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +2 -2
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +2 -2
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.d.mts +1 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.d.ts +1 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.js +2 -2
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.mjs +2 -2
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.d.mts +4 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.d.ts +4 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.js +2 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.mjs +2 -1
- package/ChartsGeoDataProviderPremium/index.d.mts +2 -1
- package/ChartsGeoDataProviderPremium/index.d.ts +2 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.d.mts +2 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.d.ts +2 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +2 -2
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +2 -2
- package/ChartsRenderer/components/PaletteOption.d.mts +1 -1
- package/ChartsRenderer/components/PaletteOption.d.ts +1 -1
- package/ChartsZoomSlider/internals/previews/CandlestickPreviewPlot.d.mts +2 -1
- package/ChartsZoomSlider/internals/previews/CandlestickPreviewPlot.d.ts +2 -1
- package/ChartsZoomSlider/internals/previews/RangeBarPreviewPlot.d.mts +1 -1
- package/ChartsZoomSlider/internals/previews/RangeBarPreviewPlot.d.ts +1 -1
- package/HeatmapPremium/HeatmapPlotPremium.d.mts +1 -1
- package/HeatmapPremium/HeatmapPlotPremium.d.ts +1 -1
- package/Map/FocusedMapShape.d.mts +2 -1
- package/Map/FocusedMapShape.d.ts +2 -1
- package/Map/GeoDataPlot.d.mts +1 -1
- package/Map/GeoDataPlot.d.ts +1 -1
- package/Map/Graticule.d.mts +1 -1
- package/Map/Graticule.d.ts +1 -1
- package/Map/MapImagePlot.d.mts +1 -1
- package/Map/MapImagePlot.d.ts +1 -1
- package/Map/MapShape.d.mts +1 -1
- package/Map/MapShape.d.ts +1 -1
- package/Map/MapShapePlot.d.mts +1 -1
- package/Map/MapShapePlot.d.ts +1 -1
- package/Map/index.d.mts +1 -3
- package/Map/index.d.ts +1 -3
- package/Map/seriesConfig/tooltipPosition.d.mts +1 -1
- package/Map/seriesConfig/tooltipPosition.d.ts +1 -1
- package/Map/seriesConfig/tooltipPosition.js +2 -8
- package/Map/seriesConfig/tooltipPosition.mjs +3 -9
- package/RadialBarChart/RadialBarElement.d.mts +1 -1
- package/RadialBarChart/RadialBarElement.d.ts +1 -1
- package/RadialBarChart/seriesConfig/index.js +2 -2
- package/RadialBarChart/seriesConfig/index.mjs +2 -2
- package/RadialBarChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/RadialBarChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/RadialBarChart/seriesConfig/tooltipPosition.js +4 -6
- package/RadialBarChart/seriesConfig/tooltipPosition.mjs +2 -5
- package/RadialLineChart/RadialArea.d.mts +2 -1
- package/RadialLineChart/RadialArea.d.ts +2 -1
- package/RadialLineChart/RadialAreaPlot.d.mts +1 -1
- package/RadialLineChart/RadialAreaPlot.d.ts +1 -1
- package/RadialLineChart/RadialLine.d.mts +1 -1
- package/RadialLineChart/RadialLine.d.ts +1 -1
- package/RadialLineChart/RadialLineHighlightElement.d.mts +1 -1
- package/RadialLineChart/RadialLineHighlightElement.d.ts +1 -1
- package/RadialLineChart/RadialLineHighlightPlot.d.mts +1 -1
- package/RadialLineChart/RadialLineHighlightPlot.d.ts +1 -1
- package/RadialLineChart/RadialLinePlot.d.mts +1 -1
- package/RadialLineChart/RadialLinePlot.d.ts +1 -1
- package/RadialLineChart/RadialMarkPlot.d.mts +1 -1
- package/RadialLineChart/RadialMarkPlot.d.ts +1 -1
- package/RadialLineChart/seriesConfig/index.js +2 -2
- package/RadialLineChart/seriesConfig/index.mjs +2 -2
- package/RadialLineChart/seriesConfig/tooltipPosition.d.mts +2 -3
- package/RadialLineChart/seriesConfig/tooltipPosition.d.ts +2 -3
- package/RadialLineChart/seriesConfig/tooltipPosition.js +4 -6
- package/RadialLineChart/seriesConfig/tooltipPosition.mjs +2 -5
- package/ScatterChartPremium/ScatterPlotPremium.d.mts +2 -1
- package/ScatterChartPremium/ScatterPlotPremium.d.ts +2 -1
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.d.mts +2 -1
- package/ScatterChartPremium/webgl/ScatterWebGLPlot.d.ts +2 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/plugins/useGeoProjection/factories.d.mts +3 -0
- package/internals/plugins/useGeoProjection/factories.d.ts +3 -0
- package/internals/plugins/useGeoProjection/factories.js +29 -0
- package/internals/plugins/useGeoProjection/factories.mjs +23 -0
- package/internals/plugins/useGeoProjection/projection.utils.d.mts +17 -0
- package/internals/plugins/useGeoProjection/projection.utils.d.ts +17 -0
- package/internals/plugins/useGeoProjection/projection.utils.js +67 -0
- package/internals/plugins/useGeoProjection/projection.utils.mjs +59 -0
- package/internals/plugins/useGeoProjection/useGeoProjection.js +7 -40
- package/internals/plugins/useGeoProjection/useGeoProjection.mjs +7 -40
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.d.mts +47 -11
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.d.ts +47 -11
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.js +118 -8
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.mjs +117 -8
- package/internals/plugins/useGeoProjection/useGeoProjection.types.d.mts +63 -2
- package/internals/plugins/useGeoProjection/useGeoProjection.types.d.ts +63 -2
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.d.mts +11 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.d.ts +11 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.js +65 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/usePanOnDrag.mjs +58 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.d.mts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.d.ts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.js +62 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnPinch.mjs +56 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.d.mts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.d.ts +13 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.js +64 -0
- package/internals/plugins/useGeoProjectionZoom/gestureHooks/useZoomOnWheel.mjs +58 -0
- package/internals/plugins/useGeoProjectionZoom/index.d.mts +2 -0
- package/internals/plugins/useGeoProjectionZoom/index.d.ts +2 -0
- package/internals/plugins/useGeoProjectionZoom/index.js +12 -0
- package/internals/plugins/useGeoProjectionZoom/index.mjs +1 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.d.mts +31 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.d.ts +31 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.js +187 -0
- package/internals/plugins/useGeoProjectionZoom/mapZoom.utils.mjs +177 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.d.mts +23 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.d.ts +23 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.js +190 -0
- package/internals/plugins/useGeoProjectionZoom/rotationMath.mjs +182 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.d.mts +3 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.d.ts +3 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.js +174 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.mjs +166 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.d.mts +152 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.d.ts +152 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.js +5 -0
- package/internals/plugins/useGeoProjectionZoom/useGeoProjectionZoom.types.mjs +1 -0
- package/package.json +6 -6
|
@@ -20,7 +20,7 @@ export interface RadialLineHighlightPlotProps extends React.SVGAttributes<SVGGEl
|
|
|
20
20
|
*/
|
|
21
21
|
slotProps?: RadialLineHighlightPlotSlotProps;
|
|
22
22
|
}
|
|
23
|
-
declare function RadialLineHighlightPlot(props: RadialLineHighlightPlotProps):
|
|
23
|
+
declare function RadialLineHighlightPlot(props: RadialLineHighlightPlotProps): React.JSX.Element | null;
|
|
24
24
|
declare namespace RadialLineHighlightPlot {
|
|
25
25
|
var propTypes: any;
|
|
26
26
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.mjs";
|
|
|
2
2
|
export interface RadialLinePlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'line' | 'linePlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialLinePlot(props: RadialLinePlotProps): import("react
|
|
5
|
+
declare function RadialLinePlot(props: RadialLinePlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialLinePlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.js";
|
|
|
2
2
|
export interface RadialLinePlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'line' | 'linePlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialLinePlot(props: RadialLinePlotProps): import("react
|
|
5
|
+
declare function RadialLinePlot(props: RadialLinePlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialLinePlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.mjs";
|
|
|
2
2
|
export interface RadialMarkPlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'mark' | 'markPlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react
|
|
5
|
+
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialMarkPlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import type { RadialLineClasses } from "./radialLineClasses.js";
|
|
|
2
2
|
export interface RadialMarkPlotProps {
|
|
3
3
|
classes?: Partial<Pick<RadialLineClasses, 'mark' | 'markPlot'>>;
|
|
4
4
|
}
|
|
5
|
-
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react
|
|
5
|
+
declare function RadialMarkPlot(props: RadialMarkPlotProps): import("react").JSX.Element;
|
|
6
6
|
declare namespace RadialMarkPlot {
|
|
7
7
|
var propTypes: any;
|
|
8
8
|
}
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.radialLineSeriesConfig = void 0;
|
|
8
8
|
var _internals = require("@mui/x-charts/internals");
|
|
9
9
|
var _legend = _interopRequireDefault(require("./legend"));
|
|
10
|
-
var _tooltipPosition =
|
|
10
|
+
var _tooltipPosition = require("./tooltipPosition");
|
|
11
11
|
var _keyboardFocusHandler = _interopRequireDefault(require("./keyboardFocusHandler"));
|
|
12
12
|
var _axisTooltipGetter = require("./axisTooltipGetter");
|
|
13
13
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
@@ -23,7 +23,7 @@ const radialLineSeriesConfig = exports.radialLineSeriesConfig = {
|
|
|
23
23
|
seriesProcessor: _seriesProcessor.default,
|
|
24
24
|
legendGetter: _legend.default,
|
|
25
25
|
tooltipGetter: _tooltip.default,
|
|
26
|
-
|
|
26
|
+
selectorTooltipItemPosition: _tooltipPosition.selectorTooltipItemPosition,
|
|
27
27
|
axisTooltipGetter: _axisTooltipGetter.axisTooltipGetter,
|
|
28
28
|
rotationExtremumGetter: _extremums.rotationExtremumGetter,
|
|
29
29
|
radiusExtremumGetter: _extremums.radiusExtremumGetter,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { identifierSerializerSeriesIdDataIndex, identifierCleanerSeriesIdDataIndex, createIsHighlighted, createIsFaded, polarSeriesTypes } from '@mui/x-charts/internals';
|
|
2
2
|
import legendGetter from "./legend.mjs";
|
|
3
|
-
import
|
|
3
|
+
import { selectorTooltipItemPosition } from "./tooltipPosition.mjs";
|
|
4
4
|
import keyboardFocusHandler from "./keyboardFocusHandler.mjs";
|
|
5
5
|
import { axisTooltipGetter } from "./axisTooltipGetter.mjs";
|
|
6
6
|
import colorProcessor from "./getColor.mjs";
|
|
@@ -16,7 +16,7 @@ export const radialLineSeriesConfig = {
|
|
|
16
16
|
seriesProcessor,
|
|
17
17
|
legendGetter,
|
|
18
18
|
tooltipGetter,
|
|
19
|
-
|
|
19
|
+
selectorTooltipItemPosition,
|
|
20
20
|
axisTooltipGetter,
|
|
21
21
|
rotationExtremumGetter,
|
|
22
22
|
radiusExtremumGetter,
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
3
|
-
export default tooltipItemPositionGetter;
|
|
1
|
+
import type { TooltipItemPositionSelector } from '@mui/x-charts/internals';
|
|
2
|
+
export declare const selectorTooltipItemPosition: TooltipItemPositionSelector<'radialLine'>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare const
|
|
3
|
-
export default tooltipItemPositionGetter;
|
|
1
|
+
import type { TooltipItemPositionSelector } from '@mui/x-charts/internals';
|
|
2
|
+
export declare const selectorTooltipItemPosition: TooltipItemPositionSelector<'radialLine'>;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
var _default = exports.default = tooltipItemPositionGetter;
|
|
6
|
+
exports.selectorTooltipItemPosition = void 0;
|
|
7
|
+
// Todo: to implement
|
|
8
|
+
const selectorTooltipItemPosition = () => null;
|
|
9
|
+
exports.selectorTooltipItemPosition = selectorTooltipItemPosition;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { RendererType, ScatterPlotProps, ScatterPlotSlots, ScatterPlotSlotProps } from '@mui/x-charts/ScatterChart';
|
|
2
3
|
export interface ScatterPlotPremiumSlots extends ScatterPlotSlots {}
|
|
3
4
|
export interface ScatterPlotPremiumSlotProps extends ScatterPlotSlotProps {}
|
|
@@ -23,7 +24,7 @@ export interface ScatterPlotPremiumProps extends Omit<ScatterPlotProps, 'rendere
|
|
|
23
24
|
declare function ScatterPlotPremium({
|
|
24
25
|
renderer,
|
|
25
26
|
...props
|
|
26
|
-
}: ScatterPlotPremiumProps):
|
|
27
|
+
}: ScatterPlotPremiumProps): React.JSX.Element;
|
|
27
28
|
declare namespace ScatterPlotPremium {
|
|
28
29
|
var propTypes: any;
|
|
29
30
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import type { RendererType, ScatterPlotProps, ScatterPlotSlots, ScatterPlotSlotProps } from '@mui/x-charts/ScatterChart';
|
|
2
3
|
export interface ScatterPlotPremiumSlots extends ScatterPlotSlots {}
|
|
3
4
|
export interface ScatterPlotPremiumSlotProps extends ScatterPlotSlotProps {}
|
|
@@ -23,7 +24,7 @@ export interface ScatterPlotPremiumProps extends Omit<ScatterPlotProps, 'rendere
|
|
|
23
24
|
declare function ScatterPlotPremium({
|
|
24
25
|
renderer,
|
|
25
26
|
...props
|
|
26
|
-
}: ScatterPlotPremiumProps):
|
|
27
|
+
}: ScatterPlotPremiumProps): React.JSX.Element;
|
|
27
28
|
declare namespace ScatterPlotPremium {
|
|
28
29
|
var propTypes: any;
|
|
29
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* @ignore - Internal component used for rendering the scatter plot using WebGL. Not exported from the package.
|
|
3
4
|
*/
|
|
4
|
-
export declare function ScatterWebGLPlot():
|
|
5
|
+
export declare function ScatterWebGLPlot(): React.JSX.Element | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
/**
|
|
2
3
|
* @ignore - Internal component used for rendering the scatter plot using WebGL. Not exported from the package.
|
|
3
4
|
*/
|
|
4
|
-
export declare function ScatterWebGLPlot():
|
|
5
|
+
export declare function ScatterWebGLPlot(): React.JSX.Element | null;
|
package/index.js
CHANGED
package/index.mjs
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PROJECTION_FACTORIES = void 0;
|
|
7
|
+
var _d3Geo = require("@mui/x-charts-vendor/d3-geo");
|
|
8
|
+
const PROJECTION_FACTORIES = exports.PROJECTION_FACTORIES = {
|
|
9
|
+
// Azimuthal projections (https://d3js.org/d3-geo/azimuthal)
|
|
10
|
+
azimuthalEqualArea: _d3Geo.geoAzimuthalEqualArea,
|
|
11
|
+
azimuthalEquidistant: _d3Geo.geoAzimuthalEquidistant,
|
|
12
|
+
gnomonic: _d3Geo.geoGnomonic,
|
|
13
|
+
orthographic: _d3Geo.geoOrthographic,
|
|
14
|
+
stereographic: _d3Geo.geoStereographic,
|
|
15
|
+
// Conic projections (https://d3js.org/d3-geo/conic)
|
|
16
|
+
conicConformal: _d3Geo.geoConicConformal,
|
|
17
|
+
conicEqualArea: _d3Geo.geoConicEqualArea,
|
|
18
|
+
conicEquidistant: _d3Geo.geoConicEquidistant,
|
|
19
|
+
albers: _d3Geo.geoAlbers,
|
|
20
|
+
albersUsa: _d3Geo.geoAlbersUsa,
|
|
21
|
+
// Special composition for the USA with an edge case for Alaska and Hawaii.
|
|
22
|
+
|
|
23
|
+
// Cylindrical projections (https://d3js.org/d3-geo/cylindrical)
|
|
24
|
+
equirectangular: _d3Geo.geoEquirectangular,
|
|
25
|
+
mercator: _d3Geo.geoMercator,
|
|
26
|
+
transverseMercator: _d3Geo.geoTransverseMercator,
|
|
27
|
+
equalEarth: _d3Geo.geoEqualEarth,
|
|
28
|
+
naturalEarth1: _d3Geo.geoNaturalEarth1
|
|
29
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { geoAlbers, geoAlbersUsa, geoAzimuthalEqualArea, geoAzimuthalEquidistant, geoConicConformal, geoConicEqualArea, geoConicEquidistant, geoEqualEarth, geoEquirectangular, geoGnomonic, geoMercator, geoNaturalEarth1, geoOrthographic, geoStereographic, geoTransverseMercator } from '@mui/x-charts-vendor/d3-geo';
|
|
2
|
+
export const PROJECTION_FACTORIES = {
|
|
3
|
+
// Azimuthal projections (https://d3js.org/d3-geo/azimuthal)
|
|
4
|
+
azimuthalEqualArea: geoAzimuthalEqualArea,
|
|
5
|
+
azimuthalEquidistant: geoAzimuthalEquidistant,
|
|
6
|
+
gnomonic: geoGnomonic,
|
|
7
|
+
orthographic: geoOrthographic,
|
|
8
|
+
stereographic: geoStereographic,
|
|
9
|
+
// Conic projections (https://d3js.org/d3-geo/conic)
|
|
10
|
+
conicConformal: geoConicConformal,
|
|
11
|
+
conicEqualArea: geoConicEqualArea,
|
|
12
|
+
conicEquidistant: geoConicEquidistant,
|
|
13
|
+
albers: geoAlbers,
|
|
14
|
+
albersUsa: geoAlbersUsa,
|
|
15
|
+
// Special composition for the USA with an edge case for Alaska and Hawaii.
|
|
16
|
+
|
|
17
|
+
// Cylindrical projections (https://d3js.org/d3-geo/cylindrical)
|
|
18
|
+
equirectangular: geoEquirectangular,
|
|
19
|
+
mercator: geoMercator,
|
|
20
|
+
transverseMercator: geoTransverseMercator,
|
|
21
|
+
equalEarth: geoEqualEarth,
|
|
22
|
+
naturalEarth1: geoNaturalEarth1
|
|
23
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExtendedFeatureCollection, GeoProjection } from '@mui/x-charts-vendor/d3-geo';
|
|
2
|
+
import type { GeoProjectionInput } from "./useGeoProjection.types.mjs";
|
|
3
|
+
export declare function getParallels(parallels: [number, number] | null | undefined): [number, number];
|
|
4
|
+
/**
|
|
5
|
+
* Builds a *fresh* `GeoProjection` instance from the raw projection input.
|
|
6
|
+
*
|
|
7
|
+
* This is intentionally not a memoized selector: callers mutate the returned projection (to fit,
|
|
8
|
+
* scale, translate, rotate it). Returning a shared instance would mean mutations leak between
|
|
9
|
+
* consumers and, worse, that a recomputed view keeps the same object reference — so store
|
|
10
|
+
* subscribers comparing with `Object.is` would not detect the change and the map would render one
|
|
11
|
+
* update behind.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveProjectionInstance(projectionInput: GeoProjectionInput | null, parallels: [number, number]): GeoProjection | null;
|
|
14
|
+
/**
|
|
15
|
+
* Helper function to compute the translation needed to fit the map in the drawing area at zoomLevel=1
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDefaultTranslation(projectionInput: GeoProjectionInput | null | undefined, geoData: ExtendedFeatureCollection | null | undefined, parallels: [number, number] | null | undefined, center: [number, number]): [number, number] | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExtendedFeatureCollection, GeoProjection } from '@mui/x-charts-vendor/d3-geo';
|
|
2
|
+
import type { GeoProjectionInput } from "./useGeoProjection.types.js";
|
|
3
|
+
export declare function getParallels(parallels: [number, number] | null | undefined): [number, number];
|
|
4
|
+
/**
|
|
5
|
+
* Builds a *fresh* `GeoProjection` instance from the raw projection input.
|
|
6
|
+
*
|
|
7
|
+
* This is intentionally not a memoized selector: callers mutate the returned projection (to fit,
|
|
8
|
+
* scale, translate, rotate it). Returning a shared instance would mean mutations leak between
|
|
9
|
+
* consumers and, worse, that a recomputed view keeps the same object reference — so store
|
|
10
|
+
* subscribers comparing with `Object.is` would not detect the change and the map would render one
|
|
11
|
+
* update behind.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveProjectionInstance(projectionInput: GeoProjectionInput | null, parallels: [number, number]): GeoProjection | null;
|
|
14
|
+
/**
|
|
15
|
+
* Helper function to compute the translation needed to fit the map in the drawing area at zoomLevel=1
|
|
16
|
+
*/
|
|
17
|
+
export declare function getDefaultTranslation(projectionInput: GeoProjectionInput | null | undefined, geoData: ExtendedFeatureCollection | null | undefined, parallels: [number, number] | null | undefined, center: [number, number]): [number, number] | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDefaultTranslation = getDefaultTranslation;
|
|
7
|
+
exports.getParallels = getParallels;
|
|
8
|
+
exports.resolveProjectionInstance = resolveProjectionInstance;
|
|
9
|
+
var _d3Geo = require("@mui/x-charts-vendor/d3-geo");
|
|
10
|
+
var _factories = require("./factories");
|
|
11
|
+
const isConicProjection = projection => {
|
|
12
|
+
return 'parallels' in projection && typeof projection.parallels === 'function';
|
|
13
|
+
};
|
|
14
|
+
const DEFAULT_PARALLELS = [30, 30];
|
|
15
|
+
function getParallels(parallels) {
|
|
16
|
+
return parallels ?? DEFAULT_PARALLELS;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Builds a *fresh* `GeoProjection` instance from the raw projection input.
|
|
21
|
+
*
|
|
22
|
+
* This is intentionally not a memoized selector: callers mutate the returned projection (to fit,
|
|
23
|
+
* scale, translate, rotate it). Returning a shared instance would mean mutations leak between
|
|
24
|
+
* consumers and, worse, that a recomputed view keeps the same object reference — so store
|
|
25
|
+
* subscribers comparing with `Object.is` would not detect the change and the map would render one
|
|
26
|
+
* update behind.
|
|
27
|
+
*/
|
|
28
|
+
function resolveProjectionInstance(projectionInput, parallels) {
|
|
29
|
+
if (projectionInput === null) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (typeof projectionInput !== 'string') {
|
|
33
|
+
return projectionInput;
|
|
34
|
+
}
|
|
35
|
+
const factory = _factories.PROJECTION_FACTORIES?.[projectionInput];
|
|
36
|
+
if (!factory) {
|
|
37
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
38
|
+
console.error(`MUI X Charts: Unknown projection name '${projectionInput}'. ` + `Expected one of: ${Object.keys(_factories.PROJECTION_FACTORIES ?? {}).join(', ')}.`);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const projection = factory();
|
|
43
|
+
if (isConicProjection(projection)) {
|
|
44
|
+
projection.parallels(parallels);
|
|
45
|
+
}
|
|
46
|
+
return projection;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Helper function to compute the translation needed to fit the map in the drawing area at zoomLevel=1
|
|
51
|
+
*/
|
|
52
|
+
function getDefaultTranslation(projectionInput, geoData, parallels, center) {
|
|
53
|
+
if (!projectionInput || !geoData) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const projection = resolveProjectionInstance(projectionInput, getParallels(parallels));
|
|
57
|
+
if (!projection) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
projection.rotate([-center[0], -center[1]]);
|
|
61
|
+
const [[ux0, uy0], [ux1, uy1]] = (0, _d3Geo.geoPath)(projection).bounds(geoData);
|
|
62
|
+
const centerPoint = projection(center);
|
|
63
|
+
if (!centerPoint) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return [(centerPoint[0] - (ux0 + ux1) / 2) / (ux1 - ux0), (centerPoint[1] - (uy0 + uy1) / 2) / (uy1 - uy0)];
|
|
67
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { geoPath } from '@mui/x-charts-vendor/d3-geo';
|
|
2
|
+
import { PROJECTION_FACTORIES } from "./factories.mjs";
|
|
3
|
+
const isConicProjection = projection => {
|
|
4
|
+
return 'parallels' in projection && typeof projection.parallels === 'function';
|
|
5
|
+
};
|
|
6
|
+
const DEFAULT_PARALLELS = [30, 30];
|
|
7
|
+
export function getParallels(parallels) {
|
|
8
|
+
return parallels ?? DEFAULT_PARALLELS;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Builds a *fresh* `GeoProjection` instance from the raw projection input.
|
|
13
|
+
*
|
|
14
|
+
* This is intentionally not a memoized selector: callers mutate the returned projection (to fit,
|
|
15
|
+
* scale, translate, rotate it). Returning a shared instance would mean mutations leak between
|
|
16
|
+
* consumers and, worse, that a recomputed view keeps the same object reference — so store
|
|
17
|
+
* subscribers comparing with `Object.is` would not detect the change and the map would render one
|
|
18
|
+
* update behind.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveProjectionInstance(projectionInput, parallels) {
|
|
21
|
+
if (projectionInput === null) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (typeof projectionInput !== 'string') {
|
|
25
|
+
return projectionInput;
|
|
26
|
+
}
|
|
27
|
+
const factory = PROJECTION_FACTORIES?.[projectionInput];
|
|
28
|
+
if (!factory) {
|
|
29
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
30
|
+
console.error(`MUI X Charts: Unknown projection name '${projectionInput}'. ` + `Expected one of: ${Object.keys(PROJECTION_FACTORIES ?? {}).join(', ')}.`);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const projection = factory();
|
|
35
|
+
if (isConicProjection(projection)) {
|
|
36
|
+
projection.parallels(parallels);
|
|
37
|
+
}
|
|
38
|
+
return projection;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Helper function to compute the translation needed to fit the map in the drawing area at zoomLevel=1
|
|
43
|
+
*/
|
|
44
|
+
export function getDefaultTranslation(projectionInput, geoData, parallels, center) {
|
|
45
|
+
if (!projectionInput || !geoData) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const projection = resolveProjectionInstance(projectionInput, getParallels(parallels));
|
|
49
|
+
if (!projection) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
projection.rotate([-center[0], -center[1]]);
|
|
53
|
+
const [[ux0, uy0], [ux1, uy1]] = geoPath(projection).bounds(geoData);
|
|
54
|
+
const centerPoint = projection(center);
|
|
55
|
+
if (!centerPoint) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
return [(centerPoint[0] - (ux0 + ux1) / 2) / (ux1 - ux0), (centerPoint[1] - (uy0 + uy1) / 2) / (uy1 - uy0)];
|
|
59
|
+
}
|
|
@@ -9,29 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.useGeoProjection = void 0;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
-
var _d3Geo = require("@mui/x-charts-vendor/d3-geo");
|
|
13
|
-
const PROJECTION_FACTORIES = {
|
|
14
|
-
// Azimuthal projections (https://d3js.org/d3-geo/azimuthal)
|
|
15
|
-
azimuthalEqualArea: _d3Geo.geoAzimuthalEqualArea,
|
|
16
|
-
azimuthalEquidistant: _d3Geo.geoAzimuthalEquidistant,
|
|
17
|
-
gnomonic: _d3Geo.geoGnomonic,
|
|
18
|
-
orthographic: _d3Geo.geoOrthographic,
|
|
19
|
-
stereographic: _d3Geo.geoStereographic,
|
|
20
|
-
// Conic projections (https://d3js.org/d3-geo/conic)
|
|
21
|
-
conicConformal: _d3Geo.geoConicConformal,
|
|
22
|
-
conicEqualArea: _d3Geo.geoConicEqualArea,
|
|
23
|
-
conicEquidistant: _d3Geo.geoConicEquidistant,
|
|
24
|
-
albers: _d3Geo.geoAlbers,
|
|
25
|
-
albersUsa: _d3Geo.geoAlbersUsa,
|
|
26
|
-
// Special composition for the USA with an edge case for Alaska and Hawaii.
|
|
27
|
-
|
|
28
|
-
// Cylindrical projections (https://d3js.org/d3-geo/cylindrical)
|
|
29
|
-
equirectangular: _d3Geo.geoEquirectangular,
|
|
30
|
-
mercator: _d3Geo.geoMercator,
|
|
31
|
-
transverseMercator: _d3Geo.geoTransverseMercator,
|
|
32
|
-
equalEarth: _d3Geo.geoEqualEarth,
|
|
33
|
-
naturalEarth1: _d3Geo.geoNaturalEarth1
|
|
34
|
-
};
|
|
35
12
|
const useGeoProjection = ({
|
|
36
13
|
params,
|
|
37
14
|
store
|
|
@@ -40,9 +17,7 @@ const useGeoProjection = ({
|
|
|
40
17
|
geoData,
|
|
41
18
|
geoFeatureKey,
|
|
42
19
|
projection,
|
|
43
|
-
|
|
44
|
-
rotate,
|
|
45
|
-
scale
|
|
20
|
+
parallels
|
|
46
21
|
} = params;
|
|
47
22
|
const isFirstRender = React.useRef(true);
|
|
48
23
|
React.useEffect(() => {
|
|
@@ -50,16 +25,13 @@ const useGeoProjection = ({
|
|
|
50
25
|
isFirstRender.current = false;
|
|
51
26
|
return;
|
|
52
27
|
}
|
|
53
|
-
store.set('geoProjection', {
|
|
28
|
+
store.set('geoProjection', (0, _extends2.default)({}, store.state.geoProjection, {
|
|
54
29
|
geoData: geoData ?? null,
|
|
55
30
|
geoFeatureKey: geoFeatureKey ?? 'name',
|
|
56
31
|
projection: projection ?? null,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
factories: PROJECTION_FACTORIES
|
|
61
|
-
});
|
|
62
|
-
}, [geoData, geoFeatureKey, projection, translate, rotate, scale, store]);
|
|
32
|
+
parallels: parallels ?? null
|
|
33
|
+
}));
|
|
34
|
+
}, [geoData, geoFeatureKey, projection, parallels, store]);
|
|
63
35
|
return {};
|
|
64
36
|
};
|
|
65
37
|
exports.useGeoProjection = useGeoProjection;
|
|
@@ -67,9 +39,7 @@ useGeoProjection.params = {
|
|
|
67
39
|
geoData: true,
|
|
68
40
|
geoFeatureKey: true,
|
|
69
41
|
projection: true,
|
|
70
|
-
|
|
71
|
-
rotate: true,
|
|
72
|
-
scale: true
|
|
42
|
+
parallels: true
|
|
73
43
|
};
|
|
74
44
|
useGeoProjection.getDefaultizedParams = ({
|
|
75
45
|
params
|
|
@@ -79,9 +49,6 @@ useGeoProjection.getInitialState = params => ({
|
|
|
79
49
|
geoData: params.geoData ?? null,
|
|
80
50
|
geoFeatureKey: params.geoFeatureKey ?? 'name',
|
|
81
51
|
projection: params.projection ?? null,
|
|
82
|
-
|
|
83
|
-
rotate: params.rotate ?? null,
|
|
84
|
-
scale: params.scale ?? null,
|
|
85
|
-
factories: PROJECTION_FACTORIES
|
|
52
|
+
parallels: params.parallels ?? null
|
|
86
53
|
}
|
|
87
54
|
});
|
|
@@ -2,29 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { geoAlbers, geoAlbersUsa, geoAzimuthalEqualArea, geoAzimuthalEquidistant, geoConicConformal, geoConicEqualArea, geoConicEquidistant, geoEqualEarth, geoEquirectangular, geoGnomonic, geoMercator, geoNaturalEarth1, geoOrthographic, geoStereographic, geoTransverseMercator } from '@mui/x-charts-vendor/d3-geo';
|
|
6
|
-
const PROJECTION_FACTORIES = {
|
|
7
|
-
// Azimuthal projections (https://d3js.org/d3-geo/azimuthal)
|
|
8
|
-
azimuthalEqualArea: geoAzimuthalEqualArea,
|
|
9
|
-
azimuthalEquidistant: geoAzimuthalEquidistant,
|
|
10
|
-
gnomonic: geoGnomonic,
|
|
11
|
-
orthographic: geoOrthographic,
|
|
12
|
-
stereographic: geoStereographic,
|
|
13
|
-
// Conic projections (https://d3js.org/d3-geo/conic)
|
|
14
|
-
conicConformal: geoConicConformal,
|
|
15
|
-
conicEqualArea: geoConicEqualArea,
|
|
16
|
-
conicEquidistant: geoConicEquidistant,
|
|
17
|
-
albers: geoAlbers,
|
|
18
|
-
albersUsa: geoAlbersUsa,
|
|
19
|
-
// Special composition for the USA with an edge case for Alaska and Hawaii.
|
|
20
|
-
|
|
21
|
-
// Cylindrical projections (https://d3js.org/d3-geo/cylindrical)
|
|
22
|
-
equirectangular: geoEquirectangular,
|
|
23
|
-
mercator: geoMercator,
|
|
24
|
-
transverseMercator: geoTransverseMercator,
|
|
25
|
-
equalEarth: geoEqualEarth,
|
|
26
|
-
naturalEarth1: geoNaturalEarth1
|
|
27
|
-
};
|
|
28
5
|
export const useGeoProjection = ({
|
|
29
6
|
params,
|
|
30
7
|
store
|
|
@@ -33,9 +10,7 @@ export const useGeoProjection = ({
|
|
|
33
10
|
geoData,
|
|
34
11
|
geoFeatureKey,
|
|
35
12
|
projection,
|
|
36
|
-
|
|
37
|
-
rotate,
|
|
38
|
-
scale
|
|
13
|
+
parallels
|
|
39
14
|
} = params;
|
|
40
15
|
const isFirstRender = React.useRef(true);
|
|
41
16
|
React.useEffect(() => {
|
|
@@ -43,25 +18,20 @@ export const useGeoProjection = ({
|
|
|
43
18
|
isFirstRender.current = false;
|
|
44
19
|
return;
|
|
45
20
|
}
|
|
46
|
-
store.set('geoProjection', {
|
|
21
|
+
store.set('geoProjection', _extends({}, store.state.geoProjection, {
|
|
47
22
|
geoData: geoData ?? null,
|
|
48
23
|
geoFeatureKey: geoFeatureKey ?? 'name',
|
|
49
24
|
projection: projection ?? null,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
factories: PROJECTION_FACTORIES
|
|
54
|
-
});
|
|
55
|
-
}, [geoData, geoFeatureKey, projection, translate, rotate, scale, store]);
|
|
25
|
+
parallels: parallels ?? null
|
|
26
|
+
}));
|
|
27
|
+
}, [geoData, geoFeatureKey, projection, parallels, store]);
|
|
56
28
|
return {};
|
|
57
29
|
};
|
|
58
30
|
useGeoProjection.params = {
|
|
59
31
|
geoData: true,
|
|
60
32
|
geoFeatureKey: true,
|
|
61
33
|
projection: true,
|
|
62
|
-
|
|
63
|
-
rotate: true,
|
|
64
|
-
scale: true
|
|
34
|
+
parallels: true
|
|
65
35
|
};
|
|
66
36
|
useGeoProjection.getDefaultizedParams = ({
|
|
67
37
|
params
|
|
@@ -71,9 +41,6 @@ useGeoProjection.getInitialState = params => ({
|
|
|
71
41
|
geoData: params.geoData ?? null,
|
|
72
42
|
geoFeatureKey: params.geoFeatureKey ?? 'name',
|
|
73
43
|
projection: params.projection ?? null,
|
|
74
|
-
|
|
75
|
-
rotate: params.rotate ?? null,
|
|
76
|
-
scale: params.scale ?? null,
|
|
77
|
-
factories: PROJECTION_FACTORIES
|
|
44
|
+
parallels: params.parallels ?? null
|
|
78
45
|
}
|
|
79
46
|
});
|