From 748c68898e0407bb4a8bc6821a9e8682eb4ce487 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Thu, 8 Feb 2024 18:29:22 +0100 Subject: [PATCH] [charts][docs] Improve (v: number | null) docs --- docs/data/charts/lines/LineDataset.js | 2 +- docs/data/charts/lines/LineDataset.tsx | 2 +- docs/data/charts/tooltip/Formatting.js | 4 ++-- docs/data/charts/tooltip/Formatting.tsx | 4 ++-- docs/data/charts/tooltip/Formatting.tsx.preview | 4 ++-- docs/pages/x/api/charts/spark-line-chart.json | 2 +- packages/x-charts/src/SparkLineChart/SparkLineChart.tsx | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/data/charts/lines/LineDataset.js b/docs/data/charts/lines/LineDataset.js index 0e05117c04945..34f6f21b7bb37 100644 --- a/docs/data/charts/lines/LineDataset.js +++ b/docs/data/charts/lines/LineDataset.js @@ -541,7 +541,7 @@ export default function LineDataset() { xAxis={[ { dataKey: 'year', - valueFormatter: (v) => v.toString(), + valueFormatter: (value) => value.toString(), min: 1985, max: 2022, }, diff --git a/docs/data/charts/lines/LineDataset.tsx b/docs/data/charts/lines/LineDataset.tsx index 00588a9035f93..4efe4d2281e42 100644 --- a/docs/data/charts/lines/LineDataset.tsx +++ b/docs/data/charts/lines/LineDataset.tsx @@ -542,7 +542,7 @@ export default function LineDataset() { xAxis={[ { dataKey: 'year', - valueFormatter: (v) => v.toString(), + valueFormatter: (value) => value.toString(), min: 1985, max: 2022, }, diff --git a/docs/data/charts/tooltip/Formatting.js b/docs/data/charts/tooltip/Formatting.js index 10dc1544a795f..e9ff77e252545 100644 --- a/docs/data/charts/tooltip/Formatting.js +++ b/docs/data/charts/tooltip/Formatting.js @@ -87,8 +87,8 @@ export default function Formatting() { ({ - ...s, + series={lineChartsParams.series.map((serie) => ({ + ...serie, valueFormatter: currencyFormatter, }))} /> diff --git a/docs/data/charts/tooltip/Formatting.tsx b/docs/data/charts/tooltip/Formatting.tsx index 91c2e822604a1..6384957f71a68 100644 --- a/docs/data/charts/tooltip/Formatting.tsx +++ b/docs/data/charts/tooltip/Formatting.tsx @@ -87,8 +87,8 @@ export default function Formatting() { ({ - ...s, + series={lineChartsParams.series.map((serie) => ({ + ...serie, valueFormatter: currencyFormatter, }))} /> diff --git a/docs/data/charts/tooltip/Formatting.tsx.preview b/docs/data/charts/tooltip/Formatting.tsx.preview index 78b79ddf0b6b6..0c659b2551fbf 100644 --- a/docs/data/charts/tooltip/Formatting.tsx.preview +++ b/docs/data/charts/tooltip/Formatting.tsx.preview @@ -1,8 +1,8 @@ ({ - ...s, + series={lineChartsParams.series.map((serie) => ({ + ...serie, valueFormatter: currencyFormatter, }))} /> \ No newline at end of file diff --git a/docs/pages/x/api/charts/spark-line-chart.json b/docs/pages/x/api/charts/spark-line-chart.json index 3bc629b180e12..e98af23cd828b 100644 --- a/docs/pages/x/api/charts/spark-line-chart.json +++ b/docs/pages/x/api/charts/spark-line-chart.json @@ -33,7 +33,7 @@ }, "valueFormatter": { "type": { "name": "func" }, - "default": "(v: number | null) => (v === null ? '' : v.toString())", + "default": "(value: number | null) => (value === null ? '' : value.toString())", "signature": { "type": "function(value: number) => string", "describedArgs": ["value"], diff --git a/packages/x-charts/src/SparkLineChart/SparkLineChart.tsx b/packages/x-charts/src/SparkLineChart/SparkLineChart.tsx index aea14b0e94aef..9a3d8e1089588 100644 --- a/packages/x-charts/src/SparkLineChart/SparkLineChart.tsx +++ b/packages/x-charts/src/SparkLineChart/SparkLineChart.tsx @@ -61,7 +61,7 @@ export interface SparkLineChartProps * Formatter used by the tooltip. * @param {number} value The value to format. * @returns {string} the formatted value. - * @default (v: number | null) => (v === null ? '' : v.toString()) + * @default (value: number | null) => (value === null ? '' : value.toString()) */ valueFormatter?: (value: number | null) => string; /** @@ -143,7 +143,7 @@ const SparkLineChart = React.forwardRef(function SparkLineChart(props: SparkLine slotProps, data, plotType = 'line', - valueFormatter = (v: number | null) => (v === null ? '' : v.toString()), + valueFormatter = (value: number | null) => (value === null ? '' : value.toString()), area, curve = 'linear', } = props; @@ -328,7 +328,7 @@ SparkLineChart.propTypes = { * Formatter used by the tooltip. * @param {number} value The value to format. * @returns {string} the formatted value. - * @default (v: number | null) => (v === null ? '' : v.toString()) + * @default (value: number | null) => (value === null ? '' : value.toString()) */ valueFormatter: PropTypes.func, viewBox: PropTypes.shape({