axidio-styleguide-library1-v2 0.0.907 → 0.0.909
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 +1 -5
- package/esm2022/lib/horizontal-grouped-bar-with-scroll-zoom/horizontal-grouped-bar-with-scroll-zoom.component.mjs +21 -8
- package/fesm2022/axidio-styleguide-library1-v2.mjs +20 -11
- package/fesm2022/axidio-styleguide-library1-v2.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -7412,10 +7412,6 @@ class HorizontalBarsWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
7412
7412
|
}
|
|
7413
7413
|
// Calculate bar width for mobile to avoid overlap
|
|
7414
7414
|
// ...barWidth is now calculated above, remove duplicate...
|
|
7415
|
-
let maxBarWidth = 70;
|
|
7416
|
-
let totalBarSpace = data.length * maxBarWidth;
|
|
7417
|
-
let availableWidth = width - rightSvgWidth - leftAndRightSpaces * 2;
|
|
7418
|
-
let xRangeEnd = Math.max(availableWidth, totalBarSpace);
|
|
7419
7415
|
var xScale = d3
|
|
7420
7416
|
.scaleBand()
|
|
7421
7417
|
.rangeRound([
|
|
@@ -9074,42 +9070,55 @@ class HorizontalGroupedBarWithScrollZoomComponent extends ComponentUniqueId {
|
|
|
9074
9070
|
})
|
|
9075
9071
|
.attr('width', function (d) {
|
|
9076
9072
|
if (self.chartConfiguration.isDrilldownChart) {
|
|
9077
|
-
//
|
|
9073
|
+
// Reduce bar width for single-bar (non-grouped) charts only
|
|
9074
|
+
const reducedBarWidth = 60; // or any value you prefer
|
|
9075
|
+
let isSingleBar = false;
|
|
9078
9076
|
data.map((indiv) => {
|
|
9079
9077
|
if (indiv.name == d.name) {
|
|
9080
9078
|
let keys = Object.keys(indiv).filter((temp, i) => i != 0);
|
|
9081
|
-
var temp;
|
|
9082
9079
|
tempScale = d3.scaleBand().domain(keys).range([0, x.bandwidth()]);
|
|
9083
|
-
|
|
9080
|
+
// If only one key (besides name), treat as single bar
|
|
9081
|
+
if (keys.length === 1) {
|
|
9082
|
+
isSingleBar = true;
|
|
9083
|
+
tempScale.range([
|
|
9084
|
+
0 + (x.bandwidth() - reducedBarWidth) / 2,
|
|
9085
|
+
x.bandwidth() - (x.bandwidth() - reducedBarWidth) / 2,
|
|
9086
|
+
]);
|
|
9087
|
+
}
|
|
9088
|
+
else if (x.bandwidth() > 100) {
|
|
9084
9089
|
if (self.chartData.data.length == 1) {
|
|
9085
9090
|
if (Object.keys(self.chartData.data[0]).length == 2) {
|
|
9086
9091
|
tempScale.range([
|
|
9087
9092
|
0 + (x.bandwidth() - 125) / 2,
|
|
9088
9093
|
x.bandwidth() - (x.bandwidth() - 125) / 2,
|
|
9089
9094
|
]);
|
|
9090
|
-
// .padding(0.05);
|
|
9091
9095
|
}
|
|
9092
|
-
else
|
|
9096
|
+
else {
|
|
9093
9097
|
tempScale.range([
|
|
9094
9098
|
0 + (x.bandwidth() - 125) / 2,
|
|
9095
9099
|
x.bandwidth() - (x.bandwidth() - 125) / 2,
|
|
9096
9100
|
]);
|
|
9097
|
-
|
|
9101
|
+
}
|
|
9098
9102
|
}
|
|
9099
|
-
else
|
|
9103
|
+
else {
|
|
9100
9104
|
tempScale.range([
|
|
9101
9105
|
0 + (x.bandwidth() - 125) / 2,
|
|
9102
9106
|
x.bandwidth() - (x.bandwidth() - 125) / 2,
|
|
9103
9107
|
]);
|
|
9108
|
+
}
|
|
9104
9109
|
}
|
|
9105
9110
|
}
|
|
9106
9111
|
});
|
|
9112
|
+
if (isSingleBar) {
|
|
9113
|
+
return tempScale.bandwidth();
|
|
9114
|
+
}
|
|
9107
9115
|
return self.isZoomedOut
|
|
9108
9116
|
? tempScale.bandwidth()
|
|
9109
9117
|
: self.chartData.data.length && self.chartData.data.length > 8
|
|
9110
9118
|
? tempScale.bandwidth() * 0.5
|
|
9111
9119
|
: tempScale.bandwidth();
|
|
9112
9120
|
}
|
|
9121
|
+
// For non-drilldown charts
|
|
9113
9122
|
return self.isZoomedOut
|
|
9114
9123
|
? tempScale.bandwidth()
|
|
9115
9124
|
: self.chartData.data.length && self.chartData.data.length > 8
|