axidio-styleguide-library1-v2 0.1.29 → 0.1.31

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.
@@ -8552,7 +8552,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8552
8552
  var height = parseInt(verticalstackedcontainer.style('height')) *
8553
8553
  (self.chartConfiguration.svgHeight / 100) -
8554
8554
  margin.top -
8555
- margin.bottom + 30;
8555
+ margin.bottom;
8556
8556
  /**
8557
8557
  * entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
8558
8558
  */
@@ -8643,7 +8643,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8643
8643
  .append('svg')
8644
8644
  // .attr('id', self.uniqueId)
8645
8645
  .attr('width', width - rightSvgWidth)
8646
- .attr('height', height + margin.top + margin.bottom + 30)
8646
+ .attr('height', height + margin.top + margin.bottom + 60)
8647
8647
  // .call(ChartHelper.responsivefy)
8648
8648
  .append('g')
8649
8649
  .attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
@@ -8779,18 +8779,19 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8779
8779
  });
8780
8780
  }
8781
8781
  if (self.chartConfiguration.xLabelsOnSameLine) {
8782
- svg
8782
+ const xAxisLabels = svg
8783
8783
  .selectAll('g.x1.axis1 g.tick text')
8784
8784
  .attr('class', 'lib-xaxis-labels-texts-drilldown')
8785
8785
  .style('font-size', this.isHeaderVisible ? '18px' : '14px')
8786
+ .attr('text-anchor', 'middle')
8786
8787
  .attr('y', function (d) {
8787
- // For grouped bar charts with many bars and xLabel present, do NOT add extra space (avoid overlap)
8788
+ // For grouped bar charts with many bars and xLabel present, only add 5 if the label is a date
8788
8789
  if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
8789
- // In maximized (fullscreen) view, keep the gap minimal
8790
+ const isDateLabel = /\d{2,4}[-\/]/.test(d);
8790
8791
  if (self.chartConfiguration.isFullScreen) {
8791
- return short_tick_length_bg;
8792
+ return isDateLabel ? short_tick_length_bg + 14 : short_tick_length_bg;
8792
8793
  }
8793
- return short_tick_length_bg;
8794
+ return isDateLabel ? short_tick_length_bg + 14 : short_tick_length_bg;
8794
8795
  }
8795
8796
  // For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
8796
8797
  if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
@@ -8839,8 +8840,37 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8839
8840
  if (isValueToBeIgnored) {
8840
8841
  return '';
8841
8842
  }
8842
- // If label looks like a date (contains digits and - or /)
8843
+ // Always add space before and after hyphen for date range labels, even when header is visible and label is single line
8844
+ // Apply for grouped bar charts and single bar charts, header visible, single line
8845
+ const dateRangeRegex = /(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})\s*-\s*(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})/;
8846
+ if (dateRangeRegex.test(d.trim())) {
8847
+ return d.trim().replace(dateRangeRegex, (m, d1, d2) => `${d1} - ${d2}`);
8848
+ }
8849
+ // Split date and week labels into two lines in grouped bar zoom-in view (and minimized view)
8843
8850
  const isDateLabel = /\d{2,4}[-\/]/.test(d);
8851
+ const isWeekLabel = /week|wk|w\d+/i.test(d);
8852
+ if (subgroups.length > 1 && !self.isZoomedOut && data.length > 8 && d.indexOf(' ') > -1 && (isDateLabel || isWeekLabel)) {
8853
+ var first = d.substring(0, d.indexOf(' '));
8854
+ var second = d.substring(d.indexOf(' ') + 1).trim();
8855
+ return first + '\n' + second;
8856
+ }
8857
+ // Also keep previous logic for minimized view
8858
+ if (isDateLabel) {
8859
+ if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
8860
+ var first = d.substring(0, d.indexOf(' '));
8861
+ var second = d.substring(d.indexOf(' ') + 1).trim();
8862
+ return first + '\n' + second;
8863
+ }
8864
+ else {
8865
+ return d;
8866
+ }
8867
+ }
8868
+ if (d.trim().indexOf(' ') > -1) {
8869
+ return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
8870
+ }
8871
+ return d.toLowerCase();
8872
+ // If label looks like a date (contains digits and - or /)
8873
+ const isDateLabel2 = /\d{2,4}[-\/]/.test(d);
8844
8874
  // Only split date/week labels if there are many grouped bars and header is not visible
