axidio-styleguide-library1-v2 0.2.52 → 0.2.54

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.
@@ -6594,10 +6594,38 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6594
6594
  if (this.chartConfiguration.isDrilldownChart) {
6595
6595
  height = containerHeight - margin.top - margin.bottom - 130;
6596
6596
  }
6597
- // Responsive bar width: smaller for mobile/tablet
6597
+ // Responsive bar width based on screen size and number of bars
6598
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
+ let barWidth;
6600
+ let barPadding;
6601
+ if (isMobileOrTablet) {
6602
+ // Dynamic sizing for mobile/tablet based on number of bars
6603
+ if (dataLength === 1) {
6604
+ barWidth = 60; // Single bar - very wide
6605
+ barPadding = 0; // No gap needed
6606
+ }
6607
+ else if (dataLength === 2) {
6608
+ barWidth = 50; // 2 bars - wide with gap
6609
+ barPadding = 45; // Significant gap between 2 bars
6610
+ }
6611
+ else if (dataLength === 3) {
6612
+ barWidth = 45; // 3 bars - wide
6613
+ barPadding = 40; // Good spacing
6614
+ }
6615
+ else if (dataLength <= 5) {
6616
+ barWidth = 35; // Medium width for 4-5 bars
6617
+ barPadding = 30; // Medium spacing
6618
+ }
6619
+ else {
6620
+ barWidth = 25; // Narrower for many bars
6621
+ barPadding = 25; // Tighter spacing for many bars
6622
+ }
6623
+ }
6624
+ else {
6625
+ // Desktop: consistent sizing
6626
+ barWidth = this.CONSTANTS.DESKTOP_BAR_WIDTH;
6627
+ barPadding = this.CONSTANTS.BAR_GAP;
6628
+ }
6601
6629
  // Calculate required SVG width: bars + gaps + side spaces
6602
6630
  const totalBarsWidth = barWidth * dataLength;
6603
6631
  const totalGaps = barPadding * (dataLength - 1);