axidio-styleguide-library1-v2 0.1.17 → 0.1.18
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/group-chart/group-chart.component.mjs +3 -3
- package/esm2022/lib/horizontal-bars-with-scroll-zoom/horizontal-bars-with-scroll-zoom.component.mjs +3 -3
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +53 -21
- package/fesm2022/axidio-styleguide-library1-v2.mjs +56 -24
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -3934,13 +3934,13 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3934
3934
|
.padding([0.5])
|
|
3935
3935
|
.domain(data.map(function (d) {
|
|
3936
3936
|
return d.name.toLowerCase();
|
|
3937
|
-
})
|
|
3937
|
+
}));
|
|
3938
3938
|
}
|
|
3939
3939
|
else {
|
|
3940
3940
|
x = d3
|
|
3941
3941
|
.scaleBand()
|
|
3942
|
+
.domain(groups)
|
|
3942
3943
|
.range([leftAndRightSpaces, width - rightSvgWidth - leftAndRightSpaces])
|
|
3943
|
-
.domain(groups).reverse()
|
|
3944
3944
|
.padding([0.3]);
|
|
3945
3945
|
}
|
|
3946
3946
|
// x.bandwidth(96);
|
|
@@ -7392,14 +7392,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7392
7392
|
])
|
|
7393
7393
|
.domain(data.map(function (d) {
|
|
7394
7394
|
return d.name;
|
|
7395
|
-
})
|
|
7395
|
+
}))
|
|
7396
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
7403
|
// ...existing code...
|
|
7404
7404
|
/**
|
|
7405
7405
|
* draw second x axis on top
|
|
@@ -8551,7 +8551,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8551
8551
|
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
8552
8552
|
(self.chartConfiguration.svgHeight / 100) -
|
|
8553
8553
|
margin.top -
|
|
8554
|
-
margin.bottom
|
|
8554
|
+
margin.bottom;
|
|
8555
8555
|
/**
|
|
8556
8556
|
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
8557
8557
|
*/
|
|
@@ -8642,7 +8642,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8642
8642
|
.append('svg')
|
|
8643
8643
|
// .attr('id', self.uniqueId)
|
|
8644
8644
|
.attr('width', width - rightSvgWidth)
|
|
8645
|
-
.attr('height', height + margin.top + margin.bottom +
|
|
8645
|
+
.attr('height', height + margin.top + margin.bottom + 60)
|
|
8646
8646
|
// .call(ChartHelper.responsivefy)
|
|
8647
8647
|
.append('g')
|
|
8648
8648
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
@@ -8778,18 +8778,18 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8778
8778
|
});
|
|
8779
8779
|
}
|
|
8780
8780
|
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
8781
|
-
svg
|
|
8781
|
+
const xAxisLabels = svg
|
|
8782
8782
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8783
8783
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8784
8784
|
.style('font-size', this.isHeaderVisible ? '18px' : '14px')
|
|
8785
8785
|
.attr('y', function (d) {
|
|
8786
|
-
// For grouped bar charts with many bars and xLabel present,
|
|
8786
|
+
// For grouped bar charts with many bars and xLabel present, only add 5 if the label is a date
|
|
8787
8787
|
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
8788
|
-
|
|
8788
|
+
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8789
8789
|
if (self.chartConfiguration.isFullScreen) {
|
|
8790
|
-
return short_tick_length_bg;
|
|
8790
|
+
return isDateLabel ? short_tick_length_bg + 10 : short_tick_length_bg;
|
|
8791
8791
|
}
|
|
8792
|
-
return short_tick_length_bg;
|
|
8792
|
+
return isDateLabel ? short_tick_length_bg + 10 : short_tick_length_bg;
|
|
8793
8793
|
}
|
|
8794
8794
|
// For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
|
|
8795
8795
|
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
@@ -8838,6 +8838,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8838
8838
|
if (isValueToBeIgnored) {
|
|
8839
8839
|
return '';
|
|
8840
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
|
|
8841
8848
|
// If label looks like a date (contains digits and - or /)
|
|
8842
8849
|
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8843
8850
|
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
@@ -8855,6 +8862,32 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8855
8862
|
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8856
8863
|
}
|
|
8857
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
|
+
}
|
|
8858
8891
|
});
|
|
8859
8892
|
if (!isMobile) {
|
|
8860
8893
|
svg
|
|
@@ -9008,20 +9041,19 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9008
9041
|
});
|
|
9009
9042
|
}
|
|
9010
9043
|
var xSubgroup = d3.scaleBand().domain(subgroups);
|
|
9011
|
-
|
|
9012
|
-
if (subgroups.length > 1 && this.chartConfiguration.isMultiChartGridLine) {
|
|
9013
|
-
xSubgroup.range([0, x.bandwidth() * 1.2]).padding(0.05);
|
|
9014
|
-
}
|
|
9015
|
-
else if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9044
|
+
if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9016
9045
|
// For grouped bar charts in zoom-in view, reduce padding between bars
|
|
9017
|
-
xSubgroup.range([0, x.bandwidth()])
|
|
9046
|
+
xSubgroup.range([0, x.bandwidth()]);
|
|
9018
9047
|
}
|
|
9019
9048
|
else if (subgroups.length === 1 && !this.isZoomedOut) {
|
|
9020
|
-
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9021
|
-
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()]);
|
|
9022
9054
|
}
|
|
9023
9055
|
else {
|
|
9024
|
-
//
|
|
9056
|
+
// used to make grouped bars with lesser width as we are not using padding for width
|
|
9025
9057
|
xSubgroup.range([0, x.bandwidth()]);
|
|
9026
9058
|
}
|
|
9027
9059
|
// if (this.chartConfiguration.isDrilldownChart) {
|
|
@@ -9078,7 +9110,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9078
9110
|
// Increase bar width a bit in zoom-in view
|
|
9079
9111
|
let reducedBarWidth = 60;
|
|
9080
9112
|
if (!self.isZoomedOut) {
|
|
9081
|
-
reducedBarWidth =
|
|
9113
|
+
reducedBarWidth = 30;
|
|
9082
9114
|
}
|
|
9083
9115
|
if (self.chartData.data.length == 1) {
|
|
9084
9116
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9119,7 +9151,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9119
9151
|
.attr('width', function (d) {
|
|
9120
9152
|
// For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
|
|
9121
9153
|
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
9122
|
-
return xSubgroup.bandwidth() * 0.
|
|
9154
|
+
return xSubgroup.bandwidth() * 0.2;
|
|
9123
9155
|
}
|
|
9124
9156
|
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9125
9157
|
if (subgroups.length === 1 && !self.isZoomedOut) {
|
|
@@ -9135,7 +9167,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9135
9167
|
// Increase bar width a bit in zoom-in view
|
|
9136
9168
|
let reducedBarWidth = 60;
|
|
9137
9169
|
if (!self.isZoomedOut) {
|
|
9138
|
-
reducedBarWidth =
|
|
9170
|
+
reducedBarWidth = 500;
|
|
9139
9171
|
}
|
|
9140
9172
|
if (self.chartData.data.length == 1) {
|
|
9141
9173
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9656,7 +9688,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9656
9688
|
}
|
|
9657
9689
|
const xLabelText = metaData.xLabel;
|
|
9658
9690
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
9659
|
-
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 + 40);
|
|
9660
9692
|
svg
|
|
9661
9693
|
.append('text')
|
|
9662
9694
|
.attr('class', function () {
|