axidio-styleguide-library1-v2 0.1.13 → 0.1.14

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.
@@ -7163,23 +7163,34 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
7163
7163
  this.isCC = false;
7164
7164
  this.isZoomedOut = false;
7165
7165
  }
7166
+ ngOnChanges(changes) {
7167
+ if (changes['chartData'] || changes['customChartConfiguration']) {
7168
+ const self = this;
7169
+ d3.select('#' + self.uniqueId).remove();
7170
+ if (this.chartData && this.chartData.data) {
7171
+ this.initializeStackedChart();
7172
+ }
7173
+ }
7174
+ }
7166
7175
  isZoomOutSelected(isZoomOut) {
7167
7176
  this.isZoomedOut = isZoomOut;
7168
- this.ngOnChanges();
7177
+ this.refreshChart();
7169
7178
  }
7170
- ngOnChanges() {
7171
- let self = this;
7179
+ refreshChart() {
7180
+ const self = this;
7172
7181
  d3.select('#' + self.uniqueId).remove();
7173
- this.initializeStackedChart();
7182
+ setTimeout(() => {
7183
+ this.initializeStackedChart();
7184
+ }, 50);
7174
7185
  }
7175
7186
  onResized(event) {
7176
- let self = this;
7177
- setTimeout(function () {
7178
- d3.select('#' + self.uniqueId).remove();
7179
- self.initializeStackedChart();
7180
- }.bind(self), 10);
7187
+ this.refreshChart();
7188
+ }
7189
+ ngOnInit() {
7190
+ if (this.chartData && this.chartData.data) {
7191
+ this.initializeStackedChart();
7192
+ }
7181
7193
  }
7182
- ngOnInit() { }
7183
7194
  initializeStackedChart() {
7184
7195
  var self = this;
7185
7196
  let data = [];
@@ -7392,14 +7403,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
7392
7403
  ])
7393
7404
  .domain(data.map(function (d) {
7394
7405
  return d.name;
7395
- }))
7406
+ }).reverse())
7396
7407
  .padding(isMobile ? 0.2 : 0.5);
7397
7408
  var xScaleFromOrigin = d3
7398
7409
  .scaleBand()
7399
7410
  .rangeRound([width - rightSvgWidth, 0])
7400
7411
  .domain(data.map(function (d) {
7401
7412
  return d.name;
7402
- }));
7413
+ }).reverse());
7403
7414
  // ...existing code...
7404
7415
  /**
7405
7416
  * draw second x axis on top
@@ -8551,7 +8562,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8551
8562
  var height = parseInt(verticalstackedcontainer.style('height')) *
8552
8563
  (self.chartConfiguration.svgHeight / 100) -
8553
8564
  margin.top -
8554
- margin.bottom;
8565
+ margin.bottom + 30;
8555
8566
  /**
8556
8567
  * entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
8557
8568
  */
@@ -8642,7 +8653,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8642
8653
  .append('svg')
8643
8654
  // .attr('id', self.uniqueId)
8644
8655
  .attr('width', width - rightSvgWidth)
8645
- .attr('height', height + margin.top + margin.bottom + 60)
8656
+ .attr('height', height + margin.top + margin.bottom + 30)
8646
8657
  // .call(ChartHelper.responsivefy)
8647
8658
  .append('g')
8648
8659
  .attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
@@ -8778,7 +8789,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8778
8789
  });
8779
8790
  }
8780
8791
  if (self.chartConfiguration.xLabelsOnSameLine) {
8781
- const xAxisLabels = svg
8792
+ svg
8782
8793
  .selectAll('g.x1.axis1 g.tick text')
8783
8794
  .attr('class', 'lib-xaxis-labels-texts-drilldown')
8784
8795
  .style('font-size', this.isHeaderVisible ? '18px' : '14px')
@@ -8787,9 +8798,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8787
8798
  if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
8788
8799
  // In maximized (fullscreen) view, keep the gap minimal
8789
8800
  if (self.chartConfiguration.isFullScreen) {
8790
- return short_tick_length_bg + 5; // Slightly reduce gap
8801
+ return short_tick_length_bg;
8791
8802
  }
8792
- return short_tick_length_bg + 5;
8803
+ return short_tick_length_bg;
8793
8804
  }
8794
8805
  // For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
8795
8806
  if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
@@ -8838,13 +8849,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8838
8849
  if (isValueToBeIgnored) {
8839
8850
  return '';
8840
8851
  }
8841
- // Always add space before and after hyphen for date range labels, even when header is visible and label is single line
8842
- // Apply for grouped bar charts and single bar charts, header visible, single line
8843
- const dateRangeRegex = /(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})\s*-\s*(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})/;
8844
- if (dateRangeRegex.test(d.trim())) {
8845
- return d.trim().replace(dateRangeRegex, (m, d1, d2) => `${d1} - ${d2}`);
8846
- }
8847
- // Show the date label as it is, do not trim or hide the year
8848
8852
  // If label looks like a date (contains digits and - or /)
