Skip to content

Commit 2daa1de

Browse files
Gen types, fix static.
1 parent d5ef009 commit 2daa1de

File tree

8 files changed

+37
-8
lines changed

8 files changed

+37
-8
lines changed

docs/data/charts/export/PrintChart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default function PrintChart() {
5959
<MenuItem value="heatmap">Heatmap</MenuItem>
6060
</Select>
6161
</FormControl>
62-
<Button onClick={() => apiRef.current.exportAsPrint()} variant="contained">
62+
<Button onClick={() => apiRef.current.exportAsPrint} variant="contained">
6363
Print
6464
</Button>
6565
</Stack>

docs/data/charts/export/PrintChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function PrintChart() {
6161
<MenuItem value="heatmap">Heatmap</MenuItem>
6262
</Select>
6363
</FormControl>
64-
<Button onClick={() => apiRef.current!.exportAsPrint()} variant="contained">
64+
<Button onClick={() => apiRef.current!.exportAsPrint} variant="contained">
6565
Print
6666
</Button>
6767
</Stack>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
export const heatmapData = [
2+
[0, 0, 10],
3+
[0, 1, 20],
4+
[0, 2, 40],
5+
[0, 3, 90],
6+
[0, 4, 70],
7+
[1, 0, 30],
8+
[1, 1, 50],
9+
[1, 2, 10],
10+
[1, 3, 70],
11+
[1, 4, 40],
12+
[2, 0, 50],
13+
[2, 1, 20],
14+
[2, 2, 90],
15+
[2, 3, 20],
16+
[2, 4, 70],
17+
[3, 0, 40],
18+
[3, 1, 50],
19+
[3, 2, 20],
20+
[3, 3, 70],
21+
[3, 4, 90],
22+
];

packages/x-charts-pro/src/ChartContainerPro/ChartProApi.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ type PluginsPerSeriesType = {
1313
bar: BarChartProPluginsSignatures;
1414
};
1515

16+
/**
17+
* The API of the chart `apiRef` object.
18+
* The chart type can be passed as the first generic parameter to narrow down the API to the specific chart type.
19+
* @example ChartProApi<'bar'>
20+
*/
1621
export type ChartProApi<
1722
TSeries extends ChartSeriesType = ChartSeriesType,
1823
TSignatures extends

packages/x-charts-pro/src/Heatmap/Heatmap.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ChartSeriesConfig,
1414
XAxis,
1515
YAxis,
16+
ChartsRootSurface,
1617
} from '@mui/x-charts/internals';
1718
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
1819
import {
@@ -22,7 +23,6 @@ import {
2223
ChartsOverlaySlots,
2324
} from '@mui/x-charts/ChartsOverlay';
2425
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
25-
import { ChartsRootSurface } from '@mui/x-charts/ChartsRootSurface';
2626
import { useChartContainerProProps } from '../ChartContainerPro/useChartContainerProProps';
2727
import { ChartDataProviderPro } from '../ChartDataProviderPro';
2828
import { ChartContainerProProps } from '../ChartContainerPro';
@@ -235,7 +235,10 @@ Heatmap.propTypes = {
235235
// | To update them edit the TypeScript types and run "pnpm proptypes" |
236236
// ----------------------------------------------------------------------
237237
apiRef: PropTypes.shape({
238-
current: PropTypes.object,
238+
current: PropTypes.shape({
239+
exportAsImage: PropTypes.func.isRequired,
240+
exportAsPrint: PropTypes.func.isRequired,
241+
}),
239242
}),
240243
className: PropTypes.string,
241244
/**

packages/x-charts/src/ChartsRootSurface/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/x-charts/src/ChartsRootSurface/ChartsRootSurface.tsx renamed to packages/x-charts/src/internals/components/ChartsRootSurface.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import useForkRef from '@mui/utils/useForkRef';
3-
import { ChartsSurface, ChartsSurfaceProps } from '../ChartsSurface';
4-
import { useChartRootRef } from '../hooks';
3+
import { ChartsSurface, ChartsSurfaceProps } from '../../ChartsSurface';
4+
import { useChartRootRef } from '../../hooks';
55

66
export interface ChartsRootSurfaceProps extends ChartsSurfaceProps {}
77

packages/x-charts/src/internals/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Components
22
export * from './components/ChartsAxesGradients';
33
export * from './components/ChartsWrapper';
4+
export * from './components/ChartsRootSurface';
45
export * from '../ChartsLabel/ChartsLabelMark';
56

67
// hooks
@@ -31,7 +32,6 @@ export * from './store/useStore';
3132
export * from './store/useSelector';
3233

3334
// plugins configs
34-
3535
export * from '../BarChart/BarChart.plugins';
3636
export * from '../LineChart/LineChart.plugins';
3737
export * from '../ScatterChart/ScatterChart.plugins';

0 commit comments

Comments
 (0)