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] Introduce hideLegend prop #15277

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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/data/charts/axis/MarginAndLabelPosition.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function MarginAndLabelPosition() {
{ dataKey: '2021', label: '2021' },
{ dataKey: '2022', label: '2022' },
]}
slotProps={{ legend: { hidden: true } }}
hideLegend
yAxis={[
{
valueFormatter: (value) => `${(value / 1000).toLocaleString()}k`,
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/axis/MarginAndLabelPosition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function MarginAndLabelPosition() {
{ dataKey: '2021', label: '2021' },
{ dataKey: '2022', label: '2022' },
]}
slotProps={{ legend: { hidden: true } }}
hideLegend
yAxis={[
{
valueFormatter: (value) => `${(value / 1000).toLocaleString()}k`,
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/bars/BarGapNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function BarGapNoSnap() {
},
]}
yAxis={[{ valueFormatter: (v) => `$ ${v / 1000000}B` }]}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
)}
getCode={({ props }) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/bars/StackBars.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function StackBars() {
{ dataKey: 'treas', stack: 'equity' },
])}
xAxis={[{ scaleType: 'band', dataKey: 'year' }]}
slotProps={{ legend: { hidden: true } }}
hideLegend
width={600}
height={350}
/>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/bars/StackBars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function StackBars() {
{ dataKey: 'treas', stack: 'equity' },
])}
xAxis={[{ scaleType: 'band', dataKey: 'year' }]}
slotProps={{ legend: { hidden: true } }}
hideLegend
width={600}
height={350}
/>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/bars/StackBars.tsx.preview
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{ dataKey: 'treas', stack: 'equity' },
])}
xAxis={[{ scaleType: 'band', dataKey: 'year' }]}
slotProps={{ legend: { hidden: true } }}
hideLegend
width={600}
height={350}
/>
4 changes: 2 additions & 2 deletions docs/data/charts/highlighting/SyncHighlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const barChartsProps = {
],
xAxis: [{ scaleType: 'band', data: ['A', 'B', 'C', 'D', 'E'] }],
height: 400,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};

const pieChartProps = {
Expand All @@ -55,5 +55,5 @@ const pieChartProps = {
},
],
height: 400,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
4 changes: 2 additions & 2 deletions docs/data/charts/highlighting/SyncHighlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const barChartsProps: BarChartProps = {
],
xAxis: [{ scaleType: 'band', data: ['A', 'B', 'C', 'D', 'E'] }],
height: 400,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};

