287287 <!-- HIGHLIGHT AREAS -->
288288 <g v-for =" oneArea in highlightAreas" >
289289 <template v-if =" oneArea .show " >
290+ <!-- HIGHLIGHT AREA FILLED RECT UNITS -->
290291 <g v-for =" (_, i) in oneArea.span" >
291- <!-- HIGHLIGHT AREA FILLED RECT UNITS -->
292292 <rect
293293 data-cy =" highlight-area"
294294 :style =" {
301301 :width =" drawingArea.width / maxSeries < 0 ? 0.00001 : drawingArea.width / maxSeries"
302302 :fill =" setOpacity(oneArea.color, oneArea.opacity)"
303303 />
304-
305- <!-- HIGHLIGHT AREA CAPTION -->
304+ </g >
305+ <!-- HIGHLIGHT AREA CAPTION -->
306+ <g v-for =" (_, i) in oneArea.span" >
306307 <foreignObject v-if =" oneArea.caption.text && i === 0"
307308 :x =" drawingArea.left + (drawingArea.width / maxSeries) * ((oneArea.from + i) - slicer.start) - (oneArea.caption.width === 'auto' ? 0 : oneArea.caption.width / 2 - (drawingArea.width / maxSeries) * oneArea.span / 2)"
308309 :y =" drawingArea.top + oneArea.caption.offsetY"
@@ -3269,23 +3270,23 @@ export default {
32693270 // Title height to substract
32703271 let title = null ;
32713272 let titleHeight = 0 ;
3272- if (this .FINAL_CONFIG .chart .title .show ) {
3273+ if (this .FINAL_CONFIG .chart .title .show && this . $refs . chartTitle ) {
32733274 title = this .$refs .chartTitle ;
32743275 titleHeight = title .getBoundingClientRect ().height ;
32753276 }
32763277
32773278 // Slicer height to substract
32783279 let slicer = null ;
32793280 let slicerHeight = 0 ;
3280- if (this .FINAL_CONFIG .chart .zoom .show && this .maxX > 6 && this .isDataset ) {
3281+ if (this .FINAL_CONFIG .chart .zoom .show && this .maxX > 6 && this .isDataset && this . $refs . chartSlicer && this . $refs . chartSlicer . $el ) {
32813282 slicer = this .$refs .chartSlicer .$el ;
32823283 slicerHeight = slicer .getBoundingClientRect ().height ;
32833284 }
32843285
32853286 // Legend height to substract
32863287 let legend = null ;
32873288 let legendHeight = 0
3288- if (this .FINAL_CONFIG .chart .legend .show ) {
3289+ if (this .FINAL_CONFIG .chart .legend .show && this . $refs . chartLegend ) {
32893290 legend = this .$refs .chartLegend ;
32903291 legendHeight = legend .getBoundingClientRect ().height ;
32913292 }
@@ -3302,27 +3303,54 @@ export default {
33023303 noTitleHeight = this .$refs .noTitle .getBoundingClientRect ().height ;
33033304 }
33043305
3305- this .height = height - titleHeight - legendHeight - slicerHeight - sourceHeight - noTitleHeight;
3306+ this .height = height
3307+ - titleHeight
3308+ - legendHeight
3309+ - slicerHeight
3310+ - sourceHeight
3311+ - noTitleHeight
3312+ - 12 ;
3313+
33063314 this .width = width;
33073315 this .viewBox = ` 0 0 ${ this .width < 0 ? 10 : this .width } ${ this .height < 0 ? 10 : this .height } ` ;
33083316 this .convertSizes ();
33093317
33103318 const ro = new ResizeObserver ((entries ) => {
33113319 for (const entry of entries) {
3312- if (this .$refs .chartTitle ) {
3320+ if (this .FINAL_CONFIG . chart . title . show && this . $refs .chartTitle ) {
33133321 titleHeight = this .$refs .chartTitle .getBoundingClientRect ().height ;
3322+ } else {
3323+ titleHeight = 0 ;
33143324 }
33153325 if (this .$refs .chartSlicer && this .$refs .chartSlicer .$el ) {
33163326 slicerHeight = this .$refs .chartSlicer .$el .getBoundingClientRect ().height ;
3327+ } else {
3328+ slicerHeight = 0 ;
33173329 }
33183330 if (this .$refs .chartLegend ) {
33193331 legendHeight = this .$refs .chartLegend .getBoundingClientRect ().height ;
3332+ } else {
3333+ legendHeight = 0 ;
33203334 }
33213335 if (this .$refs .source ) {
33223336 sourceHeight = this .$refs .source .getBoundingClientRect ().height ;
3337+ } else {
3338+ sourceHeight = 0 ;
3339+ }
3340+ if (this .$refs .noTitle ) {
3341+ noTitleHeight = this .$refs .noTitle .getBoundingClientRect ().height ;
3342+ } else {
3343+ noTitleHeight = 0 ;
33233344 }
33243345 requestAnimationFrame (() => {
3325- this .height = entry .contentBoxSize [0 ].blockSize - titleHeight - legendHeight - slicerHeight - sourceHeight - 24 ;
3346+ this .height = entry .contentRect .height
3347+ - titleHeight
3348+ - legendHeight
3349+ - slicerHeight
3350+ - sourceHeight
3351+ - noTitleHeight
3352+ - 12
3353+
33263354 this .width = entry .contentBoxSize [0 ].inlineSize ;
33273355 this .viewBox = ` 0 0 ${ this .width < 0 ? 10 : this .width } ${ this .height < 0 ? 10 : this .height } ` ;
33283356 this .convertSizes ();
0 commit comments