@mui/x-charts 8.4.0 → 8.5.1
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.d.ts +9 -2
- package/BarChart/BarChart.js +7 -1
- package/BarChart/BarLabel/BarLabel.d.ts +1 -1
- package/BarChart/seriesConfig/seriesProcessor.js +1 -1
- package/BarChart/useBarChartProps.js +1 -1
- package/CHANGELOG.md +215 -0
- package/ChartContainer/ChartContainer.d.ts +21 -2
- package/ChartContainer/ChartContainer.js +16 -0
- package/ChartContainer/useChartContainerProps.js +7 -3
- package/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/ChartDataProvider/ChartDataProvider.js +19 -2
- package/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/ChartsGrid/styledComponents.d.ts +2 -2
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +21 -16
- package/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
- package/ChartsTooltip/utils.d.ts +6 -0
- package/ChartsTooltip/utils.js +19 -1
- package/LineChart/LineChart.d.ts +9 -2
- package/LineChart/LineChart.js +7 -1
- package/LineChart/useLineChartProps.js +1 -1
- package/PieChart/PieChart.d.ts +10 -3
- package/PieChart/PieChart.js +12 -11
- package/RadarChart/RadarChart.d.ts +21 -3
- package/RadarChart/RadarChart.js +16 -2
- package/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/RadarChart/RadarChart.plugins.js +10 -0
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/RadarChart/RadarDataProvider/RadarDataProvider.js +6 -116
- package/RadarChart/index.d.ts +2 -0
- package/RadarChart/index.js +15 -1
- package/RadarChart/useRadarChartProps.d.ts +2 -1
- package/RadarChart/useRadarChartProps.js +3 -1
- package/ScatterChart/ScatterChart.d.ts +9 -2
- package/ScatterChart/ScatterChart.js +7 -1
- package/ScatterChart/useScatterChartProps.js +4 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/Toolbar/Toolbar.d.ts +11 -4
- package/Toolbar/Toolbar.js +38 -7
- package/Toolbar/Toolbar.types.d.ts +15 -0
- package/Toolbar/Toolbar.types.js +5 -0
- package/Toolbar/ToolbarButton.d.ts +8 -2
- package/Toolbar/ToolbarButton.js +39 -7
- package/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/Toolbar/chartToolbarClasses.js +9 -0
- package/Toolbar/index.d.ts +3 -1
- package/Toolbar/index.js +22 -0
- package/context/ChartsSlotsContext.d.ts +20 -0
- package/context/ChartsSlotsContext.js +44 -0
- package/context/index.d.ts +2 -1
- package/context/index.js +11 -0
- package/context/useChartApiContext.d.ts +10 -0
- package/context/useChartApiContext.js +27 -0
- package/esm/BarChart/BarChart.d.ts +9 -2
- package/esm/BarChart/BarChart.js +7 -1
- package/esm/BarChart/BarLabel/BarLabel.d.ts +1 -1
- package/esm/BarChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/BarChart/useBarChartProps.js +1 -1
- package/esm/ChartContainer/ChartContainer.d.ts +21 -2
- package/esm/ChartContainer/ChartContainer.js +16 -0
- package/esm/ChartContainer/useChartContainerProps.js +7 -3
- package/esm/ChartDataProvider/ChartDataProvider.d.ts +11 -1
- package/esm/ChartDataProvider/ChartDataProvider.js +19 -2
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +2 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -3
- package/esm/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +1 -1
- package/esm/ChartsGrid/styledComponents.d.ts +2 -2
- package/esm/ChartsReferenceLine/common.d.ts +1 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +22 -17
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +4 -4
- package/esm/ChartsTooltip/utils.d.ts +6 -0
- package/esm/ChartsTooltip/utils.js +16 -1
- package/esm/LineChart/LineChart.d.ts +9 -2
- package/esm/LineChart/LineChart.js +7 -1
- package/esm/LineChart/useLineChartProps.js +1 -1
- package/esm/PieChart/PieChart.d.ts +10 -3
- package/esm/PieChart/PieChart.js +12 -11
- package/esm/RadarChart/RadarChart.d.ts +21 -3
- package/esm/RadarChart/RadarChart.js +16 -2
- package/esm/RadarChart/RadarChart.plugins.d.ts +5 -0
- package/esm/RadarChart/RadarChart.plugins.js +4 -0
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +6 -11
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.js +5 -115
- package/esm/RadarChart/index.d.ts +2 -0
- package/esm/RadarChart/index.js +2 -0
- package/esm/RadarChart/useRadarChartProps.d.ts +2 -1
- package/esm/RadarChart/useRadarChartProps.js +3 -1
- package/esm/ScatterChart/ScatterChart.d.ts +9 -2
- package/esm/ScatterChart/ScatterChart.js +7 -1
- package/esm/ScatterChart/useScatterChartProps.js +4 -2
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/Toolbar/Toolbar.d.ts +11 -4
- package/esm/Toolbar/Toolbar.js +36 -6
- package/esm/Toolbar/Toolbar.types.d.ts +15 -0
- package/esm/Toolbar/Toolbar.types.js +1 -0
- package/esm/Toolbar/ToolbarButton.d.ts +8 -2
- package/esm/Toolbar/ToolbarButton.js +39 -6
- package/esm/Toolbar/chartToolbarClasses.d.ts +6 -0
- package/esm/Toolbar/chartToolbarClasses.js +2 -0
- package/esm/Toolbar/index.d.ts +3 -1
- package/esm/Toolbar/index.js +3 -1
- package/esm/context/ChartsSlotsContext.d.ts +20 -0
- package/esm/context/ChartsSlotsContext.js +35 -0
- package/esm/context/index.d.ts +2 -1
- package/esm/context/index.js +1 -0
- package/esm/context/useChartApiContext.d.ts +10 -0
- package/esm/context/useChartApiContext.js +21 -0
- package/esm/hooks/index.d.ts +1 -0
- package/esm/hooks/index.js +1 -0
- package/esm/index.js +1 -1
- package/esm/internals/components/AxisSharedComponents.d.ts +1 -1
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/esm/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
- package/esm/internals/constants.d.ts +10 -1
- package/esm/internals/constants.js +10 -1
- package/esm/internals/dateHelpers.d.ts +15 -0
- package/esm/internals/dateHelpers.js +20 -0
- package/esm/internals/domUtils.d.ts +1 -2
- package/esm/internals/domUtils.js +8 -19
- package/esm/internals/index.d.ts +6 -1
- package/esm/internals/index.js +6 -1
- package/esm/internals/invertScale.d.ts +2 -0
- package/esm/internals/invertScale.js +8 -0
- package/esm/internals/material/index.d.ts +2 -0
- package/esm/internals/material/index.js +2 -0
- package/esm/internals/plugins/allPlugins.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +2 -8
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -8
- package/esm/locales/index.d.ts +3 -1
- package/esm/locales/index.js +2 -0
- package/esm/locales/ptBR.d.ts +16 -0
- package/esm/locales/ptBR.js +9 -0
- package/esm/locales/ptPT.d.ts +16 -0
- package/esm/locales/ptPT.js +9 -0
- package/esm/models/axis.d.ts +2 -1
- package/esm/models/index.d.ts +2 -2
- package/esm/models/index.js +1 -0
- package/esm/models/seriesType/bar.d.ts +2 -2
- package/esm/models/slots/chartsBaseSlotProps.d.ts +7 -0
- package/esm/models/slots/chartsBaseSlots.d.ts +2 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +12 -0
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +1 -1
- package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +5 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.js +22 -3
- package/internals/constants.d.ts +10 -1
- package/internals/constants.js +11 -2
- package/internals/dateHelpers.d.ts +15 -0
- package/internals/dateHelpers.js +28 -0
- package/internals/domUtils.d.ts +1 -2
- package/internals/domUtils.js +8 -20
- package/internals/index.d.ts +6 -1
- package/internals/index.js +68 -8
- package/internals/invertScale.d.ts +2 -0
- package/internals/invertScale.js +14 -0
- package/internals/material/index.d.ts +2 -0
- package/internals/material/index.js +2 -0
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +5 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +14 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +5 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3000 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +10 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +9 -0
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +11 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +5 -11
- package/locales/index.d.ts +3 -1
- package/locales/index.js +22 -0
- package/locales/ptBR.d.ts +16 -0
- package/locales/ptBR.js +15 -0
- package/locales/ptPT.d.ts +16 -0
- package/locales/ptPT.js +15 -0
- package/models/axis.d.ts +2 -1
- package/models/index.d.ts +2 -2
- package/models/index.js +11 -0
- package/models/seriesType/bar.d.ts +2 -2
- package/models/slots/chartsBaseSlotProps.d.ts +7 -0
- package/models/slots/chartsBaseSlots.d.ts +2 -1
- package/package.json +5 -5
package/internals/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var _exportNames = {
|
|
|
10
10
|
useScatterChartProps: true,
|
|
11
11
|
useLineChartProps: true,
|
|
12
12
|
useBarChartProps: true,
|
|
13
|
-
|
|
13
|
+
useRadarChartProps: true,
|
|
14
14
|
getAxisExtremum: true
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "getAxisExtremum", {
|
|
@@ -19,12 +19,6 @@ Object.defineProperty(exports, "getAxisExtremum", {
|
|
|
19
19
|
return _getAxisExtremum.getAxisExtremum;
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
Object.defineProperty(exports, "unstable_cleanupDOM", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function () {
|
|
25
|
-
return _domUtils.unstable_cleanupDOM;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
22
|
Object.defineProperty(exports, "useBarChartProps", {
|
|
29
23
|
enumerable: true,
|
|
30
24
|
get: function () {
|
|
@@ -49,6 +43,12 @@ Object.defineProperty(exports, "useLineChartProps", {
|
|
|
49
43
|
return _useLineChartProps.useLineChartProps;
|
|
50
44
|
}
|
|
51
45
|
});
|
|
46
|
+
Object.defineProperty(exports, "useRadarChartProps", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () {
|
|
49
|
+
return _useRadarChartProps.useRadarChartProps;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
52
|
Object.defineProperty(exports, "useScatterChartProps", {
|
|
53
53
|
enumerable: true,
|
|
54
54
|
get: function () {
|
|
@@ -103,6 +103,7 @@ var _useDrawingArea = require("../hooks/useDrawingArea");
|
|
|
103
103
|
var _useScatterChartProps = require("../ScatterChart/useScatterChartProps");
|
|
104
104
|
var _useLineChartProps = require("../LineChart/useLineChartProps");
|
|
105
105
|
var _useBarChartProps = require("../BarChart/useBarChartProps");
|
|
106
|
+
var _useRadarChartProps = require("../RadarChart/useRadarChartProps");
|
|
106
107
|
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
107
108
|
Object.keys(_useChartContainerProps).forEach(function (key) {
|
|
108
109
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -331,6 +332,30 @@ Object.keys(_ScatterChart).forEach(function (key) {
|
|
|
331
332
|
}
|
|
332
333
|
});
|
|
333
334
|
});
|
|
335
|
+
var _RadarChart = require("../RadarChart/RadarChart.plugins");
|
|
336
|
+
Object.keys(_RadarChart).forEach(function (key) {
|
|
337
|
+
if (key === "default" || key === "__esModule") return;
|
|
338
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
339
|
+
if (key in exports && exports[key] === _RadarChart[key]) return;
|
|
340
|
+
Object.defineProperty(exports, key, {
|
|
341
|
+
enumerable: true,
|
|
342
|
+
get: function () {
|
|
343
|
+
return _RadarChart[key];
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
var _PieChart = require("../PieChart/PieChart.plugins");
|
|
348
|
+
Object.keys(_PieChart).forEach(function (key) {
|
|
349
|
+
if (key === "default" || key === "__esModule") return;
|
|
350
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
351
|
+
if (key in exports && exports[key] === _PieChart[key]) return;
|
|
352
|
+
Object.defineProperty(exports, key, {
|
|
353
|
+
enumerable: true,
|
|
354
|
+
get: function () {
|
|
355
|
+
return _PieChart[key];
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
});
|
|
334
359
|
var _defaultizeValueFormatter = require("./defaultizeValueFormatter");
|
|
335
360
|
Object.keys(_defaultizeValueFormatter).forEach(function (key) {
|
|
336
361
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -391,7 +416,6 @@ Object.keys(_isDefined).forEach(function (key) {
|
|
|
391
416
|
}
|
|
392
417
|
});
|
|
393
418
|
});
|
|
394
|
-
var _domUtils = require("./domUtils");
|
|
395
419
|
var _getScale = require("./getScale");
|
|
396
420
|
Object.keys(_getScale).forEach(function (key) {
|
|
397
421
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -464,6 +488,30 @@ Object.keys(_defaultizeMargin).forEach(function (key) {
|
|
|
464
488
|
}
|
|
465
489
|
});
|
|
466
490
|
});
|
|
491
|
+
var _dateHelpers = require("./dateHelpers");
|
|
492
|
+
Object.keys(_dateHelpers).forEach(function (key) {
|
|
493
|
+
if (key === "default" || key === "__esModule") return;
|
|
494
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
495
|
+
if (key in exports && exports[key] === _dateHelpers[key]) return;
|
|
496
|
+
Object.defineProperty(exports, key, {
|
|
497
|
+
enumerable: true,
|
|
498
|
+
get: function () {
|
|
499
|
+
return _dateHelpers[key];
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
var _invertScale = require("./invertScale");
|
|
504
|
+
Object.keys(_invertScale).forEach(function (key) {
|
|
505
|
+
if (key === "default" || key === "__esModule") return;
|
|
506
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
507
|
+
if (key in exports && exports[key] === _invertScale[key]) return;
|
|
508
|
+
Object.defineProperty(exports, key, {
|
|
509
|
+
enumerable: true,
|
|
510
|
+
get: function () {
|
|
511
|
+
return _invertScale[key];
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
});
|
|
467
515
|
var _getAxisExtremum = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum");
|
|
468
516
|
var _ChartProvider = require("../context/ChartProvider");
|
|
469
517
|
Object.keys(_ChartProvider).forEach(function (key) {
|
|
@@ -477,6 +525,18 @@ Object.keys(_ChartProvider).forEach(function (key) {
|
|
|
477
525
|
}
|
|
478
526
|
});
|
|
479
527
|
});
|
|
528
|
+
var _ChartsSlotsContext = require("../context/ChartsSlotsContext");
|
|
529
|
+
Object.keys(_ChartsSlotsContext).forEach(function (key) {
|
|
530
|
+
if (key === "default" || key === "__esModule") return;
|
|
531
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
532
|
+
if (key in exports && exports[key] === _ChartsSlotsContext[key]) return;
|
|
533
|
+
Object.defineProperty(exports, key, {
|
|
534
|
+
enumerable: true,
|
|
535
|
+
get: function () {
|
|
536
|
+
return _ChartsSlotsContext[key];
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
});
|
|
480
540
|
var _config = require("../models/seriesType/config");
|
|
481
541
|
Object.keys(_config).forEach(function (key) {
|
|
482
542
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.invertScale = invertScale;
|
|
7
|
+
var _isBandScale = require("./isBandScale");
|
|
8
|
+
function invertScale(scale, data, value) {
|
|
9
|
+
if ((0, _isBandScale.isBandScale)(scale)) {
|
|
10
|
+
const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
|
|
11
|
+
return data[dataIndex];
|
|
12
|
+
}
|
|
13
|
+
return scale.invert(value);
|
|
14
|
+
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
1
2
|
import { ChartsBaseSlots } from "../../models/slots/chartsBaseSlots.js";
|
|
2
3
|
import { ChartsIconSlots } from "../../models/slots/chartsIconSlots.js";
|
|
3
4
|
export type ChartsSlots = ChartsBaseSlots & ChartsIconSlots;
|
|
5
|
+
export type ChartsSlotProps = { [key in keyof ChartsSlots]: React.ComponentProps<ChartsSlots[key]> };
|
|
4
6
|
export declare const defaultSlotsMaterial: ChartsSlots;
|
|
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.defaultSlotsMaterial = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
10
11
|
const baseSlots = {
|
|
12
|
+
baseButton: _Button.default,
|
|
11
13
|
baseIconButton: _IconButton.default
|
|
12
14
|
};
|
|
13
15
|
const iconSlots = {};
|
|
@@ -6,4 +6,5 @@ import { UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarAxis/i
|
|
|
6
6
|
import { UseChartVoronoiSignature } from "./featurePlugins/useChartVoronoi/index.js";
|
|
7
7
|
import { UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
|
|
8
8
|
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
|
|
9
|
+
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartCartesianAxisSignature<TSeries>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVoronoiSignature];
|
|
9
10
|
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartVoronoiSignature>];
|
|
@@ -11,6 +11,7 @@ var _axis = require("../../../../models/axis");
|
|
|
11
11
|
var _colorScale = require("../../../colorScale");
|
|
12
12
|
var _ticks = require("../../../ticks");
|
|
13
13
|
var _getScale = require("../../../getScale");
|
|
14
|
+
var _dateHelpers = require("../../../dateHelpers");
|
|
14
15
|
var _zoom = require("./zoom");
|
|
15
16
|
var _getAxisExtremum = require("./getAxisExtremum");
|
|
16
17
|
var _getAxisTriggerTooltip = require("./getAxisTriggerTooltip");
|
|
@@ -20,13 +21,6 @@ axis) {
|
|
|
20
21
|
const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
21
22
|
return axis.reverse ? [range[1], range[0]] : range;
|
|
22
23
|
}
|
|
23
|
-
const isDateData = data => data?.[0] instanceof Date;
|
|
24
|
-
function createDateFormatter(axis, range) {
|
|
25
|
-
const timeScale = (0, _d3Scale.scaleTime)(axis.data, range);
|
|
26
|
-
return (v, {
|
|
27
|
-
location
|
|
28
|
-
}) => location === 'tick' ? timeScale.tickFormat(axis.tickNumber)(v) : `${v.toLocaleString()}`;
|
|
29
|
-
}
|
|
30
24
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
31
25
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
32
26
|
function computeAxisValue({
|
|
@@ -77,8 +71,8 @@ function computeAxisValue({
|
|
|
77
71
|
values: axis.data
|
|
78
72
|
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
79
73
|
});
|
|
80
|
-
if (isDateData(axis.data)) {
|
|
81
|
-
const dateFormatter = createDateFormatter(axis, scaleRange);
|
|
74
|
+
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
75
|
+
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis, scaleRange);
|
|
82
76
|
completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
|
|
83
77
|
}
|
|
84
78
|
}
|
|
@@ -97,8 +91,8 @@ function computeAxisValue({
|
|
|
97
91
|
values: axis.data
|
|
98
92
|
}, axis.colorMap)) : (0, _colorScale.getColorScale)(axis.colorMap))
|
|
99
93
|
});
|
|
100
|
-
if (isDateData(axis.data)) {
|
|
101
|
-
const dateFormatter = createDateFormatter(axis, scaleRange);
|
|
94
|
+
if ((0, _dateHelpers.isDateData)(axis.data)) {
|
|
95
|
+
const dateFormatter = (0, _dateHelpers.createDateFormatter)(axis, scaleRange);
|
|
102
96
|
completeAxis[axis.id].valueFormatter = axis.valueFormatter ?? dateFormatter;
|
|
103
97
|
}
|
|
104
98
|
}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { AxisId } from "../../../../models/axis.js";
|
|
2
2
|
import { DefaultizedZoomOptions } from "./useChartCartesianAxis.types.js";
|
|
3
3
|
import { ZoomOptions } from "./zoom.types.js";
|
|
4
|
+
export declare const defaultZoomOptions: {
|
|
5
|
+
minStart: number;
|
|
6
|
+
maxEnd: number;
|
|
7
|
+
step: number;
|
|
8
|
+
minSpan: number;
|
|
9
|
+
maxSpan: number;
|
|
10
|
+
panning: true;
|
|
11
|
+
filterMode: "keep";
|
|
12
|
+
slider: {
|
|
13
|
+
enabled: false;
|
|
14
|
+
size: number;
|
|
15
|
+
showTooltip: import("./zoom.types.js").ZoomSliderShowTooltip;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
4
18
|
export declare const defaultizeZoom: (zoom: boolean | ZoomOptions | undefined, axisId: AxisId, axisDirection: "x" | "y") => DefaultizedZoomOptions | undefined;
|
|
@@ -4,10 +4,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.defaultizeZoom = void 0;
|
|
7
|
+
exports.defaultizeZoom = exports.defaultZoomOptions = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _constants = require("../../../constants");
|
|
10
|
-
const defaultZoomOptions = {
|
|
10
|
+
const defaultZoomOptions = exports.defaultZoomOptions = {
|
|
11
11
|
minStart: 0,
|
|
12
12
|
maxEnd: 100,
|
|
13
13
|
step: 5,
|
|
@@ -17,7 +17,8 @@ const defaultZoomOptions = {
|
|
|
17
17
|
filterMode: 'keep',
|
|
18
18
|
slider: {
|
|
19
19
|
enabled: false,
|
|
20
|
-
size: _constants.DEFAULT_ZOOM_SLIDER_SIZE
|
|
20
|
+
size: _constants.DEFAULT_ZOOM_SLIDER_SIZE,
|
|
21
|
+
showTooltip: _constants.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
const defaultizeZoom = (zoom, axisId, axisDirection) => {
|
package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ChartPluginSignature } from "../../models/index.js";
|
|
|
2
2
|
import type { ChartSeriesType, DatasetType } from "../../../../models/seriesType/config.js";
|
|
3
3
|
import type { ComputedAxis, ScaleName, AxisId, ChartsAxisData, YAxis, XAxis, DefaultedXAxis, DefaultedYAxis } from "../../../../models/axis.js";
|
|
4
4
|
import type { UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
|
|
5
|
-
import type { ZoomData, ZoomOptions } from "./zoom.types.js";
|
|
5
|
+
import type { ZoomData, ZoomOptions, ZoomSliderShowTooltip } from "./zoom.types.js";
|
|
6
6
|
import type { UseChartInteractionSignature } from "../useChartInteraction/index.js";
|
|
7
7
|
import type { ChartsAxisProps } from "../../../../ChartsAxis/index.js";
|
|
8
8
|
/**
|
|
@@ -47,10 +47,13 @@ export type UseChartCartesianAxisDefaultizedParameters<S extends ScaleName = Sca
|
|
|
47
47
|
defaultizedXAxis: DefaultedXAxis<S>[];
|
|
48
48
|
defaultizedYAxis: DefaultedYAxis<S>[];
|
|
49
49
|
};
|
|
50
|
+
export interface DefaultedZoomSliderOptions extends Omit<NonNullable<Required<ZoomOptions['slider']>>, 'showTooltip'> {
|
|
51
|
+
showTooltip: ZoomSliderShowTooltip;
|
|
52
|
+
}
|
|
50
53
|
export interface DefaultizedZoomOptions extends Required<Omit<ZoomOptions, 'slider'>> {
|
|
51
54
|
axisId: AxisId;
|
|
52
55
|
axisDirection: 'x' | 'y';
|
|
53
|
-
slider:
|
|
56
|
+
slider: DefaultedZoomSliderOptions;
|
|
54
57
|
}
|
|
55
58
|
export interface UseChartCartesianAxisState {
|
|
56
59
|
/**
|