Skip to content

Commit

Permalink
[docs] Address charts docs feedback (#10119)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette authored Aug 23, 2023
1 parent 92d10d9 commit c73fe82
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 52 deletions.
2 changes: 1 addition & 1 deletion docs/data/charts/legend/DimensionsNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function DimensionsNoSnap() {
`<ScatterChart`,
' {/** ... */}',
' legend={{',
` directon: "${props.direction}"`,
` direction: "${props.direction}"`,
' }}',
' sx={{',
...[
Expand Down
2 changes: 1 addition & 1 deletion docs/data/charts/legend/LegendCustomizationNoSnap.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function LegendCustomizationNoSnap() {
' margin={{ top: 70, bottom: 70, left: 100, right:100 }}',
' {/** ... */}',
' legend={{',
` directon: "${props.direction}"`,
` direction: "${props.direction}"`,
' position: {',
` vertical: "${props.vertical}",`,
` horizontal: "${props.horizontal}"`,
Expand Down
48 changes: 0 additions & 48 deletions docs/data/charts/lines/InterpolationDemo.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import TextField from '@mui/material/TextField';
import MenuItem from '@mui/material/MenuItem';
import { LineChart } from '@mui/x-charts/LineChart';

import HighlightedCode from 'docs/src/modules/components/HighlightedCode';

const curveTypes = [
'catmullRom',
'linear',
Expand All @@ -15,7 +17,16 @@ const curveTypes = [
'stepAfter',
];

export default function InterpolationDemo() {
function getExample(curveType) {
return `<LineChart
series={[
{ curve: "${curveType}", data: [0, 5, 2, 6, 3, 9.3] },
{ curve: "${curveType}", data: [6, 3, 7, 9.5, 4, 2] },
]}
{/* ... */}
/>`;
}
export default function InterpolationDemoNoSnap() {
const [curveType, setCurveType] = React.useState('linear');

return (
Expand All @@ -42,6 +53,7 @@ export default function InterpolationDemo() {
height={300}
margin={{ top: 10, bottom: 30 }}
/>
<HighlightedCode code={getExample(curveType)} language="tsx" />
</Box>
);
}
5 changes: 4 additions & 1 deletion docs/data/charts/lines/lines.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ For more information, see [stacking docs](/x/react-charts/stacking/).
The interpolation between data points can be customized by the `curve` property.
This property expects one of the following string values, corresponding to the interpolation method: `'catmullRom'`, `'linear'`, `'monotoneX'`, `'monotoneY'`, `'natural'`, `'step'`, `'stepBefore'`, `'stepAfter'`.

{{"demo": "InterpolationDemo.js", "hideToolbar": true, "bg": "inline"}}
This series property adds the option to control the interpolation of a series.
Different series could even have different interpolations.

{{"demo": "InterpolationDemoNoSnap.js", "hideToolbar": true, "bg": "inline"}}

### CSS

Expand Down

0 comments on commit c73fe82

Please sign in to comment.