Skip to content

Commit

Permalink
fix threshold labels using custom formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
susielu committed Mar 31, 2018
1 parent 4abc067 commit d481be0
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 218 deletions.
66 changes: 37 additions & 29 deletions d3-legend.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion d3-legend.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/d3-legend.min.js

Large diffs are not rendered by default.

58 changes: 33 additions & 25 deletions indexRollup.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion indexRollup.js.map

Large diffs are not rendered by default.

58 changes: 33 additions & 25 deletions indexRollupNext.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion indexRollupNext.js.map

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
export const thresholdLabels = function({ i, genLength, generatedLabels }) {
export const thresholdLabels = function({
i,
genLength,
generatedLabels,
labelDelimiter
}) {
if (i === 0) {
return generatedLabels[i].replace("NaN to", "Less than")
const values = generatedLabels[i].split(` ${labelDelimiter} `)
return `Less than ${values[1]}`
} else if (i === genLength - 1) {
return `${generatedLabels[genLength - 1].replace(" to NaN", "")} or more`
const values = generatedLabels[i].split(` ${labelDelimiter} `)
return `${values[0]} or more`
}
return generatedLabels[i]
}
Expand Down
Loading

0 comments on commit d481be0

Please sign in to comment.