Skip to content

Commit

Permalink
Split file
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent 06a3b84 commit 8ea03b9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/report/reporters/histogram/main.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
getCombNamePaddedColor,
getCombinationPaddedName,
} from '../../utils/name.js'
import { getCombNamePaddedColor } from '../../utils/name.js'

import { EXTRA_HEIGHT } from './characters.js'
import { getContent } from './content.js'
import { getEmptyCombination } from './empty.js'
import { getMinBlockWidth, getMaxBlockWidth } from './min_max.js'
import { getWidths } from './width.js'

// Reporter showing distribution of measures with a histogram
// Configuration properties:
Expand Down Expand Up @@ -35,17 +32,6 @@ const reportTerminal = function (
.join('\n')
}

const getWidths = function (combinations, mini, screenWidth) {
const titleBlockWidth = getCombinationPaddedName(combinations[0]).length
const minBlockWidth = getMinBlockWidth(combinations, mini)
const maxBlockWidth = getMaxBlockWidth(combinations, mini)
const contentWidth = Math.max(
screenWidth - titleBlockWidth - minBlockWidth - maxBlockWidth,
1,
)
return { titleBlockWidth, minBlockWidth, contentWidth }
}

const serializeHistogram = function ({
combination,
combination: {
Expand Down
19 changes: 19 additions & 0 deletions src/report/reporters/histogram/width.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { getCombinationPaddedName } from '../../utils/name.js'

import { getMinBlockWidth, getMaxBlockWidth } from './min_max.js'

// Retrieve the width of all blocks, in order:
// - Combination titles
// - Padding space reserved for the leftmost `min`
// - Content, i.e. box plot and their labels
// - Padding space reserved for the rightmost `max`
export const getWidths = function (combinations, mini, screenWidth) {
const titleBlockWidth = getCombinationPaddedName(combinations[0]).length
const minBlockWidth = getMinBlockWidth(combinations, mini)
const maxBlockWidth = getMaxBlockWidth(combinations, mini)
const contentWidth = Math.max(
screenWidth - titleBlockWidth - minBlockWidth - maxBlockWidth,
1,
)
return { titleBlockWidth, minBlockWidth, contentWidth }
}

0 comments on commit 8ea03b9

Please sign in to comment.