@carbon/charts-vue 0.52.2 → 0.52.3

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
+ ## [0.52.3](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.2...v0.52.3) (2021-11-22)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-vue
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.52.2](https://github.com/carbon-design-system/carbon-charts/compare/v0.52.1...v0.52.2) (2021-11-19)
7
15
 
8
16
  **Note:** Version bump only for package @carbon/charts-vue
@@ -1071,6 +1071,7 @@ var meter = {
1071
1071
  },
1072
1072
  total: {
1073
1073
  paddingLeft: 36,
1074
+ paddingRight: 24,
1074
1075
  },
1075
1076
  height: {
1076
1077
  default: 8,
@@ -23272,9 +23273,9 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23272
23273
  title.exit().remove();
23273
23274
  // appends the associated percentage after title
23274
23275
  this.appendPercentage();
23275
- // if status ranges are provided (custom or default), display indicator
23276
- this.displayStatus();
23277
23276
  }
23277
+ // if status ranges are provided (custom or default), display indicator
23278
+ this.displayStatus();
23278
23279
  // get the max width of a title (with consideration for the status/percentage)
23279
23280
  var maxWidth = this.getMaxTitleWidth();
23280
23281
  var titleElement = dom_utils_DOMUtils.appendOrSelect(svg, 'text.meter-title');
@@ -23345,7 +23346,7 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23345
23346
  var totalString = totalFormatter !== null
23346
23347
  ? totalFormatter(totalValue)
23347
23348
  : total + " " + unit + " total";
23348
- var containerBounds = dom_utils_DOMUtils.getSVGElementSize(this.services.domUtils.getMainContainer(), { useAttrs: true });
23349
+ var containerBounds = dom_utils_DOMUtils.getHTMLElementSize(this.services.domUtils.getMainContainer());
23349
23350
  // need to check if the width is 0, and try to use the parent attribute
23350
23351
  // this can happen if the chart is toggled on/off and the height is 0 for the parent, it wont validateDimensions
23351
23352
  var containerWidth = containerBounds.width
@@ -23359,7 +23360,10 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
23359
23360
  .append('text')
23360
23361
  .classed('proportional-meter-total', true)
23361
23362
  .merge(title)
23362
- .attr('x', containerWidth)
23363
+ // Position the total text -24 pixels to add spacing between text and status icon (if status exists)
23364
+ .attr('x', this.model.getStatus()
23365
+ ? containerWidth - meter.total.paddingRight
23366
+ : containerWidth)
23363
23367
  .attr('y', '1em')
23364
23368
  .attr('text-anchor', 'end')
23365
23369
  .text(function (d) { return d; });
@@ -41545,9 +41549,18 @@ var meter_MeterChartModel = /** @class */ (function (_super) {
41545
41549
  */
41546
41550
  MeterChartModel.prototype.getStatus = function () {
41547
41551
  var options = this.getOptions();
41548
- var dataValue = tools_Tools.getProperty(this.getDisplayData(), 0, 'value');
41552
+ var dataValues = tools_Tools.getProperty(this.getDisplayData());
41553
+ var totalValue = (dataValues
41554
+ ? dataValues.reduce(function (previous, current) {
41555
+ return { value: previous.value + current.value };
41556
+ })
41557
+ : 0).value;
41549
41558
  // use max value if the percentage is bigger than 100%
41550
- var boundedValue = dataValue > 100 ? 100 : dataValue;
41559
+ var boundedValue = tools_Tools.getProperty(options, 'meter', 'proportional')
41560
+ ? totalValue
41561
+ : totalValue > 100
41562
+ ? 100
41563
+ : totalValue;
41551
41564
  // user needs to supply ranges
41552
41565
  var allRanges = tools_Tools.getProperty(options, 'meter', 'status', 'ranges');
41553
41566
  if (allRanges) {
@@ -41704,7 +41717,9 @@ var meter_Meter = /** @class */ (function (_super) {
41704
41717
  // rect with the value binded
41705
41718
  var valued = svg.selectAll('rect.value').data(stackedData);
41706
41719
  // if user provided a color for the bar, we dont want to attach a status class
41707
- var className = status != null && !self.model.isUserProvidedColorScaleValid()
41720
+ var className = status != null &&
41721
+ !self.model.isUserProvidedColorScaleValid() &&
41722
+ !proportional
41708
41723
  ? "value status--" + status
41709
41724
  : 'value';
41710
41725
  // draw the value bar
@@ -41750,9 +41765,7 @@ var meter_Meter = /** @class */ (function (_super) {
41750
41765
  .attr('aria-label', function (d) { return d.value; });
41751
41766
  valued.exit().remove();
41752
41767
  // draw the peak
41753
- var peakValue = proportional
41754
- ? null
41755
- : tools_Tools.getProperty(options, 'meter', 'peak');
41768
+ var peakValue = tools_Tools.getProperty(options, 'meter', 'peak');
41756
41769
  var peakData = peakValue;
41757
41770
  if (peakValue !== null) {
41758
41771
  if (peakValue > domainMax) {
@@ -41774,7 +41787,11 @@ var meter_Meter = /** @class */ (function (_super) {
41774
41787
  .attr('y1', 0)
41775
41788
  .attr('y2', function () {
41776
41789
  var userProvidedHeight = tools_Tools.getProperty(options, 'meter', 'height');
41777
- return userProvidedHeight ? userProvidedHeight : 8;
41790
+ return userProvidedHeight
41791
+ ? userProvidedHeight
41792
+ : proportional
41793
+ ? meter.height.proportional
41794
+ : meter.height.default;
41778
41795
  })
41779
41796
  .transition()
41780
41797
  .call(function (t) {