257257 />
258258
259259 <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" >
261261 <slot name =" plot-comment" :plot =" {...plot, color: serie.color}" />
262262 </foreignObject >
263263 </template >
403403 <text
404404 v-for =" (yLabel, j) in el.yLabels"
405405 :x =" el.x - 5 + xPadding"
406- :y =" yLabel.y + xPadding "
406+ :y =" checkNaN( yLabel.y) + fontSizes.dataLabels / 3 "
407407 :font-size =" fontSizes.dataLabels"
408408 text-anchor =" end"
409409 :fill =" el.color"
659659 :data-cy =" `xy-bar-label-x-${i}-${j}`"
660660 v-if =" plot && (!Object.hasOwn(serie, 'dataLabels') || serie.dataLabels === true) && FINAL_CONFIG.bar.labels.show"
661661 :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)"
663663 text-anchor =" middle"
664664 :font-size =" fontSizes.plotLabels"
665665 :fill =" FINAL_CONFIG.bar.labels.color"
@@ -1625,13 +1625,13 @@ export default {
16251625
16261626
16271627 return {
1628- yOffset,
1629- individualHeight,
1630- x,
1628+ yOffset: this . checkNaN (yOffset) ,
1629+ individualHeight: this . checkNaN (individualHeight) ,
1630+ x: this . checkNaN (x) ,
16311631 y: this .drawingArea .bottom - yOffset - (individualHeight * yRatio),
16321632 value: datapoint .absoluteValues [j],
1633- zeroPosition,
1634- individualMax,
1633+ zeroPosition: this . checkNaN (zeroPosition) ,
1634+ individualMax: this . checkNaN (individualMax) ,
16351635 comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
16361636 }
16371637 });
@@ -1649,13 +1649,13 @@ export default {
16491649 ? this .drawingArea .left + (this .drawingArea .width / this .maxSeries * j)
16501650 : (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 );
16511651 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 ) ),
16561656 value: datapoint .absoluteValues [j],
1657- zeroPosition,
1658- individualMax,
1657+ zeroPosition: this . checkNaN (zeroPosition) ,
1658+ individualMax: this . checkNaN (individualMax) ,
16591659 comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
16601660 }
16611661 });
@@ -1740,8 +1740,8 @@ export default {
17401740 : this .ratioToMax (plot)
17411741
17421742 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) ),
17451745 value: datapoint .absoluteValues [j],
17461746 comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
17471747 }
@@ -1758,8 +1758,8 @@ export default {
17581758 const autoScalePlots = datapoint .series .map ((plot , j ) => {
17591759 if (! [undefined , null ].includes (datapoint .absoluteValues [j])) {
17601760 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 ) ),
17631763 value: datapoint .absoluteValues [j],
17641764 comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
17651765 }
@@ -1838,8 +1838,8 @@ export default {
18381838 const plots = datapoint .series .map ((plot , j ) => {
18391839 const yRatio = this .mutableConfig .useIndividualScale ? ((datapoint .absoluteValues [j] + Math .abs (individualZero)) / individualMax) : this .ratioToMax (plot)
18401840 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) ),
18431843 value: datapoint .absoluteValues [j],
18441844 comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
18451845 }
@@ -1855,8 +1855,8 @@ export default {
18551855
18561856 const autoScalePlots = datapoint .series .map ((plot , j ) => {
18571857 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 ) ),
18601860 value: datapoint .absoluteValues [j],
18611861 comment: datapoint .comments ? datapoint .comments .slice (this .slicer .start , this .slicer .end )[j] || ' ' : ' '
18621862 }
@@ -2409,16 +2409,16 @@ export default {
24092409 },
24102410 calcRectHeight (plot ) {
24112411 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 ) ;
24132413 } 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 ) ;
24152415 }
24162416 },
24172417 calcIndividualHeight (plot ) {
24182418 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 )
24202420 } 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 )
24222422 }
24232423 },
24242424 calcRectWidth () {
@@ -2439,10 +2439,10 @@ export default {
24392439 },
24402440 calcIndividualRectY (plot ) {
24412441 if (plot .value >= 0 ) return plot .y ;
2442- return plot .zeroPosition ;
2442+ return [ null , undefined , NaN , Infinity , - Infinity ]. includes ( plot . zeroPosition ) ? 0 : plot .zeroPosition ;
24432443 },
24442444 canShowValue (value ) {
2445- return ! [null , undefined , NaN ].includes (value);
2445+ return ! [null , undefined , NaN , Infinity , - Infinity ].includes (value);
24462446 },
24472447 findClosestValue (val , arr ) {
24482448 let closest = arr[0 ];
0 commit comments