axidio-styleguide-library1-v2 0.2.50 → 0.2.52
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.
|
@@ -6488,8 +6488,9 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6488
6488
|
LONG_TICK_LENGTH: 16,
|
|
6489
6489
|
SHORT_TICK_LENGTH_BG: 5,
|
|
6490
6490
|
LONG_TICK_LENGTH_BG: 30,
|
|
6491
|
-
|
|
6492
|
-
|
|
6491
|
+
DESKTOP_BAR_WIDTH: 40, // Desktop bar width
|
|
6492
|
+
MOBILE_BAR_WIDTH: 25, // Mobile/Tablet bar width (reduced)
|
|
6493
|
+
BAR_GAP: 30, // Gap between bars (increased for better separation)
|
|
6493
6494
|
ZOOM_THRESHOLD: 30,
|
|
6494
6495
|
ZOOM_IN_THRESHOLD: 8,
|
|
6495
6496
|
};
|
|
@@ -6593,9 +6594,10 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6593
6594
|
if (this.chartConfiguration.isDrilldownChart) {
|
|
6594
6595
|
height = containerHeight - margin.top - margin.bottom - 130;
|
|
6595
6596
|
}
|
|
6596
|
-
//
|
|
6597
|
-
const
|
|
6598
|
-
const
|
|
6597
|
+
// Responsive bar width: smaller for mobile/tablet
|
|
6598
|
+
const isMobileOrTablet = window.innerWidth < 1024;
|
|
6599
|
+
const barWidth = isMobileOrTablet ? this.CONSTANTS.MOBILE_BAR_WIDTH : this.CONSTANTS.DESKTOP_BAR_WIDTH;
|
|
6600
|
+
const barPadding = this.CONSTANTS.BAR_GAP;
|
|
6599
6601
|
// Calculate required SVG width: bars + gaps + side spaces
|
|
6600
6602
|
const totalBarsWidth = barWidth * dataLength;
|
|
6601
6603
|
const totalGaps = barPadding * (dataLength - 1);
|
|
@@ -6656,10 +6658,13 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6656
6658
|
const { width, height, barWidth, barPadding } = dimensions;
|
|
6657
6659
|
// Calculate total width needed for all bars with proper spacing
|
|
6658
6660
|
const totalBarsWidth = data.length * barWidth;
|
|
6659
|
-
const totalSpacing = (data.length - 1) *
|
|
6661
|
+
const totalSpacing = (data.length - 1) * barPadding;
|
|
6660
6662
|
const requiredWidth = totalBarsWidth + totalSpacing + (this.CONSTANTS.LEFT_RIGHT_SPACES * 2);
|
|
6661
6663
|
// Use the larger of container width or required width for proper spacing
|
|
6662
6664
|
const effectiveWidth = Math.max(width - this.CONSTANTS.RIGHT_SVG_WIDTH, requiredWidth);
|
|
6665
|
+
// Calculate padding ratio to create exact pixel gaps between bars
|
|
6666
|
+
const totalAvailableSpace = effectiveWidth;
|
|
6667
|
+
const paddingRatio = barPadding / (barWidth + barPadding);
|
|
6663
6668
|
const xScale = d3
|
|
6664
6669
|
.scaleBand()
|
|
6665
6670
|
.rangeRound([
|
|
@@ -6667,7 +6672,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6667
6672
|
effectiveWidth + this.CONSTANTS.LEFT_RIGHT_SPACES - this.CONSTANTS.RIGHT_SVG_WIDTH
|
|
6668
6673
|
])
|
|
6669
6674
|
.domain(data.map(d => d.name).reverse())
|
|
6670
|
-
.paddingInner(
|
|
6675
|
+
.paddingInner(paddingRatio)
|
|
6671
6676
|
.paddingOuter(0.5)
|
|
6672
6677
|
.align(0.5); // Center alignment
|
|
6673
6678
|
const xScaleFromOrigin = d3
|
|
@@ -7042,6 +7047,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7042
7047
|
this.applyAxisConfigurations(svg, scales, dimensions, data);
|
|
7043
7048
|
}
|
|
7044
7049
|
renderStandardAxes(svg, axes, scales, dimensions, data) {
|
|
7050
|
+
const isMobileOrTablet = window.innerWidth < 1024;
|
|
7045
7051
|
svg
|
|
7046
7052
|
.append('g')
|
|
7047
7053
|
.attr('transform', `translate(0,${dimensions.height})`)
|
|
@@ -7049,11 +7055,20 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7049
7055
|
.call(axes.xAxis)
|
|
7050
7056
|
.selectAll('text')
|
|
7051
7057
|
.style('fill', 'var(--chart-text-color)')
|
|
7052
|
-
.style('font-size', '12px')
|
|
7058
|
+
.style('font-size', isMobileOrTablet ? '10px' : '12px')
|
|
7053
7059
|
.attr('text-anchor', 'middle')
|
|
7054
7060
|
.attr('dx', '0')
|
|
7055
7061
|
.attr('dy', '0.71em')
|
|
7056
|
-
.attr('transform', null)
|
|
7062
|
+
.attr('transform', null)
|
|
7063
|
+
.each(function () {
|
|
7064
|
+
// Ensure X-axis labels are centered and don't overlap
|
|
7065
|
+
const textElement = d3.select(this);
|
|
7066
|
+
const text = textElement.text();
|
|
7067
|
+
if (isMobileOrTablet && text.length > 10) {
|
|
7068
|
+
// Truncate long labels on mobile/tablet
|
|
7069
|
+
textElement.text(text.substring(0, 8) + '...');
|
|
7070
|
+
}
|
|
7071
|
+
});
|
|
7057
7072
|
svg
|
|
7058
7073
|
.append('g')
|
|
7059
7074
|
.attr('class', 'lib-stacked-y-axis-text')
|