axidio-styleguide-library1-v2 0.1.11 → 0.1.12
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 +5 -4
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +51 -19
- package/fesm2022/axidio-styleguide-library1-v2.mjs +54 -21
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -7387,19 +7387,20 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7387
7387
|
var xScale = d3
|
|
7388
7388
|
.scaleBand()
|
|
7389
7389
|
.rangeRound([
|
|
7390
|
-
width - rightSvgWidth - leftAndRightSpaces,
|
|
7391
7390
|
leftAndRightSpaces,
|
|
7391
|
+
width - rightSvgWidth - leftAndRightSpaces
|
|
7392
7392
|
])
|
|
7393
7393
|
.domain(data.map(function (d) {
|
|
7394
7394
|
return d.name;
|
|
7395
|
-
}))
|
|
7396
|
-
|
|
7395
|
+
}))
|
|
7396
|
+
.padding(isMobile ? 0.2 : 0.5);
|
|
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...
|
|
7403
7404
|
/**
|
|
7404
7405
|
* draw second x axis on top
|
|
7405
7406
|
*/
|
|
@@ -8550,7 +8551,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8550
8551
|
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
8551
8552
|
(self.chartConfiguration.svgHeight / 100) -
|
|
8552
8553
|
margin.top -
|
|
8553
|
-
margin.bottom
|
|
8554
|
+
margin.bottom;
|
|
8554
8555
|
/**
|
|
8555
8556
|
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
8556
8557
|
*/
|
|
@@ -8641,7 +8642,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8641
8642
|
.append('svg')
|
|
8642
8643
|
// .attr('id', self.uniqueId)
|
|
8643
8644
|
.attr('width', width - rightSvgWidth)
|
|
8644
|
-
.attr('height', height + margin.top + margin.bottom +
|
|
8645
|
+
.attr('height', height + margin.top + margin.bottom + 60)
|
|
8645
8646
|
// .call(ChartHelper.responsivefy)
|
|
8646
8647
|
.append('g')
|
|
8647
8648
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
@@ -8777,7 +8778,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8777
8778
|
});
|
|
8778
8779
|
}
|
|
8779
8780
|
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
8780
|
-
svg
|
|
8781
|
+
const xAxisLabels = svg
|
|
8781
8782
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8782
8783
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8783
8784
|
.style('font-size', this.isHeaderVisible ? '18px' : '14px')
|
|
@@ -8786,9 +8787,9 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8786
8787
|
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
8787
8788
|
// In maximized (fullscreen) view, keep the gap minimal
|
|
8788
8789
|
if (self.chartConfiguration.isFullScreen) {
|
|
8789
|
-
return short_tick_length_bg;
|
|
8790
|
+
return short_tick_length_bg + 3; // Slightly reduce gap
|
|
8790
8791
|
}
|
|
8791
|
-
return short_tick_length_bg;
|
|
8792
|
+
return short_tick_length_bg + 3;
|
|
8792
8793
|
}
|
|
8793
8794
|
// For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
|
|
8794
8795
|
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
@@ -8837,6 +8838,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8837
8838
|
if (isValueToBeIgnored) {
|
|
8838
8839
|
return '';
|
|
8839
8840
|
}
|
|
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
|
+
// Show the date label as it is, do not trim or hide the year
|
|
8840
8848
|
// If label looks like a date (contains digits and - or /)
|
|
8841
8849
|
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8842
8850
|
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
@@ -8854,6 +8862,32 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8854
8862
|
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8855
8863
|
}
|
|
8856
8864
|
return d.toLowerCase();
|
|
8865
|
+
// If label looks like a date (contains digits and - or /)
|
|
8866
|
+
const isDateLabel2 = /\d{2,4}[-\/]/.test(d);
|
|
8867
|
+
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
8868
|
+
if (isDateLabel) {
|
|
8869
|
+
if (!self.isHeaderVisible && data.length > 8 && d.indexOf(' ') > -1) {
|
|
8870
|
+
var first = d.substring(0, d.indexOf(' '));
|
|
8871
|
+
var second = d.substring(d.indexOf(' ') + 1).trim();
|
|
8872
|
+
return first + '\n' + second;
|
|
8873
|
+
}
|
|
8874
|
+
else {
|
|
8875
|
+
return d;
|
|
8876
|
+
}
|
|
8877
|
+
}
|
|
8878
|
+
if (d.trim().indexOf(' ') > -1) {
|
|
8879
|
+
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8880
|
+
}
|
|
8881
|
+
return d.toLowerCase();
|
|
8882
|
+
});
|
|
8883
|
+
// Now apply writing-mode: sideways-lr for grouped charts with date labels in zoomed-out view and many bars
|
|
8884
|
+
xAxisLabels.each(function (d) {
|
|
8885
|
+
// Only apply writing-mode for exact date labels, not those containing 'week' or similar
|
|
8886
|
+
const isDateLabel = /^(\d{2,4}[-\/])?\d{2,4}[-\/]\d{2,4}$/.test(d.trim());
|
|
8887
|
+
const isWeekLabel = /week|wk|w\d+/i.test(d);
|
|
8888
|
+
if (subgroups.length > 1 && self.isZoomedOut && data.length > 8 && isDateLabel && !isWeekLabel) {
|
|
8889
|
+
d3.select(this).style('writing-mode', 'sideways-lr');
|
|
8890
|
+
}
|
|
8857
8891
|
});
|
|
8858
8892
|
if (!isMobile) {
|
|
8859
8893
|
svg
|
|
@@ -9007,20 +9041,19 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9007
9041
|
});
|
|
9008
9042
|
}
|
|
9009
9043
|
var xSubgroup = d3.scaleBand().domain(subgroups);
|
|
9010
|
-
|
|
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) {
|
|
9044
|
+
if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9015
9045
|
// For grouped bar charts in zoom-in view, reduce padding between bars
|
|
9016
|
-
xSubgroup.range([0, x.bandwidth()])
|
|
9046
|
+
xSubgroup.range([0, x.bandwidth()]);
|
|
9017
9047
|
}
|
|
9018
9048
|
else if (subgroups.length === 1 && !this.isZoomedOut) {
|
|
9019
|
-
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9020
|
-
xSubgroup.range([0,
|
|
9049
|
+
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 100 (increased from 80)
|
|
9050
|
+
xSubgroup.range([0, 100]);
|
|
9051
|
+
}
|
|
9052
|
+
else if (this.chartConfiguration.isMultiChartGridLine == undefined) {
|
|
9053
|
+
xSubgroup.range([0, x.bandwidth()]);
|
|
9021
9054
|
}
|
|
9022
9055
|
else {
|
|
9023
|
-
//
|
|
9056
|
+
// used to make grouped bars with lesser width as we are not using padding for width
|
|
9024
9057
|
xSubgroup.range([0, x.bandwidth()]);
|
|
9025
9058
|
}
|
|
9026
9059
|
// if (this.chartConfiguration.isDrilldownChart) {
|
|
@@ -9077,7 +9110,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9077
9110
|
// Increase bar width a bit in zoom-in view
|
|
9078
9111
|
let reducedBarWidth = 60;
|
|
9079
9112
|
if (!self.isZoomedOut) {
|
|
9080
|
-
reducedBarWidth =
|
|
9113
|
+
reducedBarWidth = 30;
|
|
9081
9114
|
}
|
|
9082
9115
|
if (self.chartData.data.length == 1) {
|
|
9083
9116
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9118,7 +9151,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9118
9151
|
.attr('width', function (d) {
|
|
9119
9152
|
// For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
|
|
9120
9153
|
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
9121
|
-
return xSubgroup.bandwidth() * 0.
|
|
9154
|
+
return xSubgroup.bandwidth() * 0.2;
|
|
9122
9155
|
}
|
|
9123
9156
|
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9124
9157
|
if (subgroups.length === 1 && !self.isZoomedOut) {
|
|
@@ -9134,7 +9167,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9134
9167
|
// Increase bar width a bit in zoom-in view
|
|
9135
9168
|
let reducedBarWidth = 60;
|
|
9136
9169
|
if (!self.isZoomedOut) {
|
|
9137
|
-
reducedBarWidth =
|
|
9170
|
+
reducedBarWidth = 500;
|
|
9138
9171
|
}
|
|
9139
9172
|
if (self.chartData.data.length == 1) {
|
|
9140
9173
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9655,7 +9688,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9655
9688
|
}
|
|
9656
9689
|
const xLabelText = metaData.xLabel;
|
|
9657
9690
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
9658
|
-
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom +
|
|
9691
|
+
const xPosition = isria ? (height + margin.top + margin.bottom) : (height + margin.top + margin.bottom + 30);
|
|
9659
9692
|
svg
|
|
9660
9693
|
.append('text')
|
|
9661
9694
|
.attr('class', function () {
|