Skip to content

Commit

Permalink
fix grid bugs for rangebar that occured due to previous refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
junedchhipa committed Sep 21, 2024
1 parent 598dd07 commit 44a21c5
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/modules/axes/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,34 @@ class Grid {
gridAxisIndex = 0
}

const yTickAmount = gl.yAxisScale[gridAxisIndex].result.length - 1
let yTickAmount = gl.yAxisScale[gridAxisIndex].result.length - 1

let xCount

if (!gl.isBarHorizontal || this.isRangeBar) {
xCount = this.xaxisLabels.length

if (this.isRangeBar) {
xCount =
w.config.xaxis.tickAmount ||
gl.yAxisScale[gridAxisIndex].result.length - 1
yTickAmount = gl.labels.length

if (w.config.xaxis.tickAmount && w.config.xaxis.labels.formatter) {
xCount = w.config.xaxis.tickAmount
}
if (
gl.yAxisScale?.[gridAxisIndex]?.result?.length > 0 &&
w.config.xaxis.type !== 'datetime'
) {
xCount = gl.yAxisScale[gridAxisIndex].result.length - 1
}
}

this._drawXYLines({ xCount, tickAmount: yTickAmount })
} else {
xCount = yTickAmount
this._drawInvertedXYLines({ xCount, tickAmount: gl.xTickAmount })

// for horizontal bar chart, get the xaxis tickamount
yTickAmount = gl.xTickAmount
this._drawInvertedXYLines({ xCount, tickAmount: yTickAmount })
}

this.drawGridBands(xCount, yTickAmount)
Expand Down

0 comments on commit 44a21c5

Please sign in to comment.