257
257
/>
258
258
259
259
<template v-if =" plot .comment && FINAL_CONFIG .chart .comments .show " >
260
- <foreignObject style =" overflow : visible " height =" 12" :width =" (calcRectWidth() - (mutableConfig.useIndividualScale && mutableConfig.isStacked ? 0 : barPeriodGap) < 0 ? 0.00001 : calcRectWidth() - (mutableConfig.useIndividualScale && mutableConfig.isStacked ? 0 : barPeriodGap) / 2) + FINAL_CONFIG.chart.comments.width" :x =" calcRectX(plot) - (FINAL_CONFIG.chart.comments.width / 2) + FINAL_CONFIG.chart.comments.offsetX" :y =" plot.y + FINAL_CONFIG.chart.comments.offsetY + 6" >
260
+ <foreignObject style =" overflow : visible " height =" 12" :width =" (calcRectWidth() - (mutableConfig.useIndividualScale && mutableConfig.isStacked ? 0 : barPeriodGap) < 0 ? 0.00001 : calcRectWidth() - (mutableConfig.useIndividualScale && mutableConfig.isStacked ? 0 : barPeriodGap) / 2) + FINAL_CONFIG.chart.comments.width" :x =" calcRectX(plot) - (FINAL_CONFIG.chart.comments.width / 2) + FINAL_CONFIG.chart.comments.offsetX" :y =" checkNaN( plot.y) + FINAL_CONFIG.chart.comments.offsetY + 6" >
261
261
<slot name =" plot-comment" :plot =" {...plot, color: serie.color}" />
262
262
</foreignObject >
263
263
</template >
403
403
<text
404
404
v-for =" (yLabel, j) in el.yLabels"
405
405
:x =" el.x - 5 + xPadding"
406
- :y =" yLabel.y + xPadding "
406
+ :y =" checkNaN( yLabel.y) + fontSizes.dataLabels / 3 "
407
407
:font-size =" fontSizes.dataLabels"
408
408
text-anchor =" end"
409
409
:fill =" el.color"
659
659
:data-cy =" `xy-bar-label-x-${i}-${j}`"
660
660
v-if =" plot && (!Object.hasOwn(serie, 'dataLabels') || serie.dataLabels === true) && FINAL_CONFIG.bar.labels.show"
661
661
:x =" mutableConfig.useIndividualScale && mutableConfig.isStacked ? plot.x + slot.line / 2 : calcRectX(plot) + calcRectWidth() / 2 - barPeriodGap / 2"
662
- :y =" plot.y + (plot.value > 0 ? FINAL_CONFIG.bar.labels.offsetY : - FINAL_CONFIG.bar.labels.offsetY * 3)"
662
+ :y =" checkNaN( plot.y) + (plot.value > 0 ? FINAL_CONFIG.bar.labels.offsetY : - FINAL_CONFIG.bar.labels.offsetY * 3)"
663
663
text-anchor =" middle"
664
664
:font-size =" fontSizes.plotLabels"
665
665
:fill =" FINAL_CONFIG.bar.labels.color"
@@ -1625,13 +1625,13 @@ export default {
1625
1625
1626
1626
1627
1627
return {
1628
- yOffset,
1629
- individualHeight,
1630
- x,
1628
+ yOffset: this . checkNaN (yOffset) ,
1629
+ individualHeight: this . checkNaN (individualHeight) ,
1630
+ x: this . checkNaN (x) ,
1631
1631
y: this .drawingArea .bottom - yOffset - (individualHeight * yRatio),
1632
1632
value: datapoint .absoluteValues [j],
1633
- zeroPosition,
1634
- individualMax,
1633
+ zeroPosition: this . checkNaN (zeroPosition) ,
1634
+ individualMax: this . checkNaN (individualMax) ,
1635
1635
comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
1636
1636
}
1637
1637
});
@@ -1649,13 +1649,13 @@ export default {
1649
1649
? this .drawingArea .left + (this .drawingArea .width / this .maxSeries * j)
1650
1650
: (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 );
1651
1651
return {
1652
- yOffset,
1653
- individualHeight,
1654
- x,
1655
- y: this .drawingArea .bottom - yOffset - ((individualHeight * autoScaleRatiosToNiceScale[j]) || 0 ),
1652
+ yOffset: this . checkNaN (yOffset) ,
1653
+ individualHeight: this . checkNaN (individualHeight) ,
1654
+ x: this . checkNaN (x) ,
1655
+ y: this .checkNaN ( this . drawingArea .bottom - this . checkNaN ( yOffset) - ((this . checkNaN ( individualHeight) * autoScaleRatiosToNiceScale[j]) || 0 ) ),
1656
1656
value: datapoint .absoluteValues [j],
1657
- zeroPosition,
1658
- individualMax,
1657
+ zeroPosition: this . checkNaN (zeroPosition) ,
1658
+ individualMax: this . checkNaN (individualMax) ,
1659
1659
comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
1660
1660
}
1661
1661
});
@@ -1740,8 +1740,8 @@ export default {
1740
1740
: this .ratioToMax (plot)
1741
1741
1742
1742
return {
1743
- x: ( this .drawingArea .left + (this .slot .line / 2 )) + (this .slot .line * j),
1744
- y: this .drawingArea .bottom - yOffset - (individualHeight * yRatio),
1743
+ x: this . checkNaN (( this .drawingArea .left + (this .slot .line / 2 )) + (this .slot .line * j) ),
1744
+ y: this .checkNaN ( this . drawingArea .bottom - yOffset - (individualHeight * yRatio) ),
1745
1745
value: datapoint .absoluteValues [j],
1746
1746
comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
1747
1747
}
@@ -1758,8 +1758,8 @@ export default {
1758
1758
const autoScalePlots = datapoint .series .map ((plot , j ) => {
1759
1759
if (! [undefined , null ].includes (datapoint .absoluteValues [j])) {
1760
1760
return {
1761
- x: ( this .drawingArea .left + (this .slot .line / 2 )) + (this .slot .line * j),
1762
- y: this .drawingArea .bottom - yOffset - ((individualHeight * autoScaleRatiosToNiceScale[j]) || 0 ),
1761
+ x: this . checkNaN (( this .drawingArea .left + (this .slot .line / 2 )) + (this .slot .line * j) ),
1762
+ y: this .checkNaN ( this . drawingArea .bottom - yOffset - ((individualHeight * autoScaleRatiosToNiceScale[j]) || 0 ) ),
1763
1763
value: datapoint .absoluteValues [j],
1764
1764
comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
1765
1765
}
@@ -1838,8 +1838,8 @@ export default {
1838
1838
const plots = datapoint .series .map ((plot , j ) => {
1839
1839
const yRatio = this .mutableConfig .useIndividualScale ? ((datapoint .absoluteValues [j] + Math .abs (individualZero)) / individualMax) : this .ratioToMax (plot)
1840
1840
return {
1841
- x: ( this .drawingArea .left + (this .slot .plot / 2 )) + (this .slot .plot * j),
1842
- y: this .drawingArea .bottom - yOffset - (individualHeight * yRatio),
1841
+ x: this . checkNaN (( this .drawingArea .left + (this .slot .plot / 2 )) + (this .slot .plot * j) ),
1842
+ y: this .checkNaN ( this . drawingArea .bottom - yOffset - (individualHeight * yRatio) ),
1843
1843
value: datapoint .absoluteValues [j],
1844
1844
comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
1845
1845
}
@@ -1855,8 +1855,8 @@ export default {
1855
1855
1856
1856
const autoScalePlots = datapoint .series .map ((plot , j ) => {
1857
1857
return {
1858
- x: ( this .drawingArea .left + (this .slot .plot / 2 )) + (this .slot .plot * j),
1859
- y: this .drawingArea .bottom - yOffset - ((individualHeight * autoScaleRatiosToNiceScale[j]) || 0 ),
1858
+ x: this . checkNaN (( this .drawingArea .left + (this .slot .plot / 2 )) + (this .slot .plot * j) ),
1859
+ y: this .checkNaN ( this . drawingArea .bottom - yOffset - ((individualHeight * autoScaleRatiosToNiceScale[j]) || 0 ) ),
1860
1860
value: datapoint .absoluteValues [j],
1861
1861
comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
1862
1862
}
@@ -2409,16 +2409,16 @@ export default {
2409
2409
},
2410
2410
calcRectHeight (plot ) {
2411
2411
if (plot .value >= 0 ) {
2412
- return this .zero - plot .y <= 0 ? 0.00001 : this .zero - plot .y ;
2412
+ return this .checkNaN ( this . zero - plot .y <= 0 ? 0.00001 : this .zero - plot .y ) ;
2413
2413
} else {
2414
- return plot .y - this .zero <= 0 ? 0.00001 : plot .y - this .zero ;
2414
+ return this . checkNaN ( plot .y - this .zero <= 0 ? 0.00001 : plot .y - this .zero ) ;
2415
2415
}
2416
2416
},
2417
2417
calcIndividualHeight (plot ) {
2418
2418
if (plot .value >= 0 ) {
2419
- return plot .zeroPosition - plot .y <= 0 ? 0.00001 : plot .zeroPosition - plot .y
2419
+ return this . checkNaN ( plot .zeroPosition - plot .y <= 0 ? 0.00001 : plot .zeroPosition - plot .y )
2420
2420
} else {
2421
- return plot .y - plot .zeroPosition <= 0 ? 0.00001 : plot .zeroPosition - plot .y
2421
+ return this . checkNaN ( plot .y - plot .zeroPosition <= 0 ? 0.00001 : plot .zeroPosition - plot .y )
2422
2422
}
2423
2423
},
2424
2424
calcRectWidth () {
@@ -2439,10 +2439,10 @@ export default {
2439
2439
},
2440
2440
calcIndividualRectY (plot ) {
2441
2441
if (plot .value >= 0 ) return plot .y ;
2442
- return plot .zeroPosition ;
2442
+ return [ null , undefined , NaN , Infinity , - Infinity ]. includes ( plot . zeroPosition ) ? 0 : plot .zeroPosition ;
2443
2443
},
2444
2444
canShowValue (value ) {
2445
- return ! [null , undefined , NaN ].includes (value);
2445
+ return ! [null , undefined , NaN , Infinity , - Infinity ].includes (value);
2446
2446
},
2447
2447
findClosestValue (val , arr ) {
2448
2448
let closest = arr[0 ];
0 commit comments