axidio-styleguide-library1-v2 0.0.929 → 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.
@@ -8839,7 +8839,8 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8839
8839
  return firstPart.substring(0, 3).toLowerCase();
8840
8840
  }
8841
8841
  data.map((indiv) => {
8842
- if (indiv.name.toLowerCase() == d.trim().toLowerCase() &&
8842
+ if (indiv.name &&
8843
+ indiv.name.toLowerCase() == d.trim().toLowerCase() &&
8843
8844
  indiv[metaData.keyList[0]] == -1) {
8844
8845
  isValueToBeIgnored = true;
8845
8846
  }
@@ -8847,8 +8848,16 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8847
8848
  if (isValueToBeIgnored) {
8848
8849
  return '';
8849
8850
  }
8850
- // 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 /)
8851
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
+ }
8852
8861
  return d;
8853
8862
  }
8854
8863
  if (d.trim().indexOf(' ') > -1) {
@@ -9565,15 +9574,25 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9565
9574
  .each((d, i, nodes) => {
9566
9575
  const text = d3.select(nodes[i]);
9567
9576
  const label = text.text();
9568
- const words = label.split(' ');
9569
- text.text(null); // Clear current text
9570
- // Add each word to a new tspan
9571
- words.forEach((word, index) => {
9572
- text.append('tspan').text(word);
9573
- // .attr('x', '15')
9574
- // .attr('dy', index === 0 ? '0em' : '0.9em') // Reduced vertical spacing
9575
- // .attr('text-anchor', 'end');
9576
- });
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
+ }
9577
9596
  })
9578
9597
  .style('fill', 'var(--chart-text-color)')
9579
9598
  .attr('transform', null); // Remove rotate if using line breaks