Skip to content

Instantly share code, notes, and snippets.

@eliseumds
Created September 17, 2015 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliseumds/db181a5f05ec0c2f22f8 to your computer and use it in GitHub Desktop.
Save eliseumds/db181a5f05ec0c2f22f8 to your computer and use it in GitHub Desktop.
getXrange(data) {
const xRange = this.props.xRange
let max = -Infinity
let min = Infinity
if (xRange.max) {
max = xRange.max
}
if (xRange.min) {
min = xRange.min
if (xRange.pivotNumber) {
max = min.clone().add(xRange.pivotNumber, this.props.pivot)
}
}
if (min !== Infinity && max !== -Infinity) {
return new Range(min, max)
}
for (let row of data) {
let value = this.getXvalue(row)
let maxv = this.getXmax(row, value)
if (maxv > max) {
max = maxv
}
if (value < min) {
min = value
}
}
return new Range(min, max)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment