@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 +8 -0
- package/charts-vue.common.js +28 -11
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +28 -11
- 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
|
@@ -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,
|
|
@@ -23281,9 +23282,9 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
|
|
|
23281
23282
|
title.exit().remove();
|
|
23282
23283
|
// appends the associated percentage after title
|
|
23283
23284
|
this.appendPercentage();
|
|
23284
|
-
// if status ranges are provided (custom or default), display indicator
|
|
23285
|
-
this.displayStatus();
|
|
23286
23285
|
}
|
|
23286
|
+
// if status ranges are provided (custom or default), display indicator
|
|
23287
|
+
this.displayStatus();
|
|
23287
23288
|
// get the max width of a title (with consideration for the status/percentage)
|
|
23288
23289
|
var maxWidth = this.getMaxTitleWidth();
|
|
23289
23290
|
var titleElement = dom_utils_DOMUtils.appendOrSelect(svg, 'text.meter-title');
|
|
@@ -23354,7 +23355,7 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
|
|
|
23354
23355
|
var totalString = totalFormatter !== null
|
|
23355
23356
|
? totalFormatter(totalValue)
|
|
23356
23357
|
: total + " " + unit + " total";
|
|
23357
|
-
var containerBounds = dom_utils_DOMUtils.
|
|
23358
|
+
var containerBounds = dom_utils_DOMUtils.getHTMLElementSize(this.services.domUtils.getMainContainer());
|
|
23358
23359
|
// need to check if the width is 0, and try to use the parent attribute
|
|
23359
23360
|
// this can happen if the chart is toggled on/off and the height is 0 for the parent, it wont validateDimensions
|
|
23360
23361
|
var containerWidth = containerBounds.width
|
|
@@ -23368,7 +23369,10 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
|
|
|
23368
23369
|
.append('text')
|
|
23369
23370
|
.classed('proportional-meter-total', true)
|
|
23370
23371
|
.merge(title)
|
|
23371
|
-
|
|
23372
|
+
// Position the total text -24 pixels to add spacing between text and status icon (if status exists)
|
|
23373
|
+
.attr('x', this.model.getStatus()
|
|
23374
|
+
? containerWidth - meter.total.paddingRight
|
|
23375
|
+
: containerWidth)
|
|
23372
23376
|
.attr('y', '1em')
|
|
23373
23377
|
.attr('text-anchor', 'end')
|
|
23374
23378
|
.text(function (d) { return d; });
|
|
@@ -41554,9 +41558,18 @@ var meter_MeterChartModel = /** @class */ (function (_super) {
|
|
|
41554
41558
|
*/
|
|
41555
41559
|
MeterChartModel.prototype.getStatus = function () {
|
|
41556
41560
|
var options = this.getOptions();
|
|
41557
|
-
var
|
|
41561
|
+
var dataValues = tools_Tools.getProperty(this.getDisplayData());
|
|
41562
|
+
var totalValue = (dataValues
|
|
41563
|
+
? dataValues.reduce(function (previous, current) {
|
|
41564
|
+
return { value: previous.value + current.value };
|
|
41565
|
+
})
|
|
41566
|
+
: 0).value;
|
|
41558
41567
|
// use max value if the percentage is bigger than 100%
|
|
41559
|
-
var boundedValue =
|
|
41568
|
+
var boundedValue = tools_Tools.getProperty(options, 'meter', 'proportional')
|
|
41569
|
+
? totalValue
|
|
41570
|
+
: totalValue > 100
|
|
41571
|
+
? 100
|
|
41572
|
+
: totalValue;
|
|
41560
41573
|
// user needs to supply ranges
|
|
41561
41574
|
var allRanges = tools_Tools.getProperty(options, 'meter', 'status', 'ranges');
|
|
41562
41575
|
if (allRanges) {
|
|
@@ -41713,7 +41726,9 @@ var meter_Meter = /** @class */ (function (_super) {
|
|
|
41713
41726
|
// rect with the value binded
|
|
41714
41727
|
var valued = svg.selectAll('rect.value').data(stackedData);
|
|
41715
41728
|
// if user provided a color for the bar, we dont want to attach a status class
|
|
41716
|
-
var className = status != null &&
|
|
41729
|
+
var className = status != null &&
|
|
41730
|
+
!self.model.isUserProvidedColorScaleValid() &&
|
|
41731
|
+
!proportional
|
|
41717
41732
|
? "value status--" + status
|
|
41718
41733
|
: 'value';
|
|
41719
41734
|
// draw the value bar
|
|
@@ -41759,9 +41774,7 @@ var meter_Meter = /** @class */ (function (_super) {
|
|
|
41759
41774
|
.attr('aria-label', function (d) { return d.value; });
|
|
41760
41775
|
valued.exit().remove();
|
|
41761
41776
|
// draw the peak
|
|
41762
|
-
var peakValue =
|
|
41763
|
-
? null
|
|
41764
|
-
: tools_Tools.getProperty(options, 'meter', 'peak');
|
|
41777
|
+
var peakValue = tools_Tools.getProperty(options, 'meter', 'peak');
|
|
41765
41778
|
var peakData = peakValue;
|
|
41766
41779
|
if (peakValue !== null) {
|
|
41767
41780
|
if (peakValue > domainMax) {
|
|
@@ -41783,7 +41796,11 @@ var meter_Meter = /** @class */ (function (_super) {
|
|
|
41783
41796
|
.attr('y1', 0)
|
|
41784
41797
|
.attr('y2', function () {
|
|
41785
41798
|
var userProvidedHeight = tools_Tools.getProperty(options, 'meter', 'height');
|
|
41786
|
-
return userProvidedHeight
|
|
41799
|
+
return userProvidedHeight
|
|
41800
|
+
? userProvidedHeight
|
|
41801
|
+
: proportional
|
|
41802
|
+
? meter.height.proportional
|
|
41803
|
+
: meter.height.default;
|
|
41787
41804
|
})
|
|
41788
41805
|
.transition()
|
|
41789
41806
|
.call(function (t) {
|