Skip to content

Commit

Permalink
No debugStats
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent af92e56 commit 282920b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/report/reporters/histogram/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const reportTerminal = function (
const serializeCombination = function ({
combination,
combination: {
stats: { histogram, median, min, max },
stats: { histogram, quantiles, min, max },
},
titlesWidth,
minBlockWidth,
Expand All @@ -56,6 +56,7 @@ const serializeCombination = function ({
return getEmptyCombination(combination, height, mini)
}

const median = quantiles[MEDIAN_QUANTILE]
const medianIndex = getMedianIndex({ median, min, max, contentWidth })
const rows = getHistogramRows({
histogram,
Expand All @@ -82,6 +83,10 @@ const serializeCombination = function ({
return `${rows}${abscissa}`
}

// `median` is discouraged by `debugStats`.
// Distribution reporters should use `quantiles` if they do need it.
const MEDIAN_QUANTILE = 50

// Compute the position of the median tick on the screen.
// When `histogram` has a single item, it is in the first bucket.
const getMedianIndex = function ({ median, min, max, contentWidth }) {
Expand All @@ -90,7 +95,4 @@ const getMedianIndex = function ({ median, min, max, contentWidth }) {
return Math.min(Math.floor(percentage * contentWidth), contentWidth - 1)
}

export const histogramReporter = {
reportTerminal,
capabilities: { debugStats: true },
}
export const histogramReporter = { reportTerminal }

0 comments on commit 282920b

Please sign in to comment.