axidio-styleguide-library1-v2 0.4.16 → 0.4.17
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.
|
@@ -3388,10 +3388,10 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3388
3388
|
this.objectKeys = Object.keys;
|
|
3389
3389
|
this.defaultConfiguration = {
|
|
3390
3390
|
margin: {
|
|
3391
|
-
top:
|
|
3391
|
+
top: 10, // FIXED: Further reduced for tighter fit
|
|
3392
3392
|
right: 40,
|
|
3393
|
-
bottom:
|
|
3394
|
-
left:
|
|
3393
|
+
bottom: 45, // FIXED: Reduced for chart to fit inside box
|
|
3394
|
+
left: 110 // FIXED: Increased to accommodate label + gap + values
|
|
3395
3395
|
},
|
|
3396
3396
|
labelFormatter: ChartHelper.defaultFormatter,
|
|
3397
3397
|
svgHeight: 70,
|
|
@@ -3458,12 +3458,6 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3458
3458
|
for (const key in this.defaultConfiguration) {
|
|
3459
3459
|
this.chartConfiguration[key] = ChartHelper.getValueByConfigurationType(key, this.defaultConfiguration, this.customChartConfiguration);
|
|
3460
3460
|
}
|
|
3461
|
-
if (this.customChartConfiguration?.margin) {
|
|
3462
|
-
this.chartConfiguration.margin = {
|
|
3463
|
-
...this.defaultConfiguration.margin,
|
|
3464
|
-
...this.customChartConfiguration.margin
|
|
3465
|
-
};
|
|
3466
|
-
}
|
|
3467
3461
|
if (this.chartConfiguration.isHeaderVisible !== undefined) {
|
|
3468
3462
|
this.isHeaderVisible = this.chartConfiguration.isHeaderVisible;
|
|
3469
3463
|
}
|
|
@@ -3520,36 +3514,28 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3520
3514
|
return width;
|
|
3521
3515
|
}
|
|
3522
3516
|
calculateHeight(verticalstackedcontainer, margin) {
|
|
3523
|
-
|
|
3524
|
-
let containerHeight = parseInt(verticalstackedcontainer.style('height'));
|
|
3525
|
-
let height = containerHeight *
|
|
3517
|
+
let height = parseInt(verticalstackedcontainer.style('height')) *
|
|
3526
3518
|
(this.chartConfiguration.svgHeight / 100) -
|
|
3527
3519
|
margin.top -
|
|
3528
3520
|
margin.bottom;
|
|
3529
3521
|
if (this.chartConfiguration.isFullScreen && this.chartConfiguration.svgHeight !== 70) {
|
|
3530
|
-
height = this.chartConfiguration.svgHeight
|
|
3522
|
+
height = this.chartConfiguration.svgHeight;
|
|
3531
3523
|
}
|
|
3532
3524
|
else if (this.chartConfiguration.isFullScreen) {
|
|
3533
|
-
height =
|
|
3525
|
+
height = parseInt(verticalstackedcontainer.style('height'));
|
|
3534
3526
|
}
|
|
3535
3527
|
if (this.chartConfiguration.isDrilldownChart && !this.isHeaderVisible) {
|
|
3536
|
-
height =
|
|
3528
|
+
height = parseInt(verticalstackedcontainer.style('height')) - margin.top - margin.bottom - 130;
|
|
3537
3529
|
}
|
|
3538
3530
|
if (this.chartConfiguration.isHeaderVisible) {
|
|
3539
|
-
height =
|
|
3540
|
-
}
|
|
3541
|
-
// FIXED: For fixed height containers (like 300px), ensure it fits
|
|
3542
|
-
if (!this.chartConfiguration.isFullScreen && !this.chartConfiguration.isDrilldownChart) {
|
|
3543
|
-
height = containerHeight - margin.top - margin.bottom;
|
|
3531
|
+
height = parseInt(verticalstackedcontainer.style('height')) - margin.top - margin.bottom - 100;
|
|
3544
3532
|
}
|
|
3545
3533
|
return height;
|
|
3546
3534
|
}
|
|
3547
3535
|
createScales(chartContext, dimensions) {
|
|
3548
3536
|
const { data, metaData, lineData, keyList } = chartContext;
|
|
3549
3537
|
const { width, height, margin } = dimensions;
|
|
3550
|
-
|
|
3551
|
-
const dataLength = data.length;
|
|
3552
|
-
const leftAndRightSpaces = dataLength <= 5 ? 20 : (dataLength <= 10 ? 35 : 50);
|
|
3538
|
+
const leftAndRightSpaces = 50;
|
|
3553
3539
|
const rightSvgWidth = 60;
|
|
3554
3540
|
const groups = d3.map(data, (d) => d.name).keys();
|
|
3555
3541
|
let x;
|
|
@@ -3566,7 +3552,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3566
3552
|
.scaleBand()
|
|
3567
3553
|
.domain(groups)
|
|
3568
3554
|
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
3569
|
-
.padding(
|
|
3555
|
+
.padding(0.3);
|
|
3570
3556
|
}
|
|
3571
3557
|
const xScaleFromOrigin = d3.scaleBand().domain(groups).range([0, width - rightSvgWidth]);
|
|
3572
3558
|
const xSubgroup = d3.scaleBand().domain(keyList).range([0, x.bandwidth()]);
|
|
@@ -3617,33 +3603,37 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3617
3603
|
createSVGStructure(dimensions) {
|
|
3618
3604
|
const { chartContainer, height, margin } = dimensions;
|
|
3619
3605
|
const rightSvgWidth = 60;
|
|
3606
|
+
// Calculate proper left SVG width to include label
|
|
3607
|
+
const leftSvgWidth = margin.left + 20;
|
|
3620
3608
|
const outerContainer = chartContainer
|
|
3621
3609
|
.append('div')
|
|
3622
3610
|
.attr('id', this.uniqueId)
|
|
3623
3611
|
.attr('class', 'outer-container')
|
|
3624
3612
|
.style('width', '100%')
|
|
3625
3613
|
.style('height', `${height + margin.top + margin.bottom}px`)
|
|
3626
|
-
.style('overflow
|
|
3627
|
-
.style('overflow-y', 'hidden')
|
|
3614
|
+
.style('overflow', 'hidden') // FIXED: Prevent all overflow
|
|
3628
3615
|
.style('padding-left', `${margin.left}px`)
|
|
3629
3616
|
.style('padding-right', `${rightSvgWidth}px`)
|
|
3630
|
-
.style('margin-left', '15px')
|
|
3631
|
-
|
|
3617
|
+
.style('margin-left', '15px')
|
|
3618
|
+
.style('position', 'relative'); // FIXED: For absolute positioning
|
|
3619
|
+
// FIXED: Create proper Y-axis SVG with enough space for label
|
|
3632
3620
|
const svgYAxisLeft = outerContainer
|
|
3633
3621
|
.append('svg')
|
|
3634
|
-
.attr('width',
|
|
3622
|
+
.attr('width', leftSvgWidth)
|
|
3635
3623
|
.attr('height', height + margin.top + margin.bottom)
|
|
3636
3624
|
.style('position', 'absolute')
|
|
3637
|
-
.style('left', '
|
|
3625
|
+
.style('left', '0')
|
|
3626
|
+
.style('top', '0')
|
|
3638
3627
|
.style('z-index', 1)
|
|
3639
3628
|
.append('g')
|
|
3640
|
-
.attr('transform', `translate(${margin.left},${margin.top})`);
|
|
3629
|
+
.attr('transform', `translate(${margin.left + 5},${margin.top})`);
|
|
3641
3630
|
const svgYAxisRight = outerContainer
|
|
3642
3631
|
.append('svg')
|
|
3643
3632
|
.attr('width', rightSvgWidth)
|
|
3644
3633
|
.attr('height', height + margin.top + margin.bottom)
|
|
3645
3634
|
.style('position', 'absolute')
|
|
3646
3635
|
.style('right', '12px')
|
|
3636
|
+
.style('top', '0')
|
|
3647
3637
|
.style('z-index', 1)
|
|
3648
3638
|
.append('g')
|
|
3649
3639
|
.attr('transform', `translate(0,${margin.top})`);
|
|
@@ -3682,26 +3672,26 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3682
3672
|
renderXAxis(svg, x, xScaleFromOrigin, height, chartContext, keyList) {
|
|
3683
3673
|
const { data, metaData } = chartContext;
|
|
3684
3674
|
if (this.chartConfiguration.isMultiChartGridLine === undefined) {
|
|
3685
|
-
// FIXED: X-axis with bottom line
|
|
3686
3675
|
const xAxis = svg
|
|
3687
3676
|
.append('g')
|
|
3688
3677
|
.attr('class', 'x1 axis1')
|
|
3689
3678
|
.attr('transform', `translate(0,${height})`)
|
|
3690
3679
|
.call(d3.axisBottom(x).tickSize(0));
|
|
3691
|
-
// FIXED:
|
|
3680
|
+
// FIXED: Show X-axis line
|
|
3692
3681
|
xAxis
|
|
3693
3682
|
.select('.domain')
|
|
3694
|
-
.style('stroke', 'var(--chart-axis-color, #
|
|
3695
|
-
.style('stroke-width', '1px')
|
|
3683
|
+
.style('stroke', 'var(--chart-axis-color, #CCCCCC)')
|
|
3684
|
+
.style('stroke-width', '1px')
|
|
3685
|
+
.style('display', 'block');
|
|
3696
3686
|
xAxis.selectAll('g.tick line').remove();
|
|
3697
3687
|
const textClass = 'lib-xaxis-labels-texts-drilldown';
|
|
3698
3688
|
const textSelection = xAxis
|
|
3699
3689
|
.selectAll('g.tick text')
|
|
3700
3690
|
.attr('class', textClass)
|
|
3701
|
-
.style('fill', 'var(--chart-text-color)')
|
|
3702
|
-
.style('font-size', '
|
|
3691
|
+
.style('fill', 'var(--chart-text-color, #666666)')
|
|
3692
|
+
.style('font-size', '11px');
|
|
3703
3693
|
if (keyList.length > 1 && !metaData.xLabel) {
|
|
3704
|
-
textSelection.attr('y',
|
|
3694
|
+
textSelection.attr('y', 28);
|
|
3705
3695
|
}
|
|
3706
3696
|
}
|
|
3707
3697
|
else {
|
|
@@ -3710,17 +3700,16 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3710
3700
|
if (this.chartConfiguration.xLabelsOnSameLine) {
|
|
3711
3701
|
this.renderXLabelsOnSameLine(svg, data, metaData);
|
|
3712
3702
|
}
|
|
3713
|
-
// Bottom x-axis
|
|
3703
|
+
// Bottom x-axis
|
|
3714
3704
|
const xAxis2 = svg
|
|
3715
3705
|
.append('g')
|
|
3716
3706
|
.attr('class', 'x2 axis2')
|
|
3717
3707
|
.attr('transform', `translate(0,${height})`)
|
|
3718
3708
|
.style('color', '#000')
|
|
3719
3709
|
.call(d3.axisBottom(xScaleFromOrigin).tickSize(0));
|
|
3720
|
-
// FIXED: Show X-axis line
|
|
3721
3710
|
xAxis2
|
|
3722
3711
|
.select('.domain')
|
|
3723
|
-
.style('stroke', 'var(--chart-axis-color, #
|
|
3712
|
+
.style('stroke', 'var(--chart-axis-color, #CCCCCC)')
|
|
3724
3713
|
.style('stroke-width', '1px')
|
|
3725
3714
|
.attr('fill', 'none');
|
|
3726
3715
|
svg.selectAll('g.x2.axis2 g.tick text').style('display', 'none');
|
|
@@ -3799,7 +3788,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3799
3788
|
.attr('transform', 'translate(0,0)')
|
|
3800
3789
|
.call(y)
|
|
3801
3790
|
.style('display', 'none');
|
|
3802
|
-
// FIXED: Left Y-axis with
|
|
3791
|
+
// FIXED: Left Y-axis with visible line
|
|
3803
3792
|
const yAxisLeft = d3
|
|
3804
3793
|
.axisLeft(y)
|
|
3805
3794
|
.tickSize(0)
|
|
@@ -3811,18 +3800,20 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3811
3800
|
.attr('style', this.chartConfiguration.yAxisCustomTextStyles)
|
|
3812
3801
|
.attr('transform', 'translate(0,0)')
|
|
3813
3802
|
.call(yAxisLeft);
|
|
3814
|
-
// FIXED:
|
|
3803
|
+
// FIXED: Show Y-axis vertical line
|
|
3815
3804
|
yAxisGroup
|
|
3816
3805
|
.select('.domain')
|
|
3817
|
-
.style('stroke', 'var(--chart-axis-color, #
|
|
3818
|
-
.style('stroke-width', '1px')
|
|
3819
|
-
|
|
3806
|
+
.style('stroke', 'var(--chart-axis-color, #CCCCCC)')
|
|
3807
|
+
.style('stroke-width', '1px')
|
|
3808
|
+
.style('display', 'block');
|
|
3809
|
+
// FIXED: Position Y-axis values with proper spacing
|
|
3820
3810
|
yAxisGroup
|
|
3821
3811
|
.selectAll('text')
|
|
3822
|
-
.style('fill', 'var(--chart-text-color)')
|
|
3823
|
-
.style('font-size', '
|
|
3812
|
+
.style('fill', 'var(--chart-text-color, #666666)')
|
|
3813
|
+
.style('font-size', '11px')
|
|
3824
3814
|
.style('font-weight', '400')
|
|
3825
|
-
.attr('x', -
|
|
3815
|
+
.attr('x', -6) // FIXED: Small gap from axis line
|
|
3816
|
+
.attr('text-anchor', 'end')
|
|
3826
3817
|
.attr('dy', '0.32em');
|
|
3827
3818
|
// Right Y-axis (hidden)
|
|
3828
3819
|
svgYAxisRight
|
|
@@ -3840,12 +3831,16 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3840
3831
|
}
|
|
3841
3832
|
if (this.chartConfiguration.isYaxisLabelHidden) {
|
|
3842
3833
|
d3.selectAll('.yaxis-dashed > g > text').attr('class', 'lib-display-hidden');
|
|
3834
|
+
// FIXED: Don't hide the Y-axis label element
|
|
3835
|
+
d3.selectAll('.lib-ylabel-visible').style('display', 'block');
|
|
3843
3836
|
}
|
|
3844
3837
|
if (this.chartConfiguration.isYaxisHidden) {
|
|
3845
3838
|
d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
|
|
3839
|
+
// FIXED: Keep Y-axis label visible
|
|
3840
|
+
d3.selectAll('.lib-ylabel-visible').style('display', 'block');
|
|
3846
3841
|
}
|
|
3847
3842
|
if (this.chartConfiguration.isYaxisDashed) {
|
|
3848
|
-
d3.selectAll('.yaxis-dashed').style('stroke-dasharray', '5 5').style('color', '#999999');
|
|
3843
|
+
d3.selectAll('.yaxis-dashed .domain').style('stroke-dasharray', '5 5').style('color', '#999999');
|
|
3849
3844
|
}
|
|
3850
3845
|
}
|
|
3851
3846
|
renderYAxisGrid(svg, y, width) {
|
|
@@ -3856,8 +3851,8 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3856
3851
|
.ticks(this.chartConfiguration.numberOfYTicks)
|
|
3857
3852
|
.tickSize(-width)
|
|
3858
3853
|
.tickFormat(''))
|
|
3859
|
-
.style('color', '#
|
|
3860
|
-
.style('opacity', '0.
|
|
3854
|
+
.style('color', '#EEEEEE') // FIXED: Lighter grid
|
|
3855
|
+
.style('opacity', '0.7')
|
|
3861
3856
|
.style('stroke-dasharray', 'none')
|
|
3862
3857
|
.call((g) => g.select('.domain').remove())
|
|
3863
3858
|
.selectAll('line')
|
|
@@ -4132,26 +4127,26 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4132
4127
|
}
|
|
4133
4128
|
}
|
|
4134
4129
|
renderYAxisLabel(svgYAxisLeft, yLabel, height, margin) {
|
|
4130
|
+
// FIXED: Proper Y-axis label with correct positioning
|
|
4135
4131
|
svgYAxisLeft
|
|
4136
4132
|
.append('text')
|
|
4137
|
-
.attr('class', 'lib-axis-group-label
|
|
4133
|
+
.attr('class', 'lib-axis-group-label lib-ylabel-visible')
|
|
4138
4134
|
.attr('style', this.chartConfiguration.yAxisCustomlabelStyles)
|
|
4139
4135
|
.attr('transform', 'rotate(-90)')
|
|
4140
|
-
// FIXED:
|
|
4141
|
-
.attr('y', -70) // FIXED: Distance from Y-axis
|
|
4136
|
+
.attr('y', -margin.left + 15) // FIXED: Position relative to left margin
|
|
4142
4137
|
.attr('x', 0 - height / 2)
|
|
4143
4138
|
.attr('dy', '1em')
|
|
4144
4139
|
.style('text-anchor', 'middle')
|
|
4145
|
-
.style('font-size', '
|
|
4140
|
+
.style('font-size', '11px')
|
|
4146
4141
|
.style('font-weight', '400')
|
|
4147
|
-
.
|
|
4142
|
+
.style('fill', 'var(--chart-text-color, #666666)');
|
|
4148
4143
|
if (this.chartConfiguration.isMultiChartGridLine === undefined) {
|
|
4149
4144
|
svgYAxisLeft.selectAll('.lib-axis-group-label').text(yLabel);
|
|
4150
4145
|
}
|
|
4151
4146
|
else {
|
|
4152
4147
|
svgYAxisLeft
|
|
4153
4148
|
.selectAll('.lib-axis-group-label')
|
|
4154
|
-
.attr('class', 'lib-ylabel-weeklyCharts')
|
|
4149
|
+
.attr('class', 'lib-ylabel-weeklyCharts lib-ylabel-visible')
|
|
4155
4150
|
.text(yLabel.toLowerCase());
|
|
4156
4151
|
}
|
|
4157
4152
|
}
|
|
@@ -4171,11 +4166,11 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4171
4166
|
.append('text')
|
|
4172
4167
|
.attr('class', baseClass)
|
|
4173
4168
|
.attr('style', this.chartConfiguration.xAxisCustomlabelStyles)
|
|
4174
|
-
// FIXED: Adjusted for
|
|
4175
|
-
.attr('transform', `translate(${width / 2},${height +
|
|
4169
|
+
// FIXED: Adjusted for reduced bottom margin
|
|
4170
|
+
.attr('transform', `translate(${width / 2},${height + 32})`)
|
|
4176
4171
|
.style('text-anchor', 'middle')
|
|
4177
|
-
.style('fill', 'var(--chart-text-color)')
|
|
4178
|
-
.style('font-size', '
|
|
4172
|
+
.style('fill', 'var(--chart-text-color, #666666)')
|
|
4173
|
+
.style('font-size', '11px')
|
|
4179
4174
|
.text(isAcronym ? xLabel.toUpperCase() : xLabel.toLowerCase())
|
|
4180
4175
|
.style('text-transform', isAcronym ? 'none' : 'capitalize');
|
|
4181
4176
|
}
|