@carbon/charts-vue 0.53.4 → 0.54.2
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 +35 -0
- package/charts-vue.common.js +1694 -206
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +1694 -206
- 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.common.js
CHANGED
|
@@ -310,6 +310,7 @@ __webpack_require__.d(events_namespaceObject, "Legend", function() { return even
|
|
|
310
310
|
__webpack_require__.d(events_namespaceObject, "CirclePack", function() { return events_CirclePack; });
|
|
311
311
|
__webpack_require__.d(events_namespaceObject, "Alluvial", function() { return events_Alluvial; });
|
|
312
312
|
__webpack_require__.d(events_namespaceObject, "Meter", function() { return events_Meter; });
|
|
313
|
+
__webpack_require__.d(events_namespaceObject, "Heatmap", function() { return events_Heatmap; });
|
|
313
314
|
var configuration_namespaceObject = {};
|
|
314
315
|
__webpack_require__.r(configuration_namespaceObject);
|
|
315
316
|
__webpack_require__.d(configuration_namespaceObject, "grid", function() { return grid; });
|
|
@@ -324,12 +325,13 @@ __webpack_require__.d(configuration_namespaceObject, "circlePack", function() {
|
|
|
324
325
|
__webpack_require__.d(configuration_namespaceObject, "color", function() { return configuration_non_customizable_color; });
|
|
325
326
|
__webpack_require__.d(configuration_namespaceObject, "boxplot", function() { return boxplot; });
|
|
326
327
|
__webpack_require__.d(configuration_namespaceObject, "histogram", function() { return configuration_non_customizable_histogram; });
|
|
327
|
-
__webpack_require__.d(configuration_namespaceObject, "legend", function() { return
|
|
328
|
+
__webpack_require__.d(configuration_namespaceObject, "legend", function() { return configuration_non_customizable_legend; });
|
|
328
329
|
__webpack_require__.d(configuration_namespaceObject, "lines", function() { return configuration_non_customizable_lines; });
|
|
329
330
|
__webpack_require__.d(configuration_namespaceObject, "meter", function() { return meter; });
|
|
330
331
|
__webpack_require__.d(configuration_namespaceObject, "pie", function() { return configuration_non_customizable_pie; });
|
|
331
332
|
__webpack_require__.d(configuration_namespaceObject, "radar", function() { return radar; });
|
|
332
333
|
__webpack_require__.d(configuration_namespaceObject, "alluvial", function() { return alluvial; });
|
|
334
|
+
__webpack_require__.d(configuration_namespaceObject, "heatmap", function() { return heatmap; });
|
|
333
335
|
__webpack_require__.d(configuration_namespaceObject, "spacers", function() { return spacers; });
|
|
334
336
|
__webpack_require__.d(configuration_namespaceObject, "tooltips", function() { return tooltips; });
|
|
335
337
|
__webpack_require__.d(configuration_namespaceObject, "transitions", function() { return configuration_non_customizable_transitions; });
|
|
@@ -477,6 +479,9 @@ var events_Axis;
|
|
|
477
479
|
Axis["LABEL_MOUSEMOVE"] = "axis-label-mousemove";
|
|
478
480
|
Axis["LABEL_CLICK"] = "axis-label-click";
|
|
479
481
|
Axis["LABEL_MOUSEOUT"] = "axis-label-mouseout";
|
|
482
|
+
Axis["LABEL_FOCUS"] = "axis-label-focus";
|
|
483
|
+
Axis["LABEL_BLUR"] = "axis-label-blur";
|
|
484
|
+
Axis["RENDER_COMPLETE"] = "axis-render-complete";
|
|
480
485
|
})(events_Axis || (events_Axis = {}));
|
|
481
486
|
/**
|
|
482
487
|
* enum of all area graph events
|
|
@@ -652,6 +657,16 @@ var events_Meter;
|
|
|
652
657
|
Meter["METER_MOUSEOUT"] = "meter-mouseout";
|
|
653
658
|
Meter["METER_MOUSEMOVE"] = "meter-mousemove";
|
|
654
659
|
})(events_Meter || (events_Meter = {}));
|
|
660
|
+
/**
|
|
661
|
+
* enum of all heatmap related events
|
|
662
|
+
*/
|
|
663
|
+
var events_Heatmap;
|
|
664
|
+
(function (Heatmap) {
|
|
665
|
+
Heatmap["HEATMAP_MOUSEOVER"] = "heatmap-mouseover";
|
|
666
|
+
Heatmap["HEATMAP_CLICK"] = "heatmap-click";
|
|
667
|
+
Heatmap["HEATMAP_MOUSEOUT"] = "heatmap-mouseout";
|
|
668
|
+
Heatmap["HEATMAP_MOUSEMOVE"] = "hetmap-mousemove";
|
|
669
|
+
})(events_Heatmap || (events_Heatmap = {}));
|
|
655
670
|
//# sourceMappingURL=../../src/interfaces/events.js.map
|
|
656
671
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/enums.js
|
|
657
672
|
|
|
@@ -908,6 +923,31 @@ var LegendItemType;
|
|
|
908
923
|
LegendItemType["QUARTILE"] = "quartile";
|
|
909
924
|
LegendItemType["ZOOM"] = "zoom";
|
|
910
925
|
})(LegendItemType || (LegendItemType = {}));
|
|
926
|
+
/**
|
|
927
|
+
* enum of color legend types
|
|
928
|
+
*/
|
|
929
|
+
var ColorLegendType;
|
|
930
|
+
(function (ColorLegendType) {
|
|
931
|
+
ColorLegendType["LINEAR"] = "linear";
|
|
932
|
+
ColorLegendType["QUANTIZE"] = "quantize";
|
|
933
|
+
})(ColorLegendType || (ColorLegendType = {}));
|
|
934
|
+
/**
|
|
935
|
+
* enum of divider status for heatmap
|
|
936
|
+
*/
|
|
937
|
+
var DividerStatus;
|
|
938
|
+
(function (DividerStatus) {
|
|
939
|
+
DividerStatus["ON"] = "on";
|
|
940
|
+
DividerStatus["AUTO"] = "auto";
|
|
941
|
+
DividerStatus["OFF"] = "off";
|
|
942
|
+
})(DividerStatus || (DividerStatus = {}));
|
|
943
|
+
/**
|
|
944
|
+
* enum of axis flavor
|
|
945
|
+
*/
|
|
946
|
+
var AxisFlavor;
|
|
947
|
+
(function (AxisFlavor) {
|
|
948
|
+
AxisFlavor["DEFAULT"] = "default";
|
|
949
|
+
AxisFlavor["HOVERABLE"] = "hoverable";
|
|
950
|
+
})(AxisFlavor || (AxisFlavor = {}));
|
|
911
951
|
//# sourceMappingURL=../../src/interfaces/enums.js.map
|
|
912
952
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/index.js
|
|
913
953
|
|
|
@@ -948,6 +988,9 @@ var configuration_non_customizable_axis = {
|
|
|
948
988
|
compareTo: 'marker',
|
|
949
989
|
},
|
|
950
990
|
paddingRatio: 0.1,
|
|
991
|
+
hover: {
|
|
992
|
+
rectanglePadding: 4,
|
|
993
|
+
},
|
|
951
994
|
};
|
|
952
995
|
var canvasZoomSettings = {
|
|
953
996
|
duration: 1000,
|
|
@@ -999,7 +1042,7 @@ var boxplot = {
|
|
|
999
1042
|
var configuration_non_customizable_histogram = {
|
|
1000
1043
|
defaultBins: 10,
|
|
1001
1044
|
};
|
|
1002
|
-
var
|
|
1045
|
+
var configuration_non_customizable_legend = {
|
|
1003
1046
|
items: {
|
|
1004
1047
|
status: {
|
|
1005
1048
|
ACTIVE: 1,
|
|
@@ -1052,6 +1095,11 @@ var legend = {
|
|
|
1052
1095
|
iconData: [{ x: 0, y: 0, width: 12, height: 12 }],
|
|
1053
1096
|
color: '#8D8D8D',
|
|
1054
1097
|
},
|
|
1098
|
+
color: {
|
|
1099
|
+
barWidth: 300,
|
|
1100
|
+
barHeight: 8,
|
|
1101
|
+
axisYTranslation: 10,
|
|
1102
|
+
},
|
|
1055
1103
|
};
|
|
1056
1104
|
var configuration_non_customizable_lines = {
|
|
1057
1105
|
opacity: {
|
|
@@ -1121,6 +1169,11 @@ var alluvial = {
|
|
|
1121
1169
|
selected: 1,
|
|
1122
1170
|
},
|
|
1123
1171
|
};
|
|
1172
|
+
var heatmap = {
|
|
1173
|
+
minCellDividerDimension: 16,
|
|
1174
|
+
// Ensures axes lines are displayed with or without stroke disabled
|
|
1175
|
+
chartPadding: 0.5,
|
|
1176
|
+
};
|
|
1124
1177
|
var spacers = {
|
|
1125
1178
|
default: {
|
|
1126
1179
|
size: 24,
|
|
@@ -8778,6 +8831,17 @@ var alluvialChart = tools_Tools.merge({}, chart, {
|
|
|
8778
8831
|
nodes: [],
|
|
8779
8832
|
},
|
|
8780
8833
|
});
|
|
8834
|
+
var heatmapChart = tools_Tools.merge({}, chart, {
|
|
8835
|
+
axes: configuration_axes,
|
|
8836
|
+
heatmap: {
|
|
8837
|
+
divider: {
|
|
8838
|
+
state: DividerStatus.AUTO,
|
|
8839
|
+
},
|
|
8840
|
+
colorLegend: {
|
|
8841
|
+
type: 'linear',
|
|
8842
|
+
},
|
|
8843
|
+
},
|
|
8844
|
+
});
|
|
8781
8845
|
var configuration_options = {
|
|
8782
8846
|
chart: chart,
|
|
8783
8847
|
axisChart: axisChart,
|
|
@@ -8805,6 +8869,7 @@ var configuration_options = {
|
|
|
8805
8869
|
circlePackChart: circlePackChart,
|
|
8806
8870
|
wordCloudChart: wordCloudChart,
|
|
8807
8871
|
alluvialChart: alluvialChart,
|
|
8872
|
+
heatmapChart: heatmapChart,
|
|
8808
8873
|
};
|
|
8809
8874
|
|
|
8810
8875
|
//# sourceMappingURL=../src/configuration.js.map
|
|
@@ -9496,7 +9561,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9496
9561
|
if (!this.get('data')) {
|
|
9497
9562
|
return null;
|
|
9498
9563
|
}
|
|
9499
|
-
var ACTIVE =
|
|
9564
|
+
var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
|
|
9500
9565
|
var dataGroups = this.getDataGroups(groups);
|
|
9501
9566
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
9502
9567
|
var allDataFromDomain = this.getAllDataFromDomain(groups);
|
|
@@ -9541,7 +9606,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9541
9606
|
return this.get('dataGroups');
|
|
9542
9607
|
};
|
|
9543
9608
|
ChartModel.prototype.getActiveDataGroups = function (groups) {
|
|
9544
|
-
var ACTIVE =
|
|
9609
|
+
var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
|
|
9545
9610
|
return this.getDataGroups(groups).filter(function (dataGroup) { return dataGroup.status === ACTIVE; });
|
|
9546
9611
|
};
|
|
9547
9612
|
ChartModel.prototype.getDataGroupNames = function (groups) {
|
|
@@ -9813,7 +9878,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9813
9878
|
* Data labels
|
|
9814
9879
|
*/
|
|
9815
9880
|
ChartModel.prototype.toggleDataLabel = function (changedLabel) {
|
|
9816
|
-
var _a =
|
|
9881
|
+
var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
9817
9882
|
var dataGroups = this.getDataGroups();
|
|
9818
9883
|
var hasDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
|
|
9819
9884
|
var activeItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
|
|
@@ -10024,7 +10089,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
10024
10089
|
};
|
|
10025
10090
|
ChartModel.prototype.generateDataGroups = function (data) {
|
|
10026
10091
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
10027
|
-
var _a =
|
|
10092
|
+
var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
10028
10093
|
var options = this.getOptions();
|
|
10029
10094
|
var uniqueDataGroups = tools_Tools.removeArrayDuplicates(data.map(function (datum) { return datum[groupMapsTo]; }));
|
|
10030
10095
|
// check if selectedGroups can be applied to chart with current data groups
|
|
@@ -16013,6 +16078,22 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
|
|
|
16013
16078
|
this.dualAxes = true;
|
|
16014
16079
|
}
|
|
16015
16080
|
};
|
|
16081
|
+
CartesianScales.prototype.getCustomDomainValuesByposition = function (axisPosition) {
|
|
16082
|
+
var domain = tools_Tools.getProperty(this.model.getOptions(), 'axes', axisPosition, 'domain');
|
|
16083
|
+
// Check if domain is an array
|
|
16084
|
+
if (domain && !Array.isArray(domain)) {
|
|
16085
|
+
throw new Error("Domain in " + axisPosition + " axis is not a valid array");
|
|
16086
|
+
}
|
|
16087
|
+
// Determine number of elements passed in domain depending on scale types
|
|
16088
|
+
if (Array.isArray(domain)) {
|
|
16089
|
+
if ((this.scaleTypes[axisPosition] === ScaleTypes.LINEAR ||
|
|
16090
|
+
this.scaleTypes[axisPosition] === ScaleTypes.TIME) &&
|
|
16091
|
+
domain.length !== 2) {
|
|
16092
|
+
throw new Error("There can only be 2 elements in domain for scale type: " + this.scaleTypes[axisPosition]);
|
|
16093
|
+
}
|
|
16094
|
+
}
|
|
16095
|
+
return domain;
|
|
16096
|
+
};
|
|
16016
16097
|
CartesianScales.prototype.getOrientation = function () {
|
|
16017
16098
|
return this.orientation;
|
|
16018
16099
|
};
|
|
@@ -17530,6 +17611,11 @@ var zoom_Zoom = /** @class */ (function (_super) {
|
|
|
17530
17611
|
var cartesianScales = this.services.cartesianScales;
|
|
17531
17612
|
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
17532
17613
|
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
17614
|
+
var customDomain = tools_Tools.getProperty(this.model.getOptions(), 'axes', mainXAxisPosition, 'domain');
|
|
17615
|
+
// return custom domain if exists && valid
|
|
17616
|
+
if (Array.isArray(customDomain) && customDomain.length === 2) {
|
|
17617
|
+
return customDomain;
|
|
17618
|
+
}
|
|
17533
17619
|
// default to full range with extended domain
|
|
17534
17620
|
return cartesianScales.extendsDomain(mainXAxisPosition, src_extent(allZoomBarData, function (d) { return d[domainIdentifier]; }));
|
|
17535
17621
|
};
|
|
@@ -17908,7 +17994,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17908
17994
|
var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
|
|
17909
17995
|
var dataGroups = this.model.getDataGroups();
|
|
17910
17996
|
// Check if there are disabled legend items
|
|
17911
|
-
var DISABLED =
|
|
17997
|
+
var DISABLED = configuration_non_customizable_legend.items.status.DISABLED;
|
|
17912
17998
|
var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
|
|
17913
17999
|
var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
|
|
17914
18000
|
var svg = this.getComponentContainer()
|
|
@@ -17932,11 +18018,11 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17932
18018
|
addedLegendItems
|
|
17933
18019
|
.merge(svg.selectAll('div.legend-item'))
|
|
17934
18020
|
.classed('active', function (d, i) {
|
|
17935
|
-
return d.status ===
|
|
18021
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17936
18022
|
});
|
|
17937
18023
|
var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
|
|
17938
18024
|
svg.classed('clickable', legendClickable && dataGroups.length > 1);
|
|
17939
|
-
var checkboxRadius =
|
|
18025
|
+
var checkboxRadius = configuration_non_customizable_legend.checkbox.radius;
|
|
17940
18026
|
var addedCheckboxes = addedLegendItems
|
|
17941
18027
|
.append('div')
|
|
17942
18028
|
.classed('checkbox', true);
|
|
@@ -17949,7 +18035,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17949
18035
|
})
|
|
17950
18036
|
.attr('aria-checked', function (_a) {
|
|
17951
18037
|
var status = _a.status;
|
|
17952
|
-
return status ===
|
|
18038
|
+
return status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17953
18039
|
})
|
|
17954
18040
|
.attr('width', checkboxRadius * 2)
|
|
17955
18041
|
.attr('height', checkboxRadius * 2)
|
|
@@ -17961,13 +18047,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17961
18047
|
});
|
|
17962
18048
|
})
|
|
17963
18049
|
.style('background', function (d) {
|
|
17964
|
-
return d.status ===
|
|
18050
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE
|
|
17965
18051
|
? _this.model.getFillColor(d.name) ||
|
|
17966
18052
|
_this.model.getStrokeColor(d.name)
|
|
17967
18053
|
: null;
|
|
17968
18054
|
})
|
|
17969
18055
|
.classed('active', function (d, i) {
|
|
17970
|
-
return d.status ===
|
|
18056
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17971
18057
|
});
|
|
17972
18058
|
var addedCheckIcons = addedCheckboxes
|
|
17973
18059
|
.append('svg')
|
|
@@ -18052,7 +18138,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18052
18138
|
return dataGroups;
|
|
18053
18139
|
};
|
|
18054
18140
|
Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
|
|
18055
|
-
var _a =
|
|
18141
|
+
var _a = configuration_non_customizable_legend.area, width = _a.width, height = _a.height;
|
|
18056
18142
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18057
18143
|
// Circular icon
|
|
18058
18144
|
additionalItem
|
|
@@ -18065,7 +18151,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18065
18151
|
.style('height', height + "px");
|
|
18066
18152
|
}
|
|
18067
18153
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18068
|
-
var _b =
|
|
18154
|
+
var _b = configuration_non_customizable_legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
|
|
18069
18155
|
var circleEnter = additionalItem
|
|
18070
18156
|
.attr('fill', 'none')
|
|
18071
18157
|
.selectAll('circle')
|
|
@@ -18083,7 +18169,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18083
18169
|
.style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
|
|
18084
18170
|
}
|
|
18085
18171
|
else if (itemConfig.type === LegendItemType.LINE) {
|
|
18086
|
-
var lineConfig =
|
|
18172
|
+
var lineConfig = configuration_non_customizable_legend.line;
|
|
18087
18173
|
if (additionalItem.select('line.line').empty()) {
|
|
18088
18174
|
additionalItem
|
|
18089
18175
|
.append('line')
|
|
@@ -18110,13 +18196,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18110
18196
|
.attr('width', width)
|
|
18111
18197
|
.attr('height', height)
|
|
18112
18198
|
.style('fill', indexOfItem > 3 && !itemConfig.fill
|
|
18113
|
-
?
|
|
18199
|
+
? configuration_non_customizable_legend.area.fill
|
|
18114
18200
|
: itemConfig.fill)
|
|
18115
18201
|
.style('stroke', itemConfig.stroke);
|
|
18116
18202
|
}
|
|
18117
18203
|
}
|
|
18118
18204
|
else if (itemConfig.type === LegendItemType.SIZE) {
|
|
18119
|
-
var _c =
|
|
18205
|
+
var _c = configuration_non_customizable_legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
|
|
18120
18206
|
var sizeEnter = additionalItem
|
|
18121
18207
|
.attr('fill', 'none')
|
|
18122
18208
|
.attr('role', Roles.IMG)
|
|
@@ -18135,7 +18221,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18135
18221
|
.style('stroke-width', 1);
|
|
18136
18222
|
}
|
|
18137
18223
|
else if (itemConfig.type === LegendItemType.QUARTILE) {
|
|
18138
|
-
var iconData =
|
|
18224
|
+
var iconData = configuration_non_customizable_legend.quartile.iconData;
|
|
18139
18225
|
var quartileEnter = additionalItem
|
|
18140
18226
|
.selectAll('rect')
|
|
18141
18227
|
.attr('role', Roles.IMG)
|
|
@@ -18289,6 +18375,431 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18289
18375
|
}(component_Component));
|
|
18290
18376
|
|
|
18291
18377
|
//# sourceMappingURL=../../../src/components/essentials/legend.js.map
|
|
18378
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
|
|
18379
|
+
/* harmony default export */ var d3_axis_src_identity = (function(x) {
|
|
18380
|
+
return x;
|
|
18381
|
+
});
|
|
18382
|
+
|
|
18383
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
|
|
18384
|
+
|
|
18385
|
+
|
|
18386
|
+
var axis_top = 1,
|
|
18387
|
+
axis_right = 2,
|
|
18388
|
+
bottom = 3,
|
|
18389
|
+
axis_left = 4,
|
|
18390
|
+
axis_epsilon = 1e-6;
|
|
18391
|
+
|
|
18392
|
+
function axis_translateX(x) {
|
|
18393
|
+
return "translate(" + x + ",0)";
|
|
18394
|
+
}
|
|
18395
|
+
|
|
18396
|
+
function axis_translateY(y) {
|
|
18397
|
+
return "translate(0," + y + ")";
|
|
18398
|
+
}
|
|
18399
|
+
|
|
18400
|
+
function axis_number(scale) {
|
|
18401
|
+
return d => +scale(d);
|
|
18402
|
+
}
|
|
18403
|
+
|
|
18404
|
+
function center(scale, offset) {
|
|
18405
|
+
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
18406
|
+
if (scale.round()) offset = Math.round(offset);
|
|
18407
|
+
return d => +scale(d) + offset;
|
|
18408
|
+
}
|
|
18409
|
+
|
|
18410
|
+
function entering() {
|
|
18411
|
+
return !this.__axis;
|
|
18412
|
+
}
|
|
18413
|
+
|
|
18414
|
+
function axis_axis(orient, scale) {
|
|
18415
|
+
var tickArguments = [],
|
|
18416
|
+
tickValues = null,
|
|
18417
|
+
tickFormat = null,
|
|
18418
|
+
tickSizeInner = 6,
|
|
18419
|
+
tickSizeOuter = 6,
|
|
18420
|
+
tickPadding = 3,
|
|
18421
|
+
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
18422
|
+
k = orient === axis_top || orient === axis_left ? -1 : 1,
|
|
18423
|
+
x = orient === axis_left || orient === axis_right ? "x" : "y",
|
|
18424
|
+
transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
|
|
18425
|
+
|
|
18426
|
+
function axis(context) {
|
|
18427
|
+
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
18428
|
+
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
|
|
18429
|
+
spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
|
18430
|
+
range = scale.range(),
|
|
18431
|
+
range0 = +range[0] + offset,
|
|
18432
|
+
range1 = +range[range.length - 1] + offset,
|
|
18433
|
+
position = (scale.bandwidth ? center : axis_number)(scale.copy(), offset),
|
|
18434
|
+
selection = context.selection ? context.selection() : context,
|
|
18435
|
+
path = selection.selectAll(".domain").data([null]),
|
|
18436
|
+
tick = selection.selectAll(".tick").data(values, scale).order(),
|
|
18437
|
+
tickExit = tick.exit(),
|
|
18438
|
+
tickEnter = tick.enter().append("g").attr("class", "tick"),
|
|
18439
|
+
line = tick.select("line"),
|
|
18440
|
+
text = tick.select("text");
|
|
18441
|
+
|
|
18442
|
+
path = path.merge(path.enter().insert("path", ".tick")
|
|
18443
|
+
.attr("class", "domain")
|
|
18444
|
+
.attr("stroke", "currentColor"));
|
|
18445
|
+
|
|
18446
|
+
tick = tick.merge(tickEnter);
|
|
18447
|
+
|
|
18448
|
+
line = line.merge(tickEnter.append("line")
|
|
18449
|
+
.attr("stroke", "currentColor")
|
|
18450
|
+
.attr(x + "2", k * tickSizeInner));
|
|
18451
|
+
|
|
18452
|
+
text = text.merge(tickEnter.append("text")
|
|
18453
|
+
.attr("fill", "currentColor")
|
|
18454
|
+
.attr(x, k * spacing)
|
|
18455
|
+
.attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
18456
|
+
|
|
18457
|
+
if (context !== selection) {
|
|
18458
|
+
path = path.transition(context);
|
|
18459
|
+
tick = tick.transition(context);
|
|
18460
|
+
line = line.transition(context);
|
|
18461
|
+
text = text.transition(context);
|
|
18462
|
+
|
|
18463
|
+
tickExit = tickExit.transition(context)
|
|
18464
|
+
.attr("opacity", axis_epsilon)
|
|
18465
|
+
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
|
|
18466
|
+
|
|
18467
|
+
tickEnter
|
|
18468
|
+
.attr("opacity", axis_epsilon)
|
|
18469
|
+
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
|
|
18470
|
+
}
|
|
18471
|
+
|
|
18472
|
+
tickExit.remove();
|
|
18473
|
+
|
|
18474
|
+
path
|
|
18475
|
+
.attr("d", orient === axis_left || orient === axis_right
|
|
18476
|
+
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
18477
|
+
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
18478
|
+
|
|
18479
|
+
tick
|
|
18480
|
+
.attr("opacity", 1)
|
|
18481
|
+
.attr("transform", function(d) { return transform(position(d) + offset); });
|
|
18482
|
+
|
|
18483
|
+
line
|
|
18484
|
+
.attr(x + "2", k * tickSizeInner);
|
|
18485
|
+
|
|
18486
|
+
text
|
|
18487
|
+
.attr(x, k * spacing)
|
|
18488
|
+
.text(format);
|
|
18489
|
+
|
|
18490
|
+
selection.filter(entering)
|
|
18491
|
+
.attr("fill", "none")
|
|
18492
|
+
.attr("font-size", 10)
|
|
18493
|
+
.attr("font-family", "sans-serif")
|
|
18494
|
+
.attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
|
18495
|
+
|
|
18496
|
+
selection
|
|
18497
|
+
.each(function() { this.__axis = position; });
|
|
18498
|
+
}
|
|
18499
|
+
|
|
18500
|
+
axis.scale = function(_) {
|
|
18501
|
+
return arguments.length ? (scale = _, axis) : scale;
|
|
18502
|
+
};
|
|
18503
|
+
|
|
18504
|
+
axis.ticks = function() {
|
|
18505
|
+
return tickArguments = Array.from(arguments), axis;
|
|
18506
|
+
};
|
|
18507
|
+
|
|
18508
|
+
axis.tickArguments = function(_) {
|
|
18509
|
+
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
|
|
18510
|
+
};
|
|
18511
|
+
|
|
18512
|
+
axis.tickValues = function(_) {
|
|
18513
|
+
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
|
|
18514
|
+
};
|
|
18515
|
+
|
|
18516
|
+
axis.tickFormat = function(_) {
|
|
18517
|
+
return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
|
18518
|
+
};
|
|
18519
|
+
|
|
18520
|
+
axis.tickSize = function(_) {
|
|
18521
|
+
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
|
18522
|
+
};
|
|
18523
|
+
|
|
18524
|
+
axis.tickSizeInner = function(_) {
|
|
18525
|
+
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
|
18526
|
+
};
|
|
18527
|
+
|
|
18528
|
+
axis.tickSizeOuter = function(_) {
|
|
18529
|
+
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
|
18530
|
+
};
|
|
18531
|
+
|
|
18532
|
+
axis.tickPadding = function(_) {
|
|
18533
|
+
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
|
18534
|
+
};
|
|
18535
|
+
|
|
18536
|
+
axis.offset = function(_) {
|
|
18537
|
+
return arguments.length ? (offset = +_, axis) : offset;
|
|
18538
|
+
};
|
|
18539
|
+
|
|
18540
|
+
return axis;
|
|
18541
|
+
}
|
|
18542
|
+
|
|
18543
|
+
function axisTop(scale) {
|
|
18544
|
+
return axis_axis(axis_top, scale);
|
|
18545
|
+
}
|
|
18546
|
+
|
|
18547
|
+
function axisRight(scale) {
|
|
18548
|
+
return axis_axis(axis_right, scale);
|
|
18549
|
+
}
|
|
18550
|
+
|
|
18551
|
+
function axisBottom(scale) {
|
|
18552
|
+
return axis_axis(bottom, scale);
|
|
18553
|
+
}
|
|
18554
|
+
|
|
18555
|
+
function axisLeft(scale) {
|
|
18556
|
+
return axis_axis(axis_left, scale);
|
|
18557
|
+
}
|
|
18558
|
+
|
|
18559
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-interpolate/src/quantize.js
|
|
18560
|
+
/* harmony default export */ var quantize = (function(interpolator, n) {
|
|
18561
|
+
var samples = new Array(n);
|
|
18562
|
+
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
|
|
18563
|
+
return samples;
|
|
18564
|
+
});
|
|
18565
|
+
|
|
18566
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/essentials/color-scale-legend.js
|
|
18567
|
+
var color_scale_legend_extends = (undefined && undefined.__extends) || (function () {
|
|
18568
|
+
var extendStatics = function (d, b) {
|
|
18569
|
+
extendStatics = Object.setPrototypeOf ||
|
|
18570
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18571
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
18572
|
+
return extendStatics(d, b);
|
|
18573
|
+
};
|
|
18574
|
+
return function (d, b) {
|
|
18575
|
+
extendStatics(d, b);
|
|
18576
|
+
function __() { this.constructor = d; }
|
|
18577
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18578
|
+
};
|
|
18579
|
+
})();
|
|
18580
|
+
// Internal Imports
|
|
18581
|
+
|
|
18582
|
+
|
|
18583
|
+
|
|
18584
|
+
|
|
18585
|
+
|
|
18586
|
+
// D3 imports
|
|
18587
|
+
|
|
18588
|
+
|
|
18589
|
+
|
|
18590
|
+
var color_scale_legend_ColorScaleLegend = /** @class */ (function (_super) {
|
|
18591
|
+
color_scale_legend_extends(ColorScaleLegend, _super);
|
|
18592
|
+
function ColorScaleLegend() {
|
|
18593
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
18594
|
+
_this.type = 'color-legend';
|
|
18595
|
+
_this.renderType = RenderTypes.SVG;
|
|
18596
|
+
_this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
|
|
18597
|
+
_this.handleAxisComplete = function (event) {
|
|
18598
|
+
var svg = _this.getComponentContainer();
|
|
18599
|
+
var width = dom_utils_DOMUtils.getSVGElementSize(svg, {
|
|
18600
|
+
useAttrs: true,
|
|
18601
|
+
}).width;
|
|
18602
|
+
var isDataLoading = tools_Tools.getProperty(_this.getOptions(), 'data', 'loading');
|
|
18603
|
+
if (width > configuration_non_customizable_legend.color.barWidth && !isDataLoading) {
|
|
18604
|
+
var title = tools_Tools.getProperty(_this.getOptions(), 'heatmap', 'colorLegend', 'title');
|
|
18605
|
+
var cartesianScales = _this.services.cartesianScales;
|
|
18606
|
+
// Get available chart area
|
|
18607
|
+
var mainXScale = cartesianScales.getMainXScale();
|
|
18608
|
+
var xDimensions = mainXScale.range();
|
|
18609
|
+
// Align legend with the axis
|
|
18610
|
+
if (xDimensions[0] > 1) {
|
|
18611
|
+
svg.select('g.legend').attr('transform', "translate(" + xDimensions[0] + ", 0)");
|
|
18612
|
+
if (title) {
|
|
18613
|
+
var textWidth = dom_utils_DOMUtils.getSVGElementSize(svg.select('g.legend-title').select('text'), { useBBox: true }).width;
|
|
18614
|
+
// -9 since LEFT y-axis labels are moved towards the left by 9 by d3
|
|
18615
|
+
var availableSpace = xDimensions[0] - textWidth - 9;
|
|
18616
|
+
// If space is available align the the label with the axis labels
|
|
18617
|
+
if (availableSpace > 1) {
|
|
18618
|
+
svg.select('g.legend-title').attr('transform', "translate(" + availableSpace + ", 0)");
|
|
18619
|
+
}
|
|
18620
|
+
else {
|
|
18621
|
+
// Move the legend down by 16 pixels to display legend text on top
|
|
18622
|
+
svg.select('g.legend').attr('transform', "translate(" + xDimensions[0] + ", 16)");
|
|
18623
|
+
// Align legend title with start of axis
|
|
18624
|
+
svg.select('g.legend-title').attr('transform', "translate(" + xDimensions[0] + ", 0)");
|
|
18625
|
+
}
|
|
18626
|
+
}
|
|
18627
|
+
}
|
|
18628
|
+
}
|
|
18629
|
+
};
|
|
18630
|
+
return _this;
|
|
18631
|
+
}
|
|
18632
|
+
ColorScaleLegend.prototype.init = function () {
|
|
18633
|
+
var eventsFragment = this.services.events;
|
|
18634
|
+
// Highlight correct circle on legend item hovers
|
|
18635
|
+
eventsFragment.addEventListener(Events.Axis.RENDER_COMPLETE, this.handleAxisComplete);
|
|
18636
|
+
};
|
|
18637
|
+
ColorScaleLegend.prototype.render = function (animate) {
|
|
18638
|
+
if (animate === void 0) { animate = false; }
|
|
18639
|
+
var options = this.getOptions();
|
|
18640
|
+
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
18641
|
+
var colorScaleType = tools_Tools.getProperty(options, 'heatmap', 'colorLegend', 'type');
|
|
18642
|
+
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
18643
|
+
var title = tools_Tools.getProperty(options, 'heatmap', 'colorLegend', 'title');
|
|
18644
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
18645
|
+
var domain = this.model.getValueDomain();
|
|
18646
|
+
var svg = this.getComponentContainer();
|
|
18647
|
+
// Clear DOM if loading
|
|
18648
|
+
var isDataLoading = tools_Tools.getProperty(this.getOptions(), 'data', 'loading');
|
|
18649
|
+
if (isDataLoading) {
|
|
18650
|
+
svg.html('');
|
|
18651
|
+
return;
|
|
18652
|
+
}
|
|
18653
|
+
var legend = dom_utils_DOMUtils.appendOrSelect(svg, 'g.legend');
|
|
18654
|
+
var axis = dom_utils_DOMUtils.appendOrSelect(legend, 'g.legend-axis');
|
|
18655
|
+
var width = dom_utils_DOMUtils.getSVGElementSize(svg, {
|
|
18656
|
+
useAttrs: true,
|
|
18657
|
+
}).width;
|
|
18658
|
+
var barWidth = configuration_non_customizable_legend.color.barWidth;
|
|
18659
|
+
if (width <= configuration_non_customizable_legend.color.barWidth) {
|
|
18660
|
+
barWidth = width;
|
|
18661
|
+
}
|
|
18662
|
+
if (title) {
|
|
18663
|
+
var legendTitleGroup = dom_utils_DOMUtils.appendOrSelect(svg, 'g.legend-title');
|
|
18664
|
+
var legendTitle = dom_utils_DOMUtils.appendOrSelect(legendTitleGroup, 'text');
|
|
18665
|
+
legendTitle.text(title).attr('dy', '0.7em');
|
|
18666
|
+
// Move the legend down by 16 pixels to display legend text on top
|
|
18667
|
+
legend.attr('transform', "translate(0, 16)");
|
|
18668
|
+
}
|
|
18669
|
+
// If domain consists of negative and positive values, use diverging palettes
|
|
18670
|
+
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
18671
|
+
// Use default color pairing options if not in defined range
|
|
18672
|
+
if (colorPairingOption < 1 &&
|
|
18673
|
+
colorPairingOption > 4 &&
|
|
18674
|
+
colorScheme === 'mono') {
|
|
18675
|
+
colorPairingOption = 1;
|
|
18676
|
+
}
|
|
18677
|
+
else if (colorPairingOption < 1 &&
|
|
18678
|
+
colorPairingOption > 2 &&
|
|
18679
|
+
colorScheme === 'diverge') {
|
|
18680
|
+
colorPairingOption = 1;
|
|
18681
|
+
}
|
|
18682
|
+
var colorPairing = [];
|
|
18683
|
+
// Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
|
|
18684
|
+
var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
|
|
18685
|
+
if (!customColorsEnabled) {
|
|
18686
|
+
// Add class names to list and the amount based on the color scheme
|
|
18687
|
+
for (var i = 1; i < colorGroupingLength + 1; i++) {
|
|
18688
|
+
colorPairing.push(colorScaleType === ColorLegendType.LINEAR
|
|
18689
|
+
? "stop-color-" + colorScheme + "-" + colorPairingOption + "-" + i
|
|
18690
|
+
: "fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
|
|
18691
|
+
}
|
|
18692
|
+
}
|
|
18693
|
+
else {
|
|
18694
|
+
// Use custom colors
|
|
18695
|
+
colorPairing = customColors;
|
|
18696
|
+
}
|
|
18697
|
+
if (colorScaleType === ColorLegendType.LINEAR) {
|
|
18698
|
+
var stopLengthPercentage_1 = 100 / (colorPairing.length - 1);
|
|
18699
|
+
// Generate the gradient
|
|
18700
|
+
var linearGradient = dom_utils_DOMUtils.appendOrSelect(legend, 'linearGradient');
|
|
18701
|
+
linearGradient
|
|
18702
|
+
.attr('id', this.gradient_id + "-legend")
|
|
18703
|
+
.selectAll('stop')
|
|
18704
|
+
.data(colorPairing)
|
|
18705
|
+
.enter()
|
|
18706
|
+
.append('stop')
|
|
18707
|
+
.attr('offset', function (_, i) { return i * stopLengthPercentage_1 + "%"; })
|
|
18708
|
+
.attr('class', function (_, i) { return colorPairing[i]; })
|
|
18709
|
+
.attr('stop-color', function (d) { return d; });
|
|
18710
|
+
// Create the legend container
|
|
18711
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(legend, 'rect');
|
|
18712
|
+
rectangle
|
|
18713
|
+
.attr('width', barWidth)
|
|
18714
|
+
.attr('height', configuration_non_customizable_legend.color.barHeight)
|
|
18715
|
+
.style('fill', "url(#" + this.gradient_id + "-legend)");
|
|
18716
|
+
// Create scale & ticks
|
|
18717
|
+
var linearScale = linear_linear()
|
|
18718
|
+
.domain(domain)
|
|
18719
|
+
.range([0, barWidth]);
|
|
18720
|
+
domain.splice(1, 0, (domain[0] + domain[1]) / 2);
|
|
18721
|
+
var xAxis = axisBottom(linearScale)
|
|
18722
|
+
.tickSize(0)
|
|
18723
|
+
.tickValues(domain);
|
|
18724
|
+
// Align axes at the bottom of the rectangle and delete the domain line
|
|
18725
|
+
axis.attr('transform', "translate(0," + configuration_non_customizable_legend.color.axisYTranslation + ")").call(xAxis);
|
|
18726
|
+
// Remove domain
|
|
18727
|
+
axis.select('.domain').remove();
|
|
18728
|
+
// Align text to fit in container
|
|
18729
|
+
axis.style('text-anchor', 'start');
|
|
18730
|
+
}
|
|
18731
|
+
else if (colorScaleType === ColorLegendType.QUANTIZE) {
|
|
18732
|
+
// Generate equal chunks between range to act as ticks
|
|
18733
|
+
var interpolator = src_round(domain[0], domain[1]);
|
|
18734
|
+
var quant_1 = quantize(interpolator, colorPairing.length);
|
|
18735
|
+
// If divergent && non-custom color, remove 0/white from being displayed
|
|
18736
|
+
if (!customColorsEnabled && colorScheme === 'diverge') {
|
|
18737
|
+
colorPairing.splice(colorPairing.length / 2, 1);
|
|
18738
|
+
}
|
|
18739
|
+
var colorScaleBand_1 = band()
|
|
18740
|
+
.domain(colorPairing)
|
|
18741
|
+
.range([0, barWidth]);
|
|
18742
|
+
// Render the quantized rectangles
|
|
18743
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(legend, 'g.quantized-rect');
|
|
18744
|
+
rectangle
|
|
18745
|
+
.selectAll('rect')
|
|
18746
|
+
.data(colorScaleBand_1.domain())
|
|
18747
|
+
.join('rect')
|
|
18748
|
+
.attr('x', function (d) { return colorScaleBand_1(d); })
|
|
18749
|
+
.attr('y', 0)
|
|
18750
|
+
.attr('width', Math.max(0, colorScaleBand_1.bandwidth()) - 1)
|
|
18751
|
+
.attr('height', configuration_non_customizable_legend.color.barHeight)
|
|
18752
|
+
.attr('class', function (d) { return d; })
|
|
18753
|
+
.attr('fill', function (d) { return d; });
|
|
18754
|
+
var xAxis = axisBottom(colorScaleBand_1)
|
|
18755
|
+
.tickSize(0)
|
|
18756
|
+
.tickValues(colorPairing)
|
|
18757
|
+
.tickFormat(function (_, i) {
|
|
18758
|
+
// Display every other tick to create space
|
|
18759
|
+
if (!customColorsEnabled &&
|
|
18760
|
+
((i + 1) % 2 === 0 || i === colorPairing.length - 1)) {
|
|
18761
|
+
return null;
|
|
18762
|
+
}
|
|
18763
|
+
// Use the quant interpolators as ticks
|
|
18764
|
+
return quant_1[i].toString();
|
|
18765
|
+
});
|
|
18766
|
+
// Align axis to match bandwidth start after initial (white)
|
|
18767
|
+
var axisTranslation = colorScaleBand_1.bandwidth() / 2;
|
|
18768
|
+
axis.attr('transform', "translate(" + (!customColorsEnabled && colorScheme === 'diverge' ? '-' : '') + axisTranslation + ", " + configuration_non_customizable_legend.color.axisYTranslation + ")").call(xAxis);
|
|
18769
|
+
// Append the last tick
|
|
18770
|
+
var firstTick = axis.select('g.tick').clone(true);
|
|
18771
|
+
firstTick
|
|
18772
|
+
.attr('transform', "translate(" + (barWidth +
|
|
18773
|
+
(!customColorsEnabled && colorScheme === 'diverge'
|
|
18774
|
+
? axisTranslation
|
|
18775
|
+
: -axisTranslation)) + ", 0)")
|
|
18776
|
+
.classed('final-tick', true)
|
|
18777
|
+
.select('text')
|
|
18778
|
+
.text(quant_1[quant_1.length - 1]);
|
|
18779
|
+
axis.enter().append(firstTick.node());
|
|
18780
|
+
axis.select('.domain').remove();
|
|
18781
|
+
}
|
|
18782
|
+
else {
|
|
18783
|
+
throw Error('Entered color legend type is not supported.');
|
|
18784
|
+
}
|
|
18785
|
+
// Translate last axis tick if barWidth equals chart width
|
|
18786
|
+
if (width <= configuration_non_customizable_legend.color.barWidth) {
|
|
18787
|
+
var lastTick = axis.select('g.tick:last-of-type text');
|
|
18788
|
+
var width_1 = dom_utils_DOMUtils.getSVGElementSize(lastTick, {
|
|
18789
|
+
useBBox: true,
|
|
18790
|
+
}).width;
|
|
18791
|
+
lastTick.attr('x', "-" + width_1);
|
|
18792
|
+
}
|
|
18793
|
+
};
|
|
18794
|
+
ColorScaleLegend.prototype.destroy = function () {
|
|
18795
|
+
// Remove legend listeners
|
|
18796
|
+
var eventsFragment = this.services.events;
|
|
18797
|
+
eventsFragment.removeEventListener(Events.Axis.RENDER_COMPLETE, this.handleAxisComplete);
|
|
18798
|
+
};
|
|
18799
|
+
return ColorScaleLegend;
|
|
18800
|
+
}(legend_Legend));
|
|
18801
|
+
|
|
18802
|
+
//# sourceMappingURL=../../../src/components/essentials/color-scale-legend.js.map
|
|
18292
18803
|
// EXTERNAL MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/carbon-components/node_modules/warning/browser.js
|
|
18293
18804
|
var browser = __webpack_require__("9b04");
|
|
18294
18805
|
|
|
@@ -33474,7 +33985,7 @@ function justify(node, n) {
|
|
|
33474
33985
|
return node.sourceLinks.length ? node.depth : n - 1;
|
|
33475
33986
|
}
|
|
33476
33987
|
|
|
33477
|
-
function
|
|
33988
|
+
function align_center(node) {
|
|
33478
33989
|
return node.targetLinks.length ? node.depth
|
|
33479
33990
|
: node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
|
|
33480
33991
|
: 0;
|
|
@@ -34648,6 +35159,376 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34648
35159
|
}(component_Component));
|
|
34649
35160
|
|
|
34650
35161
|
//# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
|
|
35162
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/heatmap.js
|
|
35163
|
+
var heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
35164
|
+
var extendStatics = function (d, b) {
|
|
35165
|
+
extendStatics = Object.setPrototypeOf ||
|
|
35166
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
35167
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
35168
|
+
return extendStatics(d, b);
|
|
35169
|
+
};
|
|
35170
|
+
return function (d, b) {
|
|
35171
|
+
extendStatics(d, b);
|
|
35172
|
+
function __() { this.constructor = d; }
|
|
35173
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
35174
|
+
};
|
|
35175
|
+
})();
|
|
35176
|
+
// Internal Imports
|
|
35177
|
+
|
|
35178
|
+
|
|
35179
|
+
|
|
35180
|
+
|
|
35181
|
+
|
|
35182
|
+
|
|
35183
|
+
// D3 Imports
|
|
35184
|
+
|
|
35185
|
+
|
|
35186
|
+
var heatmap_Heatmap = /** @class */ (function (_super) {
|
|
35187
|
+
heatmap_extends(Heatmap, _super);
|
|
35188
|
+
function Heatmap() {
|
|
35189
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35190
|
+
_this.type = 'heatmap';
|
|
35191
|
+
_this.renderType = RenderTypes.SVG;
|
|
35192
|
+
_this.matrix = {};
|
|
35193
|
+
_this.xBandwidth = 0;
|
|
35194
|
+
_this.yBandwidth = 0;
|
|
35195
|
+
_this.translationUnits = {
|
|
35196
|
+
x: 0,
|
|
35197
|
+
y: 0,
|
|
35198
|
+
};
|
|
35199
|
+
// Highlight elements that match the hovered axis item
|
|
35200
|
+
_this.handleAxisOnHover = function (event) {
|
|
35201
|
+
var detail = event.detail;
|
|
35202
|
+
var datum = detail.datum;
|
|
35203
|
+
// Unique ranges and domains
|
|
35204
|
+
var ranges = _this.model.getUniqueRanges();
|
|
35205
|
+
var domains = _this.model.getUniqueDomain();
|
|
35206
|
+
// Labels
|
|
35207
|
+
var domainLabel = _this.services.cartesianScales.getDomainLabel();
|
|
35208
|
+
var rangeLabel = _this.services.cartesianScales.getRangeLabel();
|
|
35209
|
+
// Scales
|
|
35210
|
+
var mainXScale = _this.services.cartesianScales.getMainXScale();
|
|
35211
|
+
var mainYScale = _this.services.cartesianScales.getMainYScale();
|
|
35212
|
+
var label = '', sum = 0, minimum = 0, maximum = 0;
|
|
35213
|
+
// Check to see where datum belongs
|
|
35214
|
+
if (_this.matrix[datum] !== undefined) {
|
|
35215
|
+
label = domainLabel;
|
|
35216
|
+
// Iterate through Object and get sum, min, and max
|
|
35217
|
+
ranges.forEach(function (element) {
|
|
35218
|
+
var value = _this.matrix[datum][element].value || 0;
|
|
35219
|
+
sum += value;
|
|
35220
|
+
minimum = value < minimum ? value : minimum;
|
|
35221
|
+
maximum = value > maximum ? value : maximum;
|
|
35222
|
+
});
|
|
35223
|
+
}
|
|
35224
|
+
else {
|
|
35225
|
+
label = rangeLabel;
|
|
35226
|
+
domains.forEach(function (element) {
|
|
35227
|
+
var value = _this.matrix[element][datum].value || 0;
|
|
35228
|
+
sum += value;
|
|
35229
|
+
minimum = value < minimum ? value : minimum;
|
|
35230
|
+
maximum = value > maximum ? value : maximum;
|
|
35231
|
+
});
|
|
35232
|
+
}
|
|
35233
|
+
if (mainXScale(datum) !== undefined) {
|
|
35234
|
+
_this.parent
|
|
35235
|
+
.select('g.multi-cell.column-highlight')
|
|
35236
|
+
.classed('highlighter-hidden', false)
|
|
35237
|
+
.attr('transform', "translate(" + mainXScale(datum) + ", " + min_min(mainYScale.range()) + ")");
|
|
35238
|
+
}
|
|
35239
|
+
else if (mainYScale(datum) !== undefined) {
|
|
35240
|
+
_this.parent
|
|
35241
|
+
.select('g.multi-cell.row-highlight')
|
|
35242
|
+
.classed('highlighter-hidden', false)
|
|
35243
|
+
.attr('transform', "translate(" + min_min(mainXScale.range()) + "," + mainYScale(datum) + ")");
|
|
35244
|
+
}
|
|
35245
|
+
// Dispatch tooltip show event
|
|
35246
|
+
_this.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35247
|
+
event: detail.event,
|
|
35248
|
+
hoveredElement: src_select(event.detail.element),
|
|
35249
|
+
items: [
|
|
35250
|
+
{
|
|
35251
|
+
label: label,
|
|
35252
|
+
value: datum,
|
|
35253
|
+
bold: true,
|
|
35254
|
+
},
|
|
35255
|
+
{
|
|
35256
|
+
label: 'Min',
|
|
35257
|
+
value: minimum,
|
|
35258
|
+
},
|
|
35259
|
+
{
|
|
35260
|
+
label: 'Max',
|
|
35261
|
+
value: maximum,
|
|
35262
|
+
},
|
|
35263
|
+
{
|
|
35264
|
+
label: 'Average',
|
|
35265
|
+
value: sum / domains.length,
|
|
35266
|
+
},
|
|
35267
|
+
],
|
|
35268
|
+
});
|
|
35269
|
+
};
|
|
35270
|
+
// Un-highlight all elements
|
|
35271
|
+
_this.handleAxisMouseOut = function (event) {
|
|
35272
|
+
// Hide column/row
|
|
35273
|
+
_this.parent
|
|
35274
|
+
.selectAll('g.multi-cell')
|
|
35275
|
+
.classed('highlighter-hidden', true);
|
|
35276
|
+
// Dispatch hide tooltip event
|
|
35277
|
+
_this.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35278
|
+
event: event,
|
|
35279
|
+
});
|
|
35280
|
+
};
|
|
35281
|
+
return _this;
|
|
35282
|
+
}
|
|
35283
|
+
Heatmap.prototype.init = function () {
|
|
35284
|
+
var eventsFragment = this.services.events;
|
|
35285
|
+
// Highlight correct cells on Axis item hovers
|
|
35286
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOVER, this.handleAxisOnHover);
|
|
35287
|
+
// Highlight correct cells on Axis item mouseouts
|
|
35288
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOUT, this.handleAxisMouseOut);
|
|
35289
|
+
// Highlight correct cells on Axis item focus
|
|
35290
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_FOCUS, this.handleAxisOnHover);
|
|
35291
|
+
// Highlight correct cells on Axis item blur
|
|
35292
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_BLUR, this.handleAxisMouseOut);
|
|
35293
|
+
};
|
|
35294
|
+
Heatmap.prototype.render = function (animate) {
|
|
35295
|
+
var _this = this;
|
|
35296
|
+
if (animate === void 0) { animate = true; }
|
|
35297
|
+
var svg = this.getComponentContainer({ withinChartClip: true });
|
|
35298
|
+
// Lower the chart so the axes are always visible
|
|
35299
|
+
svg.lower();
|
|
35300
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35301
|
+
this.matrix = this.model.getMatrix();
|
|
35302
|
+
svg.html('');
|
|
35303
|
+
if (tools_Tools.getProperty(this.getOptions(), 'data', 'loading')) {
|
|
35304
|
+
return;
|
|
35305
|
+
}
|
|
35306
|
+
// determine x and y axis scale
|
|
35307
|
+
var mainXScale = cartesianScales.getMainXScale();
|
|
35308
|
+
var mainYScale = cartesianScales.getMainYScale();
|
|
35309
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35310
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35311
|
+
// Get unique axis values & create a matrix
|
|
35312
|
+
var uniqueDomain = this.model.getUniqueDomain();
|
|
35313
|
+
var uniqueRange = this.model.getUniqueRanges();
|
|
35314
|
+
// Get matrix in the form of an array to create a single heatmap group
|
|
35315
|
+
var matrixArray = this.model.getMatrixAsArray();
|
|
35316
|
+
// Get available chart area
|
|
35317
|
+
var xRange = mainXScale.range();
|
|
35318
|
+
var yRange = mainYScale.range();
|
|
35319
|
+
// Determine rectangle dimensions based on the number of unique domain and range
|
|
35320
|
+
this.xBandwidth = Math.abs((xRange[1] - xRange[0]) / uniqueDomain.length);
|
|
35321
|
+
this.yBandwidth = Math.abs((yRange[1] - yRange[0]) / uniqueRange.length);
|
|
35322
|
+
var patternID = this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");
|
|
35323
|
+
// Create a striped pattern for missing data
|
|
35324
|
+
svg.append('defs')
|
|
35325
|
+
.append('pattern')
|
|
35326
|
+
.attr('id', patternID)
|
|
35327
|
+
.attr('width', 3)
|
|
35328
|
+
.attr('height', 3)
|
|
35329
|
+
.attr('patternUnits', 'userSpaceOnUse')
|
|
35330
|
+
.attr('patternTransform', 'rotate(45)')
|
|
35331
|
+
.append('rect')
|
|
35332
|
+
.classed('pattern-fill', true)
|
|
35333
|
+
.attr('width', 0.5)
|
|
35334
|
+
.attr('height', 8);
|
|
35335
|
+
var rectangles = svg
|
|
35336
|
+
.selectAll()
|
|
35337
|
+
.data(matrixArray)
|
|
35338
|
+
.enter()
|
|
35339
|
+
.append('g')
|
|
35340
|
+
.attr('class', function (d) { return "heat-" + d.index; })
|
|
35341
|
+
.classed('cell', true)
|
|
35342
|
+
.attr('transform', function (d) {
|
|
35343
|
+
return "translate(" + mainXScale(d[domainIdentifier]) + ", " + mainYScale(d[rangeIdentifier]) + ")";
|
|
35344
|
+
})
|
|
35345
|
+
.append('rect')
|
|
35346
|
+
.attr('class', function (d) {
|
|
35347
|
+
return _this.model.getColorClassName({
|
|
35348
|
+
value: d.value,
|
|
35349
|
+
originalClassName: "heat-" + d.index,
|
|
35350
|
+
});
|
|
35351
|
+
})
|
|
35352
|
+
.classed('heat', true)
|
|
35353
|
+
.classed('null-state', function (d) {
|
|
35354
|
+
return d.index === -1 || d.value === null ? true : false;
|
|
35355
|
+
})
|
|
35356
|
+
.attr('width', this.xBandwidth)
|
|
35357
|
+
.attr('height', this.yBandwidth)
|
|
35358
|
+
.style('fill', function (d) {
|
|
35359
|
+
// Check if a valid value exists
|
|
35360
|
+
if (d.index === -1 || d.value === null) {
|
|
35361
|
+
return "url(#" + patternID + ")";
|
|
35362
|
+
}
|
|
35363
|
+
return _this.model.getFillColor(Number(d.value));
|
|
35364
|
+
})
|
|
35365
|
+
.attr('aria-label', function (d) { return d.value; });
|
|
35366
|
+
// Cell highlight box
|
|
35367
|
+
this.createOuterBox('g.cell-highlight', this.xBandwidth, this.yBandwidth);
|
|
35368
|
+
// Column highlight box
|
|
35369
|
+
this.createOuterBox('g.multi-cell.column-highlight', this.xBandwidth, Math.abs(yRange[1] - yRange[0]));
|
|
35370
|
+
// Row highlight box
|
|
35371
|
+
this.createOuterBox('g.multi-cell.row-highlight', Math.abs(xRange[1] - xRange[0]), this.yBandwidth);
|
|
35372
|
+
if (this.determineDividerStatus()) {
|
|
35373
|
+
rectangles.style('stroke-width', '1px');
|
|
35374
|
+
this.parent.select('g.cell-highlight').classed('cell-2', true);
|
|
35375
|
+
}
|
|
35376
|
+
this.addEventListener();
|
|
35377
|
+
};
|
|
35378
|
+
/**
|
|
35379
|
+
* Generates a box using lines to create a hover effect
|
|
35380
|
+
* The lines have drop shadow in their respective direction
|
|
35381
|
+
* @param parentTag - tag name
|
|
35382
|
+
* @param xBandwidth - X length
|
|
35383
|
+
* @param yBandwidth - y length
|
|
35384
|
+
*/
|
|
35385
|
+
Heatmap.prototype.createOuterBox = function (parentTag, xBandwidth, yBandwidth) {
|
|
35386
|
+
// Create a highlighter in the parent component so the shadow and the lines do not get clipped
|
|
35387
|
+
var highlight = dom_utils_DOMUtils.appendOrSelect(this.parent, parentTag)
|
|
35388
|
+
.classed('shadows', true)
|
|
35389
|
+
.classed('highlighter-hidden', true);
|
|
35390
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.top')
|
|
35391
|
+
.attr('x1', -1)
|
|
35392
|
+
.attr('x2', xBandwidth + 1);
|
|
35393
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.left')
|
|
35394
|
+
.attr('x1', 0)
|
|
35395
|
+
.attr('y1', -1)
|
|
35396
|
+
.attr('x2', 0)
|
|
35397
|
+
.attr('y2', yBandwidth + 1);
|
|
35398
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.down')
|
|
35399
|
+
.attr('x1', -1)
|
|
35400
|
+
.attr('x2', xBandwidth + 1)
|
|
35401
|
+
.attr('y1', yBandwidth)
|
|
35402
|
+
.attr('y2', yBandwidth);
|
|
35403
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.right')
|
|
35404
|
+
.attr('x1', xBandwidth)
|
|
35405
|
+
.attr('x2', xBandwidth)
|
|
35406
|
+
.attr('y1', -1)
|
|
35407
|
+
.attr('y2', yBandwidth + 1);
|
|
35408
|
+
};
|
|
35409
|
+
Heatmap.prototype.determineDividerStatus = function () {
|
|
35410
|
+
// Add dividers if status is not off, will assume auto or on by default.
|
|
35411
|
+
var dividerStatus = tools_Tools.getProperty(this.getOptions(), 'heatmap', 'divider', 'state');
|
|
35412
|
+
// Determine if cell divider should be displayed
|
|
35413
|
+
if (dividerStatus !== DividerStatus.OFF) {
|
|
35414
|
+
if ((dividerStatus === DividerStatus.AUTO &&
|
|
35415
|
+
heatmap.minCellDividerDimension <=
|
|
35416
|
+
this.xBandwidth &&
|
|
35417
|
+
heatmap.minCellDividerDimension <=
|
|
35418
|
+
this.yBandwidth) ||
|
|
35419
|
+
dividerStatus === DividerStatus.ON) {
|
|
35420
|
+
return true;
|
|
35421
|
+
}
|
|
35422
|
+
}
|
|
35423
|
+
return false;
|
|
35424
|
+
};
|
|
35425
|
+
Heatmap.prototype.addEventListener = function () {
|
|
35426
|
+
var self = this;
|
|
35427
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35428
|
+
var options = this.getOptions();
|
|
35429
|
+
var totalLabel = lodash_es_get(options, 'tooltip.totalLabel');
|
|
35430
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35431
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35432
|
+
var domainLabel = cartesianScales.getDomainLabel();
|
|
35433
|
+
var rangeLabel = cartesianScales.getRangeLabel();
|
|
35434
|
+
this.parent
|
|
35435
|
+
.selectAll('g.cell')
|
|
35436
|
+
.on('mouseover', function (event, datum) {
|
|
35437
|
+
var cell = src_select(this);
|
|
35438
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35439
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35440
|
+
// Dispatch event and tooltip only if value exists
|
|
35441
|
+
if (!nullState) {
|
|
35442
|
+
// Get transformation value of node
|
|
35443
|
+
var transform = tools_Tools.getTranformOffsets(cell.attr('transform'));
|
|
35444
|
+
src_select('g.cell-highlight')
|
|
35445
|
+
.attr('transform', "translate(" + (transform.x + self.translationUnits.x) + ", " + (transform.y + self.translationUnits.y) + ")")
|
|
35446
|
+
.classed('highlighter-hidden', false);
|
|
35447
|
+
// Dispatch mouse over event
|
|
35448
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOVER, {
|
|
35449
|
+
event: event,
|
|
35450
|
+
element: hoveredElement,
|
|
35451
|
+
datum: datum,
|
|
35452
|
+
});
|
|
35453
|
+
// Dispatch tooltip show event
|
|
35454
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35455
|
+
event: event,
|
|
35456
|
+
items: [
|
|
35457
|
+
{
|
|
35458
|
+
label: domainLabel,
|
|
35459
|
+
value: datum[domainIdentifier],
|
|
35460
|
+
},
|
|
35461
|
+
{
|
|
35462
|
+
label: rangeLabel,
|
|
35463
|
+
value: datum[rangeIdentifier],
|
|
35464
|
+
},
|
|
35465
|
+
{
|
|
35466
|
+
label: totalLabel || 'Total',
|
|
35467
|
+
value: datum['value'],
|
|
35468
|
+
color: hoveredElement.style('fill'),
|
|
35469
|
+
},
|
|
35470
|
+
],
|
|
35471
|
+
});
|
|
35472
|
+
}
|
|
35473
|
+
})
|
|
35474
|
+
.on('mousemove', function (event, datum) {
|
|
35475
|
+
// Dispatch mouse move event
|
|
35476
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEMOVE, {
|
|
35477
|
+
event: event,
|
|
35478
|
+
element: src_select(this),
|
|
35479
|
+
datum: datum,
|
|
35480
|
+
});
|
|
35481
|
+
// Dispatch tooltip move event
|
|
35482
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
35483
|
+
event: event,
|
|
35484
|
+
});
|
|
35485
|
+
})
|
|
35486
|
+
.on('click', function (event, datum) {
|
|
35487
|
+
// Dispatch mouse click event
|
|
35488
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_CLICK, {
|
|
35489
|
+
event: event,
|
|
35490
|
+
element: src_select(this),
|
|
35491
|
+
datum: datum,
|
|
35492
|
+
});
|
|
35493
|
+
})
|
|
35494
|
+
.on('mouseout', function (event, datum) {
|
|
35495
|
+
var cell = src_select(this);
|
|
35496
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35497
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35498
|
+
src_select('g.cell-highlight').classed('highlighter-hidden', true);
|
|
35499
|
+
// Dispatch event and tooltip only if value exists
|
|
35500
|
+
if (!nullState) {
|
|
35501
|
+
// Dispatch mouse out event
|
|
35502
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOUT, {
|
|
35503
|
+
event: event,
|
|
35504
|
+
element: hoveredElement,
|
|
35505
|
+
datum: datum,
|
|
35506
|
+
});
|
|
35507
|
+
// Dispatch hide tooltip event
|
|
35508
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35509
|
+
event: event,
|
|
35510
|
+
hoveredElement: hoveredElement,
|
|
35511
|
+
});
|
|
35512
|
+
}
|
|
35513
|
+
});
|
|
35514
|
+
};
|
|
35515
|
+
// Remove event listeners
|
|
35516
|
+
Heatmap.prototype.destroy = function () {
|
|
35517
|
+
this.parent
|
|
35518
|
+
.selectAll('rect.heat')
|
|
35519
|
+
.on('mouseover', null)
|
|
35520
|
+
.on('mousemove', null)
|
|
35521
|
+
.on('click', null)
|
|
35522
|
+
.on('mouseout', null);
|
|
35523
|
+
// Remove legend listeners
|
|
35524
|
+
var eventsFragment = this.services.events;
|
|
35525
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleAxisOnHover);
|
|
35526
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_MOUSEOUT, this.handleAxisMouseOut);
|
|
35527
|
+
};
|
|
35528
|
+
return Heatmap;
|
|
35529
|
+
}(component_Component));
|
|
35530
|
+
|
|
35531
|
+
//# sourceMappingURL=../../../src/components/graphs/heatmap.js.map
|
|
34651
35532
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
|
|
34652
35533
|
var spacer_extends = (undefined && undefined.__extends) || (function () {
|
|
34653
35534
|
var extendStatics = function (d, b) {
|
|
@@ -34874,187 +35755,6 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
|
|
|
34874
35755
|
}(component_Component));
|
|
34875
35756
|
|
|
34876
35757
|
//# sourceMappingURL=../../../src/components/layout/layout.js.map
|
|
34877
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
|
|
34878
|
-
/* harmony default export */ var d3_axis_src_identity = (function(x) {
|
|
34879
|
-
return x;
|
|
34880
|
-
});
|
|
34881
|
-
|
|
34882
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
|
|
34883
|
-
|
|
34884
|
-
|
|
34885
|
-
var axis_top = 1,
|
|
34886
|
-
axis_right = 2,
|
|
34887
|
-
bottom = 3,
|
|
34888
|
-
axis_left = 4,
|
|
34889
|
-
axis_epsilon = 1e-6;
|
|
34890
|
-
|
|
34891
|
-
function axis_translateX(x) {
|
|
34892
|
-
return "translate(" + x + ",0)";
|
|
34893
|
-
}
|
|
34894
|
-
|
|
34895
|
-
function axis_translateY(y) {
|
|
34896
|
-
return "translate(0," + y + ")";
|
|
34897
|
-
}
|
|
34898
|
-
|
|
34899
|
-
function axis_number(scale) {
|
|
34900
|
-
return d => +scale(d);
|
|
34901
|
-
}
|
|
34902
|
-
|
|
34903
|
-
function axis_center(scale, offset) {
|
|
34904
|
-
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
34905
|
-
if (scale.round()) offset = Math.round(offset);
|
|
34906
|
-
return d => +scale(d) + offset;
|
|
34907
|
-
}
|
|
34908
|
-
|
|
34909
|
-
function entering() {
|
|
34910
|
-
return !this.__axis;
|
|
34911
|
-
}
|
|
34912
|
-
|
|
34913
|
-
function axis_axis(orient, scale) {
|
|
34914
|
-
var tickArguments = [],
|
|
34915
|
-
tickValues = null,
|
|
34916
|
-
tickFormat = null,
|
|
34917
|
-
tickSizeInner = 6,
|
|
34918
|
-
tickSizeOuter = 6,
|
|
34919
|
-
tickPadding = 3,
|
|
34920
|
-
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
34921
|
-
k = orient === axis_top || orient === axis_left ? -1 : 1,
|
|
34922
|
-
x = orient === axis_left || orient === axis_right ? "x" : "y",
|
|
34923
|
-
transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
|
|
34924
|
-
|
|
34925
|
-
function axis(context) {
|
|
34926
|
-
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
34927
|
-
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
|
|
34928
|
-
spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
|
34929
|
-
range = scale.range(),
|
|
34930
|
-
range0 = +range[0] + offset,
|
|
34931
|
-
range1 = +range[range.length - 1] + offset,
|
|
34932
|
-
position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
|
|
34933
|
-
selection = context.selection ? context.selection() : context,
|
|
34934
|
-
path = selection.selectAll(".domain").data([null]),
|
|
34935
|
-
tick = selection.selectAll(".tick").data(values, scale).order(),
|
|
34936
|
-
tickExit = tick.exit(),
|
|
34937
|
-
tickEnter = tick.enter().append("g").attr("class", "tick"),
|
|
34938
|
-
line = tick.select("line"),
|
|
34939
|
-
text = tick.select("text");
|
|
34940
|
-
|
|
34941
|
-
path = path.merge(path.enter().insert("path", ".tick")
|
|
34942
|
-
.attr("class", "domain")
|
|
34943
|
-
.attr("stroke", "currentColor"));
|
|
34944
|
-
|
|
34945
|
-
tick = tick.merge(tickEnter);
|
|
34946
|
-
|
|
34947
|
-
line = line.merge(tickEnter.append("line")
|
|
34948
|
-
.attr("stroke", "currentColor")
|
|
34949
|
-
.attr(x + "2", k * tickSizeInner));
|
|
34950
|
-
|
|
34951
|
-
text = text.merge(tickEnter.append("text")
|
|
34952
|
-
.attr("fill", "currentColor")
|
|
34953
|
-
.attr(x, k * spacing)
|
|
34954
|
-
.attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
34955
|
-
|
|
34956
|
-
if (context !== selection) {
|
|
34957
|
-
path = path.transition(context);
|
|
34958
|
-
tick = tick.transition(context);
|
|
34959
|
-
line = line.transition(context);
|
|
34960
|
-
text = text.transition(context);
|
|
34961
|
-
|
|
34962
|
-
tickExit = tickExit.transition(context)
|
|
34963
|
-
.attr("opacity", axis_epsilon)
|
|
34964
|
-
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
|
|
34965
|
-
|
|
34966
|
-
tickEnter
|
|
34967
|
-
.attr("opacity", axis_epsilon)
|
|
34968
|
-
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
|
|
34969
|
-
}
|
|
34970
|
-
|
|
34971
|
-
tickExit.remove();
|
|
34972
|
-
|
|
34973
|
-
path
|
|
34974
|
-
.attr("d", orient === axis_left || orient === axis_right
|
|
34975
|
-
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
34976
|
-
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
34977
|
-
|
|
34978
|
-
tick
|
|
34979
|
-
.attr("opacity", 1)
|
|
34980
|
-
.attr("transform", function(d) { return transform(position(d) + offset); });
|
|
34981
|
-
|
|
34982
|
-
line
|
|
34983
|
-
.attr(x + "2", k * tickSizeInner);
|
|
34984
|
-
|
|
34985
|
-
text
|
|
34986
|
-
.attr(x, k * spacing)
|
|
34987
|
-
.text(format);
|
|
34988
|
-
|
|
34989
|
-
selection.filter(entering)
|
|
34990
|
-
.attr("fill", "none")
|
|
34991
|
-
.attr("font-size", 10)
|
|
34992
|
-
.attr("font-family", "sans-serif")
|
|
34993
|
-
.attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
|
34994
|
-
|
|
34995
|
-
selection
|
|
34996
|
-
.each(function() { this.__axis = position; });
|
|
34997
|
-
}
|
|
34998
|
-
|
|
34999
|
-
axis.scale = function(_) {
|
|
35000
|
-
return arguments.length ? (scale = _, axis) : scale;
|
|
35001
|
-
};
|
|
35002
|
-
|
|
35003
|
-
axis.ticks = function() {
|
|
35004
|
-
return tickArguments = Array.from(arguments), axis;
|
|
35005
|
-
};
|
|
35006
|
-
|
|
35007
|
-
axis.tickArguments = function(_) {
|
|
35008
|
-
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
|
|
35009
|
-
};
|
|
35010
|
-
|
|
35011
|
-
axis.tickValues = function(_) {
|
|
35012
|
-
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
|
|
35013
|
-
};
|
|
35014
|
-
|
|
35015
|
-
axis.tickFormat = function(_) {
|
|
35016
|
-
return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
|
35017
|
-
};
|
|
35018
|
-
|
|
35019
|
-
axis.tickSize = function(_) {
|
|
35020
|
-
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
|
35021
|
-
};
|
|
35022
|
-
|
|
35023
|
-
axis.tickSizeInner = function(_) {
|
|
35024
|
-
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
|
35025
|
-
};
|
|
35026
|
-
|
|
35027
|
-
axis.tickSizeOuter = function(_) {
|
|
35028
|
-
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
|
35029
|
-
};
|
|
35030
|
-
|
|
35031
|
-
axis.tickPadding = function(_) {
|
|
35032
|
-
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
|
35033
|
-
};
|
|
35034
|
-
|
|
35035
|
-
axis.offset = function(_) {
|
|
35036
|
-
return arguments.length ? (offset = +_, axis) : offset;
|
|
35037
|
-
};
|
|
35038
|
-
|
|
35039
|
-
return axis;
|
|
35040
|
-
}
|
|
35041
|
-
|
|
35042
|
-
function axisTop(scale) {
|
|
35043
|
-
return axis_axis(axis_top, scale);
|
|
35044
|
-
}
|
|
35045
|
-
|
|
35046
|
-
function axisRight(scale) {
|
|
35047
|
-
return axis_axis(axis_right, scale);
|
|
35048
|
-
}
|
|
35049
|
-
|
|
35050
|
-
function axisBottom(scale) {
|
|
35051
|
-
return axis_axis(bottom, scale);
|
|
35052
|
-
}
|
|
35053
|
-
|
|
35054
|
-
function axisLeft(scale) {
|
|
35055
|
-
return axis_axis(axis_left, scale);
|
|
35056
|
-
}
|
|
35057
|
-
|
|
35058
35758
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/axis.js
|
|
35059
35759
|
var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
35060
35760
|
var extendStatics = function (d, b) {
|
|
@@ -35083,9 +35783,16 @@ var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
|
35083
35783
|
var axis_Axis = /** @class */ (function (_super) {
|
|
35084
35784
|
axis_extends(Axis, _super);
|
|
35085
35785
|
function Axis(model, services, configs) {
|
|
35786
|
+
var _a;
|
|
35086
35787
|
var _this = _super.call(this, model, services, configs) || this;
|
|
35087
35788
|
_this.type = 'axes';
|
|
35088
35789
|
_this.renderType = RenderTypes.SVG;
|
|
35790
|
+
_this.truncation = (_a = {},
|
|
35791
|
+
_a[AxisPositions.LEFT] = false,
|
|
35792
|
+
_a[AxisPositions.RIGHT] = false,
|
|
35793
|
+
_a[AxisPositions.TOP] = false,
|
|
35794
|
+
_a[AxisPositions.BOTTOM] = false,
|
|
35795
|
+
_a);
|
|
35089
35796
|
if (configs) {
|
|
35090
35797
|
_this.configs = configs;
|
|
35091
35798
|
}
|
|
@@ -35513,11 +36220,13 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35513
36220
|
.select("g.axis." + axisPosition + " g.ticks g.tick")
|
|
35514
36221
|
.html();
|
|
35515
36222
|
container.selectAll('g.ticks g.tick').html(tick_html);
|
|
36223
|
+
var self_1 = this;
|
|
35516
36224
|
container
|
|
35517
36225
|
.selectAll('g.tick text')
|
|
35518
36226
|
.data(axisTickLabels)
|
|
35519
36227
|
.text(function (d) {
|
|
35520
36228
|
if (d.length > truncationThreshold) {
|
|
36229
|
+
self_1.truncation[axisPosition] = true;
|
|
35521
36230
|
return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
|
|
35522
36231
|
}
|
|
35523
36232
|
else {
|
|
@@ -35552,8 +36261,6 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35552
36261
|
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
35553
36262
|
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
35554
36263
|
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
35555
|
-
var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
|
|
35556
|
-
axisOptions.scaleType === ScaleTypes.TIME;
|
|
35557
36264
|
var self = this;
|
|
35558
36265
|
container
|
|
35559
36266
|
.selectAll('g.tick text')
|
|
@@ -35634,6 +36341,242 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35634
36341
|
}(component_Component));
|
|
35635
36342
|
|
|
35636
36343
|
//# sourceMappingURL=../../../src/components/axes/axis.js.map
|
|
36344
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/hover-axis.js
|
|
36345
|
+
var hover_axis_extends = (undefined && undefined.__extends) || (function () {
|
|
36346
|
+
var extendStatics = function (d, b) {
|
|
36347
|
+
extendStatics = Object.setPrototypeOf ||
|
|
36348
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
36349
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
36350
|
+
return extendStatics(d, b);
|
|
36351
|
+
};
|
|
36352
|
+
return function (d, b) {
|
|
36353
|
+
extendStatics(d, b);
|
|
36354
|
+
function __() { this.constructor = d; }
|
|
36355
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
36356
|
+
};
|
|
36357
|
+
})();
|
|
36358
|
+
var hover_axis_assign = (undefined && undefined.__assign) || function () {
|
|
36359
|
+
hover_axis_assign = Object.assign || function(t) {
|
|
36360
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
36361
|
+
s = arguments[i];
|
|
36362
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
36363
|
+
t[p] = s[p];
|
|
36364
|
+
}
|
|
36365
|
+
return t;
|
|
36366
|
+
};
|
|
36367
|
+
return hover_axis_assign.apply(this, arguments);
|
|
36368
|
+
};
|
|
36369
|
+
// Internal Imports
|
|
36370
|
+
|
|
36371
|
+
|
|
36372
|
+
|
|
36373
|
+
|
|
36374
|
+
|
|
36375
|
+
// D3 Imports
|
|
36376
|
+
|
|
36377
|
+
var hover_axis_HoverAxis = /** @class */ (function (_super) {
|
|
36378
|
+
hover_axis_extends(HoverAxis, _super);
|
|
36379
|
+
function HoverAxis(model, services, configs) {
|
|
36380
|
+
return _super.call(this, model, services, configs) || this;
|
|
36381
|
+
}
|
|
36382
|
+
HoverAxis.prototype.render = function (animate) {
|
|
36383
|
+
if (animate === void 0) { animate = true; }
|
|
36384
|
+
_super.prototype.render.call(this, animate);
|
|
36385
|
+
// Remove existing event listeners to avoid flashing behavior
|
|
36386
|
+
_super.prototype.destroy.call(this);
|
|
36387
|
+
var axisPosition = this.configs.position;
|
|
36388
|
+
var svg = this.getComponentContainer();
|
|
36389
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36390
|
+
var self = this;
|
|
36391
|
+
container.selectAll('g.tick').each(function (_, index) {
|
|
36392
|
+
var g = src_select(this);
|
|
36393
|
+
g.classed('tick-hover', true).attr('tabindex', index === 0 ? 0 : -1);
|
|
36394
|
+
var textNode = g.select('text');
|
|
36395
|
+
var _a = dom_utils_DOMUtils.getSVGElementSize(textNode, {
|
|
36396
|
+
useBBox: true,
|
|
36397
|
+
}), width = _a.width, height = _a.height;
|
|
36398
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(g, 'rect.axis-holder');
|
|
36399
|
+
var x = 0, y = 0;
|
|
36400
|
+
// Depending on axis position, apply correct translation & rotation to align the rect
|
|
36401
|
+
// with the text
|
|
36402
|
+
switch (axisPosition) {
|
|
36403
|
+
case AxisPositions.LEFT:
|
|
36404
|
+
x = -width + Number(textNode.attr('x'));
|
|
36405
|
+
y = -(height / 2);
|
|
36406
|
+
break;
|
|
36407
|
+
case AxisPositions.RIGHT:
|
|
36408
|
+
x = Math.abs(Number(textNode.attr('x')));
|
|
36409
|
+
y = -(height / 2);
|
|
36410
|
+
break;
|
|
36411
|
+
case AxisPositions.TOP:
|
|
36412
|
+
x = -(width / 2);
|
|
36413
|
+
y = -height + Number(textNode.attr('y')) / 2;
|
|
36414
|
+
if (self.truncation[axisPosition]) {
|
|
36415
|
+
x = 0;
|
|
36416
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36417
|
+
}
|
|
36418
|
+
break;
|
|
36419
|
+
case AxisPositions.BOTTOM:
|
|
36420
|
+
x = -(width / 2);
|
|
36421
|
+
y = height / 2 - 2;
|
|
36422
|
+
if (self.truncation[axisPosition]) {
|
|
36423
|
+
x = -width;
|
|
36424
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36425
|
+
}
|
|
36426
|
+
break;
|
|
36427
|
+
}
|
|
36428
|
+
// Translates x position -4 left to keep center after padding
|
|
36429
|
+
// Adds padding on left & right
|
|
36430
|
+
rectangle
|
|
36431
|
+
.attr('x', x - configuration_non_customizable_axis.hover.rectanglePadding)
|
|
36432
|
+
.attr('y', y)
|
|
36433
|
+
.attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
|
|
36434
|
+
.attr('height', height)
|
|
36435
|
+
.lower();
|
|
36436
|
+
// Add keyboard event listeners to each group element
|
|
36437
|
+
g.on('keydown', function (event) {
|
|
36438
|
+
// Choose specific arrow key depending on the axis
|
|
36439
|
+
if (axisPosition === AxisPositions.LEFT ||
|
|
36440
|
+
axisPosition === AxisPositions.RIGHT) {
|
|
36441
|
+
if (event.key && event.key === 'ArrowUp') {
|
|
36442
|
+
self.goNext(this, event);
|
|
36443
|
+
}
|
|
36444
|
+
else if (event.key && event.key === 'ArrowDown') {
|
|
36445
|
+
self.goPrevious(this, event);
|
|
36446
|
+
}
|
|
36447
|
+
}
|
|
36448
|
+
else {
|
|
36449
|
+
if (event.key && event.key === 'ArrowLeft') {
|
|
36450
|
+
self.goPrevious(this, event);
|
|
36451
|
+
}
|
|
36452
|
+
else if (event.key && event.key === 'ArrowRight') {
|
|
36453
|
+
self.goNext(this, event);
|
|
36454
|
+
}
|
|
36455
|
+
}
|
|
36456
|
+
});
|
|
36457
|
+
});
|
|
36458
|
+
// Add event listeners to element group
|
|
36459
|
+
this.addEventListeners();
|
|
36460
|
+
};
|
|
36461
|
+
HoverAxis.prototype.addEventListeners = function () {
|
|
36462
|
+
var svg = this.getComponentContainer();
|
|
36463
|
+
var axisPosition = this.configs.position;
|
|
36464
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36465
|
+
var options = this.getOptions();
|
|
36466
|
+
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
36467
|
+
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
36468
|
+
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
36469
|
+
var self = this;
|
|
36470
|
+
container
|
|
36471
|
+
.selectAll('g.tick.tick-hover')
|
|
36472
|
+
.on('mouseover', function (event) {
|
|
36473
|
+
var hoveredElement = src_select(this).select('text');
|
|
36474
|
+
var datum = hoveredElement.datum();
|
|
36475
|
+
// Dispatch mouse event
|
|
36476
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
|
|
36477
|
+
event: event,
|
|
36478
|
+
element: hoveredElement,
|
|
36479
|
+
datum: datum,
|
|
36480
|
+
});
|
|
36481
|
+
if (axisScaleType === ScaleTypes.LABELS &&
|
|
36482
|
+
datum.length > truncationThreshold) {
|
|
36483
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
36484
|
+
event: event,
|
|
36485
|
+
element: hoveredElement,
|
|
36486
|
+
datum: datum,
|
|
36487
|
+
});
|
|
36488
|
+
}
|
|
36489
|
+
})
|
|
36490
|
+
.on('mousemove', function (event) {
|
|
36491
|
+
var hoveredElement = src_select(this).select('text');
|
|
36492
|
+
var datum = hoveredElement.datum();
|
|
36493
|
+
// Dispatch mouse event
|
|
36494
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
|
|
36495
|
+
event: event,
|
|
36496
|
+
element: hoveredElement,
|
|
36497
|
+
datum: datum,
|
|
36498
|
+
});
|
|
36499
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
36500
|
+
event: event,
|
|
36501
|
+
});
|
|
36502
|
+
})
|
|
36503
|
+
.on('click', function (event) {
|
|
36504
|
+
// Dispatch mouse event
|
|
36505
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
|
|
36506
|
+
event: event,
|
|
36507
|
+
element: src_select(this).select('text'),
|
|
36508
|
+
datum: src_select(this).select('text').datum(),
|
|
36509
|
+
});
|
|
36510
|
+
})
|
|
36511
|
+
.on('mouseout', function (event) {
|
|
36512
|
+
// Dispatch mouse event
|
|
36513
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
|
|
36514
|
+
event: event,
|
|
36515
|
+
element: src_select(this).select('text'),
|
|
36516
|
+
datum: src_select(this).select('text').datum(),
|
|
36517
|
+
});
|
|
36518
|
+
if (axisScaleType === ScaleTypes.LABELS) {
|
|
36519
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE);
|
|
36520
|
+
}
|
|
36521
|
+
})
|
|
36522
|
+
.on('focus', function (event) {
|
|
36523
|
+
var coordinates = { clientX: 0, clientY: 0 };
|
|
36524
|
+
if (event.target) {
|
|
36525
|
+
// Focus element since we are using arrow keys
|
|
36526
|
+
event.target.focus();
|
|
36527
|
+
var boundingRect = event.target.getBoundingClientRect();
|
|
36528
|
+
coordinates.clientX = boundingRect.x;
|
|
36529
|
+
coordinates.clientY = boundingRect.y;
|
|
36530
|
+
}
|
|
36531
|
+
// Dispatch focus event
|
|
36532
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_FOCUS, {
|
|
36533
|
+
event: hover_axis_assign(hover_axis_assign({}, event), coordinates),
|
|
36534
|
+
element: src_select(this),
|
|
36535
|
+
datum: src_select(this).select('text').datum(),
|
|
36536
|
+
});
|
|
36537
|
+
})
|
|
36538
|
+
.on('blur', function (event) {
|
|
36539
|
+
// Dispatch blur event
|
|
36540
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
|
|
36541
|
+
event: event,
|
|
36542
|
+
element: src_select(this),
|
|
36543
|
+
datum: src_select(this).select('text').datum(),
|
|
36544
|
+
});
|
|
36545
|
+
});
|
|
36546
|
+
};
|
|
36547
|
+
// Focus on the next HTML element sibling
|
|
36548
|
+
HoverAxis.prototype.goNext = function (element, event) {
|
|
36549
|
+
if (element.nextElementSibling &&
|
|
36550
|
+
element.nextElementSibling.tagName !== 'path') {
|
|
36551
|
+
element.nextElementSibling.dispatchEvent(new Event('focus'));
|
|
36552
|
+
}
|
|
36553
|
+
event.preventDefault();
|
|
36554
|
+
};
|
|
36555
|
+
// Focus on the previous HTML element sibling
|
|
36556
|
+
HoverAxis.prototype.goPrevious = function (element, event) {
|
|
36557
|
+
if (element.previousElementSibling &&
|
|
36558
|
+
element.previousElementSibling.tagName !== 'path') {
|
|
36559
|
+
element.previousElementSibling.dispatchEvent(new Event('focus'));
|
|
36560
|
+
}
|
|
36561
|
+
event.preventDefault();
|
|
36562
|
+
};
|
|
36563
|
+
HoverAxis.prototype.destroy = function () {
|
|
36564
|
+
var svg = this.getComponentContainer();
|
|
36565
|
+
var axisPosition = this.configs.position;
|
|
36566
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36567
|
+
// Remove event listeners
|
|
36568
|
+
container
|
|
36569
|
+
.selectAll('g.tick.tick-hover')
|
|
36570
|
+
.on('mouseover', null)
|
|
36571
|
+
.on('mousemove', null)
|
|
36572
|
+
.on('mouseout', null)
|
|
36573
|
+
.on('focus', null)
|
|
36574
|
+
.on('blur', null);
|
|
36575
|
+
};
|
|
36576
|
+
return HoverAxis;
|
|
36577
|
+
}(axis_Axis));
|
|
36578
|
+
|
|
36579
|
+
//# sourceMappingURL=../../../src/components/axes/hover-axis.js.map
|
|
35637
36580
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/two-dimensional-axes.js
|
|
35638
36581
|
var two_dimensional_axes_extends = (undefined && undefined.__extends) || (function () {
|
|
35639
36582
|
var extendStatics = function (d, b) {
|
|
@@ -35655,6 +36598,7 @@ var two_dimensional_axes_extends = (undefined && undefined.__extends) || (functi
|
|
|
35655
36598
|
|
|
35656
36599
|
|
|
35657
36600
|
|
|
36601
|
+
|
|
35658
36602
|
var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
35659
36603
|
two_dimensional_axes_extends(TwoDimensionalAxes, _super);
|
|
35660
36604
|
function TwoDimensionalAxes() {
|
|
@@ -35689,11 +36633,14 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35689
36633
|
var axisPosition = AxisPositions[axisPositionKey];
|
|
35690
36634
|
if (_this.configs.axes[axisPosition] &&
|
|
35691
36635
|
!_this.children[axisPosition]) {
|
|
35692
|
-
var
|
|
36636
|
+
var configs = {
|
|
35693
36637
|
position: axisPosition,
|
|
35694
36638
|
axes: _this.configs.axes,
|
|
35695
36639
|
margins: _this.margins,
|
|
35696
|
-
}
|
|
36640
|
+
};
|
|
36641
|
+
var axisComponent = _this.model.axisFlavor === AxisFlavor.DEFAULT
|
|
36642
|
+
? new axis_Axis(_this.model, _this.services, configs)
|
|
36643
|
+
: new hover_axis_HoverAxis(_this.model, _this.services, configs);
|
|
35697
36644
|
// Set model, services & parent for the new axis component
|
|
35698
36645
|
axisComponent.setModel(_this.model);
|
|
35699
36646
|
axisComponent.setServices(_this.services);
|
|
@@ -35744,6 +36691,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35744
36691
|
break;
|
|
35745
36692
|
}
|
|
35746
36693
|
});
|
|
36694
|
+
this.services.events.dispatchEvent(Events.Axis.RENDER_COMPLETE);
|
|
35747
36695
|
// If the new margins are different than the existing ones
|
|
35748
36696
|
var isNotEqual = Object.keys(margins).some(function (marginKey) {
|
|
35749
36697
|
return _this.margins[marginKey] !== margins[marginKey];
|
|
@@ -39787,6 +40735,7 @@ var tee = {
|
|
|
39787
40735
|
|
|
39788
40736
|
|
|
39789
40737
|
|
|
40738
|
+
|
|
39790
40739
|
// GRAPHS
|
|
39791
40740
|
|
|
39792
40741
|
|
|
@@ -39810,6 +40759,7 @@ var tee = {
|
|
|
39810
40759
|
|
|
39811
40760
|
|
|
39812
40761
|
|
|
40762
|
+
|
|
39813
40763
|
|
|
39814
40764
|
|
|
39815
40765
|
// Layout
|
|
@@ -40063,7 +41013,9 @@ var cartesian_charts_spreadArrays = (undefined && undefined.__spreadArrays) || f
|
|
|
40063
41013
|
var cartesian_charts_ChartModelCartesian = /** @class */ (function (_super) {
|
|
40064
41014
|
cartesian_charts_extends(ChartModelCartesian, _super);
|
|
40065
41015
|
function ChartModelCartesian(services) {
|
|
40066
|
-
|
|
41016
|
+
var _this = _super.call(this, services) || this;
|
|
41017
|
+
_this.axisFlavor = AxisFlavor.DEFAULT;
|
|
41018
|
+
return _this;
|
|
40067
41019
|
}
|
|
40068
41020
|
// get the scales information
|
|
40069
41021
|
// needed for getTabularArray()
|
|
@@ -42991,6 +43943,493 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
42991
43943
|
}(chart_Chart));
|
|
42992
43944
|
|
|
42993
43945
|
//# sourceMappingURL=../../src/charts/alluvial.js.map
|
|
43946
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-scale/src/quantize.js
|
|
43947
|
+
|
|
43948
|
+
|
|
43949
|
+
|
|
43950
|
+
|
|
43951
|
+
function quantize_quantize() {
|
|
43952
|
+
var x0 = 0,
|
|
43953
|
+
x1 = 1,
|
|
43954
|
+
n = 1,
|
|
43955
|
+
domain = [0.5],
|
|
43956
|
+
range = [0, 1],
|
|
43957
|
+
unknown;
|
|
43958
|
+
|
|
43959
|
+
function scale(x) {
|
|
43960
|
+
return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
|
43961
|
+
}
|
|
43962
|
+
|
|
43963
|
+
function rescale() {
|
|
43964
|
+
var i = -1;
|
|
43965
|
+
domain = new Array(n);
|
|
43966
|
+
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
|
43967
|
+
return scale;
|
|
43968
|
+
}
|
|
43969
|
+
|
|
43970
|
+
scale.domain = function(_) {
|
|
43971
|
+
return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
|
|
43972
|
+
};
|
|
43973
|
+
|
|
43974
|
+
scale.range = function(_) {
|
|
43975
|
+
return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
|
|
43976
|
+
};
|
|
43977
|
+
|
|
43978
|
+
scale.invertExtent = function(y) {
|
|
43979
|
+
var i = range.indexOf(y);
|
|
43980
|
+
return i < 0 ? [NaN, NaN]
|
|
43981
|
+
: i < 1 ? [x0, domain[0]]
|
|
43982
|
+
: i >= n ? [domain[n - 1], x1]
|
|
43983
|
+
: [domain[i - 1], domain[i]];
|
|
43984
|
+
};
|
|
43985
|
+
|
|
43986
|
+
scale.unknown = function(_) {
|
|
43987
|
+
return arguments.length ? (unknown = _, scale) : scale;
|
|
43988
|
+
};
|
|
43989
|
+
|
|
43990
|
+
scale.thresholds = function() {
|
|
43991
|
+
return domain.slice();
|
|
43992
|
+
};
|
|
43993
|
+
|
|
43994
|
+
scale.copy = function() {
|
|
43995
|
+
return quantize_quantize()
|
|
43996
|
+
.domain([x0, x1])
|
|
43997
|
+
.range(range)
|
|
43998
|
+
.unknown(unknown);
|
|
43999
|
+
};
|
|
44000
|
+
|
|
44001
|
+
return initRange.apply(linearish(scale), arguments);
|
|
44002
|
+
}
|
|
44003
|
+
|
|
44004
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/model/heatmap.js
|
|
44005
|
+
var model_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44006
|
+
var extendStatics = function (d, b) {
|
|
44007
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44008
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44009
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44010
|
+
return extendStatics(d, b);
|
|
44011
|
+
};
|
|
44012
|
+
return function (d, b) {
|
|
44013
|
+
extendStatics(d, b);
|
|
44014
|
+
function __() { this.constructor = d; }
|
|
44015
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44016
|
+
};
|
|
44017
|
+
})();
|
|
44018
|
+
var heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44019
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44020
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44021
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44022
|
+
r[k] = a[j];
|
|
44023
|
+
return r;
|
|
44024
|
+
};
|
|
44025
|
+
// Internal Imports
|
|
44026
|
+
|
|
44027
|
+
|
|
44028
|
+
|
|
44029
|
+
// d3 imports
|
|
44030
|
+
|
|
44031
|
+
|
|
44032
|
+
/** The gauge chart model layer */
|
|
44033
|
+
var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
44034
|
+
model_heatmap_extends(HeatmapModel, _super);
|
|
44035
|
+
function HeatmapModel(services) {
|
|
44036
|
+
var _this = _super.call(this, services) || this;
|
|
44037
|
+
_this.axisFlavor = AxisFlavor.HOVERABLE;
|
|
44038
|
+
_this._colorScale = undefined;
|
|
44039
|
+
// List of unique ranges and domains
|
|
44040
|
+
_this._domains = [];
|
|
44041
|
+
_this._ranges = [];
|
|
44042
|
+
_this._matrix = {};
|
|
44043
|
+
// Check which scale types are being used
|
|
44044
|
+
var axis = tools_Tools.getProperty(_this.getOptions(), 'axes');
|
|
44045
|
+
// Need to check options since scale service hasn't been instantiated
|
|
44046
|
+
if ((!!tools_Tools.getProperty(axis, 'left', 'scaleType') &&
|
|
44047
|
+
tools_Tools.getProperty(axis, 'left', 'scaleType') !==
|
|
44048
|
+
ScaleTypes.LABELS) ||
|
|
44049
|
+
(!!tools_Tools.getProperty(axis, 'right', 'scaleType') &&
|
|
44050
|
+
tools_Tools.getProperty(axis, 'right', 'scaleType') !==
|
|
44051
|
+
ScaleTypes.LABELS) ||
|
|
44052
|
+
(!!tools_Tools.getProperty(axis, 'top', 'scaleType') &&
|
|
44053
|
+
tools_Tools.getProperty(axis, 'top', 'scaleType') !==
|
|
44054
|
+
ScaleTypes.LABELS) ||
|
|
44055
|
+
(!!tools_Tools.getProperty(axis, 'bottom', 'scaleType') &&
|
|
44056
|
+
tools_Tools.getProperty(axis, 'bottom', 'scaleType') !==
|
|
44057
|
+
ScaleTypes.LABELS)) {
|
|
44058
|
+
throw Error('Heatmap only supports label scaletypes.');
|
|
44059
|
+
}
|
|
44060
|
+
return _this;
|
|
44061
|
+
}
|
|
44062
|
+
/**
|
|
44063
|
+
* Get min and maximum value of the display data
|
|
44064
|
+
* @returns Array consisting of smallest and largest values in data
|
|
44065
|
+
*/
|
|
44066
|
+
HeatmapModel.prototype.getValueDomain = function () {
|
|
44067
|
+
var data = this.getDisplayData().map(function (element) { return element.value; });
|
|
44068
|
+
var limits = src_extent(data);
|
|
44069
|
+
var domain = [];
|
|
44070
|
+
// Round extent values to the nearest multiple of 10
|
|
44071
|
+
// Axis rounds values to multiples of 2, 5, and 10s.
|
|
44072
|
+
limits.forEach(function (number, index) {
|
|
44073
|
+
var value = Number(number);
|
|
44074
|
+
if (index === 0 && value >= 0) {
|
|
44075
|
+
value = 0;
|
|
44076
|
+
}
|
|
44077
|
+
else if (value % 10 === 0 || value === 0) {
|
|
44078
|
+
value;
|
|
44079
|
+
}
|
|
44080
|
+
else if (value < 0) {
|
|
44081
|
+
value = Math.floor(value / 10) * 10;
|
|
44082
|
+
}
|
|
44083
|
+
else {
|
|
44084
|
+
value = Math.ceil(value / 10) * 10;
|
|
44085
|
+
}
|
|
44086
|
+
domain.push(value);
|
|
44087
|
+
});
|
|
44088
|
+
// Ensure the median of the range is 0
|
|
44089
|
+
if (domain[0] < 0 && domain[1] > 0) {
|
|
44090
|
+
if (Math.abs(domain[0]) > domain[1]) {
|
|
44091
|
+
domain[1] = Math.abs(domain[0]);
|
|
44092
|
+
}
|
|
44093
|
+
else {
|
|
44094
|
+
domain[0] = -domain[1];
|
|
44095
|
+
}
|
|
44096
|
+
}
|
|
44097
|
+
return domain;
|
|
44098
|
+
};
|
|
44099
|
+
/**
|
|
44100
|
+
* @override
|
|
44101
|
+
* @param value
|
|
44102
|
+
* @returns
|
|
44103
|
+
*/
|
|
44104
|
+
HeatmapModel.prototype.getFillColor = function (value) {
|
|
44105
|
+
return this._colorScale(value);
|
|
44106
|
+
};
|
|
44107
|
+
/**
|
|
44108
|
+
* Generate a list of all unique domains
|
|
44109
|
+
* @returns String[]
|
|
44110
|
+
*/
|
|
44111
|
+
HeatmapModel.prototype.getUniqueDomain = function () {
|
|
44112
|
+
if (tools_Tools.isEmpty(this._domains)) {
|
|
44113
|
+
var displayData = this.getDisplayData();
|
|
44114
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44115
|
+
var domainIdentifier_1 = cartesianScales.getDomainIdentifier();
|
|
44116
|
+
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
44117
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainXAxisPosition);
|
|
44118
|
+
// Use user defined domain if specified
|
|
44119
|
+
if (!!customDomain) {
|
|
44120
|
+
return customDomain;
|
|
44121
|
+
}
|
|
44122
|
+
// Get unique axis values & create a matrix
|
|
44123
|
+
this._domains = Array.from(new Set(displayData.map(function (d) {
|
|
44124
|
+
return d[domainIdentifier_1];
|
|
44125
|
+
})));
|
|
44126
|
+
}
|
|
44127
|
+
return this._domains;
|
|
44128
|
+
};
|
|
44129
|
+
/**
|
|
44130
|
+
* Generates a list of all unique ranges
|
|
44131
|
+
* @returns String[]
|
|
44132
|
+
*/
|
|
44133
|
+
HeatmapModel.prototype.getUniqueRanges = function () {
|
|
44134
|
+
if (tools_Tools.isEmpty(this._ranges)) {
|
|
44135
|
+
var displayData = this.getDisplayData();
|
|
44136
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44137
|
+
var rangeIdentifier_1 = cartesianScales.getRangeIdentifier();
|
|
44138
|
+
var mainYAxisPosition = cartesianScales.getMainYAxisPosition();
|
|
44139
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainYAxisPosition);
|
|
44140
|
+
// Use user defined domain if specified
|
|
44141
|
+
if (!!customDomain) {
|
|
44142
|
+
return customDomain;
|
|
44143
|
+
}
|
|
44144
|
+
// Get unique axis values & create a matrix
|
|
44145
|
+
this._ranges = Array.from(new Set(displayData.map(function (d) {
|
|
44146
|
+
return d[rangeIdentifier_1];
|
|
44147
|
+
})));
|
|
44148
|
+
}
|
|
44149
|
+
return this._ranges;
|
|
44150
|
+
};
|
|
44151
|
+
/**
|
|
44152
|
+
* Generates a matrix (If doesn't exist) and returns it
|
|
44153
|
+
* @returns Object
|
|
44154
|
+
*/
|
|
44155
|
+
HeatmapModel.prototype.getMatrix = function () {
|
|
44156
|
+
var _this = this;
|
|
44157
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44158
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44159
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44160
|
+
var domainIdentifier_2 = this.services.cartesianScales.getDomainIdentifier();
|
|
44161
|
+
var rangeIdentifier_2 = this.services.cartesianScales.getRangeIdentifier();
|
|
44162
|
+
// Create a column
|
|
44163
|
+
var range_1 = {};
|
|
44164
|
+
uniqueRange.forEach(function (ran) {
|
|
44165
|
+
// Initialize matrix to empty state
|
|
44166
|
+
range_1[ran] = {
|
|
44167
|
+
value: null,
|
|
44168
|
+
index: -1,
|
|
44169
|
+
};
|
|
44170
|
+
});
|
|
44171
|
+
// Complete the matrix by cloning the column to all domains
|
|
44172
|
+
uniqueDomain.forEach(function (dom) {
|
|
44173
|
+
_this._matrix[dom] = tools_Tools.clone(range_1);
|
|
44174
|
+
});
|
|
44175
|
+
// Fill in user passed data
|
|
44176
|
+
this.getDisplayData().forEach(function (d, i) {
|
|
44177
|
+
_this._matrix[d[domainIdentifier_2]][d[rangeIdentifier_2]] = {
|
|
44178
|
+
value: d['value'],
|
|
44179
|
+
index: i,
|
|
44180
|
+
};
|
|
44181
|
+
});
|
|
44182
|
+
}
|
|
44183
|
+
return this._matrix;
|
|
44184
|
+
};
|
|
44185
|
+
/**
|
|
44186
|
+
*
|
|
44187
|
+
* @param newData The new raw data to be set
|
|
44188
|
+
*/
|
|
44189
|
+
HeatmapModel.prototype.setData = function (newData) {
|
|
44190
|
+
var sanitizedData = this.sanitize(tools_Tools.clone(newData));
|
|
44191
|
+
var dataGroups = this.generateDataGroups(sanitizedData);
|
|
44192
|
+
this.set({
|
|
44193
|
+
data: sanitizedData,
|
|
44194
|
+
dataGroups: dataGroups,
|
|
44195
|
+
});
|
|
44196
|
+
// Set attributes to empty
|
|
44197
|
+
this._domains = [];
|
|
44198
|
+
this._ranges = [];
|
|
44199
|
+
this._matrix = {};
|
|
44200
|
+
return sanitizedData;
|
|
44201
|
+
};
|
|
44202
|
+
/**
|
|
44203
|
+
* Converts Object matrix into a single array
|
|
44204
|
+
* @returns Object[]
|
|
44205
|
+
*/
|
|
44206
|
+
HeatmapModel.prototype.getMatrixAsArray = function () {
|
|
44207
|
+
var _this = this;
|
|
44208
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44209
|
+
this.getMatrix();
|
|
44210
|
+
}
|
|
44211
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44212
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44213
|
+
var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
|
|
44214
|
+
var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
|
|
44215
|
+
var arr = [];
|
|
44216
|
+
uniqueDomain.forEach(function (domain) {
|
|
44217
|
+
uniqueRange.forEach(function (range) {
|
|
44218
|
+
var element = {
|
|
44219
|
+
value: _this._matrix[domain][range].value,
|
|
44220
|
+
index: _this._matrix[domain][range].index,
|
|
44221
|
+
};
|
|
44222
|
+
element[domainIdentifier] = domain;
|
|
44223
|
+
element[rangeIdentifier] = range;
|
|
44224
|
+
arr.push(element);
|
|
44225
|
+
});
|
|
44226
|
+
});
|
|
44227
|
+
return arr;
|
|
44228
|
+
};
|
|
44229
|
+
/**
|
|
44230
|
+
* Generate tabular data from display data
|
|
44231
|
+
* @returns Array<Object>
|
|
44232
|
+
*/
|
|
44233
|
+
HeatmapModel.prototype.getTabularDataArray = function () {
|
|
44234
|
+
var displayData = this.getDisplayData();
|
|
44235
|
+
var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
|
|
44236
|
+
var domainValueFormatter;
|
|
44237
|
+
var result = heatmap_spreadArrays([
|
|
44238
|
+
[primaryDomain.label, primaryRange.label, 'Value']
|
|
44239
|
+
], displayData.map(function (datum) { return [
|
|
44240
|
+
datum[primaryDomain.identifier] === null
|
|
44241
|
+
? '–'
|
|
44242
|
+
: domainValueFormatter
|
|
44243
|
+
? domainValueFormatter(datum[primaryDomain.identifier])
|
|
44244
|
+
: datum[primaryDomain.identifier],
|
|
44245
|
+
datum[primaryRange.identifier] === null
|
|
44246
|
+
? '–'
|
|
44247
|
+
: datum[primaryRange.identifier].toLocaleString(),
|
|
44248
|
+
datum['value'],
|
|
44249
|
+
]; }));
|
|
44250
|
+
return result;
|
|
44251
|
+
};
|
|
44252
|
+
// Uses quantize scale to return class names
|
|
44253
|
+
HeatmapModel.prototype.getColorClassName = function (configs) {
|
|
44254
|
+
return configs.originalClassName + " " + this._colorScale(configs.value);
|
|
44255
|
+
};
|
|
44256
|
+
HeatmapModel.prototype.setColorClassNames = function () {
|
|
44257
|
+
var options = this.getOptions();
|
|
44258
|
+
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
44259
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
44260
|
+
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
44261
|
+
// If domain consists of negative and positive values, use diverging palettes
|
|
44262
|
+
var domain = this.getValueDomain();
|
|
44263
|
+
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
44264
|
+
// Use default color pairing options if not in defined range
|
|
44265
|
+
if (colorPairingOption < 1 &&
|
|
44266
|
+
colorPairingOption > 4 &&
|
|
44267
|
+
colorScheme === 'mono') {
|
|
44268
|
+
colorPairingOption = 1;
|
|
44269
|
+
}
|
|
44270
|
+
else if (colorPairingOption < 1 &&
|
|
44271
|
+
colorPairingOption > 2 &&
|
|
44272
|
+
colorScheme === 'diverge') {
|
|
44273
|
+
colorPairingOption = 1;
|
|
44274
|
+
}
|
|
44275
|
+
// Uses css classes for fill
|
|
44276
|
+
var colorPairing = customColorsEnabled ? customColors : [];
|
|
44277
|
+
if (!customColorsEnabled) {
|
|
44278
|
+
// Add class names to list and the amount based on the color scheme
|
|
44279
|
+
// Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
|
|
44280
|
+
var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
|
|
44281
|
+
for (var i = 1; i < colorGroupingLength + 1; i++) {
|
|
44282
|
+
colorPairing.push("fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
|
|
44283
|
+
}
|
|
44284
|
+
}
|
|
44285
|
+
// Save scale type
|
|
44286
|
+
this._colorScale = quantize_quantize()
|
|
44287
|
+
.domain(this.getValueDomain())
|
|
44288
|
+
.range(colorPairing);
|
|
44289
|
+
};
|
|
44290
|
+
return HeatmapModel;
|
|
44291
|
+
}(cartesian_charts_ChartModelCartesian));
|
|
44292
|
+
|
|
44293
|
+
//# sourceMappingURL=../../src/model/heatmap.js.map
|
|
44294
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/heatmap.js
|
|
44295
|
+
var charts_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44296
|
+
var extendStatics = function (d, b) {
|
|
44297
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44298
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44299
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44300
|
+
return extendStatics(d, b);
|
|
44301
|
+
};
|
|
44302
|
+
return function (d, b) {
|
|
44303
|
+
extendStatics(d, b);
|
|
44304
|
+
function __() { this.constructor = d; }
|
|
44305
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44306
|
+
};
|
|
44307
|
+
})();
|
|
44308
|
+
var charts_heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44309
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44310
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44311
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44312
|
+
r[k] = a[j];
|
|
44313
|
+
return r;
|
|
44314
|
+
};
|
|
44315
|
+
// Internal Imports
|
|
44316
|
+
|
|
44317
|
+
|
|
44318
|
+
|
|
44319
|
+
|
|
44320
|
+
|
|
44321
|
+
|
|
44322
|
+
var heatmap_HeatmapChart = /** @class */ (function (_super) {
|
|
44323
|
+
charts_heatmap_extends(HeatmapChart, _super);
|
|
44324
|
+
function HeatmapChart(holder, chartConfigs) {
|
|
44325
|
+
var _this = _super.call(this, holder, chartConfigs) || this;
|
|
44326
|
+
_this.model = new heatmap_HeatmapModel(_this.services);
|
|
44327
|
+
// Merge the default options for this chart
|
|
44328
|
+
// With the user provided options
|
|
44329
|
+
_this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.heatmapChart, chartConfigs.options));
|
|
44330
|
+
// Initialize data, services, components etc.
|
|
44331
|
+
_this.init(holder, chartConfigs);
|
|
44332
|
+
return _this;
|
|
44333
|
+
}
|
|
44334
|
+
// Custom getChartComponents - Implements getChartComponents
|
|
44335
|
+
// Removes zoombar support and additional `features` that are not supported in heatmap
|
|
44336
|
+
HeatmapChart.prototype.getAxisChartComponents = function (graphFrameComponents, configs) {
|
|
44337
|
+
var options = this.model.getOptions();
|
|
44338
|
+
var toolbarEnabled = tools_Tools.getProperty(options, 'toolbar', 'enabled');
|
|
44339
|
+
this.services.cartesianScales.determineAxisDuality();
|
|
44340
|
+
this.services.cartesianScales.findDomainAndRangeAxes(); // need to do this before getMainXAxisPosition()
|
|
44341
|
+
this.services.cartesianScales.determineOrientation();
|
|
44342
|
+
var titleAvailable = !!this.model.getOptions().title;
|
|
44343
|
+
var titleComponent = {
|
|
44344
|
+
id: 'title',
|
|
44345
|
+
components: [new title_Title(this.model, this.services)],
|
|
44346
|
+
growth: LayoutGrowth.STRETCH,
|
|
44347
|
+
};
|
|
44348
|
+
var toolbarComponent = {
|
|
44349
|
+
id: 'toolbar',
|
|
44350
|
+
components: [new toolbar_Toolbar(this.model, this.services)],
|
|
44351
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44352
|
+
};
|
|
44353
|
+
var headerComponent = {
|
|
44354
|
+
id: 'header',
|
|
44355
|
+
components: [
|
|
44356
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays([
|
|
44357
|
+
// always add title to keep layout correct
|
|
44358
|
+
titleComponent
|
|
44359
|
+
], (toolbarEnabled ? [toolbarComponent] : [])), {
|
|
44360
|
+
direction: LayoutDirection.ROW,
|
|
44361
|
+
alignItems: LayoutAlignItems.CENTER,
|
|
44362
|
+
}),
|
|
44363
|
+
],
|
|
44364
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44365
|
+
};
|
|
44366
|
+
var legendComponent = {
|
|
44367
|
+
id: 'legend',
|
|
44368
|
+
components: [new color_scale_legend_ColorScaleLegend(this.model, this.services)],
|
|
44369
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44370
|
+
renderType: RenderTypes.SVG,
|
|
44371
|
+
};
|
|
44372
|
+
var graphFrameComponent = {
|
|
44373
|
+
id: 'graph-frame',
|
|
44374
|
+
components: graphFrameComponents,
|
|
44375
|
+
growth: LayoutGrowth.STRETCH,
|
|
44376
|
+
renderType: RenderTypes.SVG,
|
|
44377
|
+
};
|
|
44378
|
+
var isLegendEnabled = tools_Tools.getProperty(configs, 'legend', 'enabled') !== false &&
|
|
44379
|
+
this.model.getOptions().legend.enabled !== false;
|
|
44380
|
+
// Decide the position of the legend in reference to the chart
|
|
44381
|
+
var fullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;
|
|
44382
|
+
var legendSpacerComponent = {
|
|
44383
|
+
id: 'spacer',
|
|
44384
|
+
components: [new spacer_Spacer(this.model, this.services, { size: 15 })],
|
|
44385
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44386
|
+
};
|
|
44387
|
+
var fullFrameComponent = {
|
|
44388
|
+
id: 'full-frame',
|
|
44389
|
+
components: [
|
|
44390
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays((isLegendEnabled ? [legendComponent] : []), (isLegendEnabled ? [legendSpacerComponent] : []), [
|
|
44391
|
+
graphFrameComponent,
|
|
44392
|
+
]), {
|
|
44393
|
+
direction: fullFrameComponentDirection,
|
|
44394
|
+
}),
|
|
44395
|
+
],
|
|
44396
|
+
growth: LayoutGrowth.STRETCH,
|
|
44397
|
+
};
|
|
44398
|
+
var topLevelLayoutComponents = [];
|
|
44399
|
+
// header component is required for either title or toolbar
|
|
44400
|
+
if (titleAvailable || toolbarEnabled) {
|
|
44401
|
+
topLevelLayoutComponents.push(headerComponent);
|
|
44402
|
+
var titleSpacerComponent = {
|
|
44403
|
+
id: 'spacer',
|
|
44404
|
+
components: [
|
|
44405
|
+
new spacer_Spacer(this.model, this.services, toolbarEnabled ? { size: 15 } : undefined),
|
|
44406
|
+
],
|
|
44407
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44408
|
+
};
|
|
44409
|
+
topLevelLayoutComponents.push(titleSpacerComponent);
|
|
44410
|
+
}
|
|
44411
|
+
topLevelLayoutComponents.push(fullFrameComponent);
|
|
44412
|
+
return [
|
|
44413
|
+
new tooltip_axis_AxisChartsTooltip(this.model, this.services),
|
|
44414
|
+
new essentials_modal_Modal(this.model, this.services),
|
|
44415
|
+
new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
|
|
44416
|
+
direction: LayoutDirection.COLUMN,
|
|
44417
|
+
}),
|
|
44418
|
+
];
|
|
44419
|
+
};
|
|
44420
|
+
HeatmapChart.prototype.getComponents = function () {
|
|
44421
|
+
// Specify what to render inside the graph-frame
|
|
44422
|
+
var graphFrameComponents = [
|
|
44423
|
+
new two_dimensional_axes_TwoDimensionalAxes(this.model, this.services),
|
|
44424
|
+
new heatmap_Heatmap(this.model, this.services),
|
|
44425
|
+
];
|
|
44426
|
+
var components = this.getAxisChartComponents(graphFrameComponents);
|
|
44427
|
+
return components;
|
|
44428
|
+
};
|
|
44429
|
+
return HeatmapChart;
|
|
44430
|
+
}(axis_chart_AxisChart));
|
|
44431
|
+
|
|
44432
|
+
//# sourceMappingURL=../../src/charts/heatmap.js.map
|
|
42994
44433
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
|
|
42995
44434
|
|
|
42996
44435
|
|
|
@@ -43013,6 +44452,7 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
43013
44452
|
|
|
43014
44453
|
|
|
43015
44454
|
|
|
44455
|
+
|
|
43016
44456
|
|
|
43017
44457
|
|
|
43018
44458
|
//# sourceMappingURL=../../src/charts/index.js.map
|
|
@@ -44224,6 +45664,52 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44224
45664
|
)
|
|
44225
45665
|
|
|
44226
45666
|
/* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
|
|
45667
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"624081f5-vue-loader-template"}!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
|
|
45668
|
+
var ccv_heatmap_chartvue_type_template_id_b6ba687e_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ccv-heatmap-chart"})}
|
|
45669
|
+
var ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns = []
|
|
45670
|
+
|
|
45671
|
+
|
|
45672
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
|
|
45673
|
+
|
|
45674
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--12-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/thread-loader/dist/cjs.js!/home/runner/work/carbon-charts/carbon-charts/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
|
|
45675
|
+
//
|
|
45676
|
+
//
|
|
45677
|
+
//
|
|
45678
|
+
//
|
|
45679
|
+
|
|
45680
|
+
|
|
45681
|
+
/* harmony default export */ var ccv_heatmap_chartvue_type_script_lang_js_ = ({
|
|
45682
|
+
name: 'CcvHeatmapChart',
|
|
45683
|
+
extends: ccv_base_chart,
|
|
45684
|
+
mounted: function mounted() {
|
|
45685
|
+
this.coreChart = new heatmap_HeatmapChart(this.$el, {
|
|
45686
|
+
data: this.data,
|
|
45687
|
+
options: this.options
|
|
45688
|
+
});
|
|
45689
|
+
}
|
|
45690
|
+
});
|
|
45691
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
|
|
45692
|
+
/* harmony default export */ var src_ccv_heatmap_chartvue_type_script_lang_js_ = (ccv_heatmap_chartvue_type_script_lang_js_);
|
|
45693
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue
|
|
45694
|
+
|
|
45695
|
+
|
|
45696
|
+
|
|
45697
|
+
|
|
45698
|
+
|
|
45699
|
+
/* normalize component */
|
|
45700
|
+
|
|
45701
|
+
var ccv_heatmap_chart_component = normalizeComponent(
|
|
45702
|
+
src_ccv_heatmap_chartvue_type_script_lang_js_,
|
|
45703
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_render,
|
|
45704
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns,
|
|
45705
|
+
false,
|
|
45706
|
+
null,
|
|
45707
|
+
null,
|
|
45708
|
+
null
|
|
45709
|
+
|
|
45710
|
+
)
|
|
45711
|
+
|
|
45712
|
+
/* harmony default export */ var ccv_heatmap_chart = (ccv_heatmap_chart_component.exports);
|
|
44227
45713
|
// CONCATENATED MODULE: ./src/index.js
|
|
44228
45714
|
|
|
44229
45715
|
|
|
@@ -44258,7 +45744,8 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44258
45744
|
|
|
44259
45745
|
|
|
44260
45746
|
|
|
44261
|
-
|
|
45747
|
+
|
|
45748
|
+
var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_chart, ccv_grouped_bar_chart, ccv_stacked_bar_chart, ccv_boxplot_chart, ccv_bubble_chart, ccv_bullet_chart, ccv_donut_chart, ccv_gauge_chart, ccv_histogram_chart, ccv_line_chart, ccv_lollipop_chart, ccv_pie_chart, ccv_scatter_chart, ccv_meter_chart, ccv_radar_chart, ccv_combo_chart, ccv_tree_chart, ccv_treemap_chart, ccv_circle_pack_chart, ccv_wordcloud_chart, ccv_alluvial_chart, ccv_heatmap_chart];
|
|
44262
45749
|
/*
|
|
44263
45750
|
Allows the module to be used as a Vue plug-in, and has an install()
|
|
44264
45751
|
method (which is called when the plug-in loads) that registers all the
|
|
@@ -44358,6 +45845,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
|
|
|
44358
45845
|
/* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
|
|
44359
45846
|
/* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
|
|
44360
45847
|
/* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
|
|
45848
|
+
/* concated harmony reexport CcvHeatmapChart */__webpack_require__.d(__webpack_exports__, "CcvHeatmapChart", function() { return ccv_heatmap_chart; });
|
|
44361
45849
|
|
|
44362
45850
|
|
|
44363
45851
|
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
|