Skip to content

Commit 7bf8b22

Browse files
committed
Fix - VueUiXy - Fix scaleMin issue
1 parent fc3bf67 commit 7bf8b22

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/components/vue-ui-xy.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,6 +1583,10 @@ export default {
15831583
return this.FINAL_CONFIG.chart.grid.position === 'middle' ? 0 : this.drawingArea.width / this.maxSeries / 2
15841584
},
15851585
relativeZero() {
1586+
if (![null, undefined].includes(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin)) {
1587+
return -this.niceScale.min
1588+
}
1589+
15861590
if(this.niceScale.min >= 0) return 0;
15871591
return Math.abs(this.niceScale.min);
15881592
},
@@ -1725,7 +1729,6 @@ export default {
17251729
const yRatio = this.mutableConfig.useIndividualScale ? ((datapoint.absoluteValues[j] + individualZero) / individualMax) : this.ratioToMax(plot)
17261730
const x = this.mutableConfig.useIndividualScale && this.mutableConfig.isStacked
17271731
? this.drawingArea.left + (this.drawingArea.width / this.maxSeries * j)
1728-
// : (this.drawingArea.left - this.slot.bar / 2 + (this.slot.bar) * i) + ((this.slot.bar) * j * this.absoluteDataset.filter(ds => ds.type === 'bar').filter(s => !this.segregatedSeries.includes(s.id)).length);
17291732
: this.drawingArea.left
17301733
+ (this.slot.bar * i)
17311734
+ (this.slot.bar * j * barLen)
@@ -2328,7 +2331,7 @@ export default {
23282331
},
23292332
zero(){
23302333
return this.drawingArea.bottom - (this.drawingArea.height * this.ratioToMax(this.relativeZero));
2331-
}
2334+
},
23322335
},
23332336
mounted() {
23342337
// FIXME: all contents must be placed in a func and also called when ds or cfg are updated
@@ -2737,8 +2740,10 @@ export default {
27372740
return v
27382741
},
27392742
calcRectHeight(plot) {
2743+
const zeroForPositiveValuesOnly = ![null, undefined].includes(this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin) && this.FINAL_CONFIG.chart.grid.labels.yAxis.scaleMin > 0 && this.min >= 0 ? this.drawingArea.bottom : this.zero;
2744+
27402745
if(plot.value >= 0) {
2741-
return this.checkNaN(this.zero - plot.y <= 0 ? 0.00001 : this.zero - plot.y);
2746+
return this.checkNaN(zeroForPositiveValuesOnly - plot.y <= 0 ? 0.00001 : zeroForPositiveValuesOnly - plot.y);
27422747
} else {
27432748
return this.checkNaN(plot.y - this.zero <= 0 ? 0.00001 : plot.y - this.zero);
27442749
}

0 commit comments

Comments
 (0)