axidio-styleguide-library1-v2 0.6.22 → 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.
- package/esm2022/lib/horizontal-bars-with-scroll-zoom/horizontal-bars-with-scroll-zoom.component.mjs +26 -12
- package/fesm2022/axidio-styleguide-library1-v2.mjs +25 -11
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/lib/horizontal-bars-with-scroll-zoom/horizontal-bars-with-scroll-zoom.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -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 (
|
|
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) {
|
|
@@ -7345,14 +7359,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7345
7359
|
if (this.chartConfiguration.isYaxisHidden) {
|
|
7346
7360
|
d3.selectAll('.yaxis-dashed').attr('class', 'lib-display-hidden');
|
|
7347
7361
|
}
|
|
7348
|
-
if (this.isZoomedOut && data.length > 9) {
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
}
|
|
7362
|
+
// if (this.isZoomedOut && data.length > 9) {
|
|
7363
|
+
// svg
|
|
7364
|
+
// .selectAll('.lib-xaxis-labels-texts-drilldown')
|
|
7365
|
+
// .attr('transform', 'rotate(-90)')
|
|
7366
|
+
// .attr('text-anchor', 'end')
|
|
7367
|
+
// .attr('x', '-5')
|
|
7368
|
+
// .attr('dy', null);
|
|
7369
|
+
// }
|
|
7356
7370
|
}
|
|
7357
7371
|
renderCustomXAxis(svg, scales, dimensions, data) {
|
|
7358
7372
|
svg
|