axidio-styleguide-library1-v2 0.0.929 → 0.0.931

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.
@@ -8818,13 +8818,18 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8818
8818
  })
8819
8819
  .attr('y', function (d) {
8820
8820
  // If grouped chart, no xLabel, and label is a date, add extra offset
8821
+ let baseY = self.isHeaderVisible ? short_tick_length_bg + 25 : short_tick_length_bg;
8821
8822
  if (subgroups.length > 1 &&
8822
8823
  !metaData.xLabel &&
8823
8824
  (/\d{2,4}[-\/]\d{2}[-\/]\d{2,4}/.test(d) || /\d{2,4}[-\/]\d{2,4}/.test(d))) {
8824
8825
  // 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);
8826
+ baseY = self.isHeaderVisible ? short_tick_length_bg + 15 : short_tick_length_bg + 25;
8826
8827
  }
8827
- return self.isHeaderVisible ? short_tick_length_bg + 25 : short_tick_length_bg;
8828
+ // Add a little extra space if the date label contains a space (will be split into two lines)
8829
+ if (/\d{2,4}[-\/]\d{2,4}/.test(d) && d.indexOf(' ') > -1) {
8830
+ baseY += 4; // Add 4px extra space for two-line date labels
8831
+ }
8832
+ return baseY;
8828
8833
  })
8829
8834
  .attr('x', function (d) {
8830
8835
  if (self.chartData.data.length > 8 && !self.isZoomedOut) {
@@ -8839,7 +8844,8 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8839
8844
  return firstPart.substring(0, 3).toLowerCase();
8840
8845
  }
8841
8846
  data.map((indiv) => {
8842
- if (indiv.name.toLowerCase() == d.trim().toLowerCase() &&
8847
+ if (indiv.name &&
8848
+ indiv.name.toLowerCase() == d.trim().toLowerCase() &&
8843
8849
  indiv[metaData.keyList[0]] == -1) {
8844
8850
  isValueToBeIgnored = true;
8845
8851
  }
@@ -8847,8 +8853,16 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8847
8853
  if (isValueToBeIgnored) {
8848
8854
  return '';
8849
8855
  }
8850
- // If label looks like a date (contains digits and - or /), show full label as one line
8856
+ // If label looks like a date (contains digits and - or /)
8851
8857
  if (/\d{2,4}[-\/]/.test(d)) {
8858
+ // If there is a space, show the part after the space on the next line
8859
+ if (d.indexOf(' ') > -1) {
8860
+ var first = d.substring(0, d.indexOf(' '));
8861
+ var second = d.substring(d.indexOf(' ') + 1).trim();
8862
+ // Use tspan for line break if supported, else join with \n
8863
+ // If SVG tspan is supported, this will be split into two lines by the .each below
8864
+ return first + '\n' + second;
8865
+ }
8852
8866
  return d;
8853
8867
  }
8854
8868
  if (d.trim().indexOf(' ') > -1) {
@@ -9565,15 +9579,25 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9565
9579
  .each((d, i, nodes) => {
9566
9580
  const text = d3.select(nodes[i]);
9567
9581
  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
- });
9582
+ // If label contains \n, split and use tspan for each line
9583
+ if (label.indexOf('\n') > -1) {
9584
+ const lines = label.split('\n');
9585
+ text.text(null);
9586
+ lines.forEach((line, idx) => {
9587
+ text.append('tspan')
9588
+ .text(line)
9589
+ .attr('x', 0)
9590
+ .attr('dy', idx === 0 ? '0em' : '1.1em');
9591
+ });
9592
+ }
9593
+ else {
9594
+ // Fallback: split by space for other labels
9595
+ const words = label.split(' ');
9596
+ text.text(null);
9597
+ words.forEach((word, index) => {
9598
+ text.append('tspan').text(word);
9599
+ });
9600
+ }
9577
9601
  })
9578
9602
  .style('fill', 'var(--chart-text-color)')
9579
9603
  .attr('transform', null); // Remove rotate if using line breaks