Skip to content

Commit

Permalink
[charts] Fix the font used in the overlay (mui#13107)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette authored and thomasmoon committed Sep 6, 2024
1 parent 483c656 commit 9dd6c08
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/bar-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"type": { "name": "union", "description": "object<br>&#124;&nbsp;string" },
"default": "yAxisIds[0] The id of the first provided axis"
},
"loading": { "type": { "name": "bool" } },
"loading": { "type": { "name": "bool" }, "default": "false" },
"margin": {
"type": {
"name": "shape",
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/line-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"type": { "name": "union", "description": "object<br>&#124;&nbsp;string" },
"default": "yAxisIds[0] The id of the first provided axis"
},
"loading": { "type": { "name": "bool" } },
"loading": { "type": { "name": "bool" }, "default": "false" },
"margin": {
"type": {
"name": "shape",
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/pie-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"deprecated": true,
"deprecationInfo": "Consider using <code>slotProps.legend</code> instead."
},
"loading": { "type": { "name": "bool" } },
"loading": { "type": { "name": "bool" }, "default": "false" },
"margin": {
"type": {
"name": "shape",
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/scatter-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"type": { "name": "union", "description": "object<br>&#124;&nbsp;string" },
"default": "yAxisIds[0] The id of the first provided axis"
},
"loading": { "type": { "name": "bool" } },
"loading": { "type": { "name": "bool" }, "default": "false" },
"margin": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions packages/x-charts/src/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ BarChart.propTypes = {
}),
/**
* If `true`, a loading overlay is displayed.
* @default false
*/
loading: PropTypes.bool,
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/x-charts/src/ChartsOverlay/ChartsLoadingOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useDrawingArea } from '../hooks/useDrawingArea';
import type { CommonOverlayProps } from './ChartsOverlay';

const StyledText = styled('text')(({ theme }) => ({
...theme.typography.body2,
stroke: 'none',
fill: theme.palette.text.primary,
shapeRendering: 'crispEdges',
Expand All @@ -17,7 +18,7 @@ export function ChartsLoadingOverlay(props: CommonOverlayProps) {

return (
<StyledText x={left + width / 2} y={top + height / 2} {...other}>
{message ?? 'Loading data ...'}
{message ?? 'Loading data'}
</StyledText>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useDrawingArea } from '../hooks/useDrawingArea';
import type { CommonOverlayProps } from './ChartsOverlay';

const StyledText = styled('text')(({ theme }) => ({
...theme.typography.body2,
stroke: 'none',
fill: theme.palette.text.primary,
shapeRendering: 'crispEdges',
Expand Down
10 changes: 9 additions & 1 deletion packages/x-charts/src/ChartsOverlay/ChartsOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,18 @@ export interface ChartsOverlaySlotProps {
export interface ChartsOverlayProps {
/**
* If `true`, a loading overlay is displayed.
* @default false
*/
loading?: boolean;

/**
* Overridable component slots.
* @default {}
*/
slots?: ChartsOverlaySlots;
/**
* The props used for each component slot.
* @default {}
*/
slotProps?: ChartsOverlaySlotProps;
}

Expand Down
1 change: 1 addition & 0 deletions packages/x-charts/src/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ LineChart.propTypes = {
}),
/**
* If `true`, a loading overlay is displayed.
* @default false
*/
loading: PropTypes.bool,
/**
Expand Down
1 change: 1 addition & 0 deletions packages/x-charts/src/PieChart/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ PieChart.propTypes = {
}),
/**
* If `true`, a loading overlay is displayed.
* @default false
*/
loading: PropTypes.bool,
/**
Expand Down
1 change: 1 addition & 0 deletions packages/x-charts/src/ScatterChart/ScatterChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ ScatterChart.propTypes = {
}),
/**
* If `true`, a loading overlay is displayed.
* @default false
*/
loading: PropTypes.bool,
/**
Expand Down

0 comments on commit 9dd6c08

Please sign in to comment.