8849
8853
  const isDateLabel = /\d{2,4}[-\/]/.test(d);
8850
8854
  // Only split date/week labels if there are many grouped bars and header is not visible
@@ -8862,32 +8866,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
8862
8866
  return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
8863
8867
  }
8864
8868
  return d.toLowerCase();
8865
- // If label looks like a date (contains digits and - or /)
8866
- const isDateLabel2 = /\d{2,4}[-\/]/.test(d);
8867
- // Only split date/week labels if there are many grouped bars and header is not visible
8868
- if (isDateLabel) {
8869
- if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
8870
- var first = d.substring(0, d.indexOf(' '));
8871
- var second = d.substring(d.indexOf(' ') + 1).trim();
8872
- return first + '\n' + second;
8873
- }
8874
- else {
8875
- return d;
8876
- }
8877
- }
8878
- if (d.trim().indexOf(' ') > -1) {
8879
- return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
8880
- }
8881
- return d.toLowerCase();
8882
- });
8883
- // Now apply writing-mode: sideways-lr for grouped charts with date labels in zoomed-out view and many bars
8884
- xAxisLabels.each(function (d) {
8885
- // Only apply writing-mode for exact date labels, not those containing 'week' or similar
8886
- const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
8887
- const isWeekLabel = /week|wk|w\d+/i.test(d);
8888
- if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
8889
- d3.select(this).style('writing-mode', 'sideways-lr');
8890
- }
8891
8869
  });
8892
8870
  if (!isMobile) {
8893
8871
  svg
@@ -9041,19 +9019,20 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9041
9019
  });
9042
9020
  }
9043
9021
  var xSubgroup = d3.scaleBand().domain(subgroups);
9044
- if (subgroups.length > 1 && !this.isZoomedOut) {
9022
+ // Weekly shipped/planned daily grouped chart: increase bar width for both zoom-in and zoom-out views
9023
+ if (subgroups.length > 1 && this.chartConfiguration.isMultiChartGridLine) {
9024
+ xSubgroup.range([0, x.bandwidth() * 1.2]).padding(0.05);
9025
+ }
9026
+ else if (subgroups.length > 1 && !this.isZoomedOut) {
9045
9027
  // For grouped bar charts in zoom-in view, reduce padding between bars
9046
- xSubgroup.range([0, x.bandwidth()]);
9028
+ xSubgroup.range([0, x.bandwidth()]).padding(0.05);
9047
9029
  }
9048
9030
  else if (subgroups.length === 1 && !this.isZoomedOut) {
9049
- // For single-bar (non-grouped) charts in zoom-in view, set bar width to 100 (increased from 80)
9050
- xSubgroup.range([0, 100]);
9051
- }
9052
- else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
9053
- xSubgroup.range([0, x.bandwidth()]);
9031
+ // For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
9032
+ xSubgroup.range([0, 80]);
9054
9033
  }
9055
9034
  else {
9056
- // used to make grouped bars with lesser width as we are not using padding for width
9035
+ // All other cases (including zoomed-out), use full bandwidth
9057
9036
  xSubgroup.range([0, x.bandwidth()]);
9058
9037
  }
9059
9038
  // if (this.chartConfiguration.isDrilldownChart) {
@@ -9110,7 +9089,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9110
9089
  // Increase bar width a bit in zoom-in view
9111
9090
  let reducedBarWidth = 60;
9112
9091
  if (!self.isZoomedOut) {
9113
- reducedBarWidth = 30;
9092
+ reducedBarWidth = 80;
9114
9093
  }
9115
9094
  if (self.chartData.data.length == 1) {
9116
9095
  if (Object.keys(self.chartData.data[0]).length == 2) {
@@ -9151,7 +9130,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9151
9130
  .attr('width', function (d) {
9152
9131
  // For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
9153
9132
  if (subgroups.length > 1 && !self.isZoomedOut) {
9154
- return xSubgroup.bandwidth() * 0.2;
9133
+ return xSubgroup.bandwidth() * 0.5;
9155
9134
  }
9156
9135
  // For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
9157
9136
  if (subgroups.length === 1 && !self.isZoomedOut) {
@@ -9167,7 +9146,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9167
9146
  // Increase bar width a bit in zoom-in view
9168
9147
  let reducedBarWidth = 60;
9169
9148
  if (!self.isZoomedOut) {
9170
- reducedBarWidth = 500;
9149
+ reducedBarWidth = 80;
9171
9150
  }
9172
9151
  if (self.chartData.data.length == 1) {
9173
9152
  if (Object.keys(self.chartData.data[0]).length == 2) {
@@ -9688,7 +9667,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9688
9667
  }
9689
9668
  const xLabelText = metaData.xLabel;
9690
9669
  const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
9691
- const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 40);
9670
+ const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
9692
9671
  svg
9693
9672
  .append('text')
9694
9673
  .attr('class', function () {