axidio-styleguide-library1-v2 0.1.29 → 0.1.30

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