axidio-styleguide-library1-v2 0.2.88 → 0.2.90
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.
|
@@ -7858,7 +7858,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7858
7858
|
.style('text-anchor', 'middle');
|
|
7859
7859
|
}
|
|
7860
7860
|
// Mobile/tablet override - check for single-group date charts first
|
|
7861
|
-
if (isMobile
|
|
7861
|
+
if (isMobile) {
|
|
7862
7862
|
const textNodes = svg.selectAll('g.x1.axis1 g.tick text');
|
|
7863
7863
|
const groupsCount = data.length || 0;
|
|
7864
7864
|
// Check if we have dates in x-axis and single group
|
|
@@ -7886,15 +7886,6 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7886
7886
|
// Default mobile behavior for non-date or multi-group
|
|
7887
7887
|
textNodes.classed('mobile-xaxis-override', true);
|
|
7888
7888
|
}
|
|
7889
|
-
// If there are many groups on mobile/tablet AND this is a grouped chart,
|
|
7890
|
-
// rotate labels to sideways to avoid overlapping and make them readable.
|
|
7891
|
-
// Do NOT rotate for single-bar charts on tablet/mobile.
|
|
7892
|
-
if (groupsCount > 3 && subgroups && subgroups.length < 3) {
|
|
7893
|
-
svg.selectAll('g.x1.axis1 g.tick text')
|
|
7894
|
-
.style('writing-mode', 'sideways-lr')
|
|
7895
|
-
.style('text-anchor', 'middle')
|
|
7896
|
-
.attr('y', 0);
|
|
7897
|
-
}
|
|
7898
7889
|
}
|
|
7899
7890
|
}
|
|
7900
7891
|
applyXLabelsOnSameLine(svg, subgroups, data, metaData, self, shortTickLengthBg, isMobile, isria) {
|
|
@@ -7962,6 +7953,19 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7962
7953
|
// Check if we're on mobile or tablet
|
|
7963
7954
|
const isSmallScreen = window.innerWidth < 992; // Less than 992px (mobile or tablet)
|
|
7964
7955
|
// Check if label contains both date and week information
|
|
7956
|
+
const formatDatePart = (dateStr) => {
|
|
7957
|
+
// Match different date formats: MM/DD/YYYY, YYYY/MM/DD, etc.
|
|
7958
|
+
const match = dateStr.match(/(\d{1,4})[-\/](\d{1,2})[-\/](\d{1,4})/);
|
|
7959
|
+
if (!match)
|
|
7960
|
+
return dateStr;
|
|
7961
|
+
const [_, part1, part2, part3] = match;
|
|
7962
|
+
// Check if year is first (YYYY/MM/DD)
|
|
7963
|
+
if (part1.length === 4) {
|
|
7964
|
+
return `${part2}/${part3}`; // Return MM/DD
|
|
7965
|
+
}
|
|
7966
|
+
// For MM/DD/YYYY format
|
|
7967
|
+
return `${part1}/${part2}`; // Return MM/DD
|
|
7968
|
+
};
|
|
7965
7969
|
const hasDateAndTime = (text) => {
|
|
7966
7970
|
const dateMatch = /\d{2,4}[-\/]\d{1,2}[-\/]\d{1,4}/.test(text) || !isNaN(Date.parse(text));
|
|
7967
7971
|
const weekMatch = /week|wk|w\d+/i.test(text);
|
|
@@ -7971,7 +7975,10 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7971
7975
|
// Apply date-week trimming only for mobile and tablet screens
|
|
7972
7976
|
if (isSmallScreen && labelInfo.isDate && labelInfo.isWeek) {
|
|
7973
7977
|
const datePart = d.match(/\d{2,4}[-\/]\d{1,2}[-\/]\d{1,4}/);
|
|
7974
|
-
|
|
7978
|
+
if (datePart) {
|
|
7979
|
+
return formatDatePart(datePart[0]);
|
|
7980
|
+
}
|
|
7981
|
+
return d;
|
|
7975
7982
|
}
|
|
7976
7983
|
// Mobile handling: keep date labels intact for single-series charts (do not trim)
|
|
7977
7984
|
if (isMobile) {
|