@carbon/charts-vue 0.54.11 → 0.54.14
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 +24 -0
- package/charts-vue.common.js +154 -189
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +154 -189
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.54.14](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.13...v0.54.14) (2022-03-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @carbon/charts-vue
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.54.13](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.12...v0.54.13) (2022-03-09)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @carbon/charts-vue
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.54.12](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.11...v0.54.12) (2022-02-04)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @carbon/charts-vue
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [0.54.11](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.10...v0.54.11) (2022-02-02)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @carbon/charts-vue
|
package/charts-vue.common.js
CHANGED
|
@@ -325,7 +325,7 @@ __webpack_require__.d(configuration_namespaceObject, "circlePack", function() {
|
|
|
325
325
|
__webpack_require__.d(configuration_namespaceObject, "color", function() { return configuration_non_customizable_color; });
|
|
326
326
|
__webpack_require__.d(configuration_namespaceObject, "boxplot", function() { return boxplot; });
|
|
327
327
|
__webpack_require__.d(configuration_namespaceObject, "histogram", function() { return configuration_non_customizable_histogram; });
|
|
328
|
-
__webpack_require__.d(configuration_namespaceObject, "legend", function() { return
|
|
328
|
+
__webpack_require__.d(configuration_namespaceObject, "legend", function() { return legend; });
|
|
329
329
|
__webpack_require__.d(configuration_namespaceObject, "lines", function() { return configuration_non_customizable_lines; });
|
|
330
330
|
__webpack_require__.d(configuration_namespaceObject, "meter", function() { return meter; });
|
|
331
331
|
__webpack_require__.d(configuration_namespaceObject, "pie", function() { return configuration_non_customizable_pie; });
|
|
@@ -1042,7 +1042,7 @@ var boxplot = {
|
|
|
1042
1042
|
var configuration_non_customizable_histogram = {
|
|
1043
1043
|
defaultBins: 10,
|
|
1044
1044
|
};
|
|
1045
|
-
var
|
|
1045
|
+
var legend = {
|
|
1046
1046
|
items: {
|
|
1047
1047
|
status: {
|
|
1048
1048
|
ACTIVE: 1,
|
|
@@ -9563,7 +9563,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9563
9563
|
if (!this.get('data')) {
|
|
9564
9564
|
return null;
|
|
9565
9565
|
}
|
|
9566
|
-
var ACTIVE =
|
|
9566
|
+
var ACTIVE = legend.items.status.ACTIVE;
|
|
9567
9567
|
var dataGroups = this.getDataGroups(groups);
|
|
9568
9568
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
9569
9569
|
var allDataFromDomain = this.getAllDataFromDomain(groups);
|
|
@@ -9608,7 +9608,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9608
9608
|
return this.get('dataGroups');
|
|
9609
9609
|
};
|
|
9610
9610
|
ChartModel.prototype.getActiveDataGroups = function (groups) {
|
|
9611
|
-
var ACTIVE =
|
|
9611
|
+
var ACTIVE = legend.items.status.ACTIVE;
|
|
9612
9612
|
return this.getDataGroups(groups).filter(function (dataGroup) { return dataGroup.status === ACTIVE; });
|
|
9613
9613
|
};
|
|
9614
9614
|
ChartModel.prototype.getDataGroupNames = function (groups) {
|
|
@@ -9880,7 +9880,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9880
9880
|
* Data labels
|
|
9881
9881
|
*/
|
|
9882
9882
|
ChartModel.prototype.toggleDataLabel = function (changedLabel) {
|
|
9883
|
-
var _a =
|
|
9883
|
+
var _a = legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
9884
9884
|
var dataGroups = this.getDataGroups();
|
|
9885
9885
|
var hasDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
|
|
9886
9886
|
var activeItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
|
|
@@ -10091,7 +10091,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
10091
10091
|
};
|
|
10092
10092
|
ChartModel.prototype.generateDataGroups = function (data) {
|
|
10093
10093
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
10094
|
-
var _a =
|
|
10094
|
+
var _a = legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
10095
10095
|
var options = this.getOptions();
|
|
10096
10096
|
var uniqueDataGroups = tools_Tools.removeArrayDuplicates(data.map(function (datum) { return datum[groupMapsTo]; }));
|
|
10097
10097
|
// check if selectedGroups can be applied to chart with current data groups
|
|
@@ -18001,7 +18001,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18001
18001
|
var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
|
|
18002
18002
|
var dataGroups = this.model.getDataGroups();
|
|
18003
18003
|
// Check if there are disabled legend items
|
|
18004
|
-
var DISABLED =
|
|
18004
|
+
var DISABLED = legend.items.status.DISABLED;
|
|
18005
18005
|
var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
|
|
18006
18006
|
var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
|
|
18007
18007
|
var svg = this.getComponentContainer()
|
|
@@ -18025,11 +18025,11 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18025
18025
|
addedLegendItems
|
|
18026
18026
|
.merge(svg.selectAll('div.legend-item'))
|
|
18027
18027
|
.classed('active', function (d, i) {
|
|
18028
|
-
return d.status ===
|
|
18028
|
+
return d.status === legend.items.status.ACTIVE;
|
|
18029
18029
|
});
|
|
18030
18030
|
var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
|
|
18031
18031
|
svg.classed('clickable', legendClickable && dataGroups.length > 1);
|
|
18032
|
-
var checkboxRadius =
|
|
18032
|
+
var checkboxRadius = legend.checkbox.radius;
|
|
18033
18033
|
var addedCheckboxes = addedLegendItems
|
|
18034
18034
|
.append('div')
|
|
18035
18035
|
.classed('checkbox', true);
|
|
@@ -18042,7 +18042,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18042
18042
|
})
|
|
18043
18043
|
.attr('aria-checked', function (_a) {
|
|
18044
18044
|
var status = _a.status;
|
|
18045
|
-
return status ===
|
|
18045
|
+
return status === legend.items.status.ACTIVE;
|
|
18046
18046
|
})
|
|
18047
18047
|
.attr('width', checkboxRadius * 2)
|
|
18048
18048
|
.attr('height', checkboxRadius * 2)
|
|
@@ -18054,13 +18054,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18054
18054
|
});
|
|
18055
18055
|
})
|
|
18056
18056
|
.style('background', function (d) {
|
|
18057
|
-
return d.status ===
|
|
18057
|
+
return d.status === legend.items.status.ACTIVE
|
|
18058
18058
|
? _this.model.getFillColor(d.name) ||
|
|
18059
18059
|
_this.model.getStrokeColor(d.name)
|
|
18060
18060
|
: null;
|
|
18061
18061
|
})
|
|
18062
18062
|
.classed('active', function (d, i) {
|
|
18063
|
-
return d.status ===
|
|
18063
|
+
return d.status === legend.items.status.ACTIVE;
|
|
18064
18064
|
});
|
|
18065
18065
|
var addedCheckIcons = addedCheckboxes
|
|
18066
18066
|
.append('svg')
|
|
@@ -18145,7 +18145,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18145
18145
|
return dataGroups;
|
|
18146
18146
|
};
|
|
18147
18147
|
Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
|
|
18148
|
-
var _a =
|
|
18148
|
+
var _a = legend.area, width = _a.width, height = _a.height;
|
|
18149
18149
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18150
18150
|
// Circular icon
|
|
18151
18151
|
additionalItem
|
|
@@ -18158,7 +18158,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18158
18158
|
.style('height', height + "px");
|
|
18159
18159
|
}
|
|
18160
18160
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18161
|
-
var _b =
|
|
18161
|
+
var _b = legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
|
|
18162
18162
|
var circleEnter = additionalItem
|
|
18163
18163
|
.attr('fill', 'none')
|
|
18164
18164
|
.selectAll('circle')
|
|
@@ -18176,7 +18176,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18176
18176
|
.style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
|
|
18177
18177
|
}
|
|
18178
18178
|
else if (itemConfig.type === LegendItemType.LINE) {
|
|
18179
|
-
var lineConfig =
|
|
18179
|
+
var lineConfig = legend.line;
|
|
18180
18180
|
if (additionalItem.select('line.line').empty()) {
|
|
18181
18181
|
additionalItem
|
|
18182
18182
|
.append('line')
|
|
@@ -18203,13 +18203,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18203
18203
|
.attr('width', width)
|
|
18204
18204
|
.attr('height', height)
|
|
18205
18205
|
.style('fill', indexOfItem > 3 && !itemConfig.fill
|
|
18206
|
-
?
|
|
18206
|
+
? legend.area.fill
|
|
18207
18207
|
: itemConfig.fill)
|
|
18208
18208
|
.style('stroke', itemConfig.stroke);
|
|
18209
18209
|
}
|
|
18210
18210
|
}
|
|
18211
18211
|
else if (itemConfig.type === LegendItemType.SIZE) {
|
|
18212
|
-
var _c =
|
|
18212
|
+
var _c = legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
|
|
18213
18213
|
var sizeEnter = additionalItem
|
|
18214
18214
|
.attr('fill', 'none')
|
|
18215
18215
|
.attr('role', Roles.IMG)
|
|
@@ -18228,7 +18228,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18228
18228
|
.style('stroke-width', 1);
|
|
18229
18229
|
}
|
|
18230
18230
|
else if (itemConfig.type === LegendItemType.QUARTILE) {
|
|
18231
|
-
var iconData =
|
|
18231
|
+
var iconData = legend.quartile.iconData;
|
|
18232
18232
|
var quartileEnter = additionalItem
|
|
18233
18233
|
.selectAll('rect')
|
|
18234
18234
|
.attr('role', Roles.IMG)
|
|
@@ -18601,16 +18601,17 @@ var color_scale_legend_ColorScaleLegend = /** @class */ (function (_super) {
|
|
|
18601
18601
|
_this.type = 'color-legend';
|
|
18602
18602
|
_this.renderType = RenderTypes.SVG;
|
|
18603
18603
|
_this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
|
|
18604
|
-
|
|
18604
|
+
// Position legend after axis have rendered
|
|
18605
|
+
_this.handleAxisCompleteEvent = function (event) {
|
|
18605
18606
|
var svg = _this.getComponentContainer();
|
|
18606
18607
|
var width = dom_utils_DOMUtils.getSVGElementSize(svg, {
|
|
18607
18608
|
useAttrs: true,
|
|
18608
18609
|
}).width;
|
|
18609
18610
|
var isDataLoading = tools_Tools.getProperty(_this.getOptions(), 'data', 'loading');
|
|
18610
|
-
if (width >
|
|
18611
|
+
if (width > legend.color.barWidth && !isDataLoading) {
|
|
18611
18612
|
var title = tools_Tools.getProperty(_this.getOptions(), 'heatmap', 'colorLegend', 'title');
|
|
18612
18613
|
var cartesianScales = _this.services.cartesianScales;
|
|
18613
|
-
// Get
|
|
18614
|
+
// Get axis width & start/end positions
|
|
18614
18615
|
var mainXScale = cartesianScales.getMainXScale();
|
|
18615
18616
|
var xDimensions = mainXScale.range();
|
|
18616
18617
|
// Align legend with the axis
|
|
@@ -18618,9 +18619,9 @@ var color_scale_legend_ColorScaleLegend = /** @class */ (function (_super) {
|
|
|
18618
18619
|
svg.select('g.legend').attr('transform', "translate(" + xDimensions[0] + ", 0)");
|
|
18619
18620
|
if (title) {
|
|
18620
18621
|
var textWidth = dom_utils_DOMUtils.getSVGElementSize(svg.select('g.legend-title').select('text'), { useBBox: true }).width;
|
|
18621
|
-
//
|
|
18622
|
+
// D3 moves the LEFT y-axis labels by 9
|
|
18622
18623
|
var availableSpace = xDimensions[0] - textWidth - 9;
|
|
18623
|
-
// If space is available align the
|
|
18624
|
+
// If space is available, align the label with the axis labels
|
|
18624
18625
|
if (availableSpace > 1) {
|
|
18625
18626
|
svg.select('g.legend-title').attr('transform', "translate(" + availableSpace + ", 0)");
|
|
18626
18627
|
}
|
|
@@ -18633,45 +18634,50 @@ var color_scale_legend_ColorScaleLegend = /** @class */ (function (_super) {
|
|
|
18633
18634
|
}
|
|
18634
18635
|
}
|
|
18635
18636
|
}
|
|
18637
|
+
else {
|
|
18638
|
+
// Default state
|
|
18639
|
+
svg.select('g.legend-title').attr('transform', "translate(0, 0)");
|
|
18640
|
+
}
|
|
18636
18641
|
};
|
|
18637
18642
|
return _this;
|
|
18638
18643
|
}
|
|
18639
18644
|
ColorScaleLegend.prototype.init = function () {
|
|
18640
18645
|
var eventsFragment = this.services.events;
|
|
18641
18646
|
// Highlight correct circle on legend item hovers
|
|
18642
|
-
eventsFragment.addEventListener(Events.Axis.RENDER_COMPLETE, this.
|
|
18647
|
+
eventsFragment.addEventListener(Events.Axis.RENDER_COMPLETE, this.handleAxisCompleteEvent);
|
|
18643
18648
|
};
|
|
18644
18649
|
ColorScaleLegend.prototype.render = function (animate) {
|
|
18645
18650
|
if (animate === void 0) { animate = false; }
|
|
18646
18651
|
var options = this.getOptions();
|
|
18652
|
+
var svg = this.getComponentContainer();
|
|
18653
|
+
var width = dom_utils_DOMUtils.getSVGElementSize(svg, {
|
|
18654
|
+
useAttrs: true,
|
|
18655
|
+
}).width;
|
|
18647
18656
|
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
18648
18657
|
var colorScaleType = tools_Tools.getProperty(options, 'heatmap', 'colorLegend', 'type');
|
|
18649
18658
|
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
18650
18659
|
var title = tools_Tools.getProperty(options, 'heatmap', 'colorLegend', 'title');
|
|
18651
|
-
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
18652
|
-
var domain = this.model.getValueDomain();
|
|
18653
|
-
var svg = this.getComponentContainer();
|
|
18654
18660
|
// Clear DOM if loading
|
|
18655
18661
|
var isDataLoading = tools_Tools.getProperty(this.getOptions(), 'data', 'loading');
|
|
18656
18662
|
if (isDataLoading) {
|
|
18657
18663
|
svg.html('');
|
|
18658
18664
|
return;
|
|
18659
18665
|
}
|
|
18660
|
-
var
|
|
18661
|
-
var
|
|
18662
|
-
var
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18666
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
18667
|
+
var domain = this.model.getValueDomain();
|
|
18668
|
+
var useDefaultBarWidth = !(width <= legend.color.barWidth);
|
|
18669
|
+
var barWidth = useDefaultBarWidth
|
|
18670
|
+
? legend.color.barWidth
|
|
18671
|
+
: width;
|
|
18672
|
+
var legendGroupElement = dom_utils_DOMUtils.appendOrSelect(svg, 'g.legend');
|
|
18673
|
+
var axisElement = dom_utils_DOMUtils.appendOrSelect(legendGroupElement, 'g.legend-axis');
|
|
18674
|
+
// Render title if it exists
|
|
18669
18675
|
if (title) {
|
|
18670
18676
|
var legendTitleGroup = dom_utils_DOMUtils.appendOrSelect(svg, 'g.legend-title');
|
|
18671
18677
|
var legendTitle = dom_utils_DOMUtils.appendOrSelect(legendTitleGroup, 'text');
|
|
18672
18678
|
legendTitle.text(title).attr('dy', '0.7em');
|
|
18673
18679
|
// Move the legend down by 16 pixels to display legend text on top
|
|
18674
|
-
|
|
18680
|
+
legendGroupElement.attr('transform', "translate(0, 16)");
|
|
18675
18681
|
}
|
|
18676
18682
|
// If domain consists of negative and positive values, use diverging palettes
|
|
18677
18683
|
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
@@ -18701,107 +18707,95 @@ var color_scale_legend_ColorScaleLegend = /** @class */ (function (_super) {
|
|
|
18701
18707
|
// Use custom colors
|
|
18702
18708
|
colorPairing = customColors;
|
|
18703
18709
|
}
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18707
|
-
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18714
|
-
.
|
|
18715
|
-
|
|
18716
|
-
|
|
18717
|
-
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
|
|
18722
|
-
|
|
18723
|
-
|
|
18724
|
-
|
|
18725
|
-
|
|
18726
|
-
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
|
|
18732
|
-
|
|
18733
|
-
|
|
18734
|
-
|
|
18735
|
-
|
|
18736
|
-
|
|
18737
|
-
|
|
18738
|
-
|
|
18739
|
-
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
|
|
18754
|
-
|
|
18755
|
-
|
|
18756
|
-
|
|
18757
|
-
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18785
|
-
|
|
18786
|
-
|
|
18787
|
-
|
|
18788
|
-
}
|
|
18789
|
-
else {
|
|
18790
|
-
throw Error('Entered color legend type is not supported.');
|
|
18791
|
-
}
|
|
18792
|
-
// Translate last axis tick if barWidth equals chart width
|
|
18793
|
-
if (width <= configuration_non_customizable_legend.color.barWidth) {
|
|
18794
|
-
var lastTick = axis.select('g.tick:last-of-type text');
|
|
18795
|
-
var width_1 = dom_utils_DOMUtils.getSVGElementSize(lastTick, {
|
|
18796
|
-
useBBox: true,
|
|
18797
|
-
}).width;
|
|
18798
|
-
lastTick.attr('x', "-" + width_1);
|
|
18799
|
-
}
|
|
18710
|
+
// Generate equal chunks between range to act as ticks
|
|
18711
|
+
var interpolator = d3_interpolate_src_number(domain[0], domain[1]);
|
|
18712
|
+
var quant = quantize(interpolator, 3);
|
|
18713
|
+
// Create scale & ticks
|
|
18714
|
+
var linearScale = linear_linear().domain(domain).range([0, barWidth]);
|
|
18715
|
+
var legendAxis = axisBottom(linearScale)
|
|
18716
|
+
.tickSize(0)
|
|
18717
|
+
.tickValues(quant);
|
|
18718
|
+
switch (colorScaleType) {
|
|
18719
|
+
case ColorLegendType.LINEAR:
|
|
18720
|
+
this.drawLinear(colorPairing, legendGroupElement, barWidth);
|
|
18721
|
+
break;
|
|
18722
|
+
case ColorLegendType.QUANTIZE:
|
|
18723
|
+
var rangeStart = this.drawQuantize(colorPairing, colorScheme, customColorsEnabled, legendGroupElement, barWidth);
|
|
18724
|
+
// Using range provided by drawQuantize for alignment purposes
|
|
18725
|
+
linearScale.range([rangeStart, barWidth]);
|
|
18726
|
+
break;
|
|
18727
|
+
default:
|
|
18728
|
+
throw Error('Entered color legend type is not supported.');
|
|
18729
|
+
}
|
|
18730
|
+
// Align axes at the bottom of the rectangle and delete the domain line
|
|
18731
|
+
axisElement
|
|
18732
|
+
.attr('transform', "translate(0," + legend.color.axisYTranslation + ")")
|
|
18733
|
+
.call(legendAxis);
|
|
18734
|
+
// Remove auto generated axis bottom line
|
|
18735
|
+
axisElement.select('.domain').remove();
|
|
18736
|
+
// Translate first/last axis tick if barWidth equals chart width
|
|
18737
|
+
// Ensures text is not clipped when default bar width (300px) is not used
|
|
18738
|
+
axisElement
|
|
18739
|
+
.select('g.tick:last-of-type text')
|
|
18740
|
+
.style('text-anchor', useDefaultBarWidth ? 'middle' : 'end');
|
|
18741
|
+
axisElement
|
|
18742
|
+
.select('g.tick:first-of-type text')
|
|
18743
|
+
.style('text-anchor', useDefaultBarWidth ? 'middle' : 'start');
|
|
18744
|
+
};
|
|
18745
|
+
// Renders gradient legend
|
|
18746
|
+
ColorScaleLegend.prototype.drawLinear = function (colorPairing, legendGroupElement, barWidth) {
|
|
18747
|
+
var stopLengthPercentage = 100 / (colorPairing.length - 1);
|
|
18748
|
+
// Generate the gradient
|
|
18749
|
+
var linearGradient = dom_utils_DOMUtils.appendOrSelect(legendGroupElement, 'linearGradient');
|
|
18750
|
+
// Rendering gradient
|
|
18751
|
+
linearGradient
|
|
18752
|
+
.attr('id', this.gradient_id + "-legend")
|
|
18753
|
+
.selectAll('stop')
|
|
18754
|
+
.data(colorPairing)
|
|
18755
|
+
.enter()
|
|
18756
|
+
.append('stop')
|
|
18757
|
+
.attr('offset', function (_, i) { return i * stopLengthPercentage + "%"; })
|
|
18758
|
+
.attr('class', function (_, i) { return colorPairing[i]; })
|
|
18759
|
+
.attr('stop-color', function (d) { return d; });
|
|
18760
|
+
// Create the legend container
|
|
18761
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(legendGroupElement, 'rect');
|
|
18762
|
+
rectangle
|
|
18763
|
+
.attr('width', barWidth)
|
|
18764
|
+
.attr('height', legend.color.barHeight)
|
|
18765
|
+
.style('fill', "url(#" + this.gradient_id + "-legend)");
|
|
18766
|
+
};
|
|
18767
|
+
/**
|
|
18768
|
+
* Renders quantized legend
|
|
18769
|
+
* @returns number (range start)
|
|
18770
|
+
*/
|
|
18771
|
+
ColorScaleLegend.prototype.drawQuantize = function (colorPairing, colorScheme, customColorsEnabled, legendGroupElement, barWidth) {
|
|
18772
|
+
// If divergent && non-custom color, remove 0/white from being displayed
|
|
18773
|
+
if (!customColorsEnabled && colorScheme === 'diverge') {
|
|
18774
|
+
colorPairing.splice(colorPairing.length / 2, 1);
|
|
18775
|
+
}
|
|
18776
|
+
var colorScaleBand = band()
|
|
18777
|
+
.domain(colorPairing)
|
|
18778
|
+
.range([0, barWidth]);
|
|
18779
|
+
// Render the quantized rectangles
|
|
18780
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(legendGroupElement, 'g.quantized-rect');
|
|
18781
|
+
rectangle
|
|
18782
|
+
.selectAll('rect')
|
|
18783
|
+
.data(colorScaleBand.domain())
|
|
18784
|
+
.join('rect')
|
|
18785
|
+
.attr('x', function (d) { return colorScaleBand(d); })
|
|
18786
|
+
.attr('y', 0)
|
|
18787
|
+
.attr('width', Math.max(0, colorScaleBand.bandwidth() - 1))
|
|
18788
|
+
.attr('height', legend.color.barHeight)
|
|
18789
|
+
.attr('class', function (d) { return d; })
|
|
18790
|
+
.attr('fill', function (d) { return d; });
|
|
18791
|
+
return (!customColorsEnabled && colorScheme) === 'mono'
|
|
18792
|
+
? colorScaleBand.bandwidth() - 1
|
|
18793
|
+
: 0;
|
|
18800
18794
|
};
|
|
18801
18795
|
ColorScaleLegend.prototype.destroy = function () {
|
|
18802
18796
|
// Remove legend listeners
|
|
18803
18797
|
var eventsFragment = this.services.events;
|
|
18804
|
-
eventsFragment.removeEventListener(Events.Axis.RENDER_COMPLETE, this.
|
|
18798
|
+
eventsFragment.removeEventListener(Events.Axis.RENDER_COMPLETE, this.handleAxisCompleteEvent);
|
|
18805
18799
|
};
|
|
18806
18800
|
return ColorScaleLegend;
|
|
18807
18801
|
}(legend_Legend));
|
|
@@ -31111,26 +31105,6 @@ function constantZero() {
|
|
|
31111
31105
|
return treemap;
|
|
31112
31106
|
});
|
|
31113
31107
|
|
|
31114
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-array/src/sum.js
|
|
31115
|
-
function sum_sum(values, valueof) {
|
|
31116
|
-
let sum = 0;
|
|
31117
|
-
if (valueof === undefined) {
|
|
31118
|
-
for (let value of values) {
|
|
31119
|
-
if (value = +value) {
|
|
31120
|
-
sum += value;
|
|
31121
|
-
}
|
|
31122
|
-
}
|
|
31123
|
-
} else {
|
|
31124
|
-
let index = -1;
|
|
31125
|
-
for (let value of values) {
|
|
31126
|
-
if (value = +valueof(value, ++index, values)) {
|
|
31127
|
-
sum += value;
|
|
31128
|
-
}
|
|
31129
|
-
}
|
|
31130
|
-
}
|
|
31131
|
-
return sum;
|
|
31132
|
-
}
|
|
31133
|
-
|
|
31134
31108
|
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/@carbon/colors/es/index.js
|
|
31135
31109
|
/**
|
|
31136
31110
|
* Copyright IBM Corp. 2018, 2018
|
|
@@ -31756,7 +31730,6 @@ var treemap_extends = (undefined && undefined.__extends) || (function () {
|
|
|
31756
31730
|
|
|
31757
31731
|
|
|
31758
31732
|
|
|
31759
|
-
|
|
31760
31733
|
// Carbon colors
|
|
31761
31734
|
|
|
31762
31735
|
var findColorShade = function (hex) {
|
|
@@ -31850,9 +31823,6 @@ var treemap_Treemap = /** @class */ (function (_super) {
|
|
|
31850
31823
|
})
|
|
31851
31824
|
.sum(function (d) { return d.value; })
|
|
31852
31825
|
.sort(function (a, b) { return b.value - a.value; });
|
|
31853
|
-
var total = sum_sum(allData, function (d) {
|
|
31854
|
-
return sum_sum(d.children, function (child) { return child.value; });
|
|
31855
|
-
});
|
|
31856
31826
|
var root = src_treemap()
|
|
31857
31827
|
.size([width, height])
|
|
31858
31828
|
.paddingInner(1)
|
|
@@ -33957,7 +33927,7 @@ var wordcloud_WordCloud = /** @class */ (function (_super) {
|
|
|
33957
33927
|
|
|
33958
33928
|
//# sourceMappingURL=../../../src/components/graphs/wordcloud.js.map
|
|
33959
33929
|
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-array/src/sum.js
|
|
33960
|
-
function
|
|
33930
|
+
function sum_sum(values, valueof) {
|
|
33961
33931
|
let sum = 0;
|
|
33962
33932
|
if (valueof === undefined) {
|
|
33963
33933
|
for (let value of values) {
|
|
@@ -34204,7 +34174,7 @@ function Sankey() {
|
|
|
34204
34174
|
function computeNodeValues({nodes}) {
|
|
34205
34175
|
for (const node of nodes) {
|
|
34206
34176
|
node.value = node.fixedValue === undefined
|
|
34207
|
-
? Math.max(
|
|
34177
|
+
? Math.max(sum_sum(node.sourceLinks, sankey_value), sum_sum(node.targetLinks, sankey_value))
|
|
34208
34178
|
: node.fixedValue;
|
|
34209
34179
|
}
|
|
34210
34180
|
}
|
|
@@ -34264,7 +34234,7 @@ function Sankey() {
|
|
|
34264
34234
|
}
|
|
34265
34235
|
|
|
34266
34236
|
function initializeNodeBreadths(columns) {
|
|
34267
|
-
const ky = src_min_min(columns, c => (y1 - y0 - (c.length - 1) * py) /
|
|
34237
|
+
const ky = src_min_min(columns, c => (y1 - y0 - (c.length - 1) * py) / sum_sum(c, sankey_value));
|
|
34268
34238
|
for (const nodes of columns) {
|
|
34269
34239
|
let y = y0;
|
|
34270
34240
|
for (const node of nodes) {
|
|
@@ -43521,10 +43491,11 @@ var model_treemap_extends = (undefined && undefined.__extends) || (function () {
|
|
|
43521
43491
|
})();
|
|
43522
43492
|
// Internal Imports
|
|
43523
43493
|
|
|
43494
|
+
|
|
43524
43495
|
/**
|
|
43525
43496
|
* The treemap chart model layer
|
|
43526
43497
|
*/
|
|
43527
|
-
var
|
|
43498
|
+
var treemap_TreemapChartModel = /** @class */ (function (_super) {
|
|
43528
43499
|
model_treemap_extends(TreemapChartModel, _super);
|
|
43529
43500
|
function TreemapChartModel(services) {
|
|
43530
43501
|
return _super.call(this, services) || this;
|
|
@@ -43533,9 +43504,15 @@ var TreemapChartModel = /** @class */ (function (_super) {
|
|
|
43533
43504
|
var displayData = this.getDisplayData();
|
|
43534
43505
|
var result = [['Child', 'Group', 'Value']];
|
|
43535
43506
|
displayData.forEach(function (datum) {
|
|
43536
|
-
datum.children
|
|
43537
|
-
|
|
43538
|
-
|
|
43507
|
+
if (Array.isArray(datum.children)) {
|
|
43508
|
+
datum.children.forEach(function (child) {
|
|
43509
|
+
result.push([child.name, datum.name, child.value]);
|
|
43510
|
+
});
|
|
43511
|
+
}
|
|
43512
|
+
else if (tools_Tools.getProperty(datum.name) !== null &&
|
|
43513
|
+
tools_Tools.getProperty(datum.value)) {
|
|
43514
|
+
result.push(["–", datum.name, datum.value]);
|
|
43515
|
+
}
|
|
43539
43516
|
});
|
|
43540
43517
|
return result;
|
|
43541
43518
|
};
|
|
@@ -43568,7 +43545,7 @@ var treemap_TreemapChart = /** @class */ (function (_super) {
|
|
|
43568
43545
|
charts_treemap_extends(TreemapChart, _super);
|
|
43569
43546
|
function TreemapChart(holder, chartConfigs) {
|
|
43570
43547
|
var _this = _super.call(this, holder, chartConfigs) || this;
|
|
43571
|
-
_this.model = new
|
|
43548
|
+
_this.model = new treemap_TreemapChartModel(_this.services);
|
|
43572
43549
|
// Merge the default options for this chart
|
|
43573
43550
|
// With the user provided options
|
|
43574
43551
|
_this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.treemapChart, chartConfigs.options));
|
|
@@ -44137,28 +44114,16 @@ var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
|
44137
44114
|
* @returns Array consisting of smallest and largest values in data
|
|
44138
44115
|
*/
|
|
44139
44116
|
HeatmapModel.prototype.getValueDomain = function () {
|
|
44140
|
-
var
|
|
44141
|
-
var
|
|
44142
|
-
|
|
44143
|
-
|
|
44144
|
-
|
|
44145
|
-
limits
|
|
44146
|
-
|
|
44147
|
-
|
|
44148
|
-
|
|
44149
|
-
|
|
44150
|
-
else if (value % 10 === 0 || value === 0) {
|
|
44151
|
-
value;
|
|
44152
|
-
}
|
|
44153
|
-
else if (value < 0) {
|
|
44154
|
-
value = Math.floor(value / 10) * 10;
|
|
44155
|
-
}
|
|
44156
|
-
else {
|
|
44157
|
-
value = Math.ceil(value / 10) * 10;
|
|
44158
|
-
}
|
|
44159
|
-
domain.push(value);
|
|
44160
|
-
});
|
|
44161
|
-
// Ensure the median of the range is 0
|
|
44117
|
+
var limits = src_extent(this.getDisplayData(), function (d) { return d.value; });
|
|
44118
|
+
var domain = linear_linear()
|
|
44119
|
+
.domain(limits)
|
|
44120
|
+
.nice()
|
|
44121
|
+
.domain();
|
|
44122
|
+
// Ensuring limits start at 0 to make scale look more `nicer`
|
|
44123
|
+
if (domain[0] > 0) {
|
|
44124
|
+
domain[0] = 0;
|
|
44125
|
+
}
|
|
44126
|
+
// Ensure the median of the range is 0 if domain extends into both negative & positive
|
|
44162
44127
|
if (domain[0] < 0 && domain[1] > 0) {
|
|
44163
44128
|
if (Math.abs(domain[0]) > domain[1]) {
|
|
44164
44129
|
domain[1] = Math.abs(domain[0]);
|
|
@@ -44172,7 +44137,7 @@ var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
|
44172
44137
|
/**
|
|
44173
44138
|
* @override
|
|
44174
44139
|
* @param value
|
|
44175
|
-
* @returns
|
|
44140
|
+
* @returns string
|
|
44176
44141
|
*/
|
|
44177
44142
|
HeatmapModel.prototype.getFillColor = function (value) {
|
|
44178
44143
|
return this._colorScale(value);
|