Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kangzj committed Feb 27, 2025
1 parent 0577e9e commit 784cd71
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions client/my-sites/stats/components/line-chart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ function StatsLineChart( {
if ( chartData.length <= 1 ) {
return 'linear';
}
const maxValues: number[] = [];
chartData.map( ( series ) => {
maxValues.push( Math.max( ...series.data.map( ( d ) => d.value ) ) );
} );

const maxValues = chartData.map( ( series ) =>
Math.max( ...series.data.map( ( d ) => d.value ) )
);
const [ minMax, maxMax ] = [ Math.min( ...maxValues ), Math.max( ...maxValues ) ];

// Avoid division by zero
Expand All @@ -77,6 +77,7 @@ function StatsLineChart( {
} else if ( scacle >= 200 ) {
return 'log';
}

return 'linear';
}, [ chartData ] );

Expand Down

0 comments on commit 784cd71

Please sign in to comment.