Skip to content

Commit

Permalink
scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Apr 15, 2024
1 parent 51fb4a9 commit ccf6bb6
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 32 deletions.
5 changes: 2 additions & 3 deletions docs/data/charts/axis/ModifyAxisPosition.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '@mui/x-charts/constants';
import { ScatterChart } from '@mui/x-charts/ScatterChart';
import { Chance } from 'chance';

Expand All @@ -22,8 +21,8 @@ export default function ModifyAxisPosition() {
{...params}
leftAxis={null}
bottomAxis={null}
topAxis={DEFAULT_X_AXIS_KEY}
rightAxis={DEFAULT_Y_AXIS_KEY}
topAxis={{}}
rightAxis={{}}
margin={{ top: 30, bottom: 10 }}
/>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions docs/data/charts/axis/ModifyAxisPosition.tsx.preview
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{...params}
leftAxis={null}
bottomAxis={null}
topAxis={DEFAULT_X_AXIS_KEY}
rightAxis={DEFAULT_Y_AXIS_KEY}
topAxis={{}}
rightAxis={{}}
margin={{ top: 30, bottom: 10 }}
/>
4 changes: 2 additions & 2 deletions docs/translations/api-docs/charts/bar-chart/bar-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
"description": "The width of the chart in px. If not defined, it takes the width of the parent element."
},
"xAxis": {
"description": "The configuration of the x-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_X_AXIS_KEY</code>."
"description": "The configuration of the x-axes. If not provided, a default axis config is used."
},
"yAxis": {
"description": "The configuration of the y-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_Y_AXIS_KEY</code>."
"description": "The configuration of the y-axes. If not provided, a default axis config is used."
}
},
"classDescriptions": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
},
"width": { "description": "The width of the chart in px." },
"xAxis": {
"description": "The configuration of the x-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_X_AXIS_KEY</code>."
"description": "The configuration of the x-axes. If not provided, a default axis config is used."
},
"yAxis": {
"description": "The configuration of the y-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_Y_AXIS_KEY</code>."
"description": "The configuration of the y-axes. If not provided, a default axis config is used."
}
},
"classDescriptions": {}
Expand Down
4 changes: 2 additions & 2 deletions docs/translations/api-docs/charts/line-chart/line-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
"description": "The width of the chart in px. If not defined, it takes the width of the parent element."
},
"xAxis": {
"description": "The configuration of the x-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_X_AXIS_KEY</code>."
"description": "The configuration of the x-axes. If not provided, a default axis config is used."
},
"yAxis": {
"description": "The configuration of the y-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_Y_AXIS_KEY</code>."
"description": "The configuration of the y-axes. If not provided, a default axis config is used."
}
},
"classDescriptions": {},
Expand Down
4 changes: 2 additions & 2 deletions docs/translations/api-docs/charts/pie-chart/pie-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
"description": "The width of the chart in px. If not defined, it takes the width of the parent element."
},
"xAxis": {
"description": "The configuration of the x-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_X_AXIS_KEY</code>."
"description": "The configuration of the x-axes. If not provided, a default axis config is used."
},
"yAxis": {
"description": "The configuration of the y-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_Y_AXIS_KEY</code>."
"description": "The configuration of the y-axes. If not provided, a default axis config is used."
}
},
"classDescriptions": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
"description": "The width of the chart in px. If not defined, it takes the width of the parent element."
},
"xAxis": {
"description": "The configuration of the x-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_X_AXIS_KEY</code>."
"description": "The configuration of the x-axes. If not provided, a default axis config is used."
},
"yAxis": {
"description": "The configuration of the y-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_Y_AXIS_KEY</code>."
"description": "The configuration of the y-axes. If not provided, a default axis config is used."
}
},
"classDescriptions": {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
"description": "The width of the chart in px. If not defined, it takes the width of the parent element."
},
"xAxis": {
"description": "The configuration of the x-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_X_AXIS_KEY</code>."
"description": "The configuration of the x-axes. If not provided, a default axis config is used."
},
"yAxis": {
"description": "The configuration of the y-axes. If not provided, a default axis config is used with id set to <code>DEFAULT_Y_AXIS_KEY</code>."
"description": "The configuration of the y-axes. If not provided, a default axis config is used."
}
},
"classDescriptions": {},
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ BarChart.propTypes = {
width: PropTypes.number,
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
xAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down Expand Up @@ -555,7 +555,7 @@ BarChart.propTypes = {
),
/**
* The configuration of the y-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
yAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/ChartContainer/ChartContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ ChartContainer.propTypes = {
width: PropTypes.number.isRequired,
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
xAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down Expand Up @@ -206,7 +206,7 @@ ChartContainer.propTypes = {
),
/**
* The configuration of the y-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
yAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down
7 changes: 4 additions & 3 deletions packages/x-charts/src/ChartsAxis/ChartsAxis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ export interface ChartsAxisProps {

const getAxisId = (
propsValue: undefined | null | string | ChartsXAxisProps | ChartsYAxisProps,
defaultAxisId?: string,
): AxisId | null => {
if (propsValue == null) {
return null;
}
if (typeof propsValue === 'object') {
return propsValue.axisId ?? null;
return propsValue.axisId ?? defaultAxisId ?? null;
}
return propsValue;
};
Expand Down Expand Up @@ -92,8 +93,8 @@ function ChartsAxis(props: ChartsAxisProps) {

const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis);
const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis);
const topId = getAxisId(topAxis);
const rightId = getAxisId(rightAxis);
const topId = getAxisId(topAxis, xAxisIds[0]);
const rightId = getAxisId(rightAxis, yAxisIds[0]);

if (topId !== null && !xAxis[topId]) {
throw Error(
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ LineChart.propTypes = {
width: PropTypes.number,
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
xAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down Expand Up @@ -589,7 +589,7 @@ LineChart.propTypes = {
),
/**
* The configuration of the y-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
yAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/PieChart/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ PieChart.propTypes = {
width: PropTypes.number,
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
xAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down Expand Up @@ -520,7 +520,7 @@ PieChart.propTypes = {
),
/**
* The configuration of the y-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
yAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ ResponsiveChartContainer.propTypes = {
width: PropTypes.number,
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
xAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down Expand Up @@ -184,7 +184,7 @@ ResponsiveChartContainer.propTypes = {
),
/**
* The configuration of the y-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
yAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down
4 changes: 2 additions & 2 deletions packages/x-charts/src/ScatterChart/ScatterChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ ScatterChart.propTypes = {
width: PropTypes.number,
/**
* The configuration of the x-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
xAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down Expand Up @@ -515,7 +515,7 @@ ScatterChart.propTypes = {
),
/**
* The configuration of the y-axes.
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
* If not provided, a default axis config is used.
*/
yAxis: PropTypes.arrayOf(
PropTypes.shape({
Expand Down

0 comments on commit ccf6bb6

Please sign in to comment.