const pieChartProps: PieChartProps = {
Expand All @@ -56,5 +56,5 @@ const pieChartProps: PieChartProps = {
},
],
height: 400,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
2 changes: 1 addition & 1 deletion docs/data/charts/legend/BasicColorLegend.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function BasicColorLegend() {
grid={{ horizontal: true }}
height={300}
margin={{ top: 30, right: 150 }}
slotProps={{ legend: { hidden: true } }}
hideLegend
>
<PiecewiseColorLegend
axisDirection="x"
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/legend/BasicColorLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function BasicColorLegend() {
grid={{ horizontal: true }}
height={300}
margin={{ top: 30, right: 150 }}
slotProps={{ legend: { hidden: true } }}
hideLegend
>
<PiecewiseColorLegend
axisDirection="x"
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/legend/ContinuousInteractiveDemoNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function ContinuousInteractiveDemoNoSnap() {
top: props.direction === 'row' ? 50 : 20,
right: props.direction === 'row' ? 20 : 50,
}}
slotProps={{ legend: { hidden: true } }}
hideLegend
>
<ChartsReferenceLine y={0} />
<ContinuousColorLegend
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/legend/PiecewiseInteractiveDemoNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function PiecewiseInteractiveDemoNoSnap() {
top: props.direction === 'row' ? 50 : 20,
right: props.direction === 'row' ? 20 : 150,
}}
slotProps={{ legend: { hidden: true } }}
hideLegend
>
<ChartsReferenceLine y={0} />
<PiecewiseColorLegend
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/lines/LineDataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const stackStrategy = {

const customize = {
height: 300,
slotProps: { legend: { hidden: true } },
hideLegend: true,
margin: { top: 5 },
};

Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/lines/LineDataset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const stackStrategy = {

const customize = {
height: 300,
slotProps: { legend: { hidden: true } },
hideLegend: true,
margin: { top: 5 },
};

Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/pie-demo/PieChartWithCustomizedLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const sizing = {
margin: { right: 5 },
width: 200,
height: 200,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
const TOTAL = data.map((item) => item.value).reduce((a, b) => a + b, 0);

Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/pie-demo/PieChartWithCustomizedLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const sizing = {
margin: { right: 5 },
width: 200,
height: 200,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
const TOTAL = data.map((item) => item.value).reduce((a, b) => a + b, 0);

Expand Down
4 changes: 2 additions & 2 deletions docs/data/charts/pie-demo/PieChartWithPaddingAngle.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function PieChartWithPaddingAngle() {
margin={{ right: 5 }}
width={200}
height={200}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
<PieChart
series={[
Expand All @@ -40,7 +40,7 @@ export default function PieChartWithPaddingAngle() {
margin={{ right: 5 }}
width={200}
height={200}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
</Stack>
);
Expand Down
4 changes: 2 additions & 2 deletions docs/data/charts/pie-demo/PieChartWithPaddingAngle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function PieChartWithPaddingAngle() {
margin={{ right: 5 }}
width={200}
height={200}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
<PieChart
series={[
Expand All @@ -40,7 +40,7 @@ export default function PieChartWithPaddingAngle() {
margin={{ right: 5 }}
width={200}
height={200}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
</Stack>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/pie-demo/TwoLevelPieChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function TwoLevelPieChart() {
]}
width={400}
height={300}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
);
}
2 changes: 1 addition & 1 deletion docs/data/charts/pie-demo/TwoLevelPieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function TwoLevelPieChart() {
]}
width={400}
height={300}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
);
}
2 changes: 1 addition & 1 deletion docs/data/charts/pie-demo/TwoSimplePieChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function TwoSimplePieChart() {
},
]}
height={300}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
);
}
2 changes: 1 addition & 1 deletion docs/data/charts/pie-demo/TwoSimplePieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function TwoSimplePieChart() {
},
]}
height={300}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
);
}
2 changes: 1 addition & 1 deletion docs/data/charts/pie/PieClickNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function PieClickNoSnap() {
series={series}
width={400}
height={300}
slotProps={{ legend: { hidden: true } }}
hideLegend
onItemClick={(event, d) => setItemData(d)}
/>{' '}
</Box>
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/pie/PieColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export default function PieColor() {
const pieParams = {
height: 200,
margin: { right: 5 },
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
2 changes: 1 addition & 1 deletion docs/data/charts/pie/PieColor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export default function PieColor() {
const pieParams = {
height: 200,
margin: { right: 5 },
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
2 changes: 1 addition & 1 deletion docs/data/charts/pie/PieShapeNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function PieShapeNoSnap() {
width={300}
height={300}
margin={{ right: 5 }}
slotProps={{ legend: { hidden: true } }}
hideLegend
/>
)}
getCode={({ props }) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/tooltip/AxisFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const chartParams = {
}).format((v || 0) * 1_000_000),
},
],
slotProps: { legend: { hidden: true } },
hideLegend: true,
dataset,
width: 600,
height: 400,
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/tooltip/AxisFormatter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const chartParams: BarChartProps = {
}).format((v || 0) * 1_000_000),
},
],
slotProps: { legend: { hidden: true } },
hideLegend: true,
dataset,
width: 600,
height: 400,
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/tooltip/Interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const barChartsParams = {
],
margin: { top: 10, right: 10 },
height: 200,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
export default function Interaction() {
return (
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/tooltip/Interaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const barChartsParams = {
],
margin: { top: 10, right: 10 },
height: 200,
slotProps: { legend: { hidden: true } },
hideLegend: true,
};
export default function Interaction() {
return (
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/bar-chart-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": { "name": "shape", "description": "{ horizontal?: bool, vertical?: bool }" }
},
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/bar-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": { "name": "shape", "description": "{ horizontal?: bool, vertical?: bool }" }
},
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/line-chart-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"type": { "name": "shape", "description": "{ horizontal?: bool, vertical?: bool }" }
},
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/line-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"type": { "name": "shape", "description": "{ horizontal?: bool, vertical?: bool }" }
},
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/pie-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dataset": { "type": { "name": "arrayOf", "description": "Array&lt;object&gt;" } },
"disableAxisListener": { "type": { "name": "bool" }, "default": "false" },
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/scatter-chart-pro.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": { "name": "shape", "description": "{ horizontal?: bool, vertical?: bool }" }
},
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
1 change: 1 addition & 0 deletions docs/pages/x/api/charts/scatter-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"type": { "name": "shape", "description": "{ horizontal?: bool, vertical?: bool }" }
},
"height": { "type": { "name": "number" } },
"hideLegend": { "type": { "name": "bool" } },
"highlightedItem": {
"type": {
"name": "shape",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"height": {
"description": "The height of the chart in px. If not defined, it takes the height of the parent element."
},
"hideLegend": { "description": "If <code>true</code>, the legend is not rendered." },
"highlightedItem": {
"description": "The item currently highlighted. Turns highlighting into a controlled prop."
},
Expand Down
1 change: 1 addition & 0 deletions docs/translations/api-docs/charts/bar-chart/bar-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"height": {
"description": "The height of the chart in px. If not defined, it takes the height of the parent element."
},
"hideLegend": { "description": "If <code>true</code>, the legend is not rendered." },
"highlightedItem": {
"description": "The item currently highlighted. Turns highlighting into a controlled prop."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"height": {
"description": "The height of the chart in px. If not defined, it takes the height of the parent element."
},
"hideLegend": { "description": "If <code>true</code>, the legend is not rendered." },
"highlightedItem": {
"description": "The item currently highlighted. Turns highlighting into a controlled prop."
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"height": {
"description": "The height of the chart in px. If not defined, it takes the height of the parent element."
},
"hideLegend": { "description": "If <code>true</code>, the legend is not rendered." },
"highlightedItem": {
"description": "The item currently highlighted. Turns highlighting into a controlled prop."
},
Expand Down
1 change: 1 addition & 0 deletions docs/translations/api-docs/charts/pie-chart/pie-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"height": {
"description": "The height of the chart in px. If not defined, it takes the height of the parent element."
},
"hideLegend": { "description": "If <code>true</code>, the legend is not rendered." },
"highlightedItem": {
"description": "The item currently highlighted. Turns highlighting into a controlled prop."
},
Expand Down
Loading