axidio-styleguide-library1-v2 0.3.18 → 0.3.20
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.
|
@@ -7902,6 +7902,35 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7902
7902
|
textNodes.classed('mobile-xaxis-override', true);
|
|
7903
7903
|
}
|
|
7904
7904
|
}
|
|
7905
|
+
// Tablet view: auto-rotate labels vertically when they overlap or are too long
|
|
7906
|
+
if (isTablet) {
|
|
7907
|
+
const textNodes = svg.selectAll('g.x1.axis1 g.tick text');
|
|
7908
|
+
// Measure max label width
|
|
7909
|
+
let maxLabelWidth = 0;
|
|
7910
|
+
textNodes.each(function () {
|
|
7911
|
+
try {
|
|
7912
|
+
const bbox = this.getBBox();
|
|
7913
|
+
if (bbox && bbox.width && bbox.width > maxLabelWidth) {
|
|
7914
|
+
maxLabelWidth = bbox.width;
|
|
7915
|
+
}
|
|
7916
|
+
}
|
|
7917
|
+
catch (e) {
|
|
7918
|
+
// ignore measurement errors
|
|
7919
|
+
}
|
|
7920
|
+
});
|
|
7921
|
+
// Determine available tick slot width
|
|
7922
|
+
const slotWidth = (typeof x.bandwidth === 'function') ? x.bandwidth() : 0;
|
|
7923
|
+
const labelCount = textNodes.size ? textNodes.size() : 0;
|
|
7924
|
+
// If labels are wider than the slot or there are many labels, rotate vertically
|
|
7925
|
+
if ((slotWidth > 0 && maxLabelWidth > slotWidth * 0.75) || labelCount > 3) {
|
|
7926
|
+
textNodes
|
|
7927
|
+
.style('writing-mode', 'sideways-lr')
|
|
7928
|
+
.style('text-anchor', 'middle')
|
|
7929
|
+
.attr('y', 30)
|
|
7930
|
+
.attr('x', 0)
|
|
7931
|
+
.classed('mobile-xaxis-override', true);
|
|
7932
|
+
}
|
|
7933
|
+
}
|
|
7905
7934
|
}
|
|
7906
7935
|
applyXLabelsOnSameLine(svg, subgroups, data, metaData, self, shortTickLengthBg, isMobile, isria) {
|
|
7907
7936
|
const xAxisLabels = svg.selectAll('g.x1.axis1 g.tick text')
|
|
@@ -8611,8 +8640,11 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8611
8640
|
else {
|
|
8612
8641
|
const words = label.split(' ');
|
|
8613
8642
|
text.text(null);
|
|
8614
|
-
words.forEach((word) => {
|
|
8615
|
-
text.append('tspan')
|
|
8643
|
+
words.forEach((word, idx) => {
|
|
8644
|
+
text.append('tspan')
|
|
8645
|
+
.attr('x', 0)
|
|
8646
|
+
.attr('dy', '0em')
|
|
8647
|
+
.text(word + (idx < words.length - 1 ? ' ' : ''));
|
|
8616
8648
|
});
|
|
8617
8649
|
}
|
|
8618
8650
|
})
|