axidio-styleguide-library1-v2 0.6.23 → 0.6.24

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.
@@ -6716,7 +6716,11 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6716
6716
  const isMobileOrTablet = window.innerWidth < 1024;
6717
6717
  let barWidth;
6718
6718
  let barPadding;
6719
- if (isMobileOrTablet) {
6719
+ if (!this.isZoomedOut && dataLength > this.CONSTANTS.ZOOM_IN_THRESHOLD) {
6720
+ barWidth = 60;
6721
+ barPadding = 50;
6722
+ }
6723
+ else if (isMobileOrTablet) {
6720
6724
  if (dataLength === 1) {
6721
6725
  barWidth = 60;
6722
6726
  barPadding = 0;
@@ -6756,6 +6760,11 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6756
6760
  requiredSvgWidth,
6757
6761
  };
6758
6762
  }
6763
+ scrollToCenter(scrollableContainer, svgWidth) {
6764
+ const containerWidth = scrollableContainer.node().getBoundingClientRect().width;
6765
+ const scrollPosition = (svgWidth - containerWidth) / 2;
6766
+ scrollableContainer.node().scrollLeft = Math.max(0, scrollPosition);
6767
+ }
6759
6768
  createSvgContainers(chartContainer, dimensions, margin, hasXLabel // Add this parameter
6760
6769
  ) {
6761
6770
  // Calculate total height including space for X-axis label if present
@@ -6838,7 +6847,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
6838
6847
  .style('align-items', 'center')
6839
6848
  .style('background-color', 'var(--card-bg)')
6840
6849
  .style('z-index', '10');
6841
- return { svg, svgYAxisLeft, svgYAxisRight, innerContainer, bottomLabelContainer };
6850
+ return { svg, svgYAxisLeft, svgYAxisRight, innerContainer, bottomLabelContainer, scrollableContainer };
6842
6851
  }
6843
6852
  createScales(data, layers, lineData, dimensions) {
6844
6853
  const { width, height, barWidth, barPadding } = dimensions;
@@ -7178,7 +7187,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
7178
7187
  const margin = this.chartConfiguration.margin;
7179
7188
  const dimensions = this.calculateDimensions(chartContainer, verticalstackedcontainer, margin, data.length);
7180
7189
  const hasXLabel = !!metaData.xLabel;
7181
- const { svg, svgYAxisLeft, svgYAxisRight, bottomLabelContainer } = this.createSvgContainers(chartContainer, dimensions, margin, hasXLabel);
7190
+ const { svg, svgYAxisLeft, svgYAxisRight, bottomLabelContainer, scrollableContainer } = this.createSvgContainers(chartContainer, dimensions, margin, hasXLabel);
7182
7191
  const stack = d3.stack().keys(keyList).offset(d3.stackOffsetNone);
7183
7192
  const layers = stack(data);
7184
7193
  data.sort((a, b) => b.total - a.total);
@@ -7192,6 +7201,11 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
7192
7201
  this.renderTargetLine(svg, svgYAxisRight, scales, dimensions, metaData);
7193
7202
  this.renderDataLabels(rect, scales, metaData, dimensions);
7194
7203
  this.renderLineChart(svg, lineData, scales, colors, metaData);
7204
+ if (!this.isZoomedOut && data.length > this.CONSTANTS.ZOOM_IN_THRESHOLD) {
7205
+ setTimeout(() => {
7206
+ this.scrollToCenter(scrollableContainer, dimensions.requiredSvgWidth);
7207
+ }, 0);
7208
+ }
7195
7209
  }
7196
7210
  renderGrids(svg, scales, dimensions) {
7197
7211
  if (this.chartConfiguration.isXgridBetweenLabels) {