axidio-styleguide-library1-v2 0.1.14 → 0.1.15
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 +13 -24
- 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 +64 -43
- 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 +2 -3
- package/package.json +1 -1
|
@@ -7163,34 +7163,23 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7163
7163
|
this.isCC = false;
|
|
7164
7164
|
this.isZoomedOut = false;
|
|
7165
7165
|
}
|
|
7166
|
-
ngOnChanges(changes) {
|
|
7167
|
-
if (changes['chartData'] || changes['customChartConfiguration']) {
|
|
7168
|
-
const self = this;
|
|
7169
|
-
d3.select('#' + self.uniqueId).remove();
|
|
7170
|
-
if (this.chartData && this.chartData.data) {
|
|
7171
|
-
this.initializeStackedChart();
|
|
7172
|
-
}
|
|
7173
|
-
}
|
|
7174
|
-
}
|
|
7175
7166
|
isZoomOutSelected(isZoomOut) {
|
|
7176
7167
|
this.isZoomedOut = isZoomOut;
|
|
7177
|
-
this.
|
|
7168
|
+
this.ngOnChanges();
|
|
7178
7169
|
}
|
|
7179
|
-
|
|
7180
|
-
|
|
7170
|
+
ngOnChanges() {
|
|
7171
|
+
let self = this;
|
|
7181
7172
|
d3.select('#' + self.uniqueId).remove();
|
|
7182
|
-
|
|
7183
|
-
this.initializeStackedChart();
|
|
7184
|
-
}, 50);
|
|
7173
|
+
this.initializeStackedChart();
|
|
7185
7174
|
}
|
|
7186
7175
|
onResized(event) {
|
|
7187
|
-
this
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
}
|
|
7176
|
+
let self = this;
|
|
7177
|
+
setTimeout(function () {
|
|
7178
|
+
d3.select('#' + self.uniqueId).remove();
|
|
7179
|
+
self.initializeStackedChart();
|
|
7180
|
+
}.bind(self), 10);
|
|
7193
7181
|
}
|
|
7182
|
+
ngOnInit() { }
|
|
7194
7183
|
initializeStackedChart() {
|
|
7195
7184
|
var self = this;
|
|
7196
7185
|
let data = [];
|
|
@@ -7403,14 +7392,14 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7403
7392
|
])
|
|
7404
7393
|
.domain(data.map(function (d) {
|
|
7405
7394
|
return d.name;
|
|
7406
|
-
})
|
|
7395
|
+
}))
|
|
7407
7396
|
.padding(isMobile ? 0.2 : 0.5);
|
|
7408
7397
|
var xScaleFromOrigin = d3
|
|
7409
7398
|
.scaleBand()
|
|
7410
7399
|
.rangeRound([width - rightSvgWidth, 0])
|
|
7411
7400
|
.domain(data.map(function (d) {
|
|
7412
7401
|
return d.name;
|
|
7413
|
-
})
|
|
7402
|
+
}));
|
|
7414
7403
|
// ...existing code...
|
|
7415
7404
|
/**
|
|
7416
7405
|
* draw second x axis on top
|
|
@@ -8562,7 +8551,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8562
8551
|
var height = parseInt(verticalstackedcontainer.style('height')) *
|
|
8563
8552
|
(self.chartConfiguration.svgHeight / 100) -
|
|
8564
8553
|
margin.top -
|
|
8565
|
-
margin.bottom
|
|
8554
|
+
margin.bottom;
|
|
8566
8555
|
/**
|
|
8567
8556
|
* entire height used in weekly charts as x axis needed to be displayed at the bottom of the chart
|
|
8568
8557
|
*/
|
|
@@ -8653,7 +8642,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8653
8642
|
.append('svg')
|
|
8654
8643
|
// .attr('id', self.uniqueId)
|
|
8655
8644
|
.attr('width', width - rightSvgWidth)
|
|
8656
|
-
.attr('height', height + margin.top + margin.bottom +
|
|
8645
|
+
.attr('height', height + margin.top + margin.bottom + 60)
|
|
8657
8646
|
// .call(ChartHelper.responsivefy)
|
|
8658
8647
|
.append('g')
|
|
8659
8648
|
.attr('transform', 'translate(' + 0 + ',' + margin.top + ')');
|
|
@@ -8789,18 +8778,18 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8789
8778
|
});
|
|
8790
8779
|
}
|
|
8791
8780
|
if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
8792
|
-
svg
|
|
8781
|
+
const xAxisLabels = svg
|
|
8793
8782
|
.selectAll('g.x1.axis1 g.tick text')
|
|
8794
8783
|
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
8795
8784
|
.style('font-size', this.isHeaderVisible ? '18px' : '14px')
|
|
8796
8785
|
.attr('y', function (d) {
|
|
8797
|
-
// 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
|
|
8798
8787
|
if (subgroups.length > 1 && data.length > 8 && metaData.xLabel) {
|
|
8799
|
-
|
|
8788
|
+
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8800
8789
|
if (self.chartConfiguration.isFullScreen) {
|
|
8801
|
-
return short_tick_length_bg;
|
|
8790
|
+
return isDateLabel ? short_tick_length_bg + 5 : short_tick_length_bg;
|
|
8802
8791
|
}
|
|
8803
|
-
return short_tick_length_bg;
|
|
8792
|
+
return isDateLabel ? short_tick_length_bg + 5 : short_tick_length_bg;
|
|
8804
8793
|
}
|
|
8805
8794
|
// For grouped bar charts with many bars and NO xLabel, add space as before, but reduce in fullscreen
|
|
8806
8795
|
if (subgroups.length > 1 && data.length > 8 && !metaData.xLabel) {
|
|
@@ -8849,6 +8838,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8849
8838
|
if (isValueToBeIgnored) {
|
|
8850
8839
|
return '';
|
|
8851
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
|
|
8852
8848
|
// If label looks like a date (contains digits and - or /)
|
|
8853
8849
|
const isDateLabel = /\d{2,4}[-\/]/.test(d);
|
|
8854
8850
|
// Only split date/week labels if there are many grouped bars and header is not visible
|
|
@@ -8866,6 +8862,32 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8866
8862
|
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
8867
8863
|
}
|
|
8868
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
|
+
}
|
|
8869
8891
|
});
|
|
8870
8892
|
if (!isMobile) {
|
|
8871
8893
|
svg
|
|
@@ -9019,20 +9041,19 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9019
9041
|
});
|
|
9020
9042
|
}
|
|
9021
9043
|
var xSubgroup = d3.scaleBand().domain(subgroups);
|
|
9022
|
-
|
|
9023
|
-
if (subgroups.length > 1 && this.chartConfiguration.isMultiChartGridLine) {
|
|
9024
|
-
xSubgroup.range([0, x.bandwidth() * 1.2]).padding(0.05);
|
|
9025
|
-
}
|
|
9026
|
-
else if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9044
|
+
if (subgroups.length > 1 && !this.isZoomedOut) {
|
|
9027
9045
|
// For grouped bar charts in zoom-in view, reduce padding between bars
|
|
9028
|
-
xSubgroup.range([0, x.bandwidth()])
|
|
9046
|
+
xSubgroup.range([0, x.bandwidth()]);
|
|
9029
9047
|
}
|
|
9030
9048
|
else if (subgroups.length === 1 && !this.isZoomedOut) {
|
|
9031
|
-
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9032
|
-
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()]);
|
|
9033
9054
|
}
|
|
9034
9055
|
else {
|
|
9035
|
-
//
|
|
9056
|
+
// used to make grouped bars with lesser width as we are not using padding for width
|
|
9036
9057
|
xSubgroup.range([0, x.bandwidth()]);
|
|
9037
9058
|
}
|
|
9038
9059
|
// if (this.chartConfiguration.isDrilldownChart) {
|
|
@@ -9089,7 +9110,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9089
9110
|
// Increase bar width a bit in zoom-in view
|
|
9090
9111
|
let reducedBarWidth = 60;
|
|
9091
9112
|
if (!self.isZoomedOut) {
|
|
9092
|
-
reducedBarWidth =
|
|
9113
|
+
reducedBarWidth = 30;
|
|
9093
9114
|
}
|
|
9094
9115
|
if (self.chartData.data.length == 1) {
|
|
9095
9116
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9130,7 +9151,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9130
9151
|
.attr('width', function (d) {
|
|
9131
9152
|
// For grouped bar charts in zoom-in view, slightly increase bar width for both bars (shipped and planned)
|
|
9132
9153
|
if (subgroups.length > 1 && !self.isZoomedOut) {
|
|
9133
|
-
return xSubgroup.bandwidth() * 0.
|
|
9154
|
+
return xSubgroup.bandwidth() * 0.2;
|
|
9134
9155
|
}
|
|
9135
9156
|
// For single-bar (non-grouped) charts in zoom-in view, set bar width to 80
|
|
9136
9157
|
if (subgroups.length === 1 && !self.isZoomedOut) {
|
|
@@ -9146,7 +9167,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9146
9167
|
// Increase bar width a bit in zoom-in view
|
|
9147
9168
|
let reducedBarWidth = 60;
|
|
9148
9169
|
if (!self.isZoomedOut) {
|
|
9149
|
-
reducedBarWidth =
|
|
9170
|
+
reducedBarWidth = 500;
|
|
9150
9171
|
}
|
|
9151
9172
|
if (self.chartData.data.length == 1) {
|
|
9152
9173
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
@@ -9667,7 +9688,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9667
9688
|
}
|
|
9668
9689
|
const xLabelText = metaData.xLabel;
|
|
9669
9690
|
const isAcr = isAcronym(xLabelText.replace(/[^A-Za-z]/g, ''));
|
|
9670
|
-
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);
|
|
9671
9692
|
svg
|
|
9672
9693
|
.append('text')
|
|
9673
9694
|
.attr('class', function () {
|