diff --git a/api/src/modules/h3-data/h3-data.repository.ts b/api/src/modules/h3-data/h3-data.repository.ts index d58fde712..39a7688b8 100644 --- a/api/src/modules/h3-data/h3-data.repository.ts +++ b/api/src/modules/h3-data/h3-data.repository.ts @@ -765,7 +765,7 @@ export class H3DataRepository extends Repository { * has been don't for the time being to unblock FE. Check with Data if calculus is accurate */ private async calculateQuantiles(tmpTableName: string): Promise { - const N_BINS: number = 7; + const N_BINS: number = 6; // TODO: make threshold configurable by unit const DISPLAY_THRESHOLD: number = 0.01; try { @@ -775,7 +775,8 @@ export class H3DataRepository extends Repository { ); // DISPLAY_THRESHOLD is the threshold for the smallest value to be displayed in the map and legend const max = Math.max(max_q[0]["value"], DISPLAY_THRESHOLD) - let bins: number[] = []; + this.logger.debug(`Computed 99th percentile for ${tmpTableName}: ${max}`); + let bins: number[] = [0]; for (let i = 1; i <= N_BINS; i++) { // Log scale binning value shifted with + 1 // to avoid values < 1, the zone where log behaves badly (rush to -inf for ->0). @@ -787,7 +788,7 @@ export class H3DataRepository extends Repository { let precision: number = bin >= 10? 1: 2; bins.push(Number(bin.toPrecision(precision))); } - this.logger.debug(`Computed data Bins: ${bins}`); + this.logger.debug(`Computed data Bins for ${tmpTableName}: ${bins}`); return bins; } catch (err) { diff --git a/client/src/utils/number-format.ts b/client/src/utils/number-format.ts index 1fd5bf4ae..d056ee2d4 100644 --- a/client/src/utils/number-format.ts +++ b/client/src/utils/number-format.ts @@ -8,7 +8,7 @@ export const SMALL_NUMBER_FORMAT = format('.2~g'); export function formatNumber(number: number): string { if (Math.abs(number) < 1) { - if (Math.abs(number) < 0.001) { + if (Math.abs(number) < 0.001 && Math.abs(number) > 0){ return "< 0.001"; } return SMALL_NUMBER_FORMAT(number)