axidio-styleguide-library1-v2 0.2.92 → 0.2.93
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.
|
@@ -7786,111 +7786,11 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7786
7786
|
}
|
|
7787
7787
|
}
|
|
7788
7788
|
// ==================== HELPER METHODS ====================
|
|
7789
|
-
// private renderXAxis(svg, x, height, metaData, subgroups, data,
|
|
7790
|
-
// shortTickLengthBg, longTickLengthBg, self, isria, isMobile, isTablet) {
|
|
7791
|
-
// let alternate_text = false;
|
|
7792
|
-
// if (this.chartConfiguration.isMultiChartGridLine === undefined) {
|
|
7793
|
-
// // Normal ticks for dashboard charts
|
|
7794
|
-
// // Dynamically adjust Y translation for mobile
|
|
7795
|
-
// let translateY = height;
|
|
7796
|
-
// if (isMobile) {
|
|
7797
|
-
// translateY = height + 26; // Add extra space at the top for mobile
|
|
7798
|
-
// }
|
|
7799
|
-
// svg.append('g')
|
|
7800
|
-
// .attr('class', 'x1 axis1')
|
|
7801
|
-
// .attr('transform', `translate(0,${translateY})`)
|
|
7802
|
-
// .call(d3.axisBottom(x))
|
|
7803
|
-
// .call((g) => g.select('.domain').remove());
|
|
7804
|
-
// svg.selectAll('g.x1.axis1 g.tick line').remove();
|
|
7805
|
-
// const yOffset = subgroups.length > 1 && !metaData.xLabel ? 32 : 0;
|
|
7806
|
-
// svg.selectAll('g.x1.axis1 g.tick text')
|
|
7807
|
-
// .attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
7808
|
-
// .style('fill', 'var(--chart-text-color)')
|
|
7809
|
-
// .attr('y', yOffset || null);
|
|
7810
|
-
// } else {
|
|
7811
|
-
// // Bigger ticks for weekly charts
|
|
7812
|
-
// svg.append('g')
|
|
7813
|
-
// .attr('class', 'x1 axis1')
|
|
7814
|
-
// .attr('transform', `translate(0,${height})`)
|
|
7815
|
-
// .call(d3.axisBottom(x).tickSize(0))
|
|
7816
|
-
// .call((g) => g.select('.domain').attr('fill', 'none'));
|
|
7817
|
-
// // Alternate tick line sizes
|
|
7818
|
-
// svg.selectAll('g.x1.axis1 g.tick line').attr('y2', function () {
|
|
7819
|
-
// if (alternate_text && self.chartConfiguration.isNoAlternateXaxisText === undefined) {
|
|
7820
|
-
// alternate_text = false;
|
|
7821
|
-
// return longTickLengthBg - 7;
|
|
7822
|
-
// } else {
|
|
7823
|
-
// alternate_text = true;
|
|
7824
|
-
// return shortTickLengthBg - 4;
|
|
7825
|
-
// }
|
|
7826
|
-
// });
|
|
7827
|
-
// alternate_text = false;
|
|
7828
|
-
// // X-axis label texts
|
|
7829
|
-
// svg.selectAll('g.x1.axis1 g.tick text')
|
|
7830
|
-
// .attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
7831
|
-
// .attr('y', function () {
|
|
7832
|
-
// if (self.chartConfiguration.isFullScreen) {
|
|
7833
|
-
// return shortTickLengthBg;
|
|
7834
|
-
// }
|
|
7835
|
-
// if (alternate_text) {
|
|
7836
|
-
// alternate_text = false;
|
|
7837
|
-
// return longTickLengthBg;
|
|
7838
|
-
// } else {
|
|
7839
|
-
// alternate_text = true;
|
|
7840
|
-
// return shortTickLengthBg;
|
|
7841
|
-
// }
|
|
7842
|
-
// });
|
|
7843
|
-
// }
|
|
7844
|
-
// // Apply labels on same line configuration
|
|
7845
|
-
// if (self.chartConfiguration.xLabelsOnSameLine) {
|
|
7846
|
-
// this.applyXLabelsOnSameLine(svg, subgroups, data, metaData, self,
|
|
7847
|
-
// shortTickLengthBg, isMobile, isria);
|
|
7848
|
-
// }
|
|
7849
|
-
// // Mobile override for RIA
|
|
7850
|
-
// if (isria && self.chartData.data.length > 8) {
|
|
7851
|
-
// svg.selectAll('g.x1.axis1 g.tick text')
|
|
7852
|
-
// .classed('mobile-xaxis-override', true)
|
|
7853
|
-
// .text((d: string) => d.substring(0, 3))
|
|
7854
|
-
// .style('font-size', '12px')
|
|
7855
|
-
// .attr('y', 5)
|
|
7856
|
-
// .attr('x', 5)
|
|
7857
|
-
// .style('text-anchor', 'middle');
|
|
7858
|
-
// }
|
|
7859
|
-
// // Mobile/tablet override - check for single-group date charts first
|
|
7860
|
-
// if (isMobile) {
|
|
7861
|
-
// const textNodes = svg.selectAll('g.x1.axis1 g.tick text');
|
|
7862
|
-
// const groupsCount = (data as any).length || 0;
|
|
7863
|
-
// // Check if we have dates in x-axis and single group
|
|
7864
|
-
// let hasDateValues = false;
|
|
7865
|
-
// textNodes.each(function(d) {
|
|
7866
|
-
// // Check for date values using both Date.parse and regex for date format
|
|
7867
|
-
// const isDateString =
|
|
7868
|
-
// /^\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4}$/.test(d.trim()) ||
|
|
7869
|
-
// /^(\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4})\s*[-–]\s*(\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4})$/.test(d.trim());
|
|
7870
|
-
// if (!hasDateValues && isDateString) {
|
|
7871
|
-
// hasDateValues = true;
|
|
7872
|
-
// }
|
|
7873
|
-
// });
|
|
7874
|
-
// if (hasDateValues && subgroups && subgroups.length < 3) {
|
|
7875
|
-
// // For single chart with dates, ensure horizontal display
|
|
7876
|
-
// textNodes
|
|
7877
|
-
// .style('writing-mode', 'horizontal-tb') // Explicitly set horizontal
|
|
7878
|
-
// .classed('mobile-xaxis-override', false) // Remove vertical class
|
|
7879
|
-
// .attr('transform', 'rotate(0)') // Remove any rotation
|
|
7880
|
-
// .attr('text-anchor', 'middle') // Center align
|
|
7881
|
-
// .attr('y', 20) // Push down a bit
|
|
7882
|
-
// .attr('dx', '0') // Reset any x offset
|
|
7883
|
-
// .attr('dy', '0'); // Reset any y offset
|
|
7884
|
-
// } else if (!this.isHeaderVisible) {
|
|
7885
|
-
// // Default mobile behavior for non-date or multi-group
|
|
7886
|
-
// textNodes.classed('mobile-xaxis-override', true);
|
|
7887
|
-
// }
|
|
7888
|
-
// }
|
|
7889
|
-
// }
|
|
7890
7789
|
renderXAxis(svg, x, height, metaData, subgroups, data, shortTickLengthBg, longTickLengthBg, self, isria, isMobile, isTablet) {
|
|
7891
7790
|
let alternate_text = false;
|
|
7892
7791
|
if (this.chartConfiguration.isMultiChartGridLine === undefined) {
|
|
7893
7792
|
// Normal ticks for dashboard charts
|
|
7793
|
+
// Dynamically adjust Y translation for mobile
|
|
7894
7794
|
let translateY = height;
|
|
7895
7795
|
if (isMobile) {
|
|
7896
7796
|
translateY = height + 26; // Add extra space at the top for mobile
|
|
@@ -7914,6 +7814,7 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7914
7814
|
.attr('transform', `translate(0,${height})`)
|
|
7915
7815
|
.call(d3.axisBottom(x).tickSize(0))
|
|
7916
7816
|
.call((g) => g.select('.domain').attr('fill', 'none'));
|
|
7817
|
+
// Alternate tick line sizes
|
|
7917
7818
|
svg.selectAll('g.x1.axis1 g.tick line').attr('y2', function () {
|
|
7918
7819
|
if (alternate_text && self.chartConfiguration.isNoAlternateXaxisText === undefined) {
|
|
7919
7820
|
alternate_text = false;
|
|
@@ -7925,11 +7826,13 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7925
7826
|
}
|
|
7926
7827
|
});
|
|
7927
7828
|
alternate_text = false;
|
|
7829
|
+
// X-axis label texts
|
|
7928
7830
|
svg.selectAll('g.x1.axis1 g.tick text')
|
|
7929
7831
|
.attr('class', 'lib-xaxis-labels-texts-weeklycharts')
|
|
7930
7832
|
.attr('y', function () {
|
|
7931
|
-
if (self.chartConfiguration.isFullScreen)
|
|
7833
|
+
if (self.chartConfiguration.isFullScreen) {
|
|
7932
7834
|
return shortTickLengthBg;
|
|
7835
|
+
}
|
|
7933
7836
|
if (alternate_text) {
|
|
7934
7837
|
alternate_text = false;
|
|
7935
7838
|
return longTickLengthBg;
|
|
@@ -7954,46 +7857,33 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7954
7857
|
.attr('x', 5)
|
|
7955
7858
|
.style('text-anchor', 'middle');
|
|
7956
7859
|
}
|
|
7957
|
-
// Mobile/tablet override
|
|
7958
|
-
const textNodes = svg.selectAll('g.x1.axis1 g.tick text');
|
|
7959
|
-
let hasDateValues = false;
|
|
7960
|
-
textNodes.each(function (d) {
|
|
7961
|
-
const isDateString = /^\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4}$/.test(d.trim()) ||
|
|
7962
|
-
/^(\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4})\s*[-–]\s*(\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4})$/.test(d.trim()) ||
|
|
7963
|
-
/^\d{1,2}\/\d{1,2}\/\d{4}\s*week\s*\d+$/i.test(d.trim());
|
|
7964
|
-
if (!hasDateValues && isDateString)
|
|
7965
|
-
hasDateValues = true;
|
|
7966
|
-
});
|
|
7967
|
-
// Trim "week" and year in labels if present
|
|
7968
|
-
textNodes.text(function (d) {
|
|
7969
|
-
if (/week/i.test(d)) {
|
|
7970
|
-
// Example: "10/02/2025 week 23" → "10/02"
|
|
7971
|
-
const match = d.match(/^(\d{1,2}\/\d{1,2})/);
|
|
7972
|
-
return match ? match[1] : d.replace(/week\s*\d+/i, '').trim();
|
|
7973
|
-
}
|
|
7974
|
-
return d;
|
|
7975
|
-
});
|
|
7976
|
-
// Apply rotation for tablet view with date labels
|
|
7977
|
-
if (isTablet && hasDateValues) {
|
|
7978
|
-
textNodes
|
|
7979
|
-
.style('writing-mode', 'sideways-lr')
|
|
7980
|
-
.style('text-anchor', 'start')
|
|
7981
|
-
.attr('dy', '0.5em')
|
|
7982
|
-
.attr('dx', '-0.3em');
|
|
7983
|
-
}
|
|
7984
|
-
// For mobile - ensure horizontal spacing and adjustment
|
|
7860
|
+
// Mobile/tablet override - check for single-group date charts first
|
|
7985
7861
|
if (isMobile) {
|
|
7862
|
+
const textNodes = svg.selectAll('g.x1.axis1 g.tick text');
|
|
7986
7863
|
const groupsCount = data.length || 0;
|
|
7864
|
+
// Check if we have dates in x-axis and single group
|
|
7865
|
+
let hasDateValues = false;
|
|
7866
|
+
textNodes.each(function (d) {
|
|
7867
|
+
// Check for date values using both Date.parse and regex for date format
|
|
7868
|
+
const isDateString = /^\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4}$/.test(d.trim()) ||
|
|
7869
|
+
/^(\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4})\s*[-–]\s*(\d{1,4}[-\/]\d{1,2}[-\/]\d{1,4})$/.test(d.trim());
|
|
7870
|
+
if (!hasDateValues && isDateString) {
|
|
7871
|
+
hasDateValues = true;
|
|
7872
|
+
}
|
|
7873
|
+
});
|
|
7987
7874
|
if (hasDateValues && subgroups && subgroups.length < 3) {
|
|
7875
|
+
// For single chart with dates, ensure horizontal display
|
|
7988
7876
|
textNodes
|
|
7989
|
-
.style('writing-mode', 'horizontal-tb')
|
|
7990
|
-
.
|
|
7991
|
-
.attr('
|
|
7992
|
-
.attr('
|
|
7993
|
-
.attr('
|
|
7994
|
-
.attr('
|
|
7877
|
+
.style('writing-mode', 'horizontal-tb') // Explicitly set horizontal
|
|
7878
|
+
.classed('mobile-xaxis-override', false) // Remove vertical class
|
|
7879
|
+
.attr('transform', 'rotate(0)') // Remove any rotation
|
|
7880
|
+
.attr('text-anchor', 'middle') // Center align
|
|
7881
|
+
.attr('y', 20) // Push down a bit
|
|
7882
|
+
.attr('dx', '0') // Reset any x offset
|
|
7883
|
+
.attr('dy', '0'); // Reset any y offset
|
|
7995
7884
|
}
|
|
7996
7885
|
else if (!this.isHeaderVisible) {
|
|
7886
|
+
// Default mobile behavior for non-date or multi-group
|
|
7997
7887
|
textNodes.classed('mobile-xaxis-override', true);
|
|
7998
7888
|
}
|
|
7999
7889
|
}
|
|
@@ -8070,9 +7960,26 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
8070
7960
|
};
|
|
8071
7961
|
const labelInfo = hasDateAndTime(d);
|
|
8072
7962
|
// Apply date-week trimming only for mobile and tablet screens
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
7963
|
+
// Mobile: show full date (including year). Tablet: show only month/day.
|
|
7964
|
+
const isMobileScreen = window.innerWidth < 576;
|
|
7965
|
+
const isTabletScreen = window.innerWidth >= 576 && window.innerWidth < 992;
|
|
7966
|
+
if ((isMobileScreen || isTabletScreen) && labelInfo.isDate && labelInfo.isWeek) {
|
|
7967
|
+
const datePartMatch = d.match(/\d{2,4}[-\/]\d{1,2}[-\/]\d{1,4}/);
|
|
7968
|
+
if (!datePartMatch)
|
|
7969
|
+
return d;
|
|
7970
|
+
const datePart = datePartMatch[0];
|
|
7971
|
+
if (isTabletScreen) {
|
|
7972
|
+
// Return only MM/DD (handle both YYYY/MM/DD and MM/DD/YYYY)
|
|
7973
|
+
const parts = datePart.split(/[-\/]/);
|
|
7974
|
+
if (parts[0].length === 4) {
|
|
7975
|
+
// YYYY/MM/DD -> MM/DD
|
|
7976
|
+
return `${parts[1]}/${parts[2]}`;
|
|
7977
|
+
}
|
|
7978
|
+
// MM/DD/YYYY -> MM/DD
|
|
7979
|
+
return `${parts[0]}/${parts[1]}`;
|
|
7980
|
+
}
|
|
7981
|
+
// Mobile: return full date including year
|
|
7982
|
+
return datePart;
|
|
8076
7983
|
}
|
|
8077
7984
|
// Mobile handling: keep date labels intact for single-series charts (do not trim)
|
|
8078
7985
|
if (isMobile) {
|