axidio-styleguide-library1-v2 0.3.6 → 0.3.8

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.
@@ -7871,8 +7871,14 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
7871
7871
  hasDateValues = true;
7872
7872
  }
7873
7873
  });
7874
- if (hasDateValues && subgroups && subgroups.length < 3) {
7875
- // For single chart with dates, ensure horizontal display
7874
+ // Count unique x-axis labels
7875
+ const uniqueLabels = new Set();
7876
+ textNodes.each(function (d) {
7877
+ uniqueLabels.add(d);
7878
+ });
7879
+ const labelCount = uniqueLabels.size;
7880
+ if (hasDateValues && labelCount <= 3) {
7881
+ // For 3 or fewer labels, keep horizontal display
7876
7882
  textNodes
7877
7883
  .style('writing-mode', 'horizontal-tb') // Explicitly set horizontal
7878
7884
  .classed('mobile-xaxis-override', false) // Remove vertical class
@@ -7882,6 +7888,15 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
7882
7888
  .attr('dx', '0') // Reset any x offset
7883
7889
  .attr('dy', '0'); // Reset any y offset
7884
7890
  }
7891
+ else if (labelCount > 3) {
7892
+ // For more than 3 labels, use vertical alignment
7893
+ textNodes
7894
+ .style('writing-mode', 'sideways-lr') // Vertical text
7895
+ .classed('mobile-xaxis-override', true) // Add vertical class
7896
+ .attr('text-anchor', 'middle') // Center align
7897
+ .attr('y', 30) // Adjust vertical position
7898
+ .attr('x', 0); // Reset x position
7899
+ }
7885
7900
  else if (!this.isHeaderVisible) {
7886
7901
  // Default mobile behavior for non-date or multi-group
7887
7902
  textNodes.classed('mobile-xaxis-override', true);