@mui/x-charts-pro 9.0.0-alpha.2 → 9.0.0-alpha.3
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/BarChartPro/BarChartPro.js +5 -2
- package/BarChartPro/BarChartPro.mjs +5 -2
- package/CHANGELOG.md +123 -1
- package/ChartContainerPro/ChartContainerPro.d.mts +2 -2
- package/ChartContainerPro/ChartContainerPro.d.ts +2 -2
- package/ChartContainerPro/useChartContainerProProps.d.mts +2 -2
- package/ChartContainerPro/useChartContainerProProps.d.ts +2 -2
- package/ChartDataProviderPro/ChartDataProviderPro.d.mts +1 -1
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.mts +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/ChartsContainerPro/ChartsContainerPro.d.mts +2 -2
- package/ChartsContainerPro/ChartsContainerPro.d.ts +2 -2
- package/ChartsContainerPro/useChartsContainerProProps.d.mts +3 -3
- package/ChartsContainerPro/useChartsContainerProProps.d.ts +3 -3
- package/ChartsDataProviderPro/ChartsDataProviderPro.d.mts +2 -2
- package/ChartsDataProviderPro/ChartsDataProviderPro.d.ts +2 -2
- package/ChartsDataProviderPro/ChartsDataProviderPro.js +8 -5
- package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +8 -5
- package/ChartsDataProviderPro/useChartsDataProviderProProps.d.mts +1 -1
- package/ChartsDataProviderPro/useChartsDataProviderProProps.d.ts +1 -1
- package/FunnelChart/FunnelChart.js +5 -2
- package/FunnelChart/FunnelChart.mjs +5 -2
- package/FunnelChart/FunnelSection.js +3 -4
- package/FunnelChart/FunnelSection.mjs +4 -5
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.d.mts +3 -3
- package/FunnelChart/funnelAxisPlugin/computeAxisValue.d.ts +3 -3
- package/Heatmap/Heatmap.js +5 -4
- package/Heatmap/Heatmap.mjs +5 -4
- package/Heatmap/HeatmapItem.js +0 -1
- package/Heatmap/HeatmapItem.mjs +0 -1
- package/Heatmap/HeatmapSVGPlot.js +4 -4
- package/Heatmap/HeatmapSVGPlot.mjs +5 -5
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.js +16 -13
- package/Heatmap/HeatmapTooltip/HeatmapTooltipContent.mjs +16 -13
- package/Heatmap/internals/HeatmapCell.js +1 -1
- package/Heatmap/internals/HeatmapCell.mjs +1 -1
- package/Heatmap/seriesConfig/getColor.js +5 -3
- package/Heatmap/seriesConfig/getColor.mjs +5 -3
- package/Heatmap/seriesConfig/getItemAtPosition.d.mts +2 -2
- package/Heatmap/seriesConfig/getItemAtPosition.d.ts +2 -2
- package/Heatmap/seriesConfig/getItemAtPosition.js +3 -11
- package/Heatmap/seriesConfig/getItemAtPosition.mjs +3 -11
- package/Heatmap/seriesConfig/identifierCleaner.d.mts +3 -0
- package/Heatmap/seriesConfig/identifierCleaner.d.ts +3 -0
- package/Heatmap/seriesConfig/identifierCleaner.js +15 -0
- package/Heatmap/seriesConfig/identifierCleaner.mjs +9 -0
- package/Heatmap/seriesConfig/identifierSerializer.d.mts +3 -0
- package/Heatmap/seriesConfig/identifierSerializer.d.ts +3 -0
- package/Heatmap/seriesConfig/identifierSerializer.js +11 -0
- package/Heatmap/seriesConfig/identifierSerializer.mjs +5 -0
- package/Heatmap/seriesConfig/index.js +4 -2
- package/Heatmap/seriesConfig/index.mjs +5 -3
- package/Heatmap/seriesConfig/keyboardFocusHandler.js +6 -19
- package/Heatmap/seriesConfig/keyboardFocusHandler.mjs +6 -19
- package/Heatmap/seriesConfig/seriesProcessor.js +8 -3
- package/Heatmap/seriesConfig/seriesProcessor.mjs +8 -3
- package/Heatmap/seriesConfig/tooltip.js +7 -6
- package/Heatmap/seriesConfig/tooltip.mjs +7 -6
- package/Heatmap/seriesConfig/tooltipPosition.js +3 -4
- package/Heatmap/seriesConfig/tooltipPosition.mjs +3 -4
- package/Heatmap/useHeatmapProps.js +2 -2
- package/Heatmap/useHeatmapProps.mjs +2 -2
- package/LineChartPro/LineChartPro.js +5 -2
- package/LineChartPro/LineChartPro.mjs +5 -2
- package/PieChartPro/PieChartPro.js +5 -2
- package/PieChartPro/PieChartPro.mjs +5 -2
- package/RadarChartPro/RadarChartPro.js +5 -2
- package/RadarChartPro/RadarChartPro.mjs +5 -2
- package/SankeyChart/SankeyChart.js +5 -2
- package/SankeyChart/SankeyChart.mjs +5 -2
- package/SankeyChart/SankeyLinkElement.js +4 -3
- package/SankeyChart/SankeyLinkElement.mjs +5 -4
- package/SankeyChart/SankeyNodeElement.js +4 -3
- package/SankeyChart/SankeyNodeElement.mjs +5 -4
- package/SankeyChart/sankeyHighlightHooks.d.mts +2 -2
- package/SankeyChart/sankeyHighlightHooks.d.ts +2 -2
- package/SankeyChart/sankeyHighlightHooks.js +2 -10
- package/SankeyChart/sankeyHighlightHooks.mjs +3 -11
- package/ScatterChartPro/ScatterChartPro.js +5 -2
- package/ScatterChartPro/ScatterChartPro.mjs +5 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/ChartsWatermark.d.mts +2 -2
- package/internals/ChartsWatermark.d.ts +2 -2
- package/internals/ChartsWatermark.js +5 -8
- package/internals/ChartsWatermark.mjs +3 -6
- package/internals/plugins/allPlugins.d.mts +4 -4
- package/internals/plugins/allPlugins.d.ts +4 -4
- package/internals/plugins/useChartProExport/exportImage.js +1 -1
- package/internals/plugins/useChartProExport/exportImage.mjs +1 -1
- package/models/seriesType/heatmap.d.mts +36 -9
- package/models/seriesType/heatmap.d.ts +36 -9
- package/models/seriesType/heatmap.js +28 -1
- package/models/seriesType/heatmap.mjs +25 -1
- package/package.json +128 -128
- package/plugins/selectors/useChartHeatmapPosition.selectors.d.mts +2 -2
- package/plugins/selectors/useChartHeatmapPosition.selectors.d.ts +2 -2
- package/plugins/selectors/useChartHeatmapPosition.selectors.js +4 -4
- package/plugins/selectors/useChartHeatmapPosition.selectors.mjs +4 -4
- package/typeOverloads/modules.d.mts +2 -2
- package/typeOverloads/modules.d.ts +2 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ChartSeriesType, type ConvertSignaturesIntoPlugins, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartZAxisSignature, type UseChartHighlightSignature, type UseChartPolarAxisSignature, type UseChartBrushSignature, type UseChartVisibilityManagerSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "./useChartProExport/index.mjs";
|
|
3
3
|
import { type UseChartProZoomSignature } from "./useChartProZoom/index.mjs";
|
|
4
|
-
export type AllPluginSignatures<
|
|
5
|
-
export type AllPluginsType<
|
|
4
|
+
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>];
|
|
5
|
+
export type AllPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<SeriesType>>;
|
|
6
6
|
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
7
|
-
export type DefaultPluginSignatures<
|
|
8
|
-
export type DefaultPluginsType<
|
|
7
|
+
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>];
|
|
8
|
+
export type DefaultPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<DefaultPluginSignatures<SeriesType>>;
|
|
9
9
|
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ChartSeriesType, type ConvertSignaturesIntoPlugins, type UseChartCartesianAxisSignature, type UseChartTooltipSignature, type UseChartInteractionSignature, type UseChartZAxisSignature, type UseChartHighlightSignature, type UseChartPolarAxisSignature, type UseChartBrushSignature, type UseChartVisibilityManagerSignature } from '@mui/x-charts/internals';
|
|
2
2
|
import { type UseChartProExportSignature } from "./useChartProExport/index.js";
|
|
3
3
|
import { type UseChartProZoomSignature } from "./useChartProZoom/index.js";
|
|
4
|
-
export type AllPluginSignatures<
|
|
5
|
-
export type AllPluginsType<
|
|
4
|
+
export type AllPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>];
|
|
5
|
+
export type AllPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<AllPluginSignatures<SeriesType>>;
|
|
6
6
|
export declare const ALL_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartPolarAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
7
|
-
export type DefaultPluginSignatures<
|
|
8
|
-
export type DefaultPluginsType<
|
|
7
|
+
export type DefaultPluginSignatures<SeriesType extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature<SeriesType>, UseChartInteractionSignature, UseChartCartesianAxisSignature<SeriesType>, UseChartPolarAxisSignature<SeriesType>, UseChartHighlightSignature<SeriesType>, UseChartVisibilityManagerSignature<SeriesType>, UseChartProZoomSignature, UseChartProExportSignature, UseChartVisibilityManagerSignature<SeriesType>];
|
|
8
|
+
export type DefaultPluginsType<SeriesType extends ChartSeriesType = ChartSeriesType> = ConvertSignaturesIntoPlugins<DefaultPluginSignatures<SeriesType>>;
|
|
9
9
|
export declare const DEFAULT_PLUGINS: (import("@mui/x-charts/internals").ChartPlugin<UseChartProZoomSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartProExportSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartZAxisSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartBrushSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartInteractionSignature> | import("@mui/x-charts/internals").ChartPlugin<UseChartTooltipSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartCartesianAxisSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartHighlightSignature<any>> | import("@mui/x-charts/internals").ChartPlugin<UseChartVisibilityManagerSignature<any>>)[];
|
|
@@ -34,6 +34,7 @@ async function exportImage(element, svg, params) {
|
|
|
34
34
|
} = params ?? {};
|
|
35
35
|
const drawDocumentPromise = getDrawDocument();
|
|
36
36
|
const doc = (0, _ownerDocument.default)(element);
|
|
37
|
+
const ratio = Math.max(window.devicePixelRatio || 1, 1);
|
|
37
38
|
const iframe = (0, _common.createExportIframe)(fileName);
|
|
38
39
|
/* We apply the min/max width and height to ensure the SVG doesn't resize in the export.
|
|
39
40
|
* We apply to the original SVG so that the cloned tree will contain the styles and revert these
|
|
@@ -74,7 +75,6 @@ async function exportImage(element, svg, params) {
|
|
|
74
75
|
/* Use the size from the export body in case `onBeforeExport` adds some elements that should be in the export. */
|
|
75
76
|
const exportDocBodySize = iframe.contentDocument.body.getBoundingClientRect();
|
|
76
77
|
const canvas = document.createElement('canvas');
|
|
77
|
-
const ratio = window.devicePixelRatio || 1;
|
|
78
78
|
canvas.width = exportDocBodySize.width * ratio;
|
|
79
79
|
canvas.height = exportDocBodySize.height * ratio;
|
|
80
80
|
canvas.style.width = `${exportDocBodySize.width}px`;
|
|
@@ -24,6 +24,7 @@ export async function exportImage(element, svg, params) {
|
|
|
24
24
|
} = params ?? {};
|
|
25
25
|
const drawDocumentPromise = getDrawDocument();
|
|
26
26
|
const doc = ownerDocument(element);
|
|
27
|
+
const ratio = Math.max(window.devicePixelRatio || 1, 1);
|
|
27
28
|
const iframe = createExportIframe(fileName);
|
|
28
29
|
/* We apply the min/max width and height to ensure the SVG doesn't resize in the export.
|
|
29
30
|
* We apply to the original SVG so that the cloned tree will contain the styles and revert these
|
|
@@ -64,7 +65,6 @@ export async function exportImage(element, svg, params) {
|
|
|
64
65
|
/* Use the size from the export body in case `onBeforeExport` adds some elements that should be in the export. */
|
|
65
66
|
const exportDocBodySize = iframe.contentDocument.body.getBoundingClientRect();
|
|
66
67
|
const canvas = document.createElement('canvas');
|
|
67
|
-
const ratio = window.devicePixelRatio || 1;
|
|
68
68
|
canvas.width = exportDocBodySize.width * ratio;
|
|
69
69
|
canvas.height = exportDocBodySize.height * ratio;
|
|
70
70
|
canvas.style.width = `${exportDocBodySize.width}px`;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type DefaultizedProps } from '@mui/x-internals/types';
|
|
2
2
|
import { type CommonDefaultizedProps, type CommonSeriesType, type CartesianSeriesType } from '@mui/x-charts/internals';
|
|
3
3
|
export type HeatmapValueType = readonly [number, number, number];
|
|
4
|
-
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType, 'heatmap'>, 'color' | 'colorGetter'>, CartesianSeriesType {
|
|
4
|
+
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType, 'heatmap'>, 'color' | 'colorGetter' | 'valueFormatter'>, CartesianSeriesType {
|
|
5
5
|
type: 'heatmap';
|
|
6
6
|
/**
|
|
7
|
-
* Data associated to each
|
|
7
|
+
* Data associated to each cell in the heatmap.
|
|
8
|
+
* Each entry is a tuple [xIndex, yIndex, value].
|
|
8
9
|
*/
|
|
9
10
|
data?: readonly HeatmapValueType[];
|
|
10
11
|
/**
|
|
@@ -15,9 +16,21 @@ export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueTyp
|
|
|
15
16
|
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
16
17
|
*/
|
|
17
18
|
label?: string | ((location: 'tooltip' | 'legend') => string);
|
|
19
|
+
/**
|
|
20
|
+
* Function that formats values to be displayed in a tooltip.
|
|
21
|
+
* @param {number | null} value The series' value to render. Can be `null` if the cell doesn't contain any value.
|
|
22
|
+
* @param {{ xIndex: number; yIndex: number}} context The rendering context of the value.
|
|
23
|
+
* @param {number} context.xIndex The x index of the cell the value belongs to.
|
|
24
|
+
* @param {number} context.yIndex The y index of the cell the value belongs to.
|
|
25
|
+
* @returns {string | null} The string to display or null if the value should not be shown.
|
|
26
|
+
*/
|
|
27
|
+
valueFormatter?: (value: number | null, context: {
|
|
28
|
+
xIndex: number;
|
|
29
|
+
yIndex: number;
|
|
30
|
+
}) => string | null;
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
20
|
-
* An object that allows to identify a single
|
|
33
|
+
* An object that allows to identify a single cell.
|
|
21
34
|
* Used for item interaction
|
|
22
35
|
*/
|
|
23
36
|
export type HeatmapItemIdentifier = {
|
|
@@ -26,11 +39,6 @@ export type HeatmapItemIdentifier = {
|
|
|
26
39
|
* The id of the series the cell belongs to.
|
|
27
40
|
*/
|
|
28
41
|
seriesId: DefaultizedHeatmapSeriesType['id'];
|
|
29
|
-
/**
|
|
30
|
-
* The data index of the cell.
|
|
31
|
-
* Is defined only if some data is associated to the cell.
|
|
32
|
-
*/
|
|
33
|
-
dataIndex?: number;
|
|
34
42
|
/**
|
|
35
43
|
* The x index of the cell. Useful to identify the cell position in the heatmap even if there is no data.
|
|
36
44
|
*/
|
|
@@ -40,4 +48,23 @@ export type HeatmapItemIdentifier = {
|
|
|
40
48
|
*/
|
|
41
49
|
yIndex: number;
|
|
42
50
|
};
|
|
43
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The cell identifier with the associated data value.
|
|
53
|
+
*/
|
|
54
|
+
export type HeatmapItemIdentifierWithData = HeatmapItemIdentifier & {
|
|
55
|
+
/**
|
|
56
|
+
* The value of the cell. Null if there is no data associated.
|
|
57
|
+
*/
|
|
58
|
+
value: number | null;
|
|
59
|
+
};
|
|
60
|
+
export declare class HeatmapData {
|
|
61
|
+
private valueLookup;
|
|
62
|
+
constructor(data: readonly HeatmapValueType[]);
|
|
63
|
+
getValue(xIndex: number, yIndex: number): number | null;
|
|
64
|
+
}
|
|
65
|
+
export interface DefaultizedHeatmapSeriesType extends DefaultizedProps<HeatmapSeriesType, CommonDefaultizedProps> {
|
|
66
|
+
/**
|
|
67
|
+
* Maps the `xIndex` and `yIndex` to the corresponding value of the cell.
|
|
68
|
+
*/
|
|
69
|
+
heatmapData: HeatmapData;
|
|
70
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type DefaultizedProps } from '@mui/x-internals/types';
|
|
2
2
|
import { type CommonDefaultizedProps, type CommonSeriesType, type CartesianSeriesType } from '@mui/x-charts/internals';
|
|
3
3
|
export type HeatmapValueType = readonly [number, number, number];
|
|
4
|
-
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType, 'heatmap'>, 'color' | 'colorGetter'>, CartesianSeriesType {
|
|
4
|
+
export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueType, 'heatmap'>, 'color' | 'colorGetter' | 'valueFormatter'>, CartesianSeriesType {
|
|
5
5
|
type: 'heatmap';
|
|
6
6
|
/**
|
|
7
|
-
* Data associated to each
|
|
7
|
+
* Data associated to each cell in the heatmap.
|
|
8
|
+
* Each entry is a tuple [xIndex, yIndex, value].
|
|
8
9
|
*/
|
|
9
10
|
data?: readonly HeatmapValueType[];
|
|
10
11
|
/**
|
|
@@ -15,9 +16,21 @@ export interface HeatmapSeriesType extends Omit<CommonSeriesType<HeatmapValueTyp
|
|
|
15
16
|
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
16
17
|
*/
|
|
17
18
|
label?: string | ((location: 'tooltip' | 'legend') => string);
|
|
19
|
+
/**
|
|
20
|
+
* Function that formats values to be displayed in a tooltip.
|
|
21
|
+
* @param {number | null} value The series' value to render. Can be `null` if the cell doesn't contain any value.
|
|
22
|
+
* @param {{ xIndex: number; yIndex: number}} context The rendering context of the value.
|
|
23
|
+
* @param {number} context.xIndex The x index of the cell the value belongs to.
|
|
24
|
+
* @param {number} context.yIndex The y index of the cell the value belongs to.
|
|
25
|
+
* @returns {string | null} The string to display or null if the value should not be shown.
|
|
26
|
+
*/
|
|
27
|
+
valueFormatter?: (value: number | null, context: {
|
|
28
|
+
xIndex: number;
|
|
29
|
+
yIndex: number;
|
|
30
|
+
}) => string | null;
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
20
|
-
* An object that allows to identify a single
|
|
33
|
+
* An object that allows to identify a single cell.
|
|
21
34
|
* Used for item interaction
|
|
22
35
|
*/
|
|
23
36
|
export type HeatmapItemIdentifier = {
|
|
@@ -26,11 +39,6 @@ export type HeatmapItemIdentifier = {
|
|
|
26
39
|
* The id of the series the cell belongs to.
|
|
27
40
|
*/
|
|
28
41
|
seriesId: DefaultizedHeatmapSeriesType['id'];
|
|
29
|
-
/**
|
|
30
|
-
* The data index of the cell.
|
|
31
|
-
* Is defined only if some data is associated to the cell.
|
|
32
|
-
*/
|
|
33
|
-
dataIndex?: number;
|
|
34
42
|
/**
|
|
35
43
|
* The x index of the cell. Useful to identify the cell position in the heatmap even if there is no data.
|
|
36
44
|
*/
|
|
@@ -40,4 +48,23 @@ export type HeatmapItemIdentifier = {
|
|
|
40
48
|
*/
|
|
41
49
|
yIndex: number;
|
|
42
50
|
};
|
|
43
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The cell identifier with the associated data value.
|
|
53
|
+
*/
|
|
54
|
+
export type HeatmapItemIdentifierWithData = HeatmapItemIdentifier & {
|
|
55
|
+
/**
|
|
56
|
+
* The value of the cell. Null if there is no data associated.
|
|
57
|
+
*/
|
|
58
|
+
value: number | null;
|
|
59
|
+
};
|
|
60
|
+
export declare class HeatmapData {
|
|
61
|
+
private valueLookup;
|
|
62
|
+
constructor(data: readonly HeatmapValueType[]);
|
|
63
|
+
getValue(xIndex: number, yIndex: number): number | null;
|
|
64
|
+
}
|
|
65
|
+
export interface DefaultizedHeatmapSeriesType extends DefaultizedProps<HeatmapSeriesType, CommonDefaultizedProps> {
|
|
66
|
+
/**
|
|
67
|
+
* Maps the `xIndex` and `yIndex` to the corresponding value of the cell.
|
|
68
|
+
*/
|
|
69
|
+
heatmapData: HeatmapData;
|
|
70
|
+
}
|
|
@@ -2,4 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
|
-
});
|
|
5
|
+
});
|
|
6
|
+
exports.HeatmapData = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* An object that allows to identify a single cell.
|
|
9
|
+
* Used for item interaction
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The cell identifier with the associated data value.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
class HeatmapData {
|
|
17
|
+
constructor(data) {
|
|
18
|
+
this.valueLookup = new Map();
|
|
19
|
+
for (const [xIndex, yIndex, value] of data) {
|
|
20
|
+
let column = this.valueLookup.get(xIndex);
|
|
21
|
+
if (!column) {
|
|
22
|
+
column = new Map();
|
|
23
|
+
this.valueLookup.set(xIndex, column);
|
|
24
|
+
}
|
|
25
|
+
column.set(yIndex, value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
getValue(xIndex, yIndex) {
|
|
29
|
+
return this.valueLookup.get(xIndex)?.get(yIndex) ?? null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.HeatmapData = HeatmapData;
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* An object that allows to identify a single cell.
|
|
3
|
+
* Used for item interaction
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The cell identifier with the associated data value.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export class HeatmapData {
|
|
11
|
+
constructor(data) {
|
|
12
|
+
this.valueLookup = new Map();
|
|
13
|
+
for (const [xIndex, yIndex, value] of data) {
|
|
14
|
+
let column = this.valueLookup.get(xIndex);
|
|
15
|
+
if (!column) {
|
|
16
|
+
column = new Map();
|
|
17
|
+
this.valueLookup.set(xIndex, column);
|
|
18
|
+
}
|
|
19
|
+
column.set(yIndex, value);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
getValue(xIndex, yIndex) {
|
|
23
|
+
return this.valueLookup.get(xIndex)?.get(yIndex) ?? null;
|
|
24
|
+
}
|
|
25
|
+
}
|