Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[charts] Fix the font used in the overlay #13107

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading