axidio-styleguide-library1-v2 0.2.68 → 0.2.69

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.
@@ -9103,7 +9103,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9103
9103
  }
9104
9104
  });
9105
9105
  if (hasDateValues && subgroups && subgroups.length < 3) {
9106
- // For single-series charts on mobile, ensure horizontal display
9106
+ // For single chart with dates, ensure horizontal display
9107
9107
  textNodes
9108
9108
  .style('writing-mode', 'horizontal-tb') // Explicitly set horizontal
9109
9109
  .classed('mobile-xaxis-override', false) // Remove vertical class
@@ -9131,16 +9131,46 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9131
9131
  applyXLabelsOnSameLine(svg, subgroups, data, metaData, self, shortTickLengthBg, isMobile, isria) {
9132
9132
  const xAxisLabels = svg.selectAll('g.x1.axis1 g.tick text')
9133
9133
  .attr('class', 'lib-xaxis-labels-texts-drilldown')
9134
- .style('font-size', this.isHeaderVisible ? '18px' : '14px')
9134
+ .style('font-size', () => {
9135
+ if (isMobile)
9136
+ return '12px'; // Smaller font on mobile
9137
+ return this.isHeaderVisible ? '18px' : '14px';
9138
+ })
9135
9139
  .attr('text-anchor', 'middle')
9136
- .attr('y', (d) => this.calculateXLabelYPosition(d, subgroups, data, metaData, self, shortTickLengthBg))
9137
- .attr('x', (d) => (self.chartData.data.length > 8 && !self.isZoomedOut) ? 1 : 0)
9138
- .text((d) => this.formatXLabelText(d, data, metaData, subgroups, self, isMobile));
9139
- // Apply writing-mode for grouped charts with date labels in zoomed-out view
9140
+ .attr('y', (d) => {
9141
+ if (isMobile) {
9142
+ return 20; // Fixed position for mobile
9143
+ }
9144
+ return this.calculateXLabelYPosition(d, subgroups, data, metaData, self, shortTickLengthBg);
9145
+ })
9146
+ .attr('x', (d) => {
9147
+ if (isMobile && self.isZoomedOut) {
9148
+ return 0; // Center align on mobile
9149
+ }
9150
+ return (self.chartData.data.length > 8 && !self.isZoomedOut) ? 1 : 0;
9151
+ })
9152
+ .text((d) => {
9153
+ if (isMobile) {
9154
+ // For mobile, use shorter format
9155
+ const text = d.toString().trim();
9156
+ if (text.length > 8) {
9157
+ // If it's a date, keep first part before space or first 8 chars
9158
+ const dateMatch = text.match(/^(\d{2,4}[-\/]\d{2}[-\/]\d{2,4})/);
9159
+ if (dateMatch) {
9160
+ return dateMatch[1];
9161
+ }
9162
+ // For other text, keep first 8 chars with ellipsis
9163
+ return text.substring(0, 8) + '...';
9164
+ }
9165
+ return text;
9166
+ }
9167
+ return this.formatXLabelText(d, data, metaData, subgroups, self, isMobile);
9168
+ });
9169
+ // Apply writing-mode for grouped charts with date labels in zoomed-out view (non-mobile only)
9140
9170
  xAxisLabels.each(function (d) {
9141
9171
  const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
9142
9172
  const isWeekLabel = /week|wk|w\d+/i.test(d);
9143
- if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
9173
+ if (!isMobile && subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
9144
9174
  d3.select(this).style('writing-mode', 'sideways-lr');
9145
9175
  }
9146
9176
  });
@@ -9299,32 +9329,16 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
9299
9329
  setupXSubgroupScale(subgroups, x, self) {
9300
9330
  const xSubgroup = d3.scaleBand().domain(subgroups);
9301
9331
  if (subgroups.length > 1 && !this.isZoomedOut) {
9302
- xSubgroup.range([0, x.bandwidth()]).padding(0.25); // Add padding between bars
9332
+ xSubgroup.range([0, x.bandwidth()]);
9303
9333
  }
9304
9334
  else if (subgroups.length === 1 && !this.isZoomedOut) {
9305
9335
  xSubgroup.range([0, 100]);
9306
9336
  }
9307
- else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
9308
- xSubgroup.range([0, x.bandwidth()]).padding(0.25); // Add padding between bars in zoom-out view
9309
- }
9310
- else {
9311
- // used to make grouped bars with lesser width as we are not using padding for width
9312
- xSubgroup.range([0, x.bandwidth()]).padding(0.25);
9313
- }
9314
- // Enable horizontal scrollbar in zoom-out view on mobile/tablet
9315
- const isMobile = window.innerWidth < 576;
9316
- const isTablet = window.innerWidth >= 576 && window.innerWidth < 992;
9317
- if ((isMobile || isTablet) && this.isZoomedOut && subgroups.length > 1) {
9318
- // Add a class or style to the container to enable horizontal scrolling
9319
- const chartContainer = this.containerElt.nativeElement;
9320
- chartContainer.style.overflowX = 'auto';
9321
- chartContainer.style.webkitOverflowScrolling = 'touch';
9337
+ else if (this.chartConfiguration.isMultiChartGridLine === undefined) {
9338
+ xSubgroup.range([0, x.bandwidth()]);
9322
9339
  }
9323
9340
  else {
9324
- // Remove horizontal scroll if not needed
9325
- const chartContainer = this.containerElt.nativeElement;
9326
- chartContainer.style.overflowX = '';
9327
- chartContainer.style.webkitOverflowScrolling = '';
9341
+ xSubgroup.range([0, x.bandwidth()]);
9328
9342
  }
9329
9343
  return xSubgroup;
9330
9344
  }