Skip to content

Commit

Permalink
[charts][docs] Avoid use of shorthand (#12000)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored and web-flow committed Feb 9, 2024
1 parent 385aa21 commit b330095
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/data/charts/lines/LineDataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ export default function LineDataset() {
xAxis={[
{
dataKey: 'year',
valueFormatter: (v) => v.toString(),
valueFormatter: (value) => value.toString(),
min: 1985,
max: 2022,
},
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 @@ -542,7 +542,7 @@ export default function LineDataset() {
xAxis={[
{
dataKey: 'year',
valueFormatter: (v) => v.toString(),
valueFormatter: (value) => value.toString(),
min: 1985,
max: 2022,
},
Expand Down
6 changes: 3 additions & 3 deletions docs/data/charts/tooltip/Formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export default function Formatting() {
return (
<LineChart
{...lineChartsParams}
xAxis={[{ data: years, scaleType: 'time', valueFormatter: yearFormater }]}
series={lineChartsParams.series.map((s) => ({
...s,
xAxis={[{ data: years, scaleType: 'time', valueFormatter: yearFormatter }]}
series={lineChartsParams.series.map((serie) => ({
...serie,
valueFormatter: currencyFormatter,
}))}
/>
Expand Down
6 changes: 3 additions & 3 deletions docs/data/charts/tooltip/Formatting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export default function Formatting() {
return (
<LineChart
{...lineChartsParams}
xAxis={[{ data: years, scaleType: 'time', valueFormatter: yearFormater }]}
series={lineChartsParams.series.map((s) => ({
...s,
xAxis={[{ data: years, scaleType: 'time', valueFormatter: yearFormatter }]}
series={lineChartsParams.series.map((serie) => ({
...serie,
valueFormatter: currencyFormatter,
}))}
/>
Expand Down
6 changes: 3 additions & 3 deletions docs/data/charts/tooltip/Formatting.tsx.preview
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<LineChart
{...lineChartsParams}
xAxis={[{ data: years, scaleType: 'time', valueFormatter: yearFormater }]}
series={lineChartsParams.series.map((s) => ({
...s,
xAxis={[{ data: years, scaleType: 'time', valueFormatter: yearFormatter }]}
series={lineChartsParams.series.map((serie) => ({
...serie,
valueFormatter: currencyFormatter,
}))}
/>
2 changes: 1 addition & 1 deletion docs/pages/x/api/charts/spark-line-chart.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"valueFormatter": {
"type": { "name": "func" },
"default": "(v: number) => v.toString()",
"default": "(value: number | null) => (value === null ? '' : value.toString())",
"signature": {
"type": "function(value: number) => string",
"describedArgs": ["value"],
Expand Down
6 changes: 3 additions & 3 deletions packages/x-charts/src/SparkLineChart/SparkLineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface SparkLineChartProps
* Formatter used by the tooltip.
* @param {number} value The value to format.
* @returns {string} the formatted value.
* @default (v: number) => v.toString()
* @default (value: number | null) => (value === null ? '' : value.toString())
*/
valueFormatter?: (value: number) => string;
/**
Expand Down Expand Up @@ -146,7 +146,7 @@ const SparkLineChart = React.forwardRef(function SparkLineChart(props: SparkLine
slotProps,
data,
plotType = 'line',
valueFormatter = (v: number) => v.toString(),
valueFormatter = (value: number | null) => (value === null ? '' : value.toString()),
area,
curve = 'linear',
} = props;
Expand Down Expand Up @@ -326,7 +326,7 @@ SparkLineChart.propTypes = {
* Formatter used by the tooltip.
* @param {number} value The value to format.
* @returns {string} the formatted value.
* @default (v: number) => v.toString()
* @default (value: number | null) => (value === null ? '' : value.toString())
*/
valueFormatter: PropTypes.func,
viewBox: PropTypes.shape({
Expand Down

0 comments on commit b330095

Please sign in to comment.