axidio-styleguide-library1-v2 0.0.928 → 0.0.930

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.
@@ -8806,19 +8806,27 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8806
8806
  .selectAll('g.x1.axis1 g.tick text')
8807
8807
  .attr('class', 'lib-xaxis-labels-texts-drilldown')
8808
8808
  .style('font-size', this.isHeaderVisible ? '18px' : '14px')
8809
+ .style('font-weight', function (d) {
8810
+ // Make bold if grouped, no xLabel, date, and header not visible (+25 case)
8811
+ if (subgroups.length > 1 &&
8812
+ !metaData.xLabel &&
8813
+ !self.isHeaderVisible &&
8814
+ (/\d{2,4}[-\/]\d{2}[-\/]\d{2,4}/.test(d) || /\d{2,4}[-\/]\d{2,4}/.test(d))) {
8815
+ return 'bold';
8816
+ }
8817
+ return null;
8818
+ })
8809
8819
  .attr('y', function (d) {
8810
- // If grouped chart, no xLabel, and label is a date, add +25
8820
+ // If grouped chart, no xLabel, and label is a date, add extra offset
8811
8821
  if (subgroups.length > 1 &&
8812
8822
  !metaData.xLabel &&
8813
8823
  (/\d{2,4}[-\/]\d{2}[-\/]\d{2,4}/.test(d) || /\d{2,4}[-\/]\d{2,4}/.test(d))) {
8814
- return (self.isHeaderVisible ? short_tick_length_bg + 25 : short_tick_length_bg) + 25;
8824
+ // If header is visible, use a smaller offset (e.g., +15), else +25
8825
+ return (self.isHeaderVisible ? short_tick_length_bg + 15 : short_tick_length_bg + 25);
8815
8826
  }
8816
8827
  return self.isHeaderVisible ? short_tick_length_bg + 25 : short_tick_length_bg;
8817
8828
  })
8818
8829
  .attr('x', function (d) {
8819
- if (isria && self.chartData.data.length > 8) {
8820
- return -10;
8821
- }
8822
8830
  if (self.chartData.data.length > 8 && !self.isZoomedOut) {
8823
8831
  return -25; // Move first line text slightly to the left too
8824
8832
  }
@@ -8826,16 +8834,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8826
8834
  })
8827
8835
  .text(function (d) {
8828
8836
  var isValueToBeIgnored = false;
8829
- if (isria && self.chartData.data.length > 8) {
8830
- // Show only first 3 letters, lowercase
8831
- return d.substring(0, 3).toLowerCase();
8832
- }
8833
8837
  if (isMobile && !self.isHeaderVisible) {
8834
8838
  let firstPart = d.split(/[\s\-]+/)[0];
8835
8839
  return firstPart.substring(0, 3).toLowerCase();
8836
8840
  }
8837
8841
  data.map((indiv) => {
8838
- if (indiv.name.toLowerCase() == d.trim().toLowerCase() &&
8842
+ if (indiv.name &&
8843
+ indiv.name.toLowerCase() == d.trim().toLowerCase() &&
8839
8844
  indiv[metaData.keyList[0]] == -1) {
8840
8845
  isValueToBeIgnored = true;
8841
8846
  }
@@ -8843,20 +8848,22 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8843
8848
  if (isValueToBeIgnored) {
8844
8849
  return '';
8845
8850
  }
8846
- // If label looks like a date (contains digits and - or /), show full label as one line
8851
+ // If label looks like a date (contains digits and - or /)
8847
8852
  if (/\d{2,4}[-\/]/.test(d)) {
8853
+ // If there is a space, show the part after the space on the next line
8854
+ if (d.indexOf(' ') > -1) {
8855
+ var first = d.substring(0, d.indexOf(' '));
8856
+ var second = d.substring(d.indexOf(' ') + 1).trim();
8857
+ // Use tspan for line break if supported, else join with \n
8858
+ // If SVG tspan is supported, this will be split into two lines by the .each below
8859
+ return first + '\n' + second;
8860
+ }
8848
8861
  return d;
8849
8862
  }
8850
8863
  if (d.trim().indexOf(' ') > -1) {
8851
8864
  return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
8852
8865
  }
8853
8866
  return d.toLowerCase();
8854
- }).attr('transform', function (d) {
8855
- // Rotate if RIA and >8
8856
- if (isria && self.chartData.data.length > 8) {
8857
- return 'rotate(-45)';
8858
- }
8859
- return null;
8860
8867
  });
8861
8868
  if (!isMobile) {
8862
8869
  svg
@@ -9567,15 +9574,25 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9567
9574
  .each((d, i, nodes) => {
9568
9575
  const text = d3.select(nodes[i]);
9569
9576
  const label = text.text();
9570
- const words = label.split(' ');
9571
- text.text(null); // Clear current text
9572
- // Add each word to a new tspan
9573
- words.forEach((word, index) => {
9574
- text.append('tspan').text(word);
9575
- // .attr('x', '15')
9576
- // .attr('dy', index === 0 ? '0em' : '0.9em') // Reduced vertical spacing
9577
- // .attr('text-anchor', 'end');
9578
- });
9577
+ // If label contains \n, split and use tspan for each line
9578
+ if (label.indexOf('\n') > -1) {
9579
+ const lines = label.split('\n');
9580
+ text.text(null);
9581
+ lines.forEach((line, idx) => {
9582
+ text.append('tspan')
9583
+ .text(line)
9584
+ .attr('x', 0)
9585
+ .attr('dy', idx === 0 ? '0em' : '1.1em');
9586
+ });
9587
+ }
9588
+ else {
9589
+ // Fallback: split by space for other labels
9590
+ const words = label.split(' ');
9591
+ text.text(null);
9592
+ words.forEach((word, index) => {
9593
+ text.append('tspan').text(word);
9594
+ });
9595
+ }
9579
9596
  })
9580
9597
  .style('fill', 'var(--chart-text-color)')
9581
9598
  .attr('transform', null); // Remove rotate if using line breaks