Created
September 17, 2015 14:37
-
-
Save eliseumds/db181a5f05ec0c2f22f8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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