@carbon/charts-vue 0.51.4 → 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 +32 -0
- package/charts-vue.common.js +92 -29
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +92 -29
- 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,
|
|
@@ -10113,8 +10114,12 @@ var Service = /** @class */ (function () {
|
|
|
10113
10114
|
this.services = services;
|
|
10114
10115
|
this.init();
|
|
10115
10116
|
}
|
|
10116
|
-
Service.prototype.init = function () {
|
|
10117
|
-
|
|
10117
|
+
Service.prototype.init = function () {
|
|
10118
|
+
// do nothing.
|
|
10119
|
+
};
|
|
10120
|
+
Service.prototype.update = function () {
|
|
10121
|
+
// do nothing.
|
|
10122
|
+
};
|
|
10118
10123
|
// Used to pass down information to the components
|
|
10119
10124
|
Service.prototype.setModel = function (newObj) {
|
|
10120
10125
|
this.model = newObj;
|
|
@@ -11708,12 +11713,12 @@ var Files = /** @class */ (function (_super) {
|
|
|
11708
11713
|
function Files(model, services) {
|
|
11709
11714
|
return _super.call(this, model, services) || this;
|
|
11710
11715
|
}
|
|
11711
|
-
Files.prototype.downloadCSV = function (content, filename
|
|
11716
|
+
Files.prototype.downloadCSV = function (content, filename) {
|
|
11712
11717
|
var anchor = document.createElement('a');
|
|
11713
|
-
mimeType = 'text/csv;encoding:utf-8';
|
|
11714
|
-
if (navigator
|
|
11718
|
+
var mimeType = 'text/csv;encoding:utf-8';
|
|
11719
|
+
if (navigator['msSaveBlob']) {
|
|
11715
11720
|
// Internet Explorer 10
|
|
11716
|
-
navigator
|
|
11721
|
+
navigator['msSaveBlob'](new Blob([content], {
|
|
11717
11722
|
type: mimeType,
|
|
11718
11723
|
}), filename);
|
|
11719
11724
|
}
|
|
@@ -17794,12 +17799,16 @@ var component_Component = /** @class */ (function () {
|
|
|
17794
17799
|
this.setParent(src_select(this.services.domUtils.getMainContainer()));
|
|
17795
17800
|
}
|
|
17796
17801
|
}
|
|
17797
|
-
Component.prototype.init = function () {
|
|
17802
|
+
Component.prototype.init = function () {
|
|
17803
|
+
// do nothing.
|
|
17804
|
+
};
|
|
17798
17805
|
Component.prototype.render = function (animate) {
|
|
17799
17806
|
if (animate === void 0) { animate = true; }
|
|
17800
17807
|
console.error('render() method is not implemented');
|
|
17801
17808
|
};
|
|
17802
|
-
Component.prototype.destroy = function () {
|
|
17809
|
+
Component.prototype.destroy = function () {
|
|
17810
|
+
// do nothing.
|
|
17811
|
+
};
|
|
17803
17812
|
// Used to pass down information to the components
|
|
17804
17813
|
Component.prototype.setModel = function (newObj) {
|
|
17805
17814
|
this.model = newObj;
|
|
@@ -20049,21 +20058,16 @@ var essentials_modal_Modal = /** @class */ (function (_super) {
|
|
|
20049
20058
|
var modalInstance = modal.create(_this.modal.node());
|
|
20050
20059
|
modalInstance.show();
|
|
20051
20060
|
};
|
|
20052
|
-
_this.handleHideModal = function () { };
|
|
20053
20061
|
_this.init();
|
|
20054
20062
|
return _this;
|
|
20055
20063
|
}
|
|
20056
20064
|
Modal.prototype.addEventListeners = function () {
|
|
20057
20065
|
// listen to show-modal Custom Events to render the modal
|
|
20058
20066
|
this.services.events.addEventListener(Events.Modal.SHOW, this.handleShowModal);
|
|
20059
|
-
// listen to hide-modal Custom Events to hide the modal
|
|
20060
|
-
this.services.events.addEventListener(Events.Modal.HIDE, this.handleHideModal);
|
|
20061
20067
|
};
|
|
20062
20068
|
Modal.prototype.removeEventListeners = function () {
|
|
20063
20069
|
// remove show-modal Custom Events
|
|
20064
20070
|
this.services.events.removeEventListener(Events.Modal.SHOW, this.handleShowModal);
|
|
20065
|
-
// remove hide-modal Custom Events
|
|
20066
|
-
this.services.events.removeEventListener(Events.Modal.HIDE, this.handleHideModal);
|
|
20067
20071
|
};
|
|
20068
20072
|
Modal.prototype.getModalHTML = function () {
|
|
20069
20073
|
var options = this.model.getOptions();
|
|
@@ -23278,9 +23282,9 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
|
|
|
23278
23282
|
title.exit().remove();
|
|
23279
23283
|
// appends the associated percentage after title
|
|
23280
23284
|
this.appendPercentage();
|
|
23281
|
-
// if status ranges are provided (custom or default), display indicator
|
|
23282
|
-
this.displayStatus();
|
|
23283
23285
|
}
|
|
23286
|
+
// if status ranges are provided (custom or default), display indicator
|
|
23287
|
+
this.displayStatus();
|
|
23284
23288
|
// get the max width of a title (with consideration for the status/percentage)
|
|
23285
23289
|
var maxWidth = this.getMaxTitleWidth();
|
|
23286
23290
|
var titleElement = dom_utils_DOMUtils.appendOrSelect(svg, 'text.meter-title');
|
|
@@ -23351,7 +23355,7 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
|
|
|
23351
23355
|
var totalString = totalFormatter !== null
|
|
23352
23356
|
? totalFormatter(totalValue)
|
|
23353
23357
|
: total + " " + unit + " total";
|
|
23354
|
-
var containerBounds = dom_utils_DOMUtils.
|
|
23358
|
+
var containerBounds = dom_utils_DOMUtils.getHTMLElementSize(this.services.domUtils.getMainContainer());
|
|
23355
23359
|
// need to check if the width is 0, and try to use the parent attribute
|
|
23356
23360
|
// this can happen if the chart is toggled on/off and the height is 0 for the parent, it wont validateDimensions
|
|
23357
23361
|
var containerWidth = containerBounds.width
|
|
@@ -23365,7 +23369,10 @@ var title_meter_MeterTitle = /** @class */ (function (_super) {
|
|
|
23365
23369
|
.append('text')
|
|
23366
23370
|
.classed('proportional-meter-total', true)
|
|
23367
23371
|
.merge(title)
|
|
23368
|
-
|
|
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)
|
|
23369
23376
|
.attr('y', '1em')
|
|
23370
23377
|
.attr('text-anchor', 'end')
|
|
23371
23378
|
.text(function (d) { return d; });
|
|
@@ -25593,7 +25600,7 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
|
|
|
25593
25600
|
y1 += d[1] === 0 ? 2 : 1;
|
|
25594
25601
|
}
|
|
25595
25602
|
else {
|
|
25596
|
-
y1 -=
|
|
25603
|
+
y1 -= 1;
|
|
25597
25604
|
}
|
|
25598
25605
|
}
|
|
25599
25606
|
else if (!barIsNegative) {
|
|
@@ -34142,6 +34149,7 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34142
34149
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
34143
34150
|
_this.type = 'alluvial';
|
|
34144
34151
|
_this.renderType = RenderTypes.SVG;
|
|
34152
|
+
_this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
|
|
34145
34153
|
return _this;
|
|
34146
34154
|
}
|
|
34147
34155
|
Alluvial.prototype.render = function (animate) {
|
|
@@ -34161,6 +34169,8 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34161
34169
|
}
|
|
34162
34170
|
var options = this.model.getOptions();
|
|
34163
34171
|
var data = this.model.getDisplayData();
|
|
34172
|
+
// Is gradient enabled or not
|
|
34173
|
+
var isGradientAllowed = tools_Tools.getProperty(this.getOptions(), 'color', 'gradient', 'enabled');
|
|
34164
34174
|
// Set the custom node padding if provided
|
|
34165
34175
|
var nodePadding = alluvial.minNodePadding;
|
|
34166
34176
|
if (options.alluvial.nodePadding > alluvial.minNodePadding) {
|
|
@@ -34231,11 +34241,45 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34231
34241
|
return x;
|
|
34232
34242
|
});
|
|
34233
34243
|
// Draws the links (Waves)
|
|
34234
|
-
svg
|
|
34244
|
+
var links = svg
|
|
34245
|
+
.append('g')
|
|
34235
34246
|
.attr('fill', 'none')
|
|
34236
34247
|
.selectAll('g')
|
|
34237
|
-
.data(this.graph.links)
|
|
34238
|
-
|
|
34248
|
+
.data(this.graph.links);
|
|
34249
|
+
// Exit so we can have multiple appends in group
|
|
34250
|
+
links.exit().remove();
|
|
34251
|
+
// Add gradient if requsted
|
|
34252
|
+
if (isGradientAllowed) {
|
|
34253
|
+
var scale_1 = tools_Tools.getProperty(this.getOptions(), 'color', 'scale');
|
|
34254
|
+
if (scale_1) {
|
|
34255
|
+
links
|
|
34256
|
+
.enter()
|
|
34257
|
+
.append('linearGradient')
|
|
34258
|
+
.attr('id', function (d) { return _this.gradient_id + "-link-" + d.index; })
|
|
34259
|
+
.attr('gradientUnits', 'userSpaceOnUse')
|
|
34260
|
+
.call(function (gradient) {
|
|
34261
|
+
return gradient
|
|
34262
|
+
.append('stop')
|
|
34263
|
+
.attr('offset', '0%')
|
|
34264
|
+
.attr('stop-color', function (d) {
|
|
34265
|
+
return scale_1[d.source.name];
|
|
34266
|
+
});
|
|
34267
|
+
})
|
|
34268
|
+
.call(function (gradient) {
|
|
34269
|
+
return gradient
|
|
34270
|
+
.append('stop')
|
|
34271
|
+
.attr('offset', '100%')
|
|
34272
|
+
.attr('stop-color', function (d) {
|
|
34273
|
+
return scale_1[d.target.name];
|
|
34274
|
+
});
|
|
34275
|
+
});
|
|
34276
|
+
}
|
|
34277
|
+
// Exit so path can be appended to the group
|
|
34278
|
+
links.exit().remove();
|
|
34279
|
+
}
|
|
34280
|
+
links
|
|
34281
|
+
.enter()
|
|
34282
|
+
.append('path')
|
|
34239
34283
|
.classed('link', true)
|
|
34240
34284
|
.attr('d', sankeyLinkHorizontal())
|
|
34241
34285
|
.attr('id', function (d) {
|
|
@@ -34256,7 +34300,12 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34256
34300
|
originalClassName: 'link',
|
|
34257
34301
|
});
|
|
34258
34302
|
})
|
|
34259
|
-
.style('stroke', function (d) {
|
|
34303
|
+
.style('stroke', function (d) {
|
|
34304
|
+
if (isGradientAllowed) {
|
|
34305
|
+
return "url(#" + _this.gradient_id + "-link-" + d.index + ")";
|
|
34306
|
+
}
|
|
34307
|
+
return _this.model.getFillColor(d.source.name);
|
|
34308
|
+
})
|
|
34260
34309
|
.attr('stroke-width', function (d) { return Math.max(1, d.width); })
|
|
34261
34310
|
.style('stroke-opacity', alluvial.opacity.default)
|
|
34262
34311
|
.attr('aria-label', function (d) {
|
|
@@ -39741,6 +39790,7 @@ var chart_Chart = /** @class */ (function () {
|
|
|
39741
39790
|
canvasZoom: canvas_zoom_CanvasZoom,
|
|
39742
39791
|
};
|
|
39743
39792
|
this.model = new model_ChartModel(this.services);
|
|
39793
|
+
// do nothing.
|
|
39744
39794
|
}
|
|
39745
39795
|
// Contains the code that uses properties that are overridable by the super-class
|
|
39746
39796
|
Chart.prototype.init = function (holder, chartConfigs) {
|
|
@@ -41508,9 +41558,18 @@ var meter_MeterChartModel = /** @class */ (function (_super) {
|
|
|
41508
41558
|
*/
|
|
41509
41559
|
MeterChartModel.prototype.getStatus = function () {
|
|
41510
41560
|
var options = this.getOptions();
|
|
41511
|
-
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;
|
|
41512
41567
|
// use max value if the percentage is bigger than 100%
|
|
41513
|
-
var boundedValue =
|
|
41568
|
+
var boundedValue = tools_Tools.getProperty(options, 'meter', 'proportional')
|
|
41569
|
+
? totalValue
|
|
41570
|
+
: totalValue > 100
|
|
41571
|
+
? 100
|
|
41572
|
+
: totalValue;
|
|
41514
41573
|
// user needs to supply ranges
|
|
41515
41574
|
var allRanges = tools_Tools.getProperty(options, 'meter', 'status', 'ranges');
|
|
41516
41575
|
if (allRanges) {
|
|
@@ -41667,7 +41726,9 @@ var meter_Meter = /** @class */ (function (_super) {
|
|
|
41667
41726
|
// rect with the value binded
|
|
41668
41727
|
var valued = svg.selectAll('rect.value').data(stackedData);
|
|
41669
41728
|
// if user provided a color for the bar, we dont want to attach a status class
|
|
41670
|
-
var className = status != null &&
|
|
41729
|
+
var className = status != null &&
|
|
41730
|
+
!self.model.isUserProvidedColorScaleValid() &&
|
|
41731
|
+
!proportional
|
|
41671
41732
|
? "value status--" + status
|
|
41672
41733
|
: 'value';
|
|
41673
41734
|
// draw the value bar
|
|
@@ -41713,9 +41774,7 @@ var meter_Meter = /** @class */ (function (_super) {
|
|
|
41713
41774
|
.attr('aria-label', function (d) { return d.value; });
|
|
41714
41775
|
valued.exit().remove();
|
|
41715
41776
|
// draw the peak
|
|
41716
|
-
var peakValue =
|
|
41717
|
-
? null
|
|
41718
|
-
: tools_Tools.getProperty(options, 'meter', 'peak');
|
|
41777
|
+
var peakValue = tools_Tools.getProperty(options, 'meter', 'peak');
|
|
41719
41778
|
var peakData = peakValue;
|
|
41720
41779
|
if (peakValue !== null) {
|
|
41721
41780
|
if (peakValue > domainMax) {
|
|
@@ -41737,7 +41796,11 @@ var meter_Meter = /** @class */ (function (_super) {
|
|
|
41737
41796
|
.attr('y1', 0)
|
|
41738
41797
|
.attr('y2', function () {
|
|
41739
41798
|
var userProvidedHeight = tools_Tools.getProperty(options, 'meter', 'height');
|
|
41740
|
-
return userProvidedHeight
|
|
41799
|
+
return userProvidedHeight
|
|
41800
|
+
? userProvidedHeight
|
|
41801
|
+
: proportional
|
|
41802
|
+
? meter.height.proportional
|
|
41803
|
+
: meter.height.default;
|
|
41741
41804
|
})
|
|
41742
41805
|
.transition()
|
|
41743
41806
|
.call(function (t) {
|