@carbon/charts-vue 1.2.1 → 1.3.0
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/CHANGELOG.md +8 -0
- package/charts-vue.common.js +28 -8
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +28 -8
- package/charts-vue.umd.js.map +1 -1
- package/charts-vue.umd.min.js +1 -1
- package/charts-vue.umd.min.js.map +1 -1
- package/package.json +2 -2
package/charts-vue.umd.js
CHANGED
|
@@ -25769,6 +25769,8 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
|
|
|
25769
25769
|
_this.type = 'grouped-bar';
|
|
25770
25770
|
_this.renderType = RenderTypes.SVG;
|
|
25771
25771
|
_this.padding = 5;
|
|
25772
|
+
// A factor to normalize padding between bars regardless of bar group density.
|
|
25773
|
+
_this.defaultStepFactor = 70;
|
|
25772
25774
|
// Highlight elements that match the hovered legend item
|
|
25773
25775
|
_this.handleLegendOnHover = function (event) {
|
|
25774
25776
|
var hoveredElement = event.detail.hoveredElement;
|
|
@@ -25888,7 +25890,7 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
|
|
|
25888
25890
|
});
|
|
25889
25891
|
})
|
|
25890
25892
|
.style('fill', function (d) { return _this.model.getFillColor(d[groupMapsTo]); })
|
|
25891
|
-
.attr('d', function (d) {
|
|
25893
|
+
.attr('d', function (d, i) {
|
|
25892
25894
|
/*
|
|
25893
25895
|
* Orientation support for horizontal/vertical bar charts
|
|
25894
25896
|
* Determine coordinates needed for a vertical set of paths
|
|
@@ -25902,8 +25904,11 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
|
|
|
25902
25904
|
var rangeAxis = _this.services.cartesianScales.getRangeAxisPosition({ datum: d });
|
|
25903
25905
|
var y0 = _this.services.cartesianScales.getValueThroughAxisPosition(rangeAxis, 0);
|
|
25904
25906
|
var y1 = _this.services.cartesianScales.getRangeValue(d);
|
|
25905
|
-
// don't show if part of bar is out of zoom domain
|
|
25906
|
-
|
|
25907
|
+
// don't show if part of bar is out of zoom domain - test zoom on bar pos, not group
|
|
25908
|
+
var zoomx0 = _this.services.cartesianScales.getDomainValue(d, i) -
|
|
25909
|
+
barWidth / 2;
|
|
25910
|
+
var zoomx1 = zoomx0 + barWidth;
|
|
25911
|
+
if (_this.isOutsideZoomedDomain(zoomx0, zoomx1)) {
|
|
25907
25912
|
return;
|
|
25908
25913
|
}
|
|
25909
25914
|
return tools_Tools.generateSVGPathString({ x0: x0, x1: x1, y0: y0, y1: y1 }, _this.services.cartesianScales.getOrientation());
|
|
@@ -25988,7 +25993,7 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
|
|
|
25988
25993
|
var displayData = this.model.getDisplayData(this.configs.groups);
|
|
25989
25994
|
return displayData.filter(function (datum) {
|
|
25990
25995
|
var domainIdentifier = _this.services.cartesianScales.getDomainIdentifier(datum);
|
|
25991
|
-
return datum[domainIdentifier] === label;
|
|
25996
|
+
return datum[domainIdentifier].toString() === label;
|
|
25992
25997
|
});
|
|
25993
25998
|
};
|
|
25994
25999
|
GroupedBar.prototype.getGroupWidth = function () {
|
|
@@ -25996,13 +26001,29 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
|
|
|
25996
26001
|
var totalGroupPadding = this.getTotalGroupPadding();
|
|
25997
26002
|
return this.getBarWidth() * activeData.length + totalGroupPadding;
|
|
25998
26003
|
};
|
|
26004
|
+
GroupedBar.prototype.getDomainScaleStep = function () {
|
|
26005
|
+
var domainScale = this.services.cartesianScales.getDomainScale();
|
|
26006
|
+
var activeData = this.model.getGroupedData(this.configs.groups);
|
|
26007
|
+
var step = this.defaultStepFactor;
|
|
26008
|
+
if (typeof domainScale.step === 'function') {
|
|
26009
|
+
step = domainScale.step();
|
|
26010
|
+
}
|
|
26011
|
+
else if (activeData.length > 0) {
|
|
26012
|
+
// as a fallback use distance between first bars of adjacent bar groups
|
|
26013
|
+
var ref = activeData.find(function (d) { var _a; return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.length) > 1; });
|
|
26014
|
+
if (ref) {
|
|
26015
|
+
var domainIdentifier = this.services.cartesianScales.getDomainIdentifier(ref.data[0]);
|
|
26016
|
+
step = Math.abs(domainScale(ref.data[1][domainIdentifier]) - domainScale(ref.data[0][domainIdentifier]));
|
|
26017
|
+
}
|
|
26018
|
+
}
|
|
26019
|
+
return step;
|
|
26020
|
+
};
|
|
25999
26021
|
GroupedBar.prototype.getTotalGroupPadding = function () {
|
|
26000
26022
|
var activeData = this.model.getGroupedData(this.configs.groups);
|
|
26001
26023
|
if (activeData.length === 1) {
|
|
26002
26024
|
return 0;
|
|
26003
26025
|
}
|
|
26004
|
-
var
|
|
26005
|
-
var padding = Math.min(5, 5 * (domainScale.step() / 70));
|
|
26026
|
+
var padding = Math.min(5, 5 * (this.getDomainScaleStep() / this.defaultStepFactor));
|
|
26006
26027
|
return padding * (activeData.length - 1);
|
|
26007
26028
|
};
|
|
26008
26029
|
// Gets the correct width for bars based on options & configurations
|
|
@@ -26021,8 +26042,7 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
|
|
|
26021
26042
|
var activeData = this.model.getGroupedData(this.configs.groups);
|
|
26022
26043
|
var numOfActiveDataGroups = activeData.length;
|
|
26023
26044
|
var totalGroupPadding = this.getTotalGroupPadding();
|
|
26024
|
-
|
|
26025
|
-
return Math.min(providedMaxWidth, (domainScale.step() - totalGroupPadding) / numOfActiveDataGroups);
|
|
26045
|
+
return Math.min(providedMaxWidth, (this.getDomainScaleStep() - totalGroupPadding) / numOfActiveDataGroups);
|
|
26026
26046
|
};
|
|
26027
26047
|
GroupedBar.prototype.setGroupScale = function () {
|
|
26028
26048
|
var activeData = this.model.getActiveDataGroupNames(this.configs.groups);
|