axidio-styleguide-library1-v2 0.3.2 → 0.3.4
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.
|
@@ -6576,10 +6576,10 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6576
6576
|
calculateDimensions(chartContainer, verticalContainer, margin, dataLength) {
|
|
6577
6577
|
const containerWidth = chartContainer.node().getBoundingClientRect().width;
|
|
6578
6578
|
const containerHeight = verticalContainer.node().getBoundingClientRect().height;
|
|
6579
|
-
const leftAxisWidth =
|
|
6579
|
+
const leftAxisWidth = 80;
|
|
6580
6580
|
const rightAxisWidth = this.CONSTANTS.RIGHT_SVG_WIDTH;
|
|
6581
6581
|
const availableWidth = containerWidth - leftAxisWidth - rightAxisWidth;
|
|
6582
|
-
let width = availableWidth;
|
|
6582
|
+
let width = availableWidth - margin.left - margin.right;
|
|
6583
6583
|
let height = containerHeight * (this.chartConfiguration.svgHeight / 100) - margin.top - margin.bottom;
|
|
6584
6584
|
if (dataLength > this.CONSTANTS.ZOOM_THRESHOLD && this.isZoomedOut) {
|
|
6585
6585
|
const minWidth = dataLength * 25;
|
|
@@ -6627,7 +6627,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6627
6627
|
}
|
|
6628
6628
|
const totalBarsWidth = barWidth * dataLength;
|
|
6629
6629
|
const totalGaps = barPadding * (dataLength - 1);
|
|
6630
|
-
const minRequiredWidth = totalBarsWidth + totalGaps;
|
|
6630
|
+
const minRequiredWidth = totalBarsWidth + totalGaps + (this.CONSTANTS.LEFT_RIGHT_SPACES * 2);
|
|
6631
6631
|
const requiredSvgWidth = Math.max(availableWidth, minRequiredWidth);
|
|
6632
6632
|
return {
|
|
6633
6633
|
width,
|
|
@@ -6640,6 +6640,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6640
6640
|
};
|
|
6641
6641
|
}
|
|
6642
6642
|
createSvgContainers(chartContainer, dimensions, margin) {
|
|
6643
|
+
// Main wrapper
|
|
6643
6644
|
const chartWrapper = chartContainer
|
|
6644
6645
|
.append('div')
|
|
6645
6646
|
.attr('id', this.uniqueId)
|
|
@@ -6654,16 +6655,16 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6654
6655
|
.style('position', 'absolute')
|
|
6655
6656
|
.style('left', '0')
|
|
6656
6657
|
.style('top', '0')
|
|
6657
|
-
.style('width',
|
|
6658
|
+
.style('width', '80px')
|
|
6658
6659
|
.style('height', `${dimensions.height + margin.top + margin.bottom}px`)
|
|
6659
6660
|
.style('background-color', 'var(--card-bg)')
|
|
6660
6661
|
.style('z-index', '10');
|
|
6661
6662
|
const svgYAxisLeft = leftAxisContainer
|
|
6662
6663
|
.append('svg')
|
|
6663
|
-
.attr('width',
|
|
6664
|
+
.attr('width', '80')
|
|
6664
6665
|
.attr('height', dimensions.height + margin.top + margin.bottom)
|
|
6665
6666
|
.append('g')
|
|
6666
|
-
.attr('transform', `translate(${margin.left
|
|
6667
|
+
.attr('transform', `translate(${margin.left + 10},${margin.top})`);
|
|
6667
6668
|
// Right Y-axis - Fixed
|
|
6668
6669
|
const rightAxisContainer = chartWrapper
|
|
6669
6670
|
.append('div')
|
|
@@ -6686,7 +6687,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6686
6687
|
.append('div')
|
|
6687
6688
|
.attr('class', 'scrollable-chart-container')
|
|
6688
6689
|
.style('position', 'absolute')
|
|
6689
|
-
.style('left',
|
|
6690
|
+
.style('left', '80px')
|
|
6690
6691
|
.style('right', `${this.CONSTANTS.RIGHT_SVG_WIDTH}px`)
|
|
6691
6692
|
.style('top', '0')
|
|
6692
6693
|
.style('width', 'auto')
|
|
@@ -6707,18 +6708,19 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6707
6708
|
}
|
|
6708
6709
|
createScales(data, layers, lineData, dimensions) {
|
|
6709
6710
|
const { width, height, barWidth, barPadding } = dimensions;
|
|
6711
|
+
// Calculate bar positioning
|
|
6710
6712
|
const totalBarsWidth = data.length * barWidth;
|
|
6711
6713
|
const totalSpacing = (data.length - 1) * barPadding;
|
|
6712
|
-
const requiredWidth = totalBarsWidth + totalSpacing;
|
|
6714
|
+
const requiredWidth = totalBarsWidth + totalSpacing + (this.CONSTANTS.LEFT_RIGHT_SPACES * 2);
|
|
6713
6715
|
const effectiveWidth = Math.max(width, requiredWidth);
|
|
6714
6716
|
const paddingRatio = barPadding / (barWidth + barPadding);
|
|
6715
|
-
// X-scale starts from 0
|
|
6717
|
+
// X-scale starts from 0 (no left spacing for grid alignment)
|
|
6716
6718
|
const xScale = d3
|
|
6717
6719
|
.scaleBand()
|
|
6718
|
-
.rangeRound([0, dimensions.requiredSvgWidth])
|
|
6720
|
+
.rangeRound([0, dimensions.requiredSvgWidth]) // Full width from 0
|
|
6719
6721
|
.domain(data.map(d => d.name).reverse())
|
|
6720
6722
|
.paddingInner(paddingRatio)
|
|
6721
|
-
.paddingOuter(0.
|
|
6723
|
+
.paddingOuter(0.5)
|
|
6722
6724
|
.align(0.5);
|
|
6723
6725
|
const xScaleFromOrigin = d3
|
|
6724
6726
|
.scaleBand()
|
|
@@ -6930,8 +6932,7 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6930
6932
|
this.addYAxisLabel(svgYAxisLeft, metaData.yLabel, dimensions.height, margin);
|
|
6931
6933
|
}
|
|
6932
6934
|
if (metaData.xLabel) {
|
|
6933
|
-
|
|
6934
|
-
this.addXAxisLabel(svg, metaData.xLabel, dimensions.requiredSvgWidth, dimensions.height, margin);
|
|
6935
|
+
this.addXAxisLabel(svg, metaData.xLabel, dimensions.width, dimensions.height, margin);
|
|
6935
6936
|
}
|
|
6936
6937
|
}
|
|
6937
6938
|
addYAxisLabel(svgYAxisLeft, label, height, margin) {
|
|
@@ -6956,8 +6957,8 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6956
6957
|
const isria = this.customChartConfiguration?.isRia;
|
|
6957
6958
|
const isAcronym = this.isAcronymLabel(label);
|
|
6958
6959
|
const xPosition = isria
|
|
6959
|
-
? height + margin.top + margin.bottom
|
|
6960
|
-
: height + margin.top + margin.bottom +
|
|
6960
|
+
? height + margin.top + margin.bottom
|
|
6961
|
+
: height + margin.top + margin.bottom + 10;
|
|
6961
6962
|
svg
|
|
6962
6963
|
.append('text')
|
|
6963
6964
|
.attr('class', this.getXAxisLabelClass())
|
|
@@ -6965,8 +6966,6 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
6965
6966
|
.attr('transform', `translate(${width / 2},${xPosition})`)
|
|
6966
6967
|
.style('text-anchor', 'middle')
|
|
6967
6968
|
.style('fill', 'var(--chart-text-color)')
|
|
6968
|
-
.style('font-size', '12px')
|
|
6969
|
-
.style('font-weight', '600')
|
|
6970
6969
|
.text(isAcronym ? label.toUpperCase() : label.toLowerCase())
|
|
6971
6970
|
.style('text-transform', isAcronym ? 'none' : 'capitalize');
|
|
6972
6971
|
}
|
|
@@ -7048,15 +7047,16 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7048
7047
|
.call((g) => g.select('.domain').remove());
|
|
7049
7048
|
}
|
|
7050
7049
|
if (this.chartConfiguration.yAxisGrid) {
|
|
7051
|
-
// Grid lines start
|
|
7050
|
+
// Grid lines start from x=0 (no gap with Y-axis)
|
|
7051
|
+
const gridWidth = dimensions.requiredSvgWidth;
|
|
7052
7052
|
svg
|
|
7053
7053
|
.append('g')
|
|
7054
7054
|
.attr('class', 'grid horizontal-grid')
|
|
7055
|
-
.attr('transform', 'translate(0,0)')
|
|
7055
|
+
.attr('transform', 'translate(0,0)') // Start from x=0
|
|
7056
7056
|
.call(d3
|
|
7057
7057
|
.axisLeft(scales.yScale)
|
|
7058
7058
|
.ticks(this.chartConfiguration.numberOfYTicks)
|
|
7059
|
-
.tickSize(-
|
|
7059
|
+
.tickSize(-gridWidth)
|
|
7060
7060
|
.tickFormat(''))
|
|
7061
7061
|
.style('color', 'var(--chart-grid-color)')
|
|
7062
7062
|
.style('opacity', '1')
|
|
@@ -7099,18 +7099,13 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7099
7099
|
}
|
|
7100
7100
|
renderStandardAxes(svg, axes, scales, dimensions, data) {
|
|
7101
7101
|
const isMobileOrTablet = window.innerWidth < 1024;
|
|
7102
|
-
// X-axis
|
|
7102
|
+
// X-axis with labels
|
|
7103
7103
|
const xAxisGroup = svg
|
|
7104
7104
|
.append('g')
|
|
7105
7105
|
.attr('transform', `translate(0,${dimensions.height})`)
|
|
7106
7106
|
.attr('class', 'lib-stacked-x-axis-text')
|
|
7107
7107
|
.call(axes.xAxis);
|
|
7108
|
-
// X-axis
|
|
7109
|
-
xAxisGroup
|
|
7110
|
-
.select('.domain')
|
|
7111
|
-
.style('stroke', 'var(--chart-axis-color)')
|
|
7112
|
-
.style('stroke-width', '1px');
|
|
7113
|
-
// X-axis labels
|
|
7108
|
+
// Style X-axis labels
|
|
7114
7109
|
xAxisGroup
|
|
7115
7110
|
.selectAll('text')
|
|
7116
7111
|
.style('fill', 'var(--chart-text-color)')
|
|
@@ -7124,13 +7119,19 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7124
7119
|
textElement.text(text.substring(0, 10) + '...');
|
|
7125
7120
|
}
|
|
7126
7121
|
});
|
|
7127
|
-
//
|
|
7122
|
+
// Ensure X-axis line is visible
|
|
7123
|
+
xAxisGroup
|
|
7124
|
+
.select('.domain')
|
|
7125
|
+
.style('stroke', 'var(--chart-axis-color)')
|
|
7126
|
+
.style('stroke-width', '1px');
|
|
7127
|
+
// Y-axis
|
|
7128
7128
|
svg
|
|
7129
7129
|
.append('g')
|
|
7130
|
-
.attr('class', 'lib-stacked-y-axis-text
|
|
7130
|
+
.attr('class', 'lib-stacked-y-axis-text')
|
|
7131
7131
|
.attr('style', this.chartConfiguration.yAxisCustomTextStyles)
|
|
7132
7132
|
.call(axes.yAxis)
|
|
7133
|
-
.
|
|
7133
|
+
.selectAll('text')
|
|
7134
|
+
.style('fill', 'var(--chart-text-color)');
|
|
7134
7135
|
}
|
|
7135
7136
|
renderDrilldownAxes(svg, svgYAxisLeft, svgYAxisRight, axes, scales, dimensions) {
|
|
7136
7137
|
svg
|