Skip to content

Commit

Permalink
IE11 - replaced Global Number Constants; fixed y-axis range - fixes #366
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Mar 2, 2019
1 parent 283dac3 commit f5aedee
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

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

4 changes: 2 additions & 2 deletions src/charts/Bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Bar {
this.baseLineY = xyRatios.baseLineY
this.baseLineInvertedY = xyRatios.baseLineInvertedY
}
this.minXDiff = Number.MAX_SAFE_INTEGER
this.minXDiff = -Number.MAX_VALUE
this.yaxisIndex = 0

this.seriesLen = 0
Expand Down Expand Up @@ -388,7 +388,7 @@ class Bar {

if (w.globals.isXNumeric) {
// max barwidth should be equal to minXDiff to avoid overlap
if (this.minXDiff === Number.MAX_SAFE_INTEGER) {
if (this.minXDiff === -Number.MAX_VALUE) {
// possibly a single dataPoint (fixes react-apexcharts/issue#34)
let len = w.globals.labels.length
if (w.globals.timelineLabels.length > 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/modules/CoreUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ class CoreUtils {

gl.logYRange = gl.yRange.map((yRange, i) => {
if (w.config.yaxis[i] && this.w.config.yaxis[i].logarithmic) {
let maxY = Number.MIN_SAFE_INTEGER
let minY = Number.MAX_SAFE_INTEGER
let maxY = -Number.MAX_VALUE
let minY = Number.MIN_VALUE
let range = 1
gl.seriesLog.forEach((s, si) => {
s.forEach((v) => {
Expand Down
9 changes: 3 additions & 6 deletions src/modules/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class Range {

getMinYMaxY(
startingIndex,
lowestY = Number.MAX_VALUE,
highestY = Number.MIN_SAFE_INTEGER,
lowestY = Number.MIN_VALUE,
highestY = -Number.MAX_VALUE,
len = null
) {
const gl = this.w.globals
Expand All @@ -50,9 +50,6 @@ class Range {

for (let i = startingIndex; i < len; i++) {
gl.dataPoints = Math.max(gl.dataPoints, series[i].length)
if (Utils.isIE11()) {
minY = Math.min(...seriesMin[i], 0)
}

for (let j = 0; j < gl.series[i].length; j++) {
if (series[i][j] !== null && Utils.isNumber(series[i][j])) {
Expand Down Expand Up @@ -153,7 +150,7 @@ class Range {
) {
if (
gl.minY === Number.MIN_VALUE &&
lowestYInAllSeries !== Number.MAX_SAFE_INTEGER
lowestYInAllSeries !== -Number.MAX_VALUE
) {
let diff = gl.maxY - lowestYInAllSeries
if (lowestYInAllSeries >= 0 && lowestYInAllSeries <= 10) {
Expand Down
10 changes: 3 additions & 7 deletions src/modules/Scales.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class Range {
if (
(yMin === Number.MIN_VALUE && yMax === 0) ||
(!Utils.isNumber(yMin) && !Utils.isNumber(yMax)) ||
(yMin === Number.MIN_VALUE && yMax === Number.MIN_SAFE_INTEGER)
(yMin === Number.MIN_VALUE && yMax === -Number.MAX_VALUE)
) {
// when all values are 0
yMin = 0
Expand Down Expand Up @@ -337,12 +337,8 @@ export default class Range {
})
})

let sameScaleMin = Array(indices.length)
.fill()
.map((e, i) => Number.MAX_SAFE_INTEGER)
let sameScaleMax = Array(indices.length)
.fill()
.map((e, i) => Number.MIN_SAFE_INTEGER)
let sameScaleMin = Array.apply(null, Array(indices.length)).map(Number.prototype.valueOf,Number.MIN_VALUE);
let sameScaleMax = Array.apply(null, Array(indices.length)).map(Number.prototype.valueOf,-Number.MAX_VALUE);

sameScaleMinYArr.forEach((s, i) => {
s.forEach((sc, j) => {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/settings/Globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export default class Globals {
maxYArr: [],
maxX: -Number.MAX_VALUE, // is -1.7976931348623157e+308
initialmaxX: -Number.MAX_VALUE,
minX: Number.MAX_VALUE, // is 5e-324, i.e. the smallest positive number
initialminX: Number.MAX_VALUE,
minZ: Number.MAX_VALUE, // Max Z value in charts with Z axis
minX: Number.MIN_VALUE, // is 5e-324, i.e. the smallest positive number
initialminX: Number.MIN_VALUE,
minZ: Number.MIN_VALUE, // Max Z value in charts with Z axis
maxZ: -Number.MAX_VALUE, // Max Z value in charts with Z axis
mousedown: false,
lastClientPosition: {}, // don't reset this variable this the chart is destroyed. It is used to detect right or left mousemove in panning
Expand Down

0 comments on commit f5aedee

Please sign in to comment.