@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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.3.0](https://github.com/carbon-design-system/carbon-charts/compare/v1.2.1...v1.3.0) (2022-06-28)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.2.1](https://github.com/carbon-design-system/carbon-charts/compare/v1.2.0...v1.2.1) (2022-06-14)
7
15
 
8
16
  **Note:** Version bump only for package @carbon/charts-vue
@@ -25760,6 +25760,8 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
25760
25760
  _this.type = 'grouped-bar';
25761
25761
  _this.renderType = RenderTypes.SVG;
25762
25762
  _this.padding = 5;
25763
+ // A factor to normalize padding between bars regardless of bar group density.
25764
+ _this.defaultStepFactor = 70;
25763
25765
  // Highlight elements that match the hovered legend item
25764
25766
  _this.handleLegendOnHover = function (event) {
25765
25767
  var hoveredElement = event.detail.hoveredElement;
@@ -25879,7 +25881,7 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
25879
25881
  });
25880
25882
  })
25881
25883
  .style('fill', function (d) { return _this.model.getFillColor(d[groupMapsTo]); })
25882
- .attr('d', function (d) {
25884
+ .attr('d', function (d, i) {
25883
25885
  /*
25884
25886
  * Orientation support for horizontal/vertical bar charts
25885
25887
  * Determine coordinates needed for a vertical set of paths
@@ -25893,8 +25895,11 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
25893
25895
  var rangeAxis = _this.services.cartesianScales.getRangeAxisPosition({ datum: d });
25894
25896
  var y0 = _this.services.cartesianScales.getValueThroughAxisPosition(rangeAxis, 0);
25895
25897
  var y1 = _this.services.cartesianScales.getRangeValue(d);
25896
- // don't show if part of bar is out of zoom domain
25897
- if (_this.isOutsideZoomedDomain(x0, x1)) {
25898
+ // don't show if part of bar is out of zoom domain - test zoom on bar pos, not group
25899
+ var zoomx0 = _this.services.cartesianScales.getDomainValue(d, i) -
25900
+ barWidth / 2;
25901
+ var zoomx1 = zoomx0 + barWidth;
25902
+ if (_this.isOutsideZoomedDomain(zoomx0, zoomx1)) {
25898
25903
  return;
25899
25904
  }
25900
25905
  return tools_Tools.generateSVGPathString({ x0: x0, x1: x1, y0: y0, y1: y1 }, _this.services.cartesianScales.getOrientation());
@@ -25979,7 +25984,7 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
25979
25984
  var displayData = this.model.getDisplayData(this.configs.groups);
25980
25985
  return displayData.filter(function (datum) {
25981
25986
  var domainIdentifier = _this.services.cartesianScales.getDomainIdentifier(datum);
25982
- return datum[domainIdentifier] === label;
25987
+ return datum[domainIdentifier].toString() === label;
25983
25988
  });
25984
25989
  };
25985
25990
  GroupedBar.prototype.getGroupWidth = function () {
@@ -25987,13 +25992,29 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
25987
25992
  var totalGroupPadding = this.getTotalGroupPadding();
25988
25993
  return this.getBarWidth() * activeData.length + totalGroupPadding;
25989
25994
  };
25995
+ GroupedBar.prototype.getDomainScaleStep = function () {
25996
+ var domainScale = this.services.cartesianScales.getDomainScale();
25997
+ var activeData = this.model.getGroupedData(this.configs.groups);
25998
+ var step = this.defaultStepFactor;
25999
+ if (typeof domainScale.step === 'function') {
26000
+ step = domainScale.step();
26001
+ }
26002
+ else if (activeData.length > 0) {
26003
+ // as a fallback use distance between first bars of adjacent bar groups
26004
+ var ref = activeData.find(function (d) { var _a; return ((_a = d.data) === null || _a === void 0 ? void 0 : _a.length) > 1; });
26005
+ if (ref) {
26006
+ var domainIdentifier = this.services.cartesianScales.getDomainIdentifier(ref.data[0]);
26007
+ step = Math.abs(domainScale(ref.data[1][domainIdentifier]) - domainScale(ref.data[0][domainIdentifier]));
26008
+ }
26009
+ }
26010
+ return step;
26011
+ };
25990
26012
  GroupedBar.prototype.getTotalGroupPadding = function () {
25991
26013
  var activeData = this.model.getGroupedData(this.configs.groups);
25992
26014
  if (activeData.length === 1) {
25993
26015
  return 0;
25994
26016
  }
25995
- var domainScale = this.services.cartesianScales.getDomainScale();
25996
- var padding = Math.min(5, 5 * (domainScale.step() / 70));
26017
+ var padding = Math.min(5, 5 * (this.getDomainScaleStep() / this.defaultStepFactor));
25997
26018
  return padding * (activeData.length - 1);
25998
26019
  };
25999
26020
  // Gets the correct width for bars based on options & configurations
@@ -26012,8 +26033,7 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
26012
26033
  var activeData = this.model.getGroupedData(this.configs.groups);
26013
26034
  var numOfActiveDataGroups = activeData.length;
26014
26035
  var totalGroupPadding = this.getTotalGroupPadding();
26015
- var domainScale = this.services.cartesianScales.getDomainScale();
26016
- return Math.min(providedMaxWidth, (domainScale.step() - totalGroupPadding) / numOfActiveDataGroups);
26036
+ return Math.min(providedMaxWidth, (this.getDomainScaleStep() - totalGroupPadding) / numOfActiveDataGroups);
26017
26037
  };
26018
26038
  GroupedBar.prototype.setGroupScale = function () {
26019
26039
  var activeData = this.model.getActiveDataGroupNames(this.configs.groups);