axidio-styleguide-library1-v2 0.1.9 → 0.1.11
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 +4 -5
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +19 -46
- package/fesm2022/axidio-styleguide-library1-v2.mjs +21 -49
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -7387,20 +7387,19 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7387
7387
|
var xScale = d3
|
|
7388
7388
|
.scaleBand()
|
|
7389
7389
|
.rangeRound([
|
|
7390
|
+
width - rightSvgWidth - leftAndRightSpaces,
|
|
7390
7391
|
leftAndRightSpaces,
|
|
7391
|
-
width - rightSvgWidth - leftAndRightSpaces
|
|
7392
7392
|
])
|
|
7393
7393
|
.domain(data.map(function (d) {
|
|
7394
7394
|
return d.name;
|
|
7395
|
-
}))
|
|
7396
|
-
|
|
7395
|
+
}));
|
|
7396
|
+
// xScale.bandwidth(192);
|
|
7397
7397
|
var xScaleFromOrigin = d3
|
|
7398
7398
|
.scaleBand()
|
|
7399
7399
|
.rangeRound([width - rightSvgWidth, 0])
|
|
7400
7400
|
.domain(data.map(function (d) {
|
|
7401
7401
|
return d.name;
|
|
7402
7402
|
}));
|
|
7403
|
-
// ...existing code...
|
|
7404
7403
|
/**
|
|
7405
7404
|
* draw second x axis on top
|
|
7406
7405
|
*/
|
|
@@ -8551,7 +8550,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8551
8550
|
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
8552
8551
|
(self.chartConfiguration.svgHeight / 100) -
|
|
8553
8552
|
margin.top -
|
|
8554
|
-
margin.bottom;
|
|
8553
|
+
margin.bottom + 30;
|
|
8555
8554
|
/**
|
|
8556
8555
|
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
8557
8556
|
*/
|
|
@@ -8642,7 +8641,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8642
8641
|
.append('svg')
|
|
8643
8642
|
// .attr('id', self.uniqueId)
|
|
8644
8643
|
.attr('width', width - rightSvgWidth)
|
|
8645
|
-
.attr('height', height + margin.top + margin.bottom +
|
|
8644
|
+
.attr('height', height + margin.top + margin.bottom + 30)
|
|
8646
8645
|
// .call(ChartHelper.responsivefy)
|
|
8647
8646
|
.append('g')
|
|
8648
8647
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
@@ -8778,7 +8777,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8778
8777
|
});
|
|
8779
8778
|
}
|
|
8780
8779
|
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
8781
|
-
|
|
8780
|
+
svg
|
|
8782
8781
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8783
8782
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8784
8783
|
.style('font-size', this.isHeaderVisible ? '18px' : '14px')
|
|
@@ -8787,9 +8786,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8787
8786
|
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
8788
8787
|
// In maximized (fullscreen) view, keep the gap minimal
|
|
8789
8788
|
if (self.chartConfiguration.isFullScreen) {
|
|
8790
|
-
return short_tick_length_bg
|
|
8789
|
+
return short_tick_length_bg;
|
|
8791
8790
|
}
|
|
8792
|
-
return short_tick_length_bg
|
|
8791
|
+
return short_tick_length_bg;
|
|
8793
8792
|
}
|
|
8794
8793
|
// For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
|
|
8795
8794
|
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
@@ -8838,25 +8837,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8838
8837
|
if (isValueToBeIgnored) {
|
|
8839
8838
|
return '';
|
|
8840
8839
|
}
|
|
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
|
-
// If in zoomed-out view and label is a date, show only month and date (MM/DD)
|
|
8848
|
-
if (self.isZoomedOut) {
|
|
8849
|
-
// Match date formats like '08/04/25', '2025-08-04', '08-04-2025', etc.
|
|
8850
|
-
// Try to extract MM/DD from various formats
|
|
8851
|
-
let match = d.match(/(\d{2,4})[-\/](\d{2})[-\/](\d{2,4})/);
|
|
8852
|
-
if (match) {
|
|
8853
|
-
let yearFirst = match[1].length === 4;
|
|
8854
|
-
let yearLast = match[3].length === 4;
|
|
8855
|
-
let month = yearFirst ? match[2] : match[1];
|
|
8856
|
-
let day = yearFirst ? match[3] : match[2];
|
|
8857
|
-
return `${month}/${day}`;
|
|
8858
|
-
}
|
|
8859
|
-
}
|
|
8860
8840
|
// If label looks like a date (contains digits and - or /)
|
|
8861
8841
|
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8862
8842
|
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
@@ -8875,15 +8855,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8875
8855
|
}
|
|
8876
8856
|
return d.toLowerCase();
|
|
8877
8857
|
});
|
|
8878
|
-
// Now apply writing-mode: sideways-lr for grouped charts with date labels in zoomed-out view and many bars
|
|
8879
|
-
xAxisLabels.each(function (d) {
|
|
8880
|
-
// Only apply writing-mode for exact date labels, not those containing 'week' or similar
|
|
8881
|
-
const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
|
|
8882
|
-
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
8883
|
-
if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
|
|
8884
|
-
d3.select(this).style('writing-mode', 'sideways-lr');
|
|
8885
|
-
}
|
|
8886
|
-
});
|
|
8887
8858
|
if (!isMobile) {
|
|
8888
8859
|
svg
|
|
8889
8860
|
.selectAll('g.x1.axis1 g.tick')
|
|
@@ -9036,19 +9007,20 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9036
9007
|
});
|
|
9037
9008
|
}
|
|
9038
9009
|
var xSubgroup = d3.scaleBand().domain(subgroups);
|
|
9039
|
-
|
|
9010
|
+
// Weekly shipped/planned daily grouped chart: increase bar width for both zoom-in and zoom-out views
|
|
9011
|
+
if (subgroups.length > 1 && this.chartConfiguration.isMultiChartGridLine) {
|
|
9012
|
+
xSubgroup.range([0, x.bandwidth() * 1.2]).padding(0.05);
|
|
9013
|
+
}
|
|
9014
|
+
else if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9040
9015
|
// For grouped bar charts in zoom-in view, reduce padding between bars
|
|
9041
|
-
xSubgroup.range([0, x.bandwidth()]);
|
|
9016
|
+
xSubgroup.range([0, x.bandwidth()]).padding(0.05);
|
|
9042
9017
|
}
|
|
9043
9018
|
else if (subgroups.length === 1 && !this.isZoomedOut) {
|
|
9044
|
-
// For single-bar (non-grouped) charts in zoom-in view, set bar width to
|
|
9045
|
-
xSubgroup.range([0,
|
|
9046
|
-
}
|
|
9047
|
-
else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
9048
|
-
xSubgroup.range([0, x.bandwidth()]);
|
|
9019
|
+
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9020
|
+
xSubgroup.range([0, 80]);
|
|
9049
9021
|
}
|
|
9050
9022
|
else {
|
|
9051
|
-
//
|
|
9023
|
+
// All other cases (including zoomed-out), use full bandwidth
|
|
9052
9024
|
xSubgroup.range([0, x.bandwidth()]);
|
|
9053
9025
|
}
|
|
9054
9026
|
// if (this.chartConfiguration.isDrilldownChart) {
|
|
@@ -9105,7 +9077,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9105
9077
|
// Increase bar width a bit in zoom-in view
|
|
9106
9078
|
let reducedBarWidth = 60;
|
|
9107
9079
|
if (!self.isZoomedOut) {
|
|
9108
|
-
reducedBarWidth =
|
|
9080
|
+
reducedBarWidth = 80;
|
|
9109
9081
|
}
|
|
9110
9082
|
if (self.chartData.data.length == 1) {
|
|
9111
9083
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9146,7 +9118,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9146
9118
|
.attr('width', function (d) {
|
|
9147
9119
|
// For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
|
|
9148
9120
|
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
9149
|
-
return xSubgroup.bandwidth() * 0.
|
|
9121
|
+
return xSubgroup.bandwidth() * 0.5;
|
|
9150
9122
|
}
|
|
9151
9123
|
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9152
9124
|
if (subgroups.length === 1 && !self.isZoomedOut) {
|
|
@@ -9162,7 +9134,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9162
9134
|
// Increase bar width a bit in zoom-in view
|
|
9163
9135
|
let reducedBarWidth = 60;
|
|
9164
9136
|
if (!self.isZoomedOut) {
|
|
9165
|
-
reducedBarWidth =
|
|
9137
|
+
reducedBarWidth = 80;
|
|
9166
9138
|
}
|
|
9167
9139
|
if (self.chartData.data.length == 1) {
|
|
9168
9140
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9683,7 +9655,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9683
9655
|
}
|
|
9684
9656
|
const xLabelText = metaData.xLabel;
|
|
9685
9657
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
9686
|
-
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom +
|
|
9658
|
+
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 10);
|
|
9687
9659
|
svg
|
|
9688
9660
|
.append('text')
|
|
9689
9661
|
.attr('class', function () {
|