287
287
<!-- HIGHLIGHT AREAS -->
288
288
<g v-for =" oneArea in highlightAreas" >
289
289
<template v-if =" oneArea .show " >
290
+ <!-- HIGHLIGHT AREA FILLED RECT UNITS -->
290
291
<g v-for =" (_, i) in oneArea.span" >
291
- <!-- HIGHLIGHT AREA FILLED RECT UNITS -->
292
292
<rect
293
293
data-cy =" highlight-area"
294
294
:style =" {
301
301
:width =" drawingArea.width / maxSeries < 0 ? 0.00001 : drawingArea.width / maxSeries"
302
302
:fill =" setOpacity(oneArea.color, oneArea.opacity)"
303
303
/>
304
-
305
- <!-- HIGHLIGHT AREA CAPTION -->
304
+ </g >
305
+ <!-- HIGHLIGHT AREA CAPTION -->
306
+ <g v-for =" (_, i) in oneArea.span" >
306
307
<foreignObject v-if =" oneArea.caption.text && i === 0"
307
308
: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)"
308
309
:y =" drawingArea.top + oneArea.caption.offsetY"
@@ -3269,23 +3270,23 @@ export default {
3269
3270
// Title height to substract
3270
3271
let title = null ;
3271
3272
let titleHeight = 0 ;
3272
- if (this .FINAL_CONFIG .chart .title .show ) {
3273
+ if (this .FINAL_CONFIG .chart .title .show && this . $refs . chartTitle ) {
3273
3274
title = this .$refs .chartTitle ;
3274
3275
titleHeight = title .getBoundingClientRect ().height ;
3275
3276
}
3276
3277
3277
3278
// Slicer height to substract
3278
3279
let slicer = null ;
3279
3280
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 ) {
3281
3282
slicer = this .$refs .chartSlicer .$el ;
3282
3283
slicerHeight = slicer .getBoundingClientRect ().height ;
3283
3284
}
3284
3285
3285
3286
// Legend height to substract
3286
3287
let legend = null ;
3287
3288
let legendHeight = 0
3288
- if (this .FINAL_CONFIG .chart .legend .show ) {
3289
+ if (this .FINAL_CONFIG .chart .legend .show && this . $refs . chartLegend ) {
3289
3290
legend = this .$refs .chartLegend ;
3290
3291
legendHeight = legend .getBoundingClientRect ().height ;
3291
3292
}
@@ -3302,27 +3303,54 @@ export default {
3302
3303
noTitleHeight = this .$refs .noTitle .getBoundingClientRect ().height ;
3303
3304
}
3304
3305
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
+
3306
3314
this .width = width;
3307
3315
this .viewBox = ` 0 0 ${ this .width < 0 ? 10 : this .width } ${ this .height < 0 ? 10 : this .height } ` ;
3308
3316
this .convertSizes ();
3309
3317
3310
3318
const ro = new ResizeObserver ((entries ) => {
3311
3319
for (const entry of entries) {
3312
- if (this .$refs .chartTitle ) {
3320
+ if (this .FINAL_CONFIG . chart . title . show && this . $refs .chartTitle ) {
3313
3321
titleHeight = this .$refs .chartTitle .getBoundingClientRect ().height ;
3322
+ } else {
3323
+ titleHeight = 0 ;
3314
3324
}
3315
3325
if (this .$refs .chartSlicer && this .$refs .chartSlicer .$el ) {
3316
3326
slicerHeight = this .$refs .chartSlicer .$el .getBoundingClientRect ().height ;
3327
+ } else {
3328
+ slicerHeight = 0 ;
3317
3329
}
3318
3330
if (this .$refs .chartLegend ) {
3319
3331
legendHeight = this .$refs .chartLegend .getBoundingClientRect ().height ;
3332
+ } else {
3333
+ legendHeight = 0 ;
3320
3334
}
3321
3335
if (this .$refs .source ) {
3322
3336
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 ;
3323
3344
}
3324
3345
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
+
3326
3354
this .width = entry .contentBoxSize [0 ].inlineSize ;
3327
3355
this .viewBox = ` 0 0 ${ this .width < 0 ? 10 : this .width } ${ this .height < 0 ? 10 : this .height } ` ;
3328
3356
this .convertSizes ();
0 commit comments