axidio-styleguide-library1-v2 0.4.25 → 0.4.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3490,6 +3490,8 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3490
3490
|
const margin = this.chartConfiguration.margin;
|
|
3491
3491
|
let width = this.calculateWidth(chartContainer, margin);
|
|
3492
3492
|
let height = this.calculateHeight(verticalstackedcontainer, margin);
|
|
3493
|
+
const minHeight = 300;
|
|
3494
|
+
height = Math.max(height, minHeight);
|
|
3493
3495
|
return { width, height, margin, chartContainer, verticalstackedcontainer };
|
|
3494
3496
|
}
|
|
3495
3497
|
calculateWidth(chartContainer, margin) {
|
|
@@ -3514,23 +3516,28 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3514
3516
|
return width;
|
|
3515
3517
|
}
|
|
3516
3518
|
calculateHeight(verticalstackedcontainer, margin) {
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
if (this.chartConfiguration.isFullScreen && this.chartConfiguration.svgHeight !== 70) {
|
|
3522
|
-
height = this.chartConfiguration.svgHeight;
|
|
3519
|
+
const containerHeight = parseInt(verticalstackedcontainer.style('height')) || 400;
|
|
3520
|
+
let height;
|
|
3521
|
+
if (this.chartConfiguration.isFullScreen) {
|
|
3522
|
+
height = this.chartConfiguration.svgHeight || containerHeight;
|
|
3523
3523
|
}
|
|
3524
|
-
else
|
|
3525
|
-
height
|
|
3524
|
+
else {
|
|
3525
|
+
// FIXED: Use percentage of container height more reliably
|
|
3526
|
+
const svgHeightPercentage = this.chartConfiguration.svgHeight || 70;
|
|
3527
|
+
height = (containerHeight * svgHeightPercentage) / 100;
|
|
3526
3528
|
}
|
|
3529
|
+
// FIXED: Apply margin adjustments consistently
|
|
3530
|
+
height = height - margin.top - margin.bottom;
|
|
3531
|
+
// FIXED: Additional adjustments for headers
|
|
3527
3532
|
if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
|
|
3528
|
-
height
|
|
3533
|
+
height -= 130;
|
|
3529
3534
|
}
|
|
3530
|
-
if (this.
|
|
3531
|
-
height
|
|
3535
|
+
else if (this.isHeaderVisible) {
|
|
3536
|
+
height -= 100;
|
|
3532
3537
|
}
|
|
3533
|
-
|
|
3538
|
+
// FIXED: Add the extra 50px you wanted
|
|
3539
|
+
height += 50;
|
|
3540
|
+
return Math.max(height, 150); // Ensure minimum height
|
|
3534
3541
|
}
|
|
3535
3542
|
createScales(chartContext, dimensions) {
|
|
3536
3543
|
const { data, metaData, lineData, keyList } = chartContext;
|
|
@@ -3556,7 +3563,8 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3556
3563
|
}
|
|
3557
3564
|
const xScaleFromOrigin = d3.scaleBand().domain(groups).range([0, width - rightSvgWidth]);
|
|
3558
3565
|
const xSubgroup = d3.scaleBand().domain(keyList).range([0, x.bandwidth()]);
|
|
3559
|
-
|
|
3566
|
+
// FIXED: Improved max value calculation that considers height
|
|
3567
|
+
const maxValue = this.calculateMaxValue(data, keyList, height);
|
|
3560
3568
|
const y = d3.scaleLinear().domain([0, maxValue]).nice().rangeRound([height, 0]);
|
|
3561
3569
|
let lineYscale = null;
|
|
3562
3570
|
if (lineData) {
|
|
@@ -3574,19 +3582,25 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3574
3582
|
rightSvgWidth,
|
|
3575
3583
|
};
|
|
3576
3584
|
}
|
|
3577
|
-
calculateMaxValue(data, keyList) {
|
|
3585
|
+
calculateMaxValue(data, keyList, height) {
|
|
3578
3586
|
let maxValue = d3.max(data, (d) => d3.max(keyList, (key) => +d[key])) || 0;
|
|
3587
|
+
// FIXED: Better handling for zero values
|
|
3579
3588
|
if (maxValue === 0) {
|
|
3580
3589
|
maxValue = this.chartData.targetLineData
|
|
3581
3590
|
? this.chartData.targetLineData.target + 20
|
|
3582
3591
|
: 100;
|
|
3583
3592
|
}
|
|
3593
|
+
// FIXED: Scale based on available height
|
|
3584
3594
|
if (this.chartConfiguration.customYscale) {
|
|
3585
3595
|
maxValue *= this.chartConfiguration.customYscale;
|
|
3586
3596
|
}
|
|
3597
|
+
else if (height > 400) {
|
|
3598
|
+
// Auto-scale for larger heights
|
|
3599
|
+
maxValue *= 1.2;
|
|
3600
|
+
}
|
|
3587
3601
|
if (this.chartData.targetLineData && maxValue < this.chartData.targetLineData.target) {
|
|
3588
3602
|
const target = this.chartData.targetLineData.target;
|
|
3589
|
-
maxValue = maxValue < 10 && target < 10 ? target + 3 : target + 20
|
|
3603
|
+
maxValue = maxValue < 10 && target < 10 ? target + 3 : target + (target * 0.2); // 20% buffer
|
|
3590
3604
|
}
|
|
3591
3605
|
return maxValue;
|
|
3592
3606
|
}
|
|
@@ -3603,24 +3617,25 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3603
3617
|
createSVGStructure(dimensions) {
|
|
3604
3618
|
const { chartContainer, height, margin } = dimensions;
|
|
3605
3619
|
const rightSvgWidth = 60;
|
|
3606
|
-
// Calculate
|
|
3607
|
-
const
|
|
3620
|
+
// FIXED: Calculate total height including margins and extra space
|
|
3621
|
+
const totalHeight = height + margin.top + margin.bottom + 60; // Added extra 60px
|
|
3608
3622
|
const outerContainer = chartContainer
|
|
3609
3623
|
.append('div')
|
|
3610
3624
|
.attr('id', this.uniqueId)
|
|
3611
3625
|
.attr('class', 'outer-container')
|
|
3612
3626
|
.style('width', '100%')
|
|
3613
|
-
.style('height', `${
|
|
3614
|
-
.style('overflow', 'hidden')
|
|
3627
|
+
.style('height', `${totalHeight}px`) // Use calculated total height
|
|
3628
|
+
.style('overflow', 'hidden')
|
|
3615
3629
|
.style('padding-left', `${margin.left}px`)
|
|
3616
3630
|
.style('padding-right', `${rightSvgWidth}px`)
|
|
3617
3631
|
.style('margin-left', '15px')
|
|
3618
|
-
.style('position', 'relative');
|
|
3619
|
-
|
|
3632
|
+
.style('position', 'relative');
|
|
3633
|
+
const leftSvgWidth = margin.left + 20;
|
|
3634
|
+
// FIXED: Y-axis SVG with proper height
|
|
3620
3635
|
const svgYAxisLeft = outerContainer
|
|
3621
3636
|
.append('svg')
|
|
3622
3637
|
.attr('width', leftSvgWidth)
|
|
3623
|
-
.attr('height',
|
|
3638
|
+
.attr('height', totalHeight)
|
|
3624
3639
|
.style('position', 'absolute')
|
|
3625
3640
|
.style('left', '0')
|
|
3626
3641
|
.style('top', '0')
|
|
@@ -3630,7 +3645,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3630
3645
|
const svgYAxisRight = outerContainer
|
|
3631
3646
|
.append('svg')
|
|
3632
3647
|
.attr('width', rightSvgWidth)
|
|
3633
|
-
.attr('height',
|
|
3648
|
+
.attr('height', totalHeight)
|
|
3634
3649
|
.style('position', 'absolute')
|
|
3635
3650
|
.style('right', '12px')
|
|
3636
3651
|
.style('top', '0')
|
|
@@ -3641,16 +3656,17 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3641
3656
|
.append('div')
|
|
3642
3657
|
.attr('class', 'inner-container')
|
|
3643
3658
|
.style('width', '100%')
|
|
3644
|
-
.style('height',
|
|
3659
|
+
.style('height', `${totalHeight}px`) // Match outer container height
|
|
3645
3660
|
.style('overflow-x', 'auto')
|
|
3646
3661
|
.style('overflow-y', 'hidden');
|
|
3662
|
+
// FIXED: Main SVG with increased height
|
|
3647
3663
|
const svg = innerContainer
|
|
3648
3664
|
.append('svg')
|
|
3649
3665
|
.attr('width', dimensions.width - rightSvgWidth)
|
|
3650
|
-
.attr('height',
|
|
3666
|
+
.attr('height', totalHeight) // Use total height
|
|
3651
3667
|
.append('g')
|
|
3652
3668
|
.attr('transform', `translate(0,${margin.top})`);
|
|
3653
|
-
return { outerContainer, svgYAxisLeft, svgYAxisRight, svg };
|
|
3669
|
+
return { outerContainer, svgYAxisLeft, svgYAxisRight, svg, totalHeight };
|
|
3654
3670
|
}
|
|
3655
3671
|
renderAxes(svgElements, scales, chartContext, dimensions) {
|
|
3656
3672
|
const { svg, svgYAxisLeft, svgYAxisRight } = svgElements;
|
|
@@ -3900,9 +3916,17 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3900
3916
|
.attr('class', 'bars')
|
|
3901
3917
|
.on('click', (d) => this.handleBarClick(d, metaData))
|
|
3902
3918
|
.attr('x', (d) => this.getBarX(d, data, x, xSubgroup))
|
|
3903
|
-
.attr('y', (d) =>
|
|
3919
|
+
.attr('y', (d) => {
|
|
3920
|
+
// FIXED: Ensure bars start from correct Y position
|
|
3921
|
+
const value = d.value === -1 ? 0 : d.value;
|
|
3922
|
+
return y(value);
|
|
3923
|
+
})
|
|
3904
3924
|
.attr('width', (d) => this.getBarWidth(d, data, x, xSubgroup))
|
|
3905
|
-
.attr('height', (d) =>
|
|
3925
|
+
.attr('height', (d) => {
|
|
3926
|
+
// FIXED: Improved height calculation
|
|
3927
|
+
const value = d.value === -1 ? 0 : d.value;
|
|
3928
|
+
return height - y(value);
|
|
3929
|
+
})
|
|
3906
3930
|
.style('cursor', (d) => (metaData.hasDrillDown && !isRia ? 'pointer' : 'default'))
|
|
3907
3931
|
.attr('fill', (d) => this.getBarColor(d, metaData));
|
|
3908
3932
|
if (!isRia && (this.chartConfiguration.displayTitleOnTop || (!this.chartConfiguration.textsOnBar && !this.chartConfiguration.displayTitleOnTop))) {
|