axidio-styleguide-library1-v2 0.6.80 → 0.6.82
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.
|
@@ -3743,7 +3743,7 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3743
3743
|
this.renderMultiChartXAxis(svg, x, height, data, metaData);
|
|
3744
3744
|
}
|
|
3745
3745
|
if (this.chartConfiguration.xLabelsOnSameLine) {
|
|
3746
|
-
this.renderXLabelsOnSameLine(svg, data, metaData
|
|
3746
|
+
this.renderXLabelsOnSameLine(svg, data, metaData);
|
|
3747
3747
|
}
|
|
3748
3748
|
// Bottom x-axis
|
|
3749
3749
|
const xAxis2 = svg
|
|
@@ -3794,42 +3794,34 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
3794
3794
|
}
|
|
3795
3795
|
});
|
|
3796
3796
|
}
|
|
3797
|
-
renderXLabelsOnSameLine(svg, data, metaData
|
|
3798
|
-
const
|
|
3799
|
-
const
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
const
|
|
3806
|
-
const ignore = data.some((indiv) => indiv.name.toLowerCase() === label &&
|
|
3797
|
+
renderXLabelsOnSameLine(svg, data, metaData) {
|
|
3798
|
+
const short_tick_length_bg = 5;
|
|
3799
|
+
const long_tick_length_bg = 30;
|
|
3800
|
+
svg
|
|
3801
|
+
.selectAll('g.x1.axis1 g.tick text')
|
|
3802
|
+
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
3803
|
+
.attr('y', short_tick_length_bg)
|
|
3804
|
+
.text((d) => {
|
|
3805
|
+
const isValueToBeIgnored = data.some((indiv) => indiv.name.toLowerCase() === d.trim().toLowerCase() &&
|
|
3807
3806
|
indiv[metaData.keyList[0]] === -1);
|
|
3808
|
-
if (
|
|
3809
|
-
|
|
3810
|
-
|
|
3807
|
+
if (isValueToBeIgnored)
|
|
3808
|
+
return '';
|
|
3809
|
+
if (d.trim().indexOf(' ') > -1) {
|
|
3810
|
+
return d.trim().substring(0, d.indexOf(' ')).toLowerCase();
|
|
3811
3811
|
}
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
.
|
|
3823
|
-
.text(truncate(parts[0]));
|
|
3824
|
-
// Second line (only if exists)
|
|
3825
|
-
if (parts.length > 1 && bandwidth > 35) {
|
|
3826
|
-
tick
|
|
3827
|
-
.append('text')
|
|
3828
|
-
.attr('class', 'lib-xaxis-labels-texts-drilldown lib-xaxis-split')
|
|
3829
|
-
.attr('y', longY)
|
|
3830
|
-
.attr('text-anchor', 'middle')
|
|
3831
|
-
.text(truncate(parts.slice(1).join(' ')));
|
|
3812
|
+
return d.toLowerCase();
|
|
3813
|
+
});
|
|
3814
|
+
svg
|
|
3815
|
+
.selectAll('g.x1.axis1 g.tick')
|
|
3816
|
+
.append('text')
|
|
3817
|
+
.attr('class', 'lib-xaxis-labels-texts-drilldown')
|
|
3818
|
+
.attr('y', long_tick_length_bg)
|
|
3819
|
+
.attr('fill', 'currentColor')
|
|
3820
|
+
.text((d) => {
|
|
3821
|
+
if (d.trim().indexOf(' ') > -1) {
|
|
3822
|
+
return d.trim().substring(d.indexOf(' ')).toLowerCase();
|
|
3832
3823
|
}
|
|
3824
|
+
return '';
|
|
3833
3825
|
});
|
|
3834
3826
|
}
|
|
3835
3827
|
renderYAxis(svg, svgYAxisLeft, svgYAxisRight, y, dimensions) {
|
|
@@ -4040,24 +4032,6 @@ class GroupChartComponent extends ComponentUniqueId {
|
|
|
4040
4032
|
}
|
|
4041
4033
|
return xSubgroup.bandwidth();
|
|
4042
4034
|
}
|
|
4043
|
-
truncateTextByWidth(text, maxWidth, fontSize = 12, fontFamily = 'sans-serif') {
|
|
4044
|
-
if (!text)
|
|
4045
|
-
return '';
|
|
4046
|
-
const canvas = document.createElement('canvas');
|
|
4047
|
-
const context = canvas.getContext('2d');
|
|
4048
|
-
if (!context)
|
|
4049
|
-
return text;
|
|
4050
|
-
context.font = `${fontSize}px ${fontFamily}`;
|
|
4051
|
-
if (context.measureText(text).width <= maxWidth) {
|
|
4052
|
-
return text;
|
|
4053
|
-
}
|
|
4054
|
-
let truncated = text;
|
|
4055
|
-
while (truncated.length > 0 &&
|
|
4056
|
-
context.measureText(truncated + '…').width > maxWidth) {
|
|
4057
|
-
truncated = truncated.slice(0, -1);
|
|
4058
|
-
}
|
|
4059
|
-
return truncated + '…';
|
|
4060
|
-
}
|
|
4061
4035
|
getBarHeight(d, y, height) {
|
|
4062
4036
|
if (d.value === -1)
|
|
4063
4037
|
return height - y(0);
|