8845
8875
  if (isDateLabel) {
8846
8876
  if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
@@ -8857,6 +8887,15 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8857
8887
  }
8858
8888
  return d.toLowerCase();
8859
8889
  });
8890
+ // Now apply writing-mode: sideways-lr for grouped charts with date labels in zoomed-out view and many bars
8891
+ xAxisLabels.each(function (d) {
8892
+ // Only apply writing-mode for exact date labels, not those containing 'week' or similar
8893
+ const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
8894
+ const isWeekLabel = /week|wk|w\d+/i.test(d);
8895
+ if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
8896
+ d3.select(this).style('writing-mode', 'sideways-lr');
8897
+ }
8898
+ });
8860
8899
  if (!isMobile) {
8861
8900
  svg
8862
8901
  .selectAll('g.x1.axis1 g.tick')
@@ -9009,20 +9048,19 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9009
9048
  });
9010
9049
  }
9011
9050
  var xSubgroup = d3.scaleBand().domain(subgroups);
9012
- // Weekly shipped/planned daily grouped chart: increase bar width for both zoom-in and zoom-out views
9013
- if (subgroups.length > 1 && this.chartConfiguration.isMultiChartGridLine) {
9014
- xSubgroup.range([0, x.bandwidth() * 1.2]).padding(0.05);
9015
- }
9016
- else if (subgroups.length > 1 && !this.isZoomedOut) {
9051
+ if (subgroups.length > 1 && !this.isZoomedOut) {
9017
9052
  // For grouped bar charts in zoom-in view, reduce padding between bars
9018
- xSubgroup.range([0, x.bandwidth()]).padding(0.05);
9053
+ xSubgroup.range([0, x.bandwidth()]);
9019
9054
  }
9020
9055
  else if (subgroups.length === 1 && !this.isZoomedOut) {
9021
- // For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
9022
- xSubgroup.range([0, 80]);
9056
+ // For single-bar (non-grouped) charts in zoom-in view, set bar width to 100 (increased from 80)
9057
+ xSubgroup.range([0, 100]);
9058
+ }
9059
+ else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
9060
+ xSubgroup.range([0, x.bandwidth()]);
9023
9061
  }
9024
9062
  else {
9025
- // All other cases (including zoomed-out), use full bandwidth
9063
+ // used to make grouped bars with lesser width as we are not using padding for width
9026
9064
  xSubgroup.range([0, x.bandwidth()]);
9027
9065
  }
9028
9066
  // if (this.chartConfiguration.isDrilldownChart) {
@@ -9079,7 +9117,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9079
9117
  // Increase bar width a bit in zoom-in view
9080
9118
  let reducedBarWidth = 60;
9081
9119
  if (!self.isZoomedOut) {
9082
- reducedBarWidth = 80;
9120
+ reducedBarWidth = 30;
9083
9121
  }
9084
9122
  if (self.chartData.data.length == 1) {
9085
9123
  if (Object.keys(self.chartData.data[0]).length == 2) {
@@ -9120,7 +9158,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9120
9158
  .attr('width', function (d) {
9121
9159
  // For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
9122
9160
  if (subgroups.length > 1 && !self.isZoomedOut) {
9123
- return xSubgroup.bandwidth() * 0.5;
9161
+ return xSubgroup.bandwidth() * 0.25;
9124
9162
  }
9125
9163
  // For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
9126
9164
  if (subgroups.length === 1 && !self.isZoomedOut) {
@@ -9136,7 +9174,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9136
9174
  // Increase bar width a bit in zoom-in view
9137
9175
  let reducedBarWidth = 60;
9138
9176
  if (!self.isZoomedOut) {
9139
- reducedBarWidth = 80;
9177
+ reducedBarWidth = 100;
9140
9178
  }
9141
9179
  if (self.chartData.data.length == 1) {
9142
9180
  if (Object.keys(self.chartData.data[0]).length == 2) {
@@ -9657,7 +9695,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9657
9695
  }
9658
9696
  const xLabelText = metaData.xLabel;
9659
9697
  const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
9660
- const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
9698
+ const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 40);
9661
9699
  svg
9662
9700
  .append('text')
9663
9701
  .attr('class', function () {