From 91a8a9eec3f2d68a21b44cc94b43e90ff32bfb26 Mon Sep 17 00:00:00 2001 From: Robert Elliott Date: Fri, 7 Sep 2018 14:48:07 +0200 Subject: [PATCH] improve jsdoc and remove Math.round() --- plugins/woocommerce-admin/client/components/chart/utils.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugins/woocommerce-admin/client/components/chart/utils.js b/plugins/woocommerce-admin/client/components/chart/utils.js index 240a7057826..a521e56e6ec 100644 --- a/plugins/woocommerce-admin/client/components/chart/utils.js +++ b/plugins/woocommerce-admin/client/components/chart/utils.js @@ -144,14 +144,12 @@ export const getXLineScale = ( uniqueDates, width ) => .rangeRound( [ 0, width ] ); /** - * Describes getYMax + * Describes and rounds the maximum y value to the nearest thousadn, ten-thousand, million etc. * @param {array} lineData - from `getLineData` * @returns {number} the maximum value in the timeseries multiplied by 4/3 */ export const getYMax = lineData => { - const yMax = Math.round( - 4 / 3 * d3Max( lineData, d => d3Max( d.values.map( date => date.value ) ) ) - ); + const yMax = 4 / 3 * d3Max( lineData, d => d3Max( d.values.map( date => date.value ) ) ); const pow3Y = Math.pow( 10, ( ( Math.log( yMax ) * Math.LOG10E + 1 ) | 0 ) - 2 ) * 3; return Math.ceil( yMax / pow3Y ) * pow3Y; };