axidio-styleguide-library1-v2 0.4.2 → 0.4.4

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.
@@ -7866,14 +7866,55 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
7866
7866
  this.applyXLabelsOnSameLine(svg, subgroups, data, metaData, self, shortTickLengthBg, isMobile, isria);
7867
7867
  }
7868
7868
  // Mobile override for RIA
7869
- if (isria && self.chartData.data.length > 8) {
7869
+ // if (isria && self.chartData.data.length >=2) {
7870
+ // svg.selectAll('g.x1.axis1 g.tick text')
7871
+ // .classed('mobile-xaxis-override', true)
7872
+ // // .text((d: string) => d.substring(0, 3))
7873
+ // .text((d: string) => d.substring(0, 4).toLowerCase())
7874
+ // .style('font-size', '12px')
7875
+ // .attr('y', 5)
7876
+ // .attr('x', 5)
7877
+ // .style('text-anchor', 'middle');
7878
+ // }
7879
+ if (isria && self.chartData.data.length >= 2) {
7870
7880
  svg.selectAll('g.x1.axis1 g.tick text')
7871
7881
  .classed('mobile-xaxis-override', true)
7872
- .text((d) => d.substring(0, 3))
7873
- .style('font-size', '12px')
7882
+ .each((d) => {
7883
+ const textElement = d3.select(this);
7884
+ textElement.text(null);
7885
+ if (d.length > 5) {
7886
+ // Try to split at natural boundaries (space, hyphen, slash)
7887
+ let splitIndex = d.length > 8
7888
+ ? Math.floor(d.length / 2)
7889
+ : Math.ceil(d.length / 2);
7890
+ // Look for space, hyphen, or slash near middle
7891
+ for (let i = splitIndex - 1; i <= splitIndex + 1; i++) {
7892
+ if (d[i] === ' ' || d[i] === '-' || d[i] === '/') {
7893
+ splitIndex = i + 1;
7894
+ break;
7895
+ }
7896
+ }
7897
+ const line1 = d.substring(0, splitIndex).trim().toLowerCase();
7898
+ const line2 = d.substring(splitIndex).trim().toLowerCase();
7899
+ textElement.append('tspan')
7900
+ .text(line1)
7901
+ .attr('x', 5)
7902
+ .attr('dy', '0em');
7903
+ textElement.append('tspan')
7904
+ .text(line2)
7905
+ .attr('x', 5)
7906
+ .attr('dy', '1.2em');
7907
+ }
7908
+ else {
7909
+ // Single line for 5 chars or less
7910
+ textElement.text(d.toLowerCase())
7911
+ .attr('x', 5)
7912
+ .attr('dy', '0.71em');
7913
+ }
7914
+ })
7915
+ .style('font-size', '11px') // Slightly smaller for better fit
7874
7916
  .attr('y', 5)
7875
- .attr('x', 5)
7876
- .style('text-anchor', 'middle');
7917
+ .attr('text-anchor', 'middle');
7877
7918
  }
7878
7919
  // ✅ Tablet View — Rotate if text > 10 characters
7879
7920
  if (isTablet) {