@carbon/charts-vue 0.52.2 → 0.53.1

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/charts-vue.umd.js CHANGED
@@ -1080,6 +1080,7 @@ var meter = {
1080
1080
  },
1081
1081
  total: {
1082
1082
  paddingLeft: 36,
1083
+ paddingRight: 24,
1083
1084
  },
1084
1085
  height: {
1085
1086
  default: 8,
@@ -9726,7 +9727,9 @@ var model_ChartModel = /** @class */ (function () {
9726
9727
  var _b = _a.percentage, percentage = _b === void 0 ? false : _b, _c = _a.groups, groups = _c === void 0 ? null : _c, _d = _a.divergent, divergent = _d === void 0 ? false : _d;
9727
9728
  var options = this.getOptions();
9728
9729
  var groupMapsTo = options.data.groupMapsTo;
9729
- var dataGroupNames = this.getDataGroupNames(groups);
9730
+ // Get only active data groups so non-active data groups are not rendered
9731
+ // on legend item click
9732
+ var dataGroupNames = this.getActiveDataGroupNames(groups);
9730
9733
  var dataValuesGroupedByKeys = this.getDataValuesGroupedByKeys({
9731
9734
  groups: groups,
9732
9735
  });
@@ -23281,9 +23284,9 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23281
23284
  title.exit().remove();
23282
23285
  // appends the associated percentage after title
23283
23286
  this.appendPercentage();
23284
- // if status ranges are provided (custom or default), display indicator
23285
- this.displayStatus();
23286
23287
  }
23288
+ // if status ranges are provided (custom or default), display indicator
23289
+ this.displayStatus();
23287
23290
  // get the max width of a title (with consideration for the status/percentage)
23288
23291
  var maxWidth = this.getMaxTitleWidth();
23289
23292
  var titleElement = dom_utils_DOMUtils.appendOrSelect(svg, 'text.meter-title');
@@ -23354,7 +23357,7 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23354
23357
  var totalString = totalFormatter !== null
23355
23358
  ? totalFormatter(totalValue)
23356
23359
  : total + " " + unit + " total";
23357
- var containerBounds = dom_utils_DOMUtils.getSVGElementSize(this.services.domUtils.getMainContainer(), { useAttrs: true });
23360
+ var containerBounds = dom_utils_DOMUtils.getHTMLElementSize(this.services.domUtils.getMainContainer());
23358
23361
  // need to check if the width is 0, and try to use the parent attribute
23359
23362
  // this can happen if the chart is toggled on/off and the height is 0 for the parent, it wont validateDimensions
23360
23363
  var containerWidth = containerBounds.width
@@ -23368,7 +23371,10 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23368
23371
  .append('text')
23369
23372
  .classed('proportional-meter-total', true)
23370
23373
  .merge(title)
23371
- .attr('x', containerWidth)
23374
+ // Position the total text -24 pixels to add spacing between text and status icon (if status exists)
23375
+ .attr('x', this.model.getStatus()
23376
+ ? containerWidth - meter.total.paddingRight
23377
+ : containerWidth)
23372
23378
  .attr('y', '1em')
23373
23379
  .attr('text-anchor', 'end')
23374
23380
  .text(function (d) { return d; });
@@ -39258,7 +39264,7 @@ var zoom_bar_ZoomBar = /** @class */ (function (_super) {
39258
39264
  }, { skipUpdate: true });
39259
39265
  }
39260
39266
  else if (newInitialZoomDomain === null &&
39261
- oldInitialZoomDomain != null) {
39267
+ oldInitialZoomDomain !== null) {
39262
39268
  // if newInitialZoomDomain is set to null (when oldInitialZoomDomain is not null)
39263
39269
  // save initialZoomDomain and reset zoom domain to default domain
39264
39270
  this.model.set({
@@ -41554,9 +41560,18 @@ var meter_MeterChartModel = /** @class */ (function (_super) {
41554
41560
  */
41555
41561
  MeterChartModel.prototype.getStatus = function () {
41556
41562
  var options = this.getOptions();
41557
- var dataValue = tools_Tools.getProperty(this.getDisplayData(), 0, 'value');
41563
+ var dataValues = tools_Tools.getProperty(this.getDisplayData());
41564
+ var totalValue = (dataValues
41565
+ ? dataValues.reduce(function (previous, current) {
41566
+ return { value: previous.value + current.value };
41567
+ })
41568
+ : 0).value;
41558
41569
  // use max value if the percentage is bigger than 100%
41559
- var boundedValue = dataValue > 100 ? 100 : dataValue;
41570
+ var boundedValue = tools_Tools.getProperty(options, 'meter', 'proportional')
41571
+ ? totalValue
41572
+ : totalValue > 100
41573
+ ? 100
41574
+ : totalValue;
41560
41575
  // user needs to supply ranges
41561
41576
  var allRanges = tools_Tools.getProperty(options, 'meter', 'status', 'ranges');
41562
41577
  if (allRanges) {
@@ -41713,7 +41728,9 @@ var meter_Meter = /** @class */ (function (_super) {
41713
41728
  // rect with the value binded
41714
41729
  var valued = svg.selectAll('rect.value').data(stackedData);
41715
41730
  // if user provided a color for the bar, we dont want to attach a status class
41716
- var className = status != null && !self.model.isUserProvidedColorScaleValid()
41731
+ var className = status != null &&
41732
+ !self.model.isUserProvidedColorScaleValid() &&
41733
+ !proportional
41717
41734
  ? "value status--" + status
41718
41735
  : 'value';
41719
41736
  // draw the value bar
@@ -41759,9 +41776,7 @@ var meter_Meter = /** @class */ (function (_super) {
41759
41776
  .attr('aria-label', function (d) { return d.value; });
41760
41777
  valued.exit().remove();
41761
41778
  // draw the peak
41762
- var peakValue = proportional
41763
- ? null
41764
- : tools_Tools.getProperty(options, 'meter', 'peak');
41779
+ var peakValue = tools_Tools.getProperty(options, 'meter', 'peak');
41765
41780
  var peakData = peakValue;
41766
41781
  if (peakValue !== null) {
41767
41782
  if (peakValue > domainMax) {
@@ -41783,7 +41798,11 @@ var meter_Meter = /** @class */ (function (_super) {
41783
41798
  .attr('y1', 0)
41784
41799
  .attr('y2', function () {
41785
41800
  var userProvidedHeight = tools_Tools.getProperty(options, 'meter', 'height');
41786
- return userProvidedHeight ? userProvidedHeight : 8;
41801
+ return userProvidedHeight
41802
+ ? userProvidedHeight
41803
+ : proportional
41804
+ ? meter.height.proportional
41805
+ : meter.height.default;
41787
41806
  })
41788
41807
  .transition()
41789
41808
  .call(function (t) {