Skip to content

Commit

Permalink
y axis fix for very small range - fixes #294
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Feb 2, 2019
1 parent f4ba69a commit 71ef33f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/modules/Crosshairs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Graphics from './Graphics'
import Filters from './Filters'
import Utils from '../utils/Utils';

class Crosshairs {
constructor (ctx) {
Expand Down Expand Up @@ -50,12 +51,13 @@ class Crosshairs {
// to prevent drawing 2 lines, convert rect to line
xcrosshairs = graphics.drawLine()
}

xcrosshairs.attr({
class: 'apexcharts-xcrosshairs',
x: 0,
y: 0,
y2: w.globals.gridHeight,
width: w.config.xaxis.crosshairs.width,
width: Utils.isNumber(w.config.xaxis.crosshairs.width) ? w.config.xaxis.crosshairs.width : 0,
height: w.globals.gridHeight,
fill: xcrosshairsFill,
filter: shadow,
Expand Down
10 changes: 1 addition & 9 deletions src/modules/Range.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,7 @@ class Range {
}

gl.minY = (lowestYInAllSeries - (diff * 5) / 100)

// no negatives present and values are small.
if ((lowestYInAllSeries > 0 && gl.maxY < 50) || (lowestYInAllSeries > 0 && gl.minY < 0)) {
gl.minY = 0
}

if (gl.maxY > 10) {
gl.maxY = (gl.maxY + (diff * 5) / 100) + 0.6
}
gl.maxY = (gl.maxY + (diff * 5) / 100) + 0.01
}
}

Expand Down

0 comments on commit 71ef33f

Please sign in to comment.