axidio-styleguide-library1-v2 0.2.48 → 0.2.50
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.
|
@@ -6595,9 +6595,11 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6595
6595
|
}
|
|
6596
6596
|
// Fixed bar width and padding for all resolutions
|
|
6597
6597
|
const barWidth = this.CONSTANTS.FIXED_BAR_WIDTH;
|
|
6598
|
-
const barPadding =
|
|
6599
|
-
// Calculate required SVG width
|
|
6600
|
-
const
|
|
6598
|
+
const barPadding = 20; // 20px gap between bars
|
|
6599
|
+
// Calculate required SVG width: bars + gaps + side spaces
|
|
6600
|
+
const totalBarsWidth = barWidth * dataLength;
|
|
6601
|
+
const totalGaps = barPadding * (dataLength - 1);
|
|
6602
|
+
const requiredSvgWidth = Math.max(width - this.CONSTANTS.RIGHT_SVG_WIDTH, totalBarsWidth + totalGaps + (this.CONSTANTS.LEFT_RIGHT_SPACES * 2));
|
|
6601
6603
|
return {
|
|
6602
6604
|
width,
|
|
6603
6605
|
height,
|
|
@@ -6652,16 +6654,22 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6652
6654
|
}
|
|
6653
6655
|
createScales(data, layers, lineData, dimensions) {
|
|
6654
6656
|
const { width, height, barWidth, barPadding } = dimensions;
|
|
6655
|
-
//
|
|
6656
|
-
const
|
|
6657
|
+
// Calculate total width needed for all bars with proper spacing
|
|
6658
|
+
const totalBarsWidth = data.length * barWidth;
|
|
6659
|
+
const totalSpacing = (data.length - 1) * 20; // 20px gap between bars
|
|
6660
|
+
const requiredWidth = totalBarsWidth + totalSpacing + (this.CONSTANTS.LEFT_RIGHT_SPACES * 2);
|
|
6661
|
+
// Use the larger of container width or required width for proper spacing
|
|
6662
|
+
const effectiveWidth = Math.max(width - this.CONSTANTS.RIGHT_SVG_WIDTH, requiredWidth);
|
|
6657
6663
|
const xScale = d3
|
|
6658
6664
|
.scaleBand()
|
|
6659
6665
|
.rangeRound([
|
|
6660
6666
|
this.CONSTANTS.LEFT_RIGHT_SPACES,
|
|
6661
|
-
|
|
6667
|
+
effectiveWidth + this.CONSTANTS.LEFT_RIGHT_SPACES - this.CONSTANTS.RIGHT_SVG_WIDTH
|
|
6662
6668
|
])
|
|
6663
6669
|
.domain(data.map(d => d.name).reverse())
|
|
6664
|
-
.
|
|
6670
|
+
.paddingInner(20 / (barWidth + 20)) // Convert 20px gap to padding ratio
|
|
6671
|
+
.paddingOuter(0.5)
|
|
6672
|
+
.align(0.5); // Center alignment
|
|
6665
6673
|
const xScaleFromOrigin = d3
|
|
6666
6674
|
.scaleBand()
|
|
6667
6675
|
.rangeRound([width - this.CONSTANTS.RIGHT_SVG_WIDTH, 0])
|
|
@@ -6746,17 +6754,18 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6746
6754
|
return 0;
|
|
6747
6755
|
})
|
|
6748
6756
|
.attr('x', (d) => {
|
|
6749
|
-
// Center the bar within its bandwidth
|
|
6757
|
+
// Center the bar within its bandwidth with proper spacing
|
|
6758
|
+
const xPosition = xScale(d.data.name);
|
|
6759
|
+
const bandwidth = xScale.bandwidth();
|
|
6750
6760
|
if (!this.chartConfiguration.isMultiChartGridLine) {
|
|
6751
|
-
|
|
6752
|
-
return
|
|
6761
|
+
// Center the fixed-width bar in the available space
|
|
6762
|
+
return xPosition + (bandwidth - barWidth) / 2;
|
|
6753
6763
|
}
|
|
6754
6764
|
if (this.chartConfiguration.isDrilldownChart && this.chartData.data.length <= 3) {
|
|
6755
|
-
return
|
|
6765
|
+
return xPosition + bandwidth / 2 - 35;
|
|
6756
6766
|
}
|
|
6757
|
-
const bandwidth = xScale.bandwidth();
|
|
6758
6767
|
const calculatedWidth = bandwidth * 0.8;
|
|
6759
|
-
return
|
|
6768
|
+
return xPosition + (bandwidth - calculatedWidth) / 2;
|
|
6760
6769
|
})
|
|
6761
6770
|
.attr('height', (d) => {
|
|
6762
6771
|
if (!isNaN(d[0]) && !isNaN(d[1])) {
|