Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent dfcb87a commit 5fdcbd4
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/report/reporters/boxplot/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,8 @@ const getMaxQuantile = function ({

const getWidths = function (combinations, screenWidth, mini) {
const titleBlockWidth = getTitleBlockWidth(combinations)
const minBlockWidth = mini
? 0
: Math.max(
getHeaderNameWidth('min'),
getMinMaxBlockWidth(combinations, 'min'),
)
const maxBlockWidth = mini
? 0
: Math.max(
getHeaderNameWidth('max'),
getMinMaxBlockWidth(combinations, 'max'),
)
const minBlockWidth = getMinMaxFullWidth(combinations, mini, 'min')
const maxBlockWidth = getMinMaxFullWidth(combinations, mini, 'max')
const contentWidth = Math.max(
screenWidth - titleBlockWidth - minBlockWidth - maxBlockWidth,
1,
Expand All @@ -112,6 +102,15 @@ const getHeader = function ({
return [`${titleHeader}${minHeader}${boxHeader}${maxHeader}`]
}

const getMinMaxFullWidth = function (combinations, mini, statName) {
return mini
? 0
: Math.max(
getHeaderNameWidth(statName),
getMinMaxBlockWidth(combinations, statName),
)
}

const getHeaderNameWidth = function (statName) {
return getHeaderName(statName).length
}
Expand Down

0 comments on commit 5fdcbd4

Please sign in to comment.