@carbon/charts-vue 0.54.12 → 0.55.0
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 +155 -169
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +155 -169
- 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.55.0](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.14...v0.55.0) (2022-03-14)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @carbon/charts-vue
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.54.14](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.13...v0.54.14) (2022-03-14)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @carbon/charts-vue
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [0.54.13](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.12...v0.54.13) (2022-03-09)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @carbon/charts-vue
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [0.54.12](https://github.com/carbon-design-system/carbon-charts/compare/v0.54.11...v0.54.12) (2022-02-04)
|
|
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));
|
|
@@ -20586,12 +20580,12 @@ var essentials_modal_Modal = /** @class */ (function (_super) {
|
|
|
20586
20580
|
var options = this.model.getOptions();
|
|
20587
20581
|
var chartprefix = tools_Tools.getProperty(options, 'style', 'prefix');
|
|
20588
20582
|
var tableArray = this.model.getTabularDataArray();
|
|
20589
|
-
return "\n\t\t<div class=\"bx--modal-container\">\n\t\t\t<div class=\"bx--modal-header\">\n\t\t\t\t<p class=\"bx--modal-header__label bx--type-delta\" id=\"modal-title\">Tabular representation</p>\n\t\t\t\t<p class=\"bx--modal-header__heading bx--type-beta\" id=\"modal-description\">" + options.title + "</p>\n\t\t\t\t<button class=\"bx--modal-close\" type=\"button\" data-modal-close aria-label=\"close modal\" data-modal-primary-focus>\n\t\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" aria-label=\"Close\" width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" role=\"img\" class=\"bx--modal-close__icon\">\n\t\t\t\t\t\t<path d=\"M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z\"></path>\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class=\"bx--modal-content\"
|
|
20590
|
-
.map(function (heading) { return "<th scope=\"col\">\n\t\t\t\t\t\t\t\t<div class=\"bx--table-header-label\">" + heading + "</div>\n\t\t\t\t\t\t\t</th>"; })
|
|
20591
|
-
.join('') + "\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\t\t\t\t\t<tbody>" + tableArray
|
|
20583
|
+
return "\n\t\t<div class=\"bx--modal-container cds--modal-container\">\n\t\t\t<div class=\"bx--modal-header cds--modal-header\">\n\t\t\t\t<p class=\"bx--modal-header__label bx--type-delta cds--modal-header__label cds--type-delta\" id=\"modal-title\">Tabular representation</p>\n\n\t\t\t\t<p class=\"bx--modal-header__heading bx--type-beta cds--modal-header__heading cds--type-beta\" id=\"modal-description\">" + options.title + "</p>\n\n\t\t\t\t<button class=\"bx--modal-close cds--modal-close\" type=\"button\" data-modal-close aria-label=\"close modal\" data-modal-primary-focus>\n\t\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" aria-label=\"Close\" width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" role=\"img\" class=\"bx--modal-close__icon cds--modal-close__icon\">\n\t\t\t\t\t\t<path d=\"M24 9.4L22.6 8 16 14.6 9.4 8 8 9.4 14.6 16 8 22.6 9.4 24 16 17.4 22.6 24 24 22.6 17.4 16 24 9.4z\"></path>\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t</div>\n\n\t\t\t<div class=\"bx--modal-content cds--modal-content\">\n\t\t\t\t<table class=\"bx--data-table bx--data-table--no-border cds--data-table cds--data-table--no-border\">\n\t\t\t\t\t<thead>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t" + lodash_es_get(tableArray, 0)
|
|
20584
|
+
.map(function (heading) { return "<th scope=\"col\">\n\t\t\t\t\t\t\t\t<div class=\"bx--table-header-label cds--table-header-label\">" + heading + "</div>\n\t\t\t\t\t\t\t</th>"; })
|
|
20585
|
+
.join('') + "\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</thead>\n\n\t\t\t\t\t<tbody>" + tableArray
|
|
20592
20586
|
.slice(1)
|
|
20593
20587
|
.map(function (row) { return "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t" + row.map(function (column) { return "<td>" + column + "</td>"; }).join('') + "\n\t\t\t\t\t\t\t</tr>"; })
|
|
20594
|
-
.join('') + "\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=\"bx--modal-footer\">\n\t\t\t <div class=\"" + js_settings.prefix + "--" + chartprefix + "-modal-footer-spacer\"></div>\n\t\t\t <button class=\"bx--btn bx--btn--primary\" type=\"button\" data-modal-primary-focus>Download as CSV</button>\n\t\t\t</div>\n\t\t</div>";
|
|
20588
|
+
.join('') + "\n\t\t\t\t\t</tbody>\n\t\t\t\t</table>\n\t\t\t</div>\n\n\t\t\t<div class=\"bx--modal-footer cds--modal-footer\">\n\t\t\t <div class=\"" + js_settings.prefix + "--" + chartprefix + "-modal-footer-spacer\"></div>\n\t\t\t <button class=\"bx--btn bx--btn--primary cds--btn cds--btn--primary\" type=\"button\" data-modal-primary-focus>Download as CSV</button>\n\t\t\t</div>\n\t\t</div>";
|
|
20595
20589
|
};
|
|
20596
20590
|
Modal.prototype.render = function () {
|
|
20597
20591
|
var options = this.model.getOptions();
|
|
@@ -20604,7 +20598,7 @@ var essentials_modal_Modal = /** @class */ (function (_super) {
|
|
|
20604
20598
|
this.isEventListenerAdded = true;
|
|
20605
20599
|
this.modal
|
|
20606
20600
|
.attr('data-modal', true)
|
|
20607
|
-
.attr('class', 'bx--modal')
|
|
20601
|
+
.attr('class', 'bx--modal cds--modal')
|
|
20608
20602
|
.attr('role', 'dialog')
|
|
20609
20603
|
.attr('aria-modal', true)
|
|
20610
20604
|
.attr('aria-labelledby', 'modal-title')
|
|
@@ -39592,7 +39586,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39592
39586
|
if (!this.overflowMenu) {
|
|
39593
39587
|
this.overflowMenu = container
|
|
39594
39588
|
.append('div')
|
|
39595
|
-
.attr('class', 'bx--overflow-menu-options bx--overflow-menu--flip')
|
|
39589
|
+
.attr('class', 'bx--overflow-menu-options bx--overflow-menu--flip cds--overflow-menu-options cds--overflow-menu--flip')
|
|
39596
39590
|
.attr('tabindex', -1)
|
|
39597
39591
|
.attr('role', 'menu')
|
|
39598
39592
|
.html("<ul></ul>");
|
|
@@ -39610,7 +39604,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39610
39604
|
var enteringToolbarControls = toolbarControls
|
|
39611
39605
|
.enter()
|
|
39612
39606
|
.append('div')
|
|
39613
|
-
.attr('class', 'toolbar-control bx--overflow-menu')
|
|
39607
|
+
.attr('class', 'toolbar-control bx--overflow-menu cds--overflow-menu')
|
|
39614
39608
|
.attr('role', 'button');
|
|
39615
39609
|
var self_1 = this;
|
|
39616
39610
|
var allToolbarControls = enteringToolbarControls
|
|
@@ -39618,9 +39612,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39618
39612
|
.classed('disabled', function (d) { return d.shouldBeDisabled(); })
|
|
39619
39613
|
.attr('aria-disabled', function (d) { return d.shouldBeDisabled(); })
|
|
39620
39614
|
.attr('aria-label', function (d) { return d.title; })
|
|
39621
|
-
.html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.iconSVG.width !== undefined ? d.iconSVG.width : '20px') + "; height: " + (d.iconSVG.height !== undefined
|
|
39615
|
+
.html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger cds--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.iconSVG.width !== undefined ? d.iconSVG.width : '20px') + "; height: " + (d.iconSVG.height !== undefined
|
|
39622
39616
|
? d.iconSVG.height
|
|
39623
|
-
: '20px') + "\" xmlns=\"http://www.w3.org/2000/svg\" class=\"bx--overflow-menu__icon\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n\t\t\t\t\t" + d.iconSVG.content + "\n\t\t\t\t</svg>\n\t\t\t</button>"; })
|
|
39617
|
+
: '20px') + "\" xmlns=\"http://www.w3.org/2000/svg\" class=\"bx--overflow-menu__icon cds--overflow-menu__icon\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n\t\t\t\t\t" + d.iconSVG.content + "\n\t\t\t\t</svg>\n\t\t\t</button>"; })
|
|
39624
39618
|
.each(function (d, index) {
|
|
39625
39619
|
var _this = this;
|
|
39626
39620
|
src_select(this)
|
|
@@ -39664,15 +39658,18 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39664
39658
|
.attr('id', function (d) {
|
|
39665
39659
|
return _this.services.domUtils.generateElementIDString("control-" + d.id);
|
|
39666
39660
|
})
|
|
39667
|
-
.attr('class', 'bx--overflow-menu-options__option')
|
|
39661
|
+
.attr('class', 'bx--overflow-menu-options__option cds--overflow-menu-options__option')
|
|
39668
39662
|
.attr('role', 'menuitem');
|
|
39669
39663
|
enteringOverflowMenuControls
|
|
39670
39664
|
.append('button')
|
|
39671
|
-
.attr('class', 'bx--overflow-menu-options__btn');
|
|
39665
|
+
.attr('class', 'bx--overflow-menu-options__btn cds--overflow-menu-options__btn');
|
|
39672
39666
|
enteringOverflowMenuControls
|
|
39673
39667
|
.merge(overflowMenuControls)
|
|
39674
39668
|
.classed('bx--overflow-menu-options__option--disabled', function (d) {
|
|
39675
39669
|
return d.shouldBeDisabled();
|
|
39670
|
+
})
|
|
39671
|
+
.classed('cds--overflow-menu-options__option--disabled', function (d) {
|
|
39672
|
+
return d.shouldBeDisabled();
|
|
39676
39673
|
})
|
|
39677
39674
|
.attr('aria-disabled', function (d) { return d.shouldBeDisabled(); })
|
|
39678
39675
|
.selectAll('button')
|
|
@@ -39690,7 +39687,8 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39690
39687
|
// update overflow button background
|
|
39691
39688
|
if (this.overflowButton) {
|
|
39692
39689
|
this.overflowButton.attr('aria-expanded', show);
|
|
39693
|
-
src_select(this.overflowButton.node().parentNode)
|
|
39690
|
+
src_select(this.overflowButton.node().parentNode)
|
|
39691
|
+
.classed('bx--overflow-menu--open', show).classed('cds--overflow-menu--open', show);
|
|
39694
39692
|
}
|
|
39695
39693
|
if (show) {
|
|
39696
39694
|
this.services.events.dispatchEvent(Events.Toolbar.SHOW_OVERFLOW_MENU);
|
|
@@ -44120,28 +44118,16 @@ var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
|
44120
44118
|
* @returns Array consisting of smallest and largest values in data
|
|
44121
44119
|
*/
|
|
44122
44120
|
HeatmapModel.prototype.getValueDomain = function () {
|
|
44123
|
-
var
|
|
44124
|
-
var
|
|
44125
|
-
|
|
44126
|
-
|
|
44127
|
-
|
|
44128
|
-
limits
|
|
44129
|
-
|
|
44130
|
-
|
|
44131
|
-
|
|
44132
|
-
|
|
44133
|
-
else if (value % 10 === 0 || value === 0) {
|
|
44134
|
-
value;
|
|
44135
|
-
}
|
|
44136
|
-
else if (value < 0) {
|
|
44137
|
-
value = Math.floor(value / 10) * 10;
|
|
44138
|
-
}
|
|
44139
|
-
else {
|
|
44140
|
-
value = Math.ceil(value / 10) * 10;
|
|
44141
|
-
}
|
|
44142
|
-
domain.push(value);
|
|
44143
|
-
});
|
|
44144
|
-
// Ensure the median of the range is 0
|
|
44121
|
+
var limits = src_extent(this.getDisplayData(), function (d) { return d.value; });
|
|
44122
|
+
var domain = linear_linear()
|
|
44123
|
+
.domain(limits)
|
|
44124
|
+
.nice()
|
|
44125
|
+
.domain();
|
|
44126
|
+
// Ensuring limits start at 0 to make scale look more `nicer`
|
|
44127
|
+
if (domain[0] > 0) {
|
|
44128
|
+
domain[0] = 0;
|
|
44129
|
+
}
|
|
44130
|
+
// Ensure the median of the range is 0 if domain extends into both negative & positive
|
|
44145
44131
|
if (domain[0] < 0 && domain[1] > 0) {
|
|
44146
44132
|
if (Math.abs(domain[0]) > domain[1]) {
|
|
44147
44133
|
domain[1] = Math.abs(domain[0]);
|
|
@@ -44155,7 +44141,7 @@ var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
|
44155
44141
|
/**
|
|
44156
44142
|
* @override
|
|
44157
44143
|
* @param value
|
|
44158
|
-
* @returns
|
|
44144
|
+
* @returns string
|
|
44159
44145
|
*/
|
|
44160
44146
|
HeatmapModel.prototype.getFillColor = function (value) {
|
|
44161
44147
|
return this._colorScale(value);
|