@mui/x-charts-premium 9.4.0 → 9.6.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.js +5 -3
- package/BarChartPremium/BarChartPremium.mjs +5 -3
- package/BarChartPremium/BarPlotPremium.js +1 -1
- package/BarChartPremium/BarPlotPremium.mjs +1 -1
- package/BarChartPremium/RangeBar/RangeBarPlot.js +2 -2
- package/BarChartPremium/RangeBar/RangeBarPlot.mjs +2 -2
- package/BarChartPremium/RangeBar/seriesConfig/getColor.js +2 -5
- package/BarChartPremium/RangeBar/seriesConfig/getColor.mjs +2 -5
- package/BarChartPremium/webgl/useWebGLBarLikePlotData.d.mts +1 -0
- package/BarChartPremium/webgl/useWebGLBarLikePlotData.d.ts +1 -0
- package/BarChartPremium/webgl/useWebGLBarLikePlotData.js +66 -7
- package/BarChartPremium/webgl/useWebGLBarLikePlotData.mjs +66 -7
- package/CHANGELOG.md +251 -0
- package/CandlestickChart/CandlestickChart.js +1 -1
- package/CandlestickChart/CandlestickChart.mjs +1 -1
- package/CandlestickChart/index.d.mts +11 -2
- package/CandlestickChart/index.d.ts +11 -2
- package/CandlestickChart/index.js +15 -3
- package/CandlestickChart/index.mjs +16 -2
- package/CandlestickChart/seriesConfig/getColor.js +2 -5
- package/CandlestickChart/seriesConfig/getColor.mjs +2 -5
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.js +7 -3
- package/ChartsDataProviderPremium/ChartsDataProviderPremium.mjs +7 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.js +11 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.mjs +11 -3
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.d.mts +1 -1
- package/ChartsGeoDataProviderPremium/ChartsGeoDataProviderPremium.plugins.d.ts +1 -1
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.js +11 -3
- package/ChartsRadialDataProviderPremium/ChartsRadialDataProviderPremium.mjs +11 -3
- package/ChartsRenderer/ChartsRenderer.js +1 -1
- package/ChartsRenderer/ChartsRenderer.mjs +1 -1
- package/HeatmapPremium/HeatmapPremium.js +5 -3
- package/HeatmapPremium/HeatmapPremium.mjs +5 -3
- package/Map/GeoDataPlot.js +1 -1
- package/Map/GeoDataPlot.mjs +1 -1
- package/Map/MapShape.d.mts +3 -0
- package/Map/MapShape.d.ts +3 -0
- package/Map/MapShape.js +10 -1
- package/Map/MapShape.mjs +9 -0
- package/Map/MapShapePlot.d.mts +5 -1
- package/Map/MapShapePlot.d.ts +5 -1
- package/Map/MapShapePlot.js +27 -3
- package/Map/MapShapePlot.mjs +28 -4
- package/Map/index.d.mts +3 -1
- package/Map/index.d.ts +3 -1
- package/Map/seriesConfig/getColor.js +4 -9
- package/Map/seriesConfig/getColor.mjs +4 -9
- package/Map/seriesConfig/index.js +2 -0
- package/Map/seriesConfig/index.mjs +2 -0
- package/Map/seriesConfig/tooltip.js +5 -1
- package/Map/seriesConfig/tooltip.mjs +5 -1
- package/Map/seriesConfig/tooltipPosition.d.mts +3 -0
- package/Map/seriesConfig/tooltipPosition.d.ts +3 -0
- package/Map/seriesConfig/tooltipPosition.js +64 -0
- package/Map/seriesConfig/tooltipPosition.mjs +58 -0
- package/RadialBarChart/RadialBarChart.d.mts +1 -1
- package/RadialBarChart/RadialBarChart.d.ts +1 -1
- package/RadialBarChart/RadialBarChart.js +3 -3
- package/RadialBarChart/RadialBarChart.mjs +2 -2
- package/RadialBarChart/RadialBarPlot.js +1 -1
- package/RadialBarChart/RadialBarPlot.mjs +1 -1
- package/RadialBarChart/index.d.mts +4 -0
- package/RadialBarChart/index.d.ts +4 -0
- package/RadialBarChart/index.js +8 -1
- package/RadialBarChart/index.mjs +6 -0
- package/RadialLineChart/RadialAreaPlot.d.mts +5 -1
- package/RadialLineChart/RadialAreaPlot.d.ts +5 -1
- package/RadialLineChart/RadialAreaPlot.js +10 -1
- package/RadialLineChart/RadialAreaPlot.mjs +11 -2
- package/RadialLineChart/RadialLineChart.d.mts +1 -1
- package/RadialLineChart/RadialLineChart.d.ts +1 -1
- package/RadialLineChart/RadialLineChart.js +5 -5
- package/RadialLineChart/RadialLineChart.mjs +6 -6
- package/RadialLineChart/RadialLineHighlightElement.d.mts +3 -0
- package/RadialLineChart/RadialLineHighlightElement.d.ts +3 -0
- package/RadialLineChart/RadialLineHighlightElement.js +10 -1
- package/RadialLineChart/RadialLineHighlightElement.mjs +9 -0
- package/RadialLineChart/RadialLineHighlightPlot.d.mts +3 -0
- package/RadialLineChart/RadialLineHighlightPlot.d.ts +3 -0
- package/RadialLineChart/RadialLineHighlightPlot.js +18 -1
- package/RadialLineChart/RadialLineHighlightPlot.mjs +17 -0
- package/RadialLineChart/RadialLinePlot.d.mts +5 -1
- package/RadialLineChart/RadialLinePlot.d.ts +5 -1
- package/RadialLineChart/RadialLinePlot.js +10 -1
- package/RadialLineChart/RadialLinePlot.mjs +11 -2
- package/RadialLineChart/RadialMarkPlot.d.mts +5 -1
- package/RadialLineChart/RadialMarkPlot.d.ts +5 -1
- package/RadialLineChart/RadialMarkPlot.js +10 -1
- package/RadialLineChart/RadialMarkPlot.mjs +11 -2
- package/RadialLineChart/index.d.mts +4 -0
- package/RadialLineChart/index.d.ts +4 -0
- package/RadialLineChart/index.js +16 -1
- package/RadialLineChart/index.mjs +6 -0
- package/ScatterChartPremium/ScatterChartPremium.js +9 -5
- package/ScatterChartPremium/ScatterChartPremium.mjs +10 -6
- package/ScatterChartPremium/ScatterChartPremium.plugins.d.mts +1 -1
- package/ScatterChartPremium/ScatterChartPremium.plugins.d.ts +1 -1
- package/ScatterChartPremium/ScatterPlotPremium.d.mts +20 -4
- package/ScatterChartPremium/ScatterPlotPremium.d.ts +20 -4
- package/ScatterChartPremium/ScatterPlotPremium.js +34 -1
- package/ScatterChartPremium/ScatterPlotPremium.mjs +36 -2
- package/ScatterChartPremium/index.d.mts +1 -1
- package/ScatterChartPremium/index.d.ts +1 -1
- package/context/ChartPremiumApi.d.mts +4 -1
- package/context/ChartPremiumApi.d.ts +4 -1
- package/hooks/useGeoData.js +1 -1
- package/hooks/useGeoData.mjs +2 -2
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/index.js +8 -1
- package/index.mjs +2 -2
- package/internals/plugins/allPlugins.d.mts +5 -5
- package/internals/plugins/allPlugins.d.ts +5 -5
- package/internals/plugins/allPlugins.js +2 -2
- package/internals/plugins/allPlugins.mjs +3 -3
- package/internals/plugins/useGeoProjection/useGeoProjection.d.mts +1 -1
- package/internals/plugins/useGeoProjection/useGeoProjection.d.ts +1 -1
- package/internals/plugins/useGeoProjection/useGeoProjection.js +32 -3
- package/internals/plugins/useGeoProjection/useGeoProjection.mjs +32 -3
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.d.mts +12 -34
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.d.ts +12 -34
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.js +8 -129
- package/internals/plugins/useGeoProjection/useGeoProjection.selectors.mjs +8 -128
- package/internals/plugins/useGeoProjection/useGeoProjection.types.d.mts +2 -55
- package/internals/plugins/useGeoProjection/useGeoProjection.types.d.ts +2 -55
- package/models/seriesType/mapShape.d.mts +1 -1
- package/models/seriesType/mapShape.d.ts +1 -1
- package/models/seriesType/ohlc.d.mts +1 -1
- package/models/seriesType/ohlc.d.ts +1 -1
- package/models/seriesType/radialBar.d.mts +1 -1
- package/models/seriesType/radialBar.d.ts +1 -1
- package/models/seriesType/radialLine.d.mts +1 -1
- package/models/seriesType/radialLine.d.ts +1 -1
- package/models/seriesType/rangeBar.d.mts +1 -1
- package/models/seriesType/rangeBar.d.ts +1 -1
- package/package.json +9 -6
|
@@ -3,133 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectorChartRawScale = exports.selectorChartRawProjection = exports.
|
|
7
|
-
var _store = require("@mui/x-internals/store");
|
|
6
|
+
exports.selectorChartRawScale = exports.selectorChartRawProjection = exports.selectorChartProjection = exports.selectorChartGeoProjectionState = exports.selectorChartGeoPath = exports.selectorChartGeoFeatureIndexesByName = exports.selectorChartGeoData = void 0;
|
|
8
7
|
var _internals = require("@mui/x-charts/internals");
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
stereographic: _d3Geo.geoStereographic,
|
|
17
|
-
// Conic projections (https://d3js.org/d3-geo/conic)
|
|
18
|
-
conicConformal: _d3Geo.geoConicConformal,
|
|
19
|
-
conicEqualArea: _d3Geo.geoConicEqualArea,
|
|
20
|
-
conicEquidistant: _d3Geo.geoConicEquidistant,
|
|
21
|
-
albers: _d3Geo.geoAlbers,
|
|
22
|
-
albersUsa: _d3Geo.geoAlbersUsa,
|
|
23
|
-
// Special composition for the USA with an edge case for Alaska and Hawaii.
|
|
24
|
-
|
|
25
|
-
// Cylindrical projections (https://d3js.org/d3-geo/cylindrical)
|
|
26
|
-
equirectangular: _d3Geo.geoEquirectangular,
|
|
27
|
-
mercator: _d3Geo.geoMercator,
|
|
28
|
-
transverseMercator: _d3Geo.geoTransverseMercator,
|
|
29
|
-
equalEarth: _d3Geo.geoEqualEarth,
|
|
30
|
-
naturalEarth1: _d3Geo.geoNaturalEarth1
|
|
31
|
-
};
|
|
32
|
-
const isConicProjection = projection => {
|
|
33
|
-
return 'parallels' in projection && typeof projection.parallels === 'function';
|
|
34
|
-
};
|
|
35
|
-
const selectorChartGeoProjectionState = state => state.geoProjection;
|
|
36
|
-
exports.selectorChartGeoProjectionState = selectorChartGeoProjectionState;
|
|
37
|
-
const selectorChartRawGeoData = exports.selectorChartRawGeoData = (0, _store.createSelector)(selectorChartGeoProjectionState, geoProjection => geoProjection?.geoData ?? null);
|
|
38
|
-
const selectorChartRawProjection = exports.selectorChartRawProjection = (0, _store.createSelector)(selectorChartGeoProjectionState, geoProjection => geoProjection?.projection ?? null);
|
|
39
|
-
const selectorChartRawScale = exports.selectorChartRawScale = (0, _store.createSelector)(selectorChartGeoProjectionState, geoProjection => geoProjection?.scale ?? null);
|
|
40
|
-
const selectorChartRotate = (0, _store.createSelectorMemoized)(selectorChartGeoProjectionState, geoProjection => geoProjection?.rotate ?? null);
|
|
41
|
-
const selectorChartTranslate = (0, _store.createSelectorMemoized)(selectorChartGeoProjectionState, geoProjection => geoProjection?.translate ?? null);
|
|
42
|
-
const selectorChartParallels = (0, _store.createSelectorMemoized)(selectorChartGeoProjectionState, selectorChartRotate, (geoProjection, rotate) => geoProjection?.parallels ?? (rotate ? [rotate[1] - 15, rotate[1] + 15] : [30, 30]));
|
|
43
|
-
/**
|
|
44
|
-
* Map a feature's `properties.name` to its index in `geoData.features`,
|
|
45
|
-
* for fast lookup by name when joining series rows to features.
|
|
46
|
-
*
|
|
47
|
-
* Features without a string `properties.name` are skipped; on duplicates,
|
|
48
|
-
* the first occurrence wins.
|
|
49
|
-
*/
|
|
50
|
-
const selectorChartGeoFeatureIndexesByName = exports.selectorChartGeoFeatureIndexesByName = (0, _store.createSelectorMemoized)(selectorChartRawGeoData, geoData => {
|
|
51
|
-
const map = new Map();
|
|
52
|
-
if (!geoData) {
|
|
53
|
-
return map;
|
|
54
|
-
}
|
|
55
|
-
geoData.features.forEach((feature, index) => {
|
|
56
|
-
const name = feature.properties?.name;
|
|
57
|
-
if (typeof name !== 'string') {
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (map.has(name)) {
|
|
61
|
-
map.get(name).push(index);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
map.set(name, [index]);
|
|
65
|
-
});
|
|
66
|
-
return map;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Resolves the raw `projection` input into a ready-to-use `GeoProjection` instance
|
|
71
|
-
* fitted to the chart's drawing area.
|
|
72
|
-
*
|
|
73
|
-
* - String inputs (e.g. `'mercator'`) are mapped to the matching d3-geo factory.
|
|
74
|
-
* - `GeoProjection` instances are used as-is, then fitted.
|
|
75
|
-
* - Returns `null` when no projection is registered or the name is unknown.
|
|
76
|
-
*/
|
|
77
|
-
const selectorChartProjection = exports.selectorChartProjection = (0, _store.createSelectorMemoized)(selectorChartRawProjection, selectorChartRawGeoData, selectorChartParallels, selectorChartRotate, selectorChartTranslate, selectorChartRawScale, _internals.selectorChartDrawingArea, (projectionInput, geoData, parallels, rotate, translate, scale, drawingArea) => {
|
|
78
|
-
if (!projectionInput) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
let projection;
|
|
82
|
-
if (typeof projectionInput === 'string') {
|
|
83
|
-
const factory = PROJECTION_FACTORIES[projectionInput];
|
|
84
|
-
if (!factory) {
|
|
85
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
86
|
-
console.error(`MUI X Charts: Unknown projection name '${projectionInput}'. ` + `Expected one of: ${Object.keys(PROJECTION_FACTORIES).join(', ')}.`);
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
projection = factory();
|
|
91
|
-
if (isConicProjection(projection)) {
|
|
92
|
-
projection.parallels(parallels);
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
projection = projectionInput;
|
|
96
|
-
}
|
|
97
|
-
if (geoData) {
|
|
98
|
-
if (isConicProjection(projection)) {
|
|
99
|
-
if (rotate) {
|
|
100
|
-
projection.rotate?.(rotate);
|
|
101
|
-
}
|
|
102
|
-
if (!scale) {
|
|
103
|
-
const [[x0, y0], [x1, y1]] = (0, _d3Geo.geoPath)(projection).bounds(geoData);
|
|
104
|
-
const currentScale = projection.scale();
|
|
105
|
-
const fitScale = Math.min(currentScale * (drawingArea.width / (x1 - x0)), currentScale * (drawingArea.height / (y1 - y0)));
|
|
106
|
-
projection.scale(fitScale);
|
|
107
|
-
} else {
|
|
108
|
-
projection.scale(scale);
|
|
109
|
-
}
|
|
110
|
-
return projection;
|
|
111
|
-
}
|
|
112
|
-
if (rotate) {
|
|
113
|
-
projection.rotate?.(rotate);
|
|
114
|
-
}
|
|
115
|
-
if (scale) {
|
|
116
|
-
projection.scale(scale);
|
|
117
|
-
projection.clipExtent?.([[drawingArea.left, drawingArea.top], [drawingArea.left + drawingArea.width, drawingArea.top + drawingArea.height]]);
|
|
118
|
-
} else {
|
|
119
|
-
projection.fitExtent?.([[drawingArea.left, drawingArea.top], [drawingArea.left + drawingArea.width, drawingArea.top + drawingArea.height]], geoData);
|
|
120
|
-
}
|
|
121
|
-
projection.translate(translate ?? [drawingArea.left + drawingArea.width / 2, drawingArea.top + drawingArea.height / 2]);
|
|
122
|
-
}
|
|
123
|
-
return projection;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Resolves the raw `projection` input into a ready-to-use `GeoPath` instance
|
|
128
|
-
* fitted to the chart's drawing area.
|
|
129
|
-
*/
|
|
130
|
-
const selectorChartGeoPath = exports.selectorChartGeoPath = (0, _store.createSelectorMemoized)(selectorChartProjection, projection => {
|
|
131
|
-
if (!projection) {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
return (0, _d3Geo.geoPath)(projection);
|
|
135
|
-
});
|
|
8
|
+
const selectorChartGeoFeatureIndexesByName = exports.selectorChartGeoFeatureIndexesByName = _internals.useGeoProjectionSelectors.selectorChartGeoFeatureIndexesByName;
|
|
9
|
+
const selectorChartGeoProjectionState = exports.selectorChartGeoProjectionState = _internals.useGeoProjectionSelectors.selectorChartGeoProjectionState;
|
|
10
|
+
const selectorChartGeoData = exports.selectorChartGeoData = _internals.useGeoProjectionSelectors.selectorChartGeoData;
|
|
11
|
+
const selectorChartRawProjection = exports.selectorChartRawProjection = _internals.useGeoProjectionSelectors.selectorChartRawProjection;
|
|
12
|
+
const selectorChartRawScale = exports.selectorChartRawScale = _internals.useGeoProjectionSelectors.selectorChartRawScale;
|
|
13
|
+
const selectorChartProjection = exports.selectorChartProjection = _internals.useGeoProjectionSelectors.selectorChartProjection;
|
|
14
|
+
const selectorChartGeoPath = exports.selectorChartGeoPath = _internals.useGeoProjectionSelectors.selectorChartGeoPath;
|
|
@@ -1,128 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
orthographic: geoOrthographic,
|
|
10
|
-
stereographic: geoStereographic,
|
|
11
|
-
// Conic projections (https://d3js.org/d3-geo/conic)
|
|
12
|
-
conicConformal: geoConicConformal,
|
|
13
|
-
conicEqualArea: geoConicEqualArea,
|
|
14
|
-
conicEquidistant: geoConicEquidistant,
|
|
15
|
-
albers: geoAlbers,
|
|
16
|
-
albersUsa: geoAlbersUsa,
|
|
17
|
-
// Special composition for the USA with an edge case for Alaska and Hawaii.
|
|
18
|
-
|
|
19
|
-
// Cylindrical projections (https://d3js.org/d3-geo/cylindrical)
|
|
20
|
-
equirectangular: geoEquirectangular,
|
|
21
|
-
mercator: geoMercator,
|
|
22
|
-
transverseMercator: geoTransverseMercator,
|
|
23
|
-
equalEarth: geoEqualEarth,
|
|
24
|
-
naturalEarth1: geoNaturalEarth1
|
|
25
|
-
};
|
|
26
|
-
const isConicProjection = projection => {
|
|
27
|
-
return 'parallels' in projection && typeof projection.parallels === 'function';
|
|
28
|
-
};
|
|
29
|
-
export const selectorChartGeoProjectionState = state => state.geoProjection;
|
|
30
|
-
export const selectorChartRawGeoData = createSelector(selectorChartGeoProjectionState, geoProjection => geoProjection?.geoData ?? null);
|
|
31
|
-
export const selectorChartRawProjection = createSelector(selectorChartGeoProjectionState, geoProjection => geoProjection?.projection ?? null);
|
|
32
|
-
export const selectorChartRawScale = createSelector(selectorChartGeoProjectionState, geoProjection => geoProjection?.scale ?? null);
|
|
33
|
-
const selectorChartRotate = createSelectorMemoized(selectorChartGeoProjectionState, geoProjection => geoProjection?.rotate ?? null);
|
|
34
|
-
const selectorChartTranslate = createSelectorMemoized(selectorChartGeoProjectionState, geoProjection => geoProjection?.translate ?? null);
|
|
35
|
-
const selectorChartParallels = createSelectorMemoized(selectorChartGeoProjectionState, selectorChartRotate, (geoProjection, rotate) => geoProjection?.parallels ?? (rotate ? [rotate[1] - 15, rotate[1] + 15] : [30, 30]));
|
|
36
|
-
/**
|
|
37
|
-
* Map a feature's `properties.name` to its index in `geoData.features`,
|
|
38
|
-
* for fast lookup by name when joining series rows to features.
|
|
39
|
-
*
|
|
40
|
-
* Features without a string `properties.name` are skipped; on duplicates,
|
|
41
|
-
* the first occurrence wins.
|
|
42
|
-
*/
|
|
43
|
-
export const selectorChartGeoFeatureIndexesByName = createSelectorMemoized(selectorChartRawGeoData, geoData => {
|
|
44
|
-
const map = new Map();
|
|
45
|
-
if (!geoData) {
|
|
46
|
-
return map;
|
|
47
|
-
}
|
|
48
|
-
geoData.features.forEach((feature, index) => {
|
|
49
|
-
const name = feature.properties?.name;
|
|
50
|
-
if (typeof name !== 'string') {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (map.has(name)) {
|
|
54
|
-
map.get(name).push(index);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
map.set(name, [index]);
|
|
58
|
-
});
|
|
59
|
-
return map;
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Resolves the raw `projection` input into a ready-to-use `GeoProjection` instance
|
|
64
|
-
* fitted to the chart's drawing area.
|
|
65
|
-
*
|
|
66
|
-
* - String inputs (e.g. `'mercator'`) are mapped to the matching d3-geo factory.
|
|
67
|
-
* - `GeoProjection` instances are used as-is, then fitted.
|
|
68
|
-
* - Returns `null` when no projection is registered or the name is unknown.
|
|
69
|
-
*/
|
|
70
|
-
export const selectorChartProjection = createSelectorMemoized(selectorChartRawProjection, selectorChartRawGeoData, selectorChartParallels, selectorChartRotate, selectorChartTranslate, selectorChartRawScale, selectorChartDrawingArea, (projectionInput, geoData, parallels, rotate, translate, scale, drawingArea) => {
|
|
71
|
-
if (!projectionInput) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
let projection;
|
|
75
|
-
if (typeof projectionInput === 'string') {
|
|
76
|
-
const factory = PROJECTION_FACTORIES[projectionInput];
|
|
77
|
-
if (!factory) {
|
|
78
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
79
|
-
console.error(`MUI X Charts: Unknown projection name '${projectionInput}'. ` + `Expected one of: ${Object.keys(PROJECTION_FACTORIES).join(', ')}.`);
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
projection = factory();
|
|
84
|
-
if (isConicProjection(projection)) {
|
|
85
|
-
projection.parallels(parallels);
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
projection = projectionInput;
|
|
89
|
-
}
|
|
90
|
-
if (geoData) {
|
|
91
|
-
if (isConicProjection(projection)) {
|
|
92
|
-
if (rotate) {
|
|
93
|
-
projection.rotate?.(rotate);
|
|
94
|
-
}
|
|
95
|
-
if (!scale) {
|
|
96
|
-
const [[x0, y0], [x1, y1]] = geoPath(projection).bounds(geoData);
|
|
97
|
-
const currentScale = projection.scale();
|
|
98
|
-
const fitScale = Math.min(currentScale * (drawingArea.width / (x1 - x0)), currentScale * (drawingArea.height / (y1 - y0)));
|
|
99
|
-
projection.scale(fitScale);
|
|
100
|
-
} else {
|
|
101
|
-
projection.scale(scale);
|
|
102
|
-
}
|
|
103
|
-
return projection;
|
|
104
|
-
}
|
|
105
|
-
if (rotate) {
|
|
106
|
-
projection.rotate?.(rotate);
|
|
107
|
-
}
|
|
108
|
-
if (scale) {
|
|
109
|
-
projection.scale(scale);
|
|
110
|
-
projection.clipExtent?.([[drawingArea.left, drawingArea.top], [drawingArea.left + drawingArea.width, drawingArea.top + drawingArea.height]]);
|
|
111
|
-
} else {
|
|
112
|
-
projection.fitExtent?.([[drawingArea.left, drawingArea.top], [drawingArea.left + drawingArea.width, drawingArea.top + drawingArea.height]], geoData);
|
|
113
|
-
}
|
|
114
|
-
projection.translate(translate ?? [drawingArea.left + drawingArea.width / 2, drawingArea.top + drawingArea.height / 2]);
|
|
115
|
-
}
|
|
116
|
-
return projection;
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Resolves the raw `projection` input into a ready-to-use `GeoPath` instance
|
|
121
|
-
* fitted to the chart's drawing area.
|
|
122
|
-
*/
|
|
123
|
-
export const selectorChartGeoPath = createSelectorMemoized(selectorChartProjection, projection => {
|
|
124
|
-
if (!projection) {
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
return geoPath(projection);
|
|
128
|
-
});
|
|
1
|
+
import { useGeoProjectionSelectors } from '@mui/x-charts/internals';
|
|
2
|
+
export const selectorChartGeoFeatureIndexesByName = useGeoProjectionSelectors.selectorChartGeoFeatureIndexesByName;
|
|
3
|
+
export const selectorChartGeoProjectionState = useGeoProjectionSelectors.selectorChartGeoProjectionState;
|
|
4
|
+
export const selectorChartGeoData = useGeoProjectionSelectors.selectorChartGeoData;
|
|
5
|
+
export const selectorChartRawProjection = useGeoProjectionSelectors.selectorChartRawProjection;
|
|
6
|
+
export const selectorChartRawScale = useGeoProjectionSelectors.selectorChartRawScale;
|
|
7
|
+
export const selectorChartProjection = useGeoProjectionSelectors.selectorChartProjection;
|
|
8
|
+
export const selectorChartGeoPath = useGeoProjectionSelectors.selectorChartGeoPath;
|
|
@@ -1,55 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
export type D3NamedProjection = 'azimuthalEqualArea' | 'azimuthalEquidistant' | 'gnomonic' | 'orthographic' | 'stereographic' | 'conicConformal' | 'conicEqualArea' | 'conicEquidistant' | 'albers' | 'albersUsa' | 'equirectangular' | 'mercator' | 'transverseMercator' | 'equalEarth' | 'naturalEarth1';
|
|
4
|
-
/**
|
|
5
|
-
* A d3-geo projection accepted by `useGeoProjection`.
|
|
6
|
-
*
|
|
7
|
-
* Either a built-in projection name (e.g. `'mercator'`, `'naturalEarth1'`)
|
|
8
|
-
* or a `GeoProjection` instance returned by a d3-geo factory.
|
|
9
|
-
*/
|
|
10
|
-
export type GeoProjectionInput = D3NamedProjection | GeoProjection;
|
|
11
|
-
export interface UseGeoProjectionParameters {
|
|
12
|
-
/**
|
|
13
|
-
* The GeoJSON `FeatureCollection` whose features will be rendered on the map.
|
|
14
|
-
*/
|
|
15
|
-
geoData?: ExtendedFeatureCollection;
|
|
16
|
-
/**
|
|
17
|
-
* The d3-geo projection used to map geographic coordinates to SVG coordinates.
|
|
18
|
-
* Accepts a d3-geo projection name (e.g. `'mercator'`, `'naturalEarth1'`)
|
|
19
|
-
* or a custom `GeoProjection` instance.
|
|
20
|
-
*/
|
|
21
|
-
projection?: GeoProjectionInput;
|
|
22
|
-
/**
|
|
23
|
-
* The center of the projection, specified as a `[longitude, latitude]` pair in degrees.
|
|
24
|
-
*/
|
|
25
|
-
translate?: [number, number];
|
|
26
|
-
/**
|
|
27
|
-
* The rotation of the projection, specified as a `[longitude, latitude]` pair in degrees.
|
|
28
|
-
*/
|
|
29
|
-
rotate?: [number, number];
|
|
30
|
-
/**
|
|
31
|
-
* The scale of the projection.
|
|
32
|
-
* Id not provided the scale will default to fit the entire geoData in the drawing area.
|
|
33
|
-
*/
|
|
34
|
-
scale?: number;
|
|
35
|
-
}
|
|
36
|
-
export type UseGeoProjectionDefaultizedParameters = UseGeoProjectionParameters;
|
|
37
|
-
export interface UseGeoProjectionState {
|
|
38
|
-
geoProjection: {
|
|
39
|
-
geoData: ExtendedFeatureCollection | null;
|
|
40
|
-
projection: GeoProjectionInput | null;
|
|
41
|
-
translate: [number, number] | null;
|
|
42
|
-
rotate: [number, number] | null;
|
|
43
|
-
scale: number | null;
|
|
44
|
-
/**
|
|
45
|
-
* The two standard parallels used by conic projections, if applicable.
|
|
46
|
-
* Used for projection 'conicConformal', 'conicEqualArea', 'conicEquidistant'.
|
|
47
|
-
*/
|
|
48
|
-
parallels?: [number, number] | null;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export type UseGeoProjectionSignature = ChartPluginSignature<{
|
|
52
|
-
params: UseGeoProjectionParameters;
|
|
53
|
-
defaultizedParams: UseGeoProjectionDefaultizedParameters;
|
|
54
|
-
state: UseGeoProjectionState;
|
|
55
|
-
}>;
|
|
1
|
+
import { type useGeoProjectionTypes } from '@mui/x-charts/internals';
|
|
2
|
+
export type UseGeoProjectionSignature = useGeoProjectionTypes.UseGeoProjectionSignature;
|
|
@@ -1,55 +1,2 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
export type D3NamedProjection = 'azimuthalEqualArea' | 'azimuthalEquidistant' | 'gnomonic' | 'orthographic' | 'stereographic' | 'conicConformal' | 'conicEqualArea' | 'conicEquidistant' | 'albers' | 'albersUsa' | 'equirectangular' | 'mercator' | 'transverseMercator' | 'equalEarth' | 'naturalEarth1';
|
|
4
|
-
/**
|
|
5
|
-
* A d3-geo projection accepted by `useGeoProjection`.
|
|
6
|
-
*
|
|
7
|
-
* Either a built-in projection name (e.g. `'mercator'`, `'naturalEarth1'`)
|
|
8
|
-
* or a `GeoProjection` instance returned by a d3-geo factory.
|
|
9
|
-
*/
|
|
10
|
-
export type GeoProjectionInput = D3NamedProjection | GeoProjection;
|
|
11
|
-
export interface UseGeoProjectionParameters {
|
|
12
|
-
/**
|
|
13
|
-
* The GeoJSON `FeatureCollection` whose features will be rendered on the map.
|
|
14
|
-
*/
|
|
15
|
-
geoData?: ExtendedFeatureCollection;
|
|
16
|
-
/**
|
|
17
|
-
* The d3-geo projection used to map geographic coordinates to SVG coordinates.
|
|
18
|
-
* Accepts a d3-geo projection name (e.g. `'mercator'`, `'naturalEarth1'`)
|
|
19
|
-
* or a custom `GeoProjection` instance.
|
|
20
|
-
*/
|
|
21
|
-
projection?: GeoProjectionInput;
|
|
22
|
-
/**
|
|
23
|
-
* The center of the projection, specified as a `[longitude, latitude]` pair in degrees.
|
|
24
|
-
*/
|
|
25
|
-
translate?: [number, number];
|
|
26
|
-
/**
|
|
27
|
-
* The rotation of the projection, specified as a `[longitude, latitude]` pair in degrees.
|
|
28
|
-
*/
|
|
29
|
-
rotate?: [number, number];
|
|
30
|
-
/**
|
|
31
|
-
* The scale of the projection.
|
|
32
|
-
* Id not provided the scale will default to fit the entire geoData in the drawing area.
|
|
33
|
-
*/
|
|
34
|
-
scale?: number;
|
|
35
|
-
}
|
|
36
|
-
export type UseGeoProjectionDefaultizedParameters = UseGeoProjectionParameters;
|
|
37
|
-
export interface UseGeoProjectionState {
|
|
38
|
-
geoProjection: {
|
|
39
|
-
geoData: ExtendedFeatureCollection | null;
|
|
40
|
-
projection: GeoProjectionInput | null;
|
|
41
|
-
translate: [number, number] | null;
|
|
42
|
-
rotate: [number, number] | null;
|
|
43
|
-
scale: number | null;
|
|
44
|
-
/**
|
|
45
|
-
* The two standard parallels used by conic projections, if applicable.
|
|
46
|
-
* Used for projection 'conicConformal', 'conicEqualArea', 'conicEquidistant'.
|
|
47
|
-
*/
|
|
48
|
-
parallels?: [number, number] | null;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
export type UseGeoProjectionSignature = ChartPluginSignature<{
|
|
52
|
-
params: UseGeoProjectionParameters;
|
|
53
|
-
defaultizedParams: UseGeoProjectionDefaultizedParameters;
|
|
54
|
-
state: UseGeoProjectionState;
|
|
55
|
-
}>;
|
|
1
|
+
import { type useGeoProjectionTypes } from '@mui/x-charts/internals';
|
|
2
|
+
export type UseGeoProjectionSignature = useGeoProjectionTypes.UseGeoProjectionSignature;
|
|
@@ -29,7 +29,7 @@ export interface MapShapeValueType {
|
|
|
29
29
|
*/
|
|
30
30
|
color?: string;
|
|
31
31
|
}
|
|
32
|
-
export interface MapShapeSeriesType extends Omit<CommonSeriesType<
|
|
32
|
+
export interface MapShapeSeriesType extends Omit<CommonSeriesType<'mapShape'>, 'valueFormatter'> {
|
|
33
33
|
type: 'mapShape';
|
|
34
34
|
/**
|
|
35
35
|
* The data points to render. Each entry is joined to a feature in `geoData`
|
|
@@ -29,7 +29,7 @@ export interface MapShapeValueType {
|
|
|
29
29
|
*/
|
|
30
30
|
color?: string;
|
|
31
31
|
}
|
|
32
|
-
export interface MapShapeSeriesType extends Omit<CommonSeriesType<
|
|
32
|
+
export interface MapShapeSeriesType extends Omit<CommonSeriesType<'mapShape'>, 'valueFormatter'> {
|
|
33
33
|
type: 'mapShape';
|
|
34
34
|
/**
|
|
35
35
|
* The data points to render. Each entry is joined to a feature in `geoData`
|
|
@@ -11,7 +11,7 @@ export type OHLCValueType = [number, number, number, number];
|
|
|
11
11
|
* The OHLC fields that can be formatted individually.
|
|
12
12
|
*/
|
|
13
13
|
export type OHLCField = 'open' | 'high' | 'low' | 'close';
|
|
14
|
-
export interface OHLCSeriesType extends Omit<CommonSeriesType<
|
|
14
|
+
export interface OHLCSeriesType extends Omit<CommonSeriesType<'ohlc'>, 'valueFormatter'>, CartesianSeriesType {
|
|
15
15
|
type: 'ohlc';
|
|
16
16
|
/**
|
|
17
17
|
* The OHLC data points.
|
|
@@ -11,7 +11,7 @@ export type OHLCValueType = [number, number, number, number];
|
|
|
11
11
|
* The OHLC fields that can be formatted individually.
|
|
12
12
|
*/
|
|
13
13
|
export type OHLCField = 'open' | 'high' | 'low' | 'close';
|
|
14
|
-
export interface OHLCSeriesType extends Omit<CommonSeriesType<
|
|
14
|
+
export interface OHLCSeriesType extends Omit<CommonSeriesType<'ohlc'>, 'valueFormatter'>, CartesianSeriesType {
|
|
15
15
|
type: 'ohlc';
|
|
16
16
|
/**
|
|
17
17
|
* The OHLC data points.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonSeriesType, CommonBarSeriesType, RadialSeriesType, StackableSeriesType, SeriesId, CommonDefaultizedProps } from '@mui/x-charts/internals';
|
|
2
2
|
import type { StackOffsetType } from '@mui/x-charts/models';
|
|
3
3
|
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
4
|
-
export interface RadialBarSeriesType extends CommonSeriesType<
|
|
4
|
+
export interface RadialBarSeriesType extends CommonSeriesType<'radialBar'>, RadialSeriesType, StackableSeriesType, CommonBarSeriesType {
|
|
5
5
|
type: 'radialBar';
|
|
6
6
|
/**
|
|
7
7
|
* Defines how stacked series handle negative values.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonSeriesType, CommonBarSeriesType, RadialSeriesType, StackableSeriesType, SeriesId, CommonDefaultizedProps } from '@mui/x-charts/internals';
|
|
2
2
|
import type { StackOffsetType } from '@mui/x-charts/models';
|
|
3
3
|
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
4
|
-
export interface RadialBarSeriesType extends CommonSeriesType<
|
|
4
|
+
export interface RadialBarSeriesType extends CommonSeriesType<'radialBar'>, RadialSeriesType, StackableSeriesType, CommonBarSeriesType {
|
|
5
5
|
type: 'radialBar';
|
|
6
6
|
/**
|
|
7
7
|
* Defines how stacked series handle negative values.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonSeriesType, CommonLineSeriesType, RadialSeriesType, StackableSeriesType, SeriesId, CommonDefaultizedProps } from '@mui/x-charts/internals';
|
|
2
2
|
import type { CurveType, StackOffsetType } from '@mui/x-charts/models';
|
|
3
3
|
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
4
|
-
export interface RadialLineSeriesType extends CommonSeriesType<
|
|
4
|
+
export interface RadialLineSeriesType extends CommonSeriesType<'line'>, RadialSeriesType, StackableSeriesType, CommonLineSeriesType {
|
|
5
5
|
type: 'radialLine';
|
|
6
6
|
/**
|
|
7
7
|
* Defines how stacked series handle negative values.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CommonSeriesType, CommonLineSeriesType, RadialSeriesType, StackableSeriesType, SeriesId, CommonDefaultizedProps } from '@mui/x-charts/internals';
|
|
2
2
|
import type { CurveType, StackOffsetType } from '@mui/x-charts/models';
|
|
3
3
|
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
4
|
-
export interface RadialLineSeriesType extends CommonSeriesType<
|
|
4
|
+
export interface RadialLineSeriesType extends CommonSeriesType<'line'>, RadialSeriesType, StackableSeriesType, CommonLineSeriesType {
|
|
5
5
|
type: 'radialLine';
|
|
6
6
|
/**
|
|
7
7
|
* Defines how stacked series handle negative values.
|
|
@@ -2,7 +2,7 @@ import { type CartesianSeriesType, type CommonDefaultizedProps, type CommonSerie
|
|
|
2
2
|
import { type DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
/** [start, end] */
|
|
4
4
|
export type RangeBarValueType = [number, number];
|
|
5
|
-
export interface RangeBarSeriesType extends CommonSeriesType<
|
|
5
|
+
export interface RangeBarSeriesType extends CommonSeriesType<'rangeBar'>, CartesianSeriesType {
|
|
6
6
|
type: 'rangeBar';
|
|
7
7
|
/**
|
|
8
8
|
* Data associated to each range bar.
|
|
@@ -2,7 +2,7 @@ import { type CartesianSeriesType, type CommonDefaultizedProps, type CommonSerie
|
|
|
2
2
|
import { type DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
/** [start, end] */
|
|
4
4
|
export type RangeBarValueType = [number, number];
|
|
5
|
-
export interface RangeBarSeriesType extends CommonSeriesType<
|
|
5
|
+
export interface RangeBarSeriesType extends CommonSeriesType<'rangeBar'>, CartesianSeriesType {
|
|
6
6
|
type: 'rangeBar';
|
|
7
7
|
/**
|
|
8
8
|
* Data associated to each range bar.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts-premium",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Premium plan edition of the MUI X Charts components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.29.7",
|
|
31
|
-
"@mui/utils": "9.0.1",
|
|
31
|
+
"@mui/utils": "^9.0.1",
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
|
-
"@mui/x-charts": "^9.
|
|
35
|
-
"@mui/x-
|
|
36
|
-
"@mui/x-
|
|
34
|
+
"@mui/x-charts": "^9.6.0",
|
|
35
|
+
"@mui/x-license": "^9.6.0",
|
|
36
|
+
"@mui/x-internals": "^9.6.0",
|
|
37
37
|
"@mui/x-charts-vendor": "^9.4.0",
|
|
38
|
-
"@mui/x-
|
|
38
|
+
"@mui/x-charts-pro": "^9.6.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@emotion/react": "^11.9.0",
|
|
@@ -1071,6 +1071,9 @@
|
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
1073
|
},
|
|
1074
|
+
"imports": {
|
|
1075
|
+
"#formatErrorMessage": "@mui/x-internals/formatErrorMessage"
|
|
1076
|
+
},
|
|
1074
1077
|
"main": "./index.js",
|
|
1075
1078
|
"types": "./index.d.ts"
|
|
1076
1079
|
}
|