@carbon/charts-vue 0.53.5 → 0.54.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/charts-vue.common.js +1706 -207
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +1706 -207
- 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) {
|
|
@@ -9648,7 +9713,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9648
9713
|
};
|
|
9649
9714
|
ChartModel.prototype.getStackKeys = function (_a) {
|
|
9650
9715
|
var _this = this;
|
|
9651
|
-
var _b = _a.bins, bins =
|
|
9716
|
+
var _b = _a === void 0 ? { bins: null, groups: null } : _a, _c = _b.bins, bins = _c === void 0 ? null : _c, _d = _b.groups, groups = _d === void 0 ? null : _d;
|
|
9652
9717
|
var options = this.getOptions();
|
|
9653
9718
|
var displayData = this.getDisplayData(groups);
|
|
9654
9719
|
var stackKeys;
|
|
@@ -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
|
};
|
|
@@ -17913,7 +17994,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17913
17994
|
var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
|
|
17914
17995
|
var dataGroups = this.model.getDataGroups();
|
|
17915
17996
|
// Check if there are disabled legend items
|
|
17916
|
-
var DISABLED =
|
|
17997
|
+
var DISABLED = configuration_non_customizable_legend.items.status.DISABLED;
|
|
17917
17998
|
var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
|
|
17918
17999
|
var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
|
|
17919
18000
|
var svg = this.getComponentContainer()
|
|
@@ -17937,11 +18018,11 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17937
18018
|
addedLegendItems
|
|
17938
18019
|
.merge(svg.selectAll('div.legend-item'))
|
|
17939
18020
|
.classed('active', function (d, i) {
|
|
17940
|
-
return d.status ===
|
|
18021
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17941
18022
|
});
|
|
17942
18023
|
var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
|
|
17943
18024
|
svg.classed('clickable', legendClickable && dataGroups.length > 1);
|
|
17944
|
-
var checkboxRadius =
|
|
18025
|
+
var checkboxRadius = configuration_non_customizable_legend.checkbox.radius;
|
|
17945
18026
|
var addedCheckboxes = addedLegendItems
|
|
17946
18027
|
.append('div')
|
|
17947
18028
|
.classed('checkbox', true);
|
|
@@ -17954,7 +18035,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17954
18035
|
})
|
|
17955
18036
|
.attr('aria-checked', function (_a) {
|
|
17956
18037
|
var status = _a.status;
|
|
17957
|
-
return status ===
|
|
18038
|
+
return status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17958
18039
|
})
|
|
17959
18040
|
.attr('width', checkboxRadius * 2)
|
|
17960
18041
|
.attr('height', checkboxRadius * 2)
|
|
@@ -17966,13 +18047,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17966
18047
|
});
|
|
17967
18048
|
})
|
|
17968
18049
|
.style('background', function (d) {
|
|
17969
|
-
return d.status ===
|
|
18050
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE
|
|
17970
18051
|
? _this.model.getFillColor(d.name) ||
|
|
17971
18052
|
_this.model.getStrokeColor(d.name)
|
|
17972
18053
|
: null;
|
|
17973
18054
|
})
|
|
17974
18055
|
.classed('active', function (d, i) {
|
|
17975
|
-
return d.status ===
|
|
18056
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17976
18057
|
});
|
|
17977
18058
|
var addedCheckIcons = addedCheckboxes
|
|
17978
18059
|
.append('svg')
|
|
@@ -18057,7 +18138,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18057
18138
|
return dataGroups;
|
|
18058
18139
|
};
|
|
18059
18140
|
Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
|
|
18060
|
-
var _a =
|
|
18141
|
+
var _a = configuration_non_customizable_legend.area, width = _a.width, height = _a.height;
|
|
18061
18142
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18062
18143
|
// Circular icon
|
|
18063
18144
|
additionalItem
|
|
@@ -18070,7 +18151,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18070
18151
|
.style('height', height + "px");
|
|
18071
18152
|
}
|
|
18072
18153
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18073
|
-
var _b =
|
|
18154
|
+
var _b = configuration_non_customizable_legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
|
|
18074
18155
|
var circleEnter = additionalItem
|
|
18075
18156
|
.attr('fill', 'none')
|
|
18076
18157
|
.selectAll('circle')
|
|
@@ -18088,7 +18169,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18088
18169
|
.style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
|
|
18089
18170
|
}
|
|
18090
18171
|
else if (itemConfig.type === LegendItemType.LINE) {
|
|
18091
|
-
var lineConfig =
|
|
18172
|
+
var lineConfig = configuration_non_customizable_legend.line;
|
|
18092
18173
|
if (additionalItem.select('line.line').empty()) {
|
|
18093
18174
|
additionalItem
|
|
18094
18175
|
.append('line')
|
|
@@ -18115,13 +18196,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18115
18196
|
.attr('width', width)
|
|
18116
18197
|
.attr('height', height)
|
|
18117
18198
|
.style('fill', indexOfItem > 3 && !itemConfig.fill
|
|
18118
|
-
?
|
|
18199
|
+
? configuration_non_customizable_legend.area.fill
|
|
18119
18200
|
: itemConfig.fill)
|
|
18120
18201
|
.style('stroke', itemConfig.stroke);
|
|
18121
18202
|
}
|
|
18122
18203
|
}
|
|
18123
18204
|
else if (itemConfig.type === LegendItemType.SIZE) {
|
|
18124
|
-
var _c =
|
|
18205
|
+
var _c = configuration_non_customizable_legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
|
|
18125
18206
|
var sizeEnter = additionalItem
|
|
18126
18207
|
.attr('fill', 'none')
|
|
18127
18208
|
.attr('role', Roles.IMG)
|
|
@@ -18140,7 +18221,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18140
18221
|
.style('stroke-width', 1);
|
|
18141
18222
|
}
|
|
18142
18223
|
else if (itemConfig.type === LegendItemType.QUARTILE) {
|
|
18143
|
-
var iconData =
|
|
18224
|
+
var iconData = configuration_non_customizable_legend.quartile.iconData;
|
|
18144
18225
|
var quartileEnter = additionalItem
|
|
18145
18226
|
.selectAll('rect')
|
|
18146
18227
|
.attr('role', Roles.IMG)
|
|
@@ -18294,6 +18375,431 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18294
18375
|
}(component_Component));
|
|
18295
18376
|
|
|
18296
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
|
|
18297
18803
|
// EXTERNAL MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/carbon-components/node_modules/warning/browser.js
|
|
18298
18804
|
var browser = __webpack_require__("9b04");
|
|
18299
18805
|
|
|
@@ -25476,6 +25982,7 @@ var bar_stacked_extends = (undefined && undefined.__extends) || (function () {
|
|
|
25476
25982
|
|
|
25477
25983
|
|
|
25478
25984
|
|
|
25985
|
+
|
|
25479
25986
|
// D3 Imports
|
|
25480
25987
|
|
|
25481
25988
|
var bar_stacked_StackedBar = /** @class */ (function (_super) {
|
|
@@ -25707,6 +26214,21 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
|
|
|
25707
26214
|
});
|
|
25708
26215
|
});
|
|
25709
26216
|
};
|
|
26217
|
+
StackedBar.prototype.getBarWidth = function () {
|
|
26218
|
+
var options = this.getOptions();
|
|
26219
|
+
if (tools_Tools.getProperty(options, "bars", "width")) {
|
|
26220
|
+
return options.bars.width;
|
|
26221
|
+
}
|
|
26222
|
+
var mainXScale = this.services.cartesianScales.getMainXScale();
|
|
26223
|
+
var chartWidth = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
|
|
26224
|
+
useAttrs: true,
|
|
26225
|
+
}).width;
|
|
26226
|
+
var numberOfDomainValues = this.model.getStackKeys().length;
|
|
26227
|
+
if (!mainXScale.step) {
|
|
26228
|
+
return Math.min(options.bars.maxWidth, (chartWidth * 0.25) / numberOfDomainValues);
|
|
26229
|
+
}
|
|
26230
|
+
return Math.min(options.bars.maxWidth, mainXScale.step() / 2);
|
|
26231
|
+
};
|
|
25710
26232
|
StackedBar.prototype.destroy = function () {
|
|
25711
26233
|
// Remove event listeners
|
|
25712
26234
|
this.parent
|
|
@@ -33479,7 +34001,7 @@ function justify(node, n) {
|
|
|
33479
34001
|
return node.sourceLinks.length ? node.depth : n - 1;
|
|
33480
34002
|
}
|
|
33481
34003
|
|
|
33482
|
-
function
|
|
34004
|
+
function align_center(node) {
|
|
33483
34005
|
return node.targetLinks.length ? node.depth
|
|
33484
34006
|
: node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
|
|
33485
34007
|
: 0;
|
|
@@ -34653,6 +35175,376 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34653
35175
|
}(component_Component));
|
|
34654
35176
|
|
|
34655
35177
|
//# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
|
|
35178
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/heatmap.js
|
|
35179
|
+
var heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
35180
|
+
var extendStatics = function (d, b) {
|
|
35181
|
+
extendStatics = Object.setPrototypeOf ||
|
|
35182
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
35183
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
35184
|
+
return extendStatics(d, b);
|
|
35185
|
+
};
|
|
35186
|
+
return function (d, b) {
|
|
35187
|
+
extendStatics(d, b);
|
|
35188
|
+
function __() { this.constructor = d; }
|
|
35189
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
35190
|
+
};
|
|
35191
|
+
})();
|
|
35192
|
+
// Internal Imports
|
|
35193
|
+
|
|
35194
|
+
|
|
35195
|
+
|
|
35196
|
+
|
|
35197
|
+
|
|
35198
|
+
|
|
35199
|
+
// D3 Imports
|
|
35200
|
+
|
|
35201
|
+
|
|
35202
|
+
var heatmap_Heatmap = /** @class */ (function (_super) {
|
|
35203
|
+
heatmap_extends(Heatmap, _super);
|
|
35204
|
+
function Heatmap() {
|
|
35205
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35206
|
+
_this.type = 'heatmap';
|
|
35207
|
+
_this.renderType = RenderTypes.SVG;
|
|
35208
|
+
_this.matrix = {};
|
|
35209
|
+
_this.xBandwidth = 0;
|
|
35210
|
+
_this.yBandwidth = 0;
|
|
35211
|
+
_this.translationUnits = {
|
|
35212
|
+
x: 0,
|
|
35213
|
+
y: 0,
|
|
35214
|
+
};
|
|
35215
|
+
// Highlight elements that match the hovered axis item
|
|
35216
|
+
_this.handleAxisOnHover = function (event) {
|
|
35217
|
+
var detail = event.detail;
|
|
35218
|
+
var datum = detail.datum;
|
|
35219
|
+
// Unique ranges and domains
|
|
35220
|
+
var ranges = _this.model.getUniqueRanges();
|
|
35221
|
+
var domains = _this.model.getUniqueDomain();
|
|
35222
|
+
// Labels
|
|
35223
|
+
var domainLabel = _this.services.cartesianScales.getDomainLabel();
|
|
35224
|
+
var rangeLabel = _this.services.cartesianScales.getRangeLabel();
|
|
35225
|
+
// Scales
|
|
35226
|
+
var mainXScale = _this.services.cartesianScales.getMainXScale();
|
|
35227
|
+
var mainYScale = _this.services.cartesianScales.getMainYScale();
|
|
35228
|
+
var label = '', sum = 0, minimum = 0, maximum = 0;
|
|
35229
|
+
// Check to see where datum belongs
|
|
35230
|
+
if (_this.matrix[datum] !== undefined) {
|
|
35231
|
+
label = domainLabel;
|
|
35232
|
+
// Iterate through Object and get sum, min, and max
|
|
35233
|
+
ranges.forEach(function (element) {
|
|
35234
|
+
var value = _this.matrix[datum][element].value || 0;
|
|
35235
|
+
sum += value;
|
|
35236
|
+
minimum = value < minimum ? value : minimum;
|
|
35237
|
+
maximum = value > maximum ? value : maximum;
|
|
35238
|
+
});
|
|
35239
|
+
}
|
|
35240
|
+
else {
|
|
35241
|
+
label = rangeLabel;
|
|
35242
|
+
domains.forEach(function (element) {
|
|
35243
|
+
var value = _this.matrix[element][datum].value || 0;
|
|
35244
|
+
sum += value;
|
|
35245
|
+
minimum = value < minimum ? value : minimum;
|
|
35246
|
+
maximum = value > maximum ? value : maximum;
|
|
35247
|
+
});
|
|
35248
|
+
}
|
|
35249
|
+
if (mainXScale(datum) !== undefined) {
|
|
35250
|
+
_this.parent
|
|
35251
|
+
.select('g.multi-cell.column-highlight')
|
|
35252
|
+
.classed('highlighter-hidden', false)
|
|
35253
|
+
.attr('transform', "translate(" + mainXScale(datum) + ", " + min_min(mainYScale.range()) + ")");
|
|
35254
|
+
}
|
|
35255
|
+
else if (mainYScale(datum) !== undefined) {
|
|
35256
|
+
_this.parent
|
|
35257
|
+
.select('g.multi-cell.row-highlight')
|
|
35258
|
+
.classed('highlighter-hidden', false)
|
|
35259
|
+
.attr('transform', "translate(" + min_min(mainXScale.range()) + "," + mainYScale(datum) + ")");
|
|
35260
|
+
}
|
|
35261
|
+
// Dispatch tooltip show event
|
|
35262
|
+
_this.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35263
|
+
event: detail.event,
|
|
35264
|
+
hoveredElement: src_select(event.detail.element),
|
|
35265
|
+
items: [
|
|
35266
|
+
{
|
|
35267
|
+
label: label,
|
|
35268
|
+
value: datum,
|
|
35269
|
+
bold: true,
|
|
35270
|
+
},
|
|
35271
|
+
{
|
|
35272
|
+
label: 'Min',
|
|
35273
|
+
value: minimum,
|
|
35274
|
+
},
|
|
35275
|
+
{
|
|
35276
|
+
label: 'Max',
|
|
35277
|
+
value: maximum,
|
|
35278
|
+
},
|
|
35279
|
+
{
|
|
35280
|
+
label: 'Average',
|
|
35281
|
+
value: sum / domains.length,
|
|
35282
|
+
},
|
|
35283
|
+
],
|
|
35284
|
+
});
|
|
35285
|
+
};
|
|
35286
|
+
// Un-highlight all elements
|
|
35287
|
+
_this.handleAxisMouseOut = function (event) {
|
|
35288
|
+
// Hide column/row
|
|
35289
|
+
_this.parent
|
|
35290
|
+
.selectAll('g.multi-cell')
|
|
35291
|
+
.classed('highlighter-hidden', true);
|
|
35292
|
+
// Dispatch hide tooltip event
|
|
35293
|
+
_this.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35294
|
+
event: event,
|
|
35295
|
+
});
|
|
35296
|
+
};
|
|
35297
|
+
return _this;
|
|
35298
|
+
}
|
|
35299
|
+
Heatmap.prototype.init = function () {
|
|
35300
|
+
var eventsFragment = this.services.events;
|
|
35301
|
+
// Highlight correct cells on Axis item hovers
|
|
35302
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOVER, this.handleAxisOnHover);
|
|
35303
|
+
// Highlight correct cells on Axis item mouseouts
|
|
35304
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOUT, this.handleAxisMouseOut);
|
|
35305
|
+
// Highlight correct cells on Axis item focus
|
|
35306
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_FOCUS, this.handleAxisOnHover);
|
|
35307
|
+
// Highlight correct cells on Axis item blur
|
|
35308
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_BLUR, this.handleAxisMouseOut);
|
|
35309
|
+
};
|
|
35310
|
+
Heatmap.prototype.render = function (animate) {
|
|
35311
|
+
var _this = this;
|
|
35312
|
+
if (animate === void 0) { animate = true; }
|
|
35313
|
+
var svg = this.getComponentContainer({ withinChartClip: true });
|
|
35314
|
+
// Lower the chart so the axes are always visible
|
|
35315
|
+
svg.lower();
|
|
35316
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35317
|
+
this.matrix = this.model.getMatrix();
|
|
35318
|
+
svg.html('');
|
|
35319
|
+
if (tools_Tools.getProperty(this.getOptions(), 'data', 'loading')) {
|
|
35320
|
+
return;
|
|
35321
|
+
}
|
|
35322
|
+
// determine x and y axis scale
|
|
35323
|
+
var mainXScale = cartesianScales.getMainXScale();
|
|
35324
|
+
var mainYScale = cartesianScales.getMainYScale();
|
|
35325
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35326
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35327
|
+
// Get unique axis values & create a matrix
|
|
35328
|
+
var uniqueDomain = this.model.getUniqueDomain();
|
|
35329
|
+
var uniqueRange = this.model.getUniqueRanges();
|
|
35330
|
+
// Get matrix in the form of an array to create a single heatmap group
|
|
35331
|
+
var matrixArray = this.model.getMatrixAsArray();
|
|
35332
|
+
// Get available chart area
|
|
35333
|
+
var xRange = mainXScale.range();
|
|
35334
|
+
var yRange = mainYScale.range();
|
|
35335
|
+
// Determine rectangle dimensions based on the number of unique domain and range
|
|
35336
|
+
this.xBandwidth = Math.abs((xRange[1] - xRange[0]) / uniqueDomain.length);
|
|
35337
|
+
this.yBandwidth = Math.abs((yRange[1] - yRange[0]) / uniqueRange.length);
|
|
35338
|
+
var patternID = this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");
|
|
35339
|
+
// Create a striped pattern for missing data
|
|
35340
|
+
svg.append('defs')
|
|
35341
|
+
.append('pattern')
|
|
35342
|
+
.attr('id', patternID)
|
|
35343
|
+
.attr('width', 3)
|
|
35344
|
+
.attr('height', 3)
|
|
35345
|
+
.attr('patternUnits', 'userSpaceOnUse')
|
|
35346
|
+
.attr('patternTransform', 'rotate(45)')
|
|
35347
|
+
.append('rect')
|
|
35348
|
+
.classed('pattern-fill', true)
|
|
35349
|
+
.attr('width', 0.5)
|
|
35350
|
+
.attr('height', 8);
|
|
35351
|
+
var rectangles = svg
|
|
35352
|
+
.selectAll()
|
|
35353
|
+
.data(matrixArray)
|
|
35354
|
+
.enter()
|
|
35355
|
+
.append('g')
|
|
35356
|
+
.attr('class', function (d) { return "heat-" + d.index; })
|
|
35357
|
+
.classed('cell', true)
|
|
35358
|
+
.attr('transform', function (d) {
|
|
35359
|
+
return "translate(" + mainXScale(d[domainIdentifier]) + ", " + mainYScale(d[rangeIdentifier]) + ")";
|
|
35360
|
+
})
|
|
35361
|
+
.append('rect')
|
|
35362
|
+
.attr('class', function (d) {
|
|
35363
|
+
return _this.model.getColorClassName({
|
|
35364
|
+
value: d.value,
|
|
35365
|
+
originalClassName: "heat-" + d.index,
|
|
35366
|
+
});
|
|
35367
|
+
})
|
|
35368
|
+
.classed('heat', true)
|
|
35369
|
+
.classed('null-state', function (d) {
|
|
35370
|
+
return d.index === -1 || d.value === null ? true : false;
|
|
35371
|
+
})
|
|
35372
|
+
.attr('width', this.xBandwidth)
|
|
35373
|
+
.attr('height', this.yBandwidth)
|
|
35374
|
+
.style('fill', function (d) {
|
|
35375
|
+
// Check if a valid value exists
|
|
35376
|
+
if (d.index === -1 || d.value === null) {
|
|
35377
|
+
return "url(#" + patternID + ")";
|
|
35378
|
+
}
|
|
35379
|
+
return _this.model.getFillColor(Number(d.value));
|
|
35380
|
+
})
|
|
35381
|
+
.attr('aria-label', function (d) { return d.value; });
|
|
35382
|
+
// Cell highlight box
|
|
35383
|
+
this.createOuterBox('g.cell-highlight', this.xBandwidth, this.yBandwidth);
|
|
35384
|
+
// Column highlight box
|
|
35385
|
+
this.createOuterBox('g.multi-cell.column-highlight', this.xBandwidth, Math.abs(yRange[1] - yRange[0]));
|
|
35386
|
+
// Row highlight box
|
|
35387
|
+
this.createOuterBox('g.multi-cell.row-highlight', Math.abs(xRange[1] - xRange[0]), this.yBandwidth);
|
|
35388
|
+
if (this.determineDividerStatus()) {
|
|
35389
|
+
rectangles.style('stroke-width', '1px');
|
|
35390
|
+
this.parent.select('g.cell-highlight').classed('cell-2', true);
|
|
35391
|
+
}
|
|
35392
|
+
this.addEventListener();
|
|
35393
|
+
};
|
|
35394
|
+
/**
|
|
35395
|
+
* Generates a box using lines to create a hover effect
|
|
35396
|
+
* The lines have drop shadow in their respective direction
|
|
35397
|
+
* @param parentTag - tag name
|
|
35398
|
+
* @param xBandwidth - X length
|
|
35399
|
+
* @param yBandwidth - y length
|
|
35400
|
+
*/
|
|
35401
|
+
Heatmap.prototype.createOuterBox = function (parentTag, xBandwidth, yBandwidth) {
|
|
35402
|
+
// Create a highlighter in the parent component so the shadow and the lines do not get clipped
|
|
35403
|
+
var highlight = dom_utils_DOMUtils.appendOrSelect(this.parent, parentTag)
|
|
35404
|
+
.classed('shadows', true)
|
|
35405
|
+
.classed('highlighter-hidden', true);
|
|
35406
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.top')
|
|
35407
|
+
.attr('x1', -1)
|
|
35408
|
+
.attr('x2', xBandwidth + 1);
|
|
35409
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.left')
|
|
35410
|
+
.attr('x1', 0)
|
|
35411
|
+
.attr('y1', -1)
|
|
35412
|
+
.attr('x2', 0)
|
|
35413
|
+
.attr('y2', yBandwidth + 1);
|
|
35414
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.down')
|
|
35415
|
+
.attr('x1', -1)
|
|
35416
|
+
.attr('x2', xBandwidth + 1)
|
|
35417
|
+
.attr('y1', yBandwidth)
|
|
35418
|
+
.attr('y2', yBandwidth);
|
|
35419
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.right')
|
|
35420
|
+
.attr('x1', xBandwidth)
|
|
35421
|
+
.attr('x2', xBandwidth)
|
|
35422
|
+
.attr('y1', -1)
|
|
35423
|
+
.attr('y2', yBandwidth + 1);
|
|
35424
|
+
};
|
|
35425
|
+
Heatmap.prototype.determineDividerStatus = function () {
|
|
35426
|
+
// Add dividers if status is not off, will assume auto or on by default.
|
|
35427
|
+
var dividerStatus = tools_Tools.getProperty(this.getOptions(), 'heatmap', 'divider', 'state');
|
|
35428
|
+
// Determine if cell divider should be displayed
|
|
35429
|
+
if (dividerStatus !== DividerStatus.OFF) {
|
|
35430
|
+
if ((dividerStatus === DividerStatus.AUTO &&
|
|
35431
|
+
heatmap.minCellDividerDimension <=
|
|
35432
|
+
this.xBandwidth &&
|
|
35433
|
+
heatmap.minCellDividerDimension <=
|
|
35434
|
+
this.yBandwidth) ||
|
|
35435
|
+
dividerStatus === DividerStatus.ON) {
|
|
35436
|
+
return true;
|
|
35437
|
+
}
|
|
35438
|
+
}
|
|
35439
|
+
return false;
|
|
35440
|
+
};
|
|
35441
|
+
Heatmap.prototype.addEventListener = function () {
|
|
35442
|
+
var self = this;
|
|
35443
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35444
|
+
var options = this.getOptions();
|
|
35445
|
+
var totalLabel = lodash_es_get(options, 'tooltip.totalLabel');
|
|
35446
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35447
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35448
|
+
var domainLabel = cartesianScales.getDomainLabel();
|
|
35449
|
+
var rangeLabel = cartesianScales.getRangeLabel();
|
|
35450
|
+
this.parent
|
|
35451
|
+
.selectAll('g.cell')
|
|
35452
|
+
.on('mouseover', function (event, datum) {
|
|
35453
|
+
var cell = src_select(this);
|
|
35454
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35455
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35456
|
+
// Dispatch event and tooltip only if value exists
|
|
35457
|
+
if (!nullState) {
|
|
35458
|
+
// Get transformation value of node
|
|
35459
|
+
var transform = tools_Tools.getTranformOffsets(cell.attr('transform'));
|
|
35460
|
+
src_select('g.cell-highlight')
|
|
35461
|
+
.attr('transform', "translate(" + (transform.x + self.translationUnits.x) + ", " + (transform.y + self.translationUnits.y) + ")")
|
|
35462
|
+
.classed('highlighter-hidden', false);
|
|
35463
|
+
// Dispatch mouse over event
|
|
35464
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOVER, {
|
|
35465
|
+
event: event,
|
|
35466
|
+
element: hoveredElement,
|
|
35467
|
+
datum: datum,
|
|
35468
|
+
});
|
|
35469
|
+
// Dispatch tooltip show event
|
|
35470
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35471
|
+
event: event,
|
|
35472
|
+
items: [
|
|
35473
|
+
{
|
|
35474
|
+
label: domainLabel,
|
|
35475
|
+
value: datum[domainIdentifier],
|
|
35476
|
+
},
|
|
35477
|
+
{
|
|
35478
|
+
label: rangeLabel,
|
|
35479
|
+
value: datum[rangeIdentifier],
|
|
35480
|
+
},
|
|
35481
|
+
{
|
|
35482
|
+
label: totalLabel || 'Total',
|
|
35483
|
+
value: datum['value'],
|
|
35484
|
+
color: hoveredElement.style('fill'),
|
|
35485
|
+
},
|
|
35486
|
+
],
|
|
35487
|
+
});
|
|
35488
|
+
}
|
|
35489
|
+
})
|
|
35490
|
+
.on('mousemove', function (event, datum) {
|
|
35491
|
+
// Dispatch mouse move event
|
|
35492
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEMOVE, {
|
|
35493
|
+
event: event,
|
|
35494
|
+
element: src_select(this),
|
|
35495
|
+
datum: datum,
|
|
35496
|
+
});
|
|
35497
|
+
// Dispatch tooltip move event
|
|
35498
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
35499
|
+
event: event,
|
|
35500
|
+
});
|
|
35501
|
+
})
|
|
35502
|
+
.on('click', function (event, datum) {
|
|
35503
|
+
// Dispatch mouse click event
|
|
35504
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_CLICK, {
|
|
35505
|
+
event: event,
|
|
35506
|
+
element: src_select(this),
|
|
35507
|
+
datum: datum,
|
|
35508
|
+
});
|
|
35509
|
+
})
|
|
35510
|
+
.on('mouseout', function (event, datum) {
|
|
35511
|
+
var cell = src_select(this);
|
|
35512
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35513
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35514
|
+
src_select('g.cell-highlight').classed('highlighter-hidden', true);
|
|
35515
|
+
// Dispatch event and tooltip only if value exists
|
|
35516
|
+
if (!nullState) {
|
|
35517
|
+
// Dispatch mouse out event
|
|
35518
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOUT, {
|
|
35519
|
+
event: event,
|
|
35520
|
+
element: hoveredElement,
|
|
35521
|
+
datum: datum,
|
|
35522
|
+
});
|
|
35523
|
+
// Dispatch hide tooltip event
|
|
35524
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35525
|
+
event: event,
|
|
35526
|
+
hoveredElement: hoveredElement,
|
|
35527
|
+
});
|
|
35528
|
+
}
|
|
35529
|
+
});
|
|
35530
|
+
};
|
|
35531
|
+
// Remove event listeners
|
|
35532
|
+
Heatmap.prototype.destroy = function () {
|
|
35533
|
+
this.parent
|
|
35534
|
+
.selectAll('rect.heat')
|
|
35535
|
+
.on('mouseover', null)
|
|
35536
|
+
.on('mousemove', null)
|
|
35537
|
+
.on('click', null)
|
|
35538
|
+
.on('mouseout', null);
|
|
35539
|
+
// Remove legend listeners
|
|
35540
|
+
var eventsFragment = this.services.events;
|
|
35541
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleAxisOnHover);
|
|
35542
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_MOUSEOUT, this.handleAxisMouseOut);
|
|
35543
|
+
};
|
|
35544
|
+
return Heatmap;
|
|
35545
|
+
}(component_Component));
|
|
35546
|
+
|
|
35547
|
+
//# sourceMappingURL=../../../src/components/graphs/heatmap.js.map
|
|
34656
35548
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
|
|
34657
35549
|
var spacer_extends = (undefined && undefined.__extends) || (function () {
|
|
34658
35550
|
var extendStatics = function (d, b) {
|
|
@@ -34879,187 +35771,6 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
|
|
|
34879
35771
|
}(component_Component));
|
|
34880
35772
|
|
|
34881
35773
|
//# sourceMappingURL=../../../src/components/layout/layout.js.map
|
|
34882
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
|
|
34883
|
-
/* harmony default export */ var d3_axis_src_identity = (function(x) {
|
|
34884
|
-
return x;
|
|
34885
|
-
});
|
|
34886
|
-
|
|
34887
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
|
|
34888
|
-
|
|
34889
|
-
|
|
34890
|
-
var axis_top = 1,
|
|
34891
|
-
axis_right = 2,
|
|
34892
|
-
bottom = 3,
|
|
34893
|
-
axis_left = 4,
|
|
34894
|
-
axis_epsilon = 1e-6;
|
|
34895
|
-
|
|
34896
|
-
function axis_translateX(x) {
|
|
34897
|
-
return "translate(" + x + ",0)";
|
|
34898
|
-
}
|
|
34899
|
-
|
|
34900
|
-
function axis_translateY(y) {
|
|
34901
|
-
return "translate(0," + y + ")";
|
|
34902
|
-
}
|
|
34903
|
-
|
|
34904
|
-
function axis_number(scale) {
|
|
34905
|
-
return d => +scale(d);
|
|
34906
|
-
}
|
|
34907
|
-
|
|
34908
|
-
function axis_center(scale, offset) {
|
|
34909
|
-
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
34910
|
-
if (scale.round()) offset = Math.round(offset);
|
|
34911
|
-
return d => +scale(d) + offset;
|
|
34912
|
-
}
|
|
34913
|
-
|
|
34914
|
-
function entering() {
|
|
34915
|
-
return !this.__axis;
|
|
34916
|
-
}
|
|
34917
|
-
|
|
34918
|
-
function axis_axis(orient, scale) {
|
|
34919
|
-
var tickArguments = [],
|
|
34920
|
-
tickValues = null,
|
|
34921
|
-
tickFormat = null,
|
|
34922
|
-
tickSizeInner = 6,
|
|
34923
|
-
tickSizeOuter = 6,
|
|
34924
|
-
tickPadding = 3,
|
|
34925
|
-
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
34926
|
-
k = orient === axis_top || orient === axis_left ? -1 : 1,
|
|
34927
|
-
x = orient === axis_left || orient === axis_right ? "x" : "y",
|
|
34928
|
-
transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
|
|
34929
|
-
|
|
34930
|
-
function axis(context) {
|
|
34931
|
-
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
34932
|
-
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
|
|
34933
|
-
spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
|
34934
|
-
range = scale.range(),
|
|
34935
|
-
range0 = +range[0] + offset,
|
|
34936
|
-
range1 = +range[range.length - 1] + offset,
|
|
34937
|
-
position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
|
|
34938
|
-
selection = context.selection ? context.selection() : context,
|
|
34939
|
-
path = selection.selectAll(".domain").data([null]),
|
|
34940
|
-
tick = selection.selectAll(".tick").data(values, scale).order(),
|
|
34941
|
-
tickExit = tick.exit(),
|
|
34942
|
-
tickEnter = tick.enter().append("g").attr("class", "tick"),
|
|
34943
|
-
line = tick.select("line"),
|
|
34944
|
-
text = tick.select("text");
|
|
34945
|
-
|
|
34946
|
-
path = path.merge(path.enter().insert("path", ".tick")
|
|
34947
|
-
.attr("class", "domain")
|
|
34948
|
-
.attr("stroke", "currentColor"));
|
|
34949
|
-
|
|
34950
|
-
tick = tick.merge(tickEnter);
|
|
34951
|
-
|
|
34952
|
-
line = line.merge(tickEnter.append("line")
|
|
34953
|
-
.attr("stroke", "currentColor")
|
|
34954
|
-
.attr(x + "2", k * tickSizeInner));
|
|
34955
|
-
|
|
34956
|
-
text = text.merge(tickEnter.append("text")
|
|
34957
|
-
.attr("fill", "currentColor")
|
|
34958
|
-
.attr(x, k * spacing)
|
|
34959
|
-
.attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
34960
|
-
|
|
34961
|
-
if (context !== selection) {
|
|
34962
|
-
path = path.transition(context);
|
|
34963
|
-
tick = tick.transition(context);
|
|
34964
|
-
line = line.transition(context);
|
|
34965
|
-
text = text.transition(context);
|
|
34966
|
-
|
|
34967
|
-
tickExit = tickExit.transition(context)
|
|
34968
|
-
.attr("opacity", axis_epsilon)
|
|
34969
|
-
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
|
|
34970
|
-
|
|
34971
|
-
tickEnter
|
|
34972
|
-
.attr("opacity", axis_epsilon)
|
|
34973
|
-
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
|
|
34974
|
-
}
|
|
34975
|
-
|
|
34976
|
-
tickExit.remove();
|
|
34977
|
-
|
|
34978
|
-
path
|
|
34979
|
-
.attr("d", orient === axis_left || orient === axis_right
|
|
34980
|
-
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
34981
|
-
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
34982
|
-
|
|
34983
|
-
tick
|
|
34984
|
-
.attr("opacity", 1)
|
|
34985
|
-
.attr("transform", function(d) { return transform(position(d) + offset); });
|
|
34986
|
-
|
|
34987
|
-
line
|
|
34988
|
-
.attr(x + "2", k * tickSizeInner);
|
|
34989
|
-
|
|
34990
|
-
text
|
|
34991
|
-
.attr(x, k * spacing)
|
|
34992
|
-
.text(format);
|
|
34993
|
-
|
|
34994
|
-
selection.filter(entering)
|
|
34995
|
-
.attr("fill", "none")
|
|
34996
|
-
.attr("font-size", 10)
|
|
34997
|
-
.attr("font-family", "sans-serif")
|
|
34998
|
-
.attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
|
34999
|
-
|
|
35000
|
-
selection
|
|
35001
|
-
.each(function() { this.__axis = position; });
|
|
35002
|
-
}
|
|
35003
|
-
|
|
35004
|
-
axis.scale = function(_) {
|
|
35005
|
-
return arguments.length ? (scale = _, axis) : scale;
|
|
35006
|
-
};
|
|
35007
|
-
|
|
35008
|
-
axis.ticks = function() {
|
|
35009
|
-
return tickArguments = Array.from(arguments), axis;
|
|
35010
|
-
};
|
|
35011
|
-
|
|
35012
|
-
axis.tickArguments = function(_) {
|
|
35013
|
-
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
|
|
35014
|
-
};
|
|
35015
|
-
|
|
35016
|
-
axis.tickValues = function(_) {
|
|
35017
|
-
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
|
|
35018
|
-
};
|
|
35019
|
-
|
|
35020
|
-
axis.tickFormat = function(_) {
|
|
35021
|
-
return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
|
35022
|
-
};
|
|
35023
|
-
|
|
35024
|
-
axis.tickSize = function(_) {
|
|
35025
|
-
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
|
35026
|
-
};
|
|
35027
|
-
|
|
35028
|
-
axis.tickSizeInner = function(_) {
|
|
35029
|
-
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
|
35030
|
-
};
|
|
35031
|
-
|
|
35032
|
-
axis.tickSizeOuter = function(_) {
|
|
35033
|
-
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
|
35034
|
-
};
|
|
35035
|
-
|
|
35036
|
-
axis.tickPadding = function(_) {
|
|
35037
|
-
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
|
35038
|
-
};
|
|
35039
|
-
|
|
35040
|
-
axis.offset = function(_) {
|
|
35041
|
-
return arguments.length ? (offset = +_, axis) : offset;
|
|
35042
|
-
};
|
|
35043
|
-
|
|
35044
|
-
return axis;
|
|
35045
|
-
}
|
|
35046
|
-
|
|
35047
|
-
function axisTop(scale) {
|
|
35048
|
-
return axis_axis(axis_top, scale);
|
|
35049
|
-
}
|
|
35050
|
-
|
|
35051
|
-
function axisRight(scale) {
|
|
35052
|
-
return axis_axis(axis_right, scale);
|
|
35053
|
-
}
|
|
35054
|
-
|
|
35055
|
-
function axisBottom(scale) {
|
|
35056
|
-
return axis_axis(bottom, scale);
|
|
35057
|
-
}
|
|
35058
|
-
|
|
35059
|
-
function axisLeft(scale) {
|
|
35060
|
-
return axis_axis(axis_left, scale);
|
|
35061
|
-
}
|
|
35062
|
-
|
|
35063
35774
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/axis.js
|
|
35064
35775
|
var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
35065
35776
|
var extendStatics = function (d, b) {
|
|
@@ -35088,9 +35799,16 @@ var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
|
35088
35799
|
var axis_Axis = /** @class */ (function (_super) {
|
|
35089
35800
|
axis_extends(Axis, _super);
|
|
35090
35801
|
function Axis(model, services, configs) {
|
|
35802
|
+
var _a;
|
|
35091
35803
|
var _this = _super.call(this, model, services, configs) || this;
|
|
35092
35804
|
_this.type = 'axes';
|
|
35093
35805
|
_this.renderType = RenderTypes.SVG;
|
|
35806
|
+
_this.truncation = (_a = {},
|
|
35807
|
+
_a[AxisPositions.LEFT] = false,
|
|
35808
|
+
_a[AxisPositions.RIGHT] = false,
|
|
35809
|
+
_a[AxisPositions.TOP] = false,
|
|
35810
|
+
_a[AxisPositions.BOTTOM] = false,
|
|
35811
|
+
_a);
|
|
35094
35812
|
if (configs) {
|
|
35095
35813
|
_this.configs = configs;
|
|
35096
35814
|
}
|
|
@@ -35518,11 +36236,13 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35518
36236
|
.select("g.axis." + axisPosition + " g.ticks g.tick")
|
|
35519
36237
|
.html();
|
|
35520
36238
|
container.selectAll('g.ticks g.tick').html(tick_html);
|
|
36239
|
+
var self_1 = this;
|
|
35521
36240
|
container
|
|
35522
36241
|
.selectAll('g.tick text')
|
|
35523
36242
|
.data(axisTickLabels)
|
|
35524
36243
|
.text(function (d) {
|
|
35525
36244
|
if (d.length > truncationThreshold) {
|
|
36245
|
+
self_1.truncation[axisPosition] = true;
|
|
35526
36246
|
return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
|
|
35527
36247
|
}
|
|
35528
36248
|
else {
|
|
@@ -35557,8 +36277,6 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35557
36277
|
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
35558
36278
|
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
35559
36279
|
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
35560
|
-
var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
|
|
35561
|
-
axisOptions.scaleType === ScaleTypes.TIME;
|
|
35562
36280
|
var self = this;
|
|
35563
36281
|
container
|
|
35564
36282
|
.selectAll('g.tick text')
|
|
@@ -35639,6 +36357,242 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35639
36357
|
}(component_Component));
|
|
35640
36358
|
|
|
35641
36359
|
//# sourceMappingURL=../../../src/components/axes/axis.js.map
|
|
36360
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/hover-axis.js
|
|
36361
|
+
var hover_axis_extends = (undefined && undefined.__extends) || (function () {
|
|
36362
|
+
var extendStatics = function (d, b) {
|
|
36363
|
+
extendStatics = Object.setPrototypeOf ||
|
|
36364
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
36365
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
36366
|
+
return extendStatics(d, b);
|
|
36367
|
+
};
|
|
36368
|
+
return function (d, b) {
|
|
36369
|
+
extendStatics(d, b);
|
|
36370
|
+
function __() { this.constructor = d; }
|
|
36371
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
36372
|
+
};
|
|
36373
|
+
})();
|
|
36374
|
+
var hover_axis_assign = (undefined && undefined.__assign) || function () {
|
|
36375
|
+
hover_axis_assign = Object.assign || function(t) {
|
|
36376
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
36377
|
+
s = arguments[i];
|
|
36378
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
36379
|
+
t[p] = s[p];
|
|
36380
|
+
}
|
|
36381
|
+
return t;
|
|
36382
|
+
};
|
|
36383
|
+
return hover_axis_assign.apply(this, arguments);
|
|
36384
|
+
};
|
|
36385
|
+
// Internal Imports
|
|
36386
|
+
|
|
36387
|
+
|
|
36388
|
+
|
|
36389
|
+
|
|
36390
|
+
|
|
36391
|
+
// D3 Imports
|
|
36392
|
+
|
|
36393
|
+
var hover_axis_HoverAxis = /** @class */ (function (_super) {
|
|
36394
|
+
hover_axis_extends(HoverAxis, _super);
|
|
36395
|
+
function HoverAxis(model, services, configs) {
|
|
36396
|
+
return _super.call(this, model, services, configs) || this;
|
|
36397
|
+
}
|
|
36398
|
+
HoverAxis.prototype.render = function (animate) {
|
|
36399
|
+
if (animate === void 0) { animate = true; }
|
|
36400
|
+
_super.prototype.render.call(this, animate);
|
|
36401
|
+
// Remove existing event listeners to avoid flashing behavior
|
|
36402
|
+
_super.prototype.destroy.call(this);
|
|
36403
|
+
var axisPosition = this.configs.position;
|
|
36404
|
+
var svg = this.getComponentContainer();
|
|
36405
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36406
|
+
var self = this;
|
|
36407
|
+
container.selectAll('g.tick').each(function (_, index) {
|
|
36408
|
+
var g = src_select(this);
|
|
36409
|
+
g.classed('tick-hover', true).attr('tabindex', index === 0 ? 0 : -1);
|
|
36410
|
+
var textNode = g.select('text');
|
|
36411
|
+
var _a = dom_utils_DOMUtils.getSVGElementSize(textNode, {
|
|
36412
|
+
useBBox: true,
|
|
36413
|
+
}), width = _a.width, height = _a.height;
|
|
36414
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(g, 'rect.axis-holder');
|
|
36415
|
+
var x = 0, y = 0;
|
|
36416
|
+
// Depending on axis position, apply correct translation & rotation to align the rect
|
|
36417
|
+
// with the text
|
|
36418
|
+
switch (axisPosition) {
|
|
36419
|
+
case AxisPositions.LEFT:
|
|
36420
|
+
x = -width + Number(textNode.attr('x'));
|
|
36421
|
+
y = -(height / 2);
|
|
36422
|
+
break;
|
|
36423
|
+
case AxisPositions.RIGHT:
|
|
36424
|
+
x = Math.abs(Number(textNode.attr('x')));
|
|
36425
|
+
y = -(height / 2);
|
|
36426
|
+
break;
|
|
36427
|
+
case AxisPositions.TOP:
|
|
36428
|
+
x = -(width / 2);
|
|
36429
|
+
y = -height + Number(textNode.attr('y')) / 2;
|
|
36430
|
+
if (self.truncation[axisPosition]) {
|
|
36431
|
+
x = 0;
|
|
36432
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36433
|
+
}
|
|
36434
|
+
break;
|
|
36435
|
+
case AxisPositions.BOTTOM:
|
|
36436
|
+
x = -(width / 2);
|
|
36437
|
+
y = height / 2 - 2;
|
|
36438
|
+
if (self.truncation[axisPosition]) {
|
|
36439
|
+
x = -width;
|
|
36440
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36441
|
+
}
|
|
36442
|
+
break;
|
|
36443
|
+
}
|
|
36444
|
+
// Translates x position -4 left to keep center after padding
|
|
36445
|
+
// Adds padding on left & right
|
|
36446
|
+
rectangle
|
|
36447
|
+
.attr('x', x - configuration_non_customizable_axis.hover.rectanglePadding)
|
|
36448
|
+
.attr('y', y)
|
|
36449
|
+
.attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
|
|
36450
|
+
.attr('height', height)
|
|
36451
|
+
.lower();
|
|
36452
|
+
// Add keyboard event listeners to each group element
|
|
36453
|
+
g.on('keydown', function (event) {
|
|
36454
|
+
// Choose specific arrow key depending on the axis
|
|
36455
|
+
if (axisPosition === AxisPositions.LEFT ||
|
|
36456
|
+
axisPosition === AxisPositions.RIGHT) {
|
|
36457
|
+
if (event.key && event.key === 'ArrowUp') {
|
|
36458
|
+
self.goNext(this, event);
|
|
36459
|
+
}
|
|
36460
|
+
else if (event.key && event.key === 'ArrowDown') {
|
|
36461
|
+
self.goPrevious(this, event);
|
|
36462
|
+
}
|
|
36463
|
+
}
|
|
36464
|
+
else {
|
|
36465
|
+
if (event.key && event.key === 'ArrowLeft') {
|
|
36466
|
+
self.goPrevious(this, event);
|
|
36467
|
+
}
|
|
36468
|
+
else if (event.key && event.key === 'ArrowRight') {
|
|
36469
|
+
self.goNext(this, event);
|
|
36470
|
+
}
|
|
36471
|
+
}
|
|
36472
|
+
});
|
|
36473
|
+
});
|
|
36474
|
+
// Add event listeners to element group
|
|
36475
|
+
this.addEventListeners();
|
|
36476
|
+
};
|
|
36477
|
+
HoverAxis.prototype.addEventListeners = function () {
|
|
36478
|
+
var svg = this.getComponentContainer();
|
|
36479
|
+
var axisPosition = this.configs.position;
|
|
36480
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36481
|
+
var options = this.getOptions();
|
|
36482
|
+
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
36483
|
+
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
36484
|
+
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
36485
|
+
var self = this;
|
|
36486
|
+
container
|
|
36487
|
+
.selectAll('g.tick.tick-hover')
|
|
36488
|
+
.on('mouseover', function (event) {
|
|
36489
|
+
var hoveredElement = src_select(this).select('text');
|
|
36490
|
+
var datum = hoveredElement.datum();
|
|
36491
|
+
// Dispatch mouse event
|
|
36492
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
|
|
36493
|
+
event: event,
|
|
36494
|
+
element: hoveredElement,
|
|
36495
|
+
datum: datum,
|
|
36496
|
+
});
|
|
36497
|
+
if (axisScaleType === ScaleTypes.LABELS &&
|
|
36498
|
+
datum.length > truncationThreshold) {
|
|
36499
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
36500
|
+
event: event,
|
|
36501
|
+
element: hoveredElement,
|
|
36502
|
+
datum: datum,
|
|
36503
|
+
});
|
|
36504
|
+
}
|
|
36505
|
+
})
|
|
36506
|
+
.on('mousemove', function (event) {
|
|
36507
|
+
var hoveredElement = src_select(this).select('text');
|
|
36508
|
+
var datum = hoveredElement.datum();
|
|
36509
|
+
// Dispatch mouse event
|
|
36510
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
|
|
36511
|
+
event: event,
|
|
36512
|
+
element: hoveredElement,
|
|
36513
|
+
datum: datum,
|
|
36514
|
+
});
|
|
36515
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
36516
|
+
event: event,
|
|
36517
|
+
});
|
|
36518
|
+
})
|
|
36519
|
+
.on('click', function (event) {
|
|
36520
|
+
// Dispatch mouse event
|
|
36521
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
|
|
36522
|
+
event: event,
|
|
36523
|
+
element: src_select(this).select('text'),
|
|
36524
|
+
datum: src_select(this).select('text').datum(),
|
|
36525
|
+
});
|
|
36526
|
+
})
|
|
36527
|
+
.on('mouseout', function (event) {
|
|
36528
|
+
// Dispatch mouse event
|
|
36529
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
|
|
36530
|
+
event: event,
|
|
36531
|
+
element: src_select(this).select('text'),
|
|
36532
|
+
datum: src_select(this).select('text').datum(),
|
|
36533
|
+
});
|
|
36534
|
+
if (axisScaleType === ScaleTypes.LABELS) {
|
|
36535
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE);
|
|
36536
|
+
}
|
|
36537
|
+
})
|
|
36538
|
+
.on('focus', function (event) {
|
|
36539
|
+
var coordinates = { clientX: 0, clientY: 0 };
|
|
36540
|
+
if (event.target) {
|
|
36541
|
+
// Focus element since we are using arrow keys
|
|
36542
|
+
event.target.focus();
|
|
36543
|
+
var boundingRect = event.target.getBoundingClientRect();
|
|
36544
|
+
coordinates.clientX = boundingRect.x;
|
|
36545
|
+
coordinates.clientY = boundingRect.y;
|
|
36546
|
+
}
|
|
36547
|
+
// Dispatch focus event
|
|
36548
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_FOCUS, {
|
|
36549
|
+
event: hover_axis_assign(hover_axis_assign({}, event), coordinates),
|
|
36550
|
+
element: src_select(this),
|
|
36551
|
+
datum: src_select(this).select('text').datum(),
|
|
36552
|
+
});
|
|
36553
|
+
})
|
|
36554
|
+
.on('blur', function (event) {
|
|
36555
|
+
// Dispatch blur event
|
|
36556
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
|
|
36557
|
+
event: event,
|
|
36558
|
+
element: src_select(this),
|
|
36559
|
+
datum: src_select(this).select('text').datum(),
|
|
36560
|
+
});
|
|
36561
|
+
});
|
|
36562
|
+
};
|
|
36563
|
+
// Focus on the next HTML element sibling
|
|
36564
|
+
HoverAxis.prototype.goNext = function (element, event) {
|
|
36565
|
+
if (element.nextElementSibling &&
|
|
36566
|
+
element.nextElementSibling.tagName !== 'path') {
|
|
36567
|
+
element.nextElementSibling.dispatchEvent(new Event('focus'));
|
|
36568
|
+
}
|
|
36569
|
+
event.preventDefault();
|
|
36570
|
+
};
|
|
36571
|
+
// Focus on the previous HTML element sibling
|
|
36572
|
+
HoverAxis.prototype.goPrevious = function (element, event) {
|
|
36573
|
+
if (element.previousElementSibling &&
|
|
36574
|
+
element.previousElementSibling.tagName !== 'path') {
|
|
36575
|
+
element.previousElementSibling.dispatchEvent(new Event('focus'));
|
|
36576
|
+
}
|
|
36577
|
+
event.preventDefault();
|
|
36578
|
+
};
|
|
36579
|
+
HoverAxis.prototype.destroy = function () {
|
|
36580
|
+
var svg = this.getComponentContainer();
|
|
36581
|
+
var axisPosition = this.configs.position;
|
|
36582
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36583
|
+
// Remove event listeners
|
|
36584
|
+
container
|
|
36585
|
+
.selectAll('g.tick.tick-hover')
|
|
36586
|
+
.on('mouseover', null)
|
|
36587
|
+
.on('mousemove', null)
|
|
36588
|
+
.on('mouseout', null)
|
|
36589
|
+
.on('focus', null)
|
|
36590
|
+
.on('blur', null);
|
|
36591
|
+
};
|
|
36592
|
+
return HoverAxis;
|
|
36593
|
+
}(axis_Axis));
|
|
36594
|
+
|
|
36595
|
+
//# sourceMappingURL=../../../src/components/axes/hover-axis.js.map
|
|
35642
36596
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/two-dimensional-axes.js
|
|
35643
36597
|
var two_dimensional_axes_extends = (undefined && undefined.__extends) || (function () {
|
|
35644
36598
|
var extendStatics = function (d, b) {
|
|
@@ -35660,6 +36614,7 @@ var two_dimensional_axes_extends = (undefined && undefined.__extends) || (functi
|
|
|
35660
36614
|
|
|
35661
36615
|
|
|
35662
36616
|
|
|
36617
|
+
|
|
35663
36618
|
var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
35664
36619
|
two_dimensional_axes_extends(TwoDimensionalAxes, _super);
|
|
35665
36620
|
function TwoDimensionalAxes() {
|
|
@@ -35694,11 +36649,14 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35694
36649
|
var axisPosition = AxisPositions[axisPositionKey];
|
|
35695
36650
|
if (_this.configs.axes[axisPosition] &&
|
|
35696
36651
|
!_this.children[axisPosition]) {
|
|
35697
|
-
var
|
|
36652
|
+
var configs = {
|
|
35698
36653
|
position: axisPosition,
|
|
35699
36654
|
axes: _this.configs.axes,
|
|
35700
36655
|
margins: _this.margins,
|
|
35701
|
-
}
|
|
36656
|
+
};
|
|
36657
|
+
var axisComponent = _this.model.axisFlavor === AxisFlavor.DEFAULT
|
|
36658
|
+
? new axis_Axis(_this.model, _this.services, configs)
|
|
36659
|
+
: new hover_axis_HoverAxis(_this.model, _this.services, configs);
|
|
35702
36660
|
// Set model, services & parent for the new axis component
|
|
35703
36661
|
axisComponent.setModel(_this.model);
|
|
35704
36662
|
axisComponent.setServices(_this.services);
|
|
@@ -35749,6 +36707,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35749
36707
|
break;
|
|
35750
36708
|
}
|
|
35751
36709
|
});
|
|
36710
|
+
this.services.events.dispatchEvent(Events.Axis.RENDER_COMPLETE);
|
|
35752
36711
|
// If the new margins are different than the existing ones
|
|
35753
36712
|
var isNotEqual = Object.keys(margins).some(function (marginKey) {
|
|
35754
36713
|
return _this.margins[marginKey] !== margins[marginKey];
|
|
@@ -39792,6 +40751,7 @@ var tee = {
|
|
|
39792
40751
|
|
|
39793
40752
|
|
|
39794
40753
|
|
|
40754
|
+
|
|
39795
40755
|
// GRAPHS
|
|
39796
40756
|
|
|
39797
40757
|
|
|
@@ -39815,6 +40775,7 @@ var tee = {
|
|
|
39815
40775
|
|
|
39816
40776
|
|
|
39817
40777
|
|
|
40778
|
+
|
|
39818
40779
|
|
|
39819
40780
|
|
|
39820
40781
|
// Layout
|
|
@@ -40068,7 +41029,9 @@ var cartesian_charts_spreadArrays = (undefined && undefined.__spreadArrays) || f
|
|
|
40068
41029
|
var cartesian_charts_ChartModelCartesian = /** @class */ (function (_super) {
|
|
40069
41030
|
cartesian_charts_extends(ChartModelCartesian, _super);
|
|
40070
41031
|
function ChartModelCartesian(services) {
|
|
40071
|
-
|
|
41032
|
+
var _this = _super.call(this, services) || this;
|
|
41033
|
+
_this.axisFlavor = AxisFlavor.DEFAULT;
|
|
41034
|
+
return _this;
|
|
40072
41035
|
}
|
|
40073
41036
|
// get the scales information
|
|
40074
41037
|
// needed for getTabularArray()
|
|
@@ -42996,6 +43959,493 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
42996
43959
|
}(chart_Chart));
|
|
42997
43960
|
|
|
42998
43961
|
//# sourceMappingURL=../../src/charts/alluvial.js.map
|
|
43962
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-scale/src/quantize.js
|
|
43963
|
+
|
|
43964
|
+
|
|
43965
|
+
|
|
43966
|
+
|
|
43967
|
+
function quantize_quantize() {
|
|
43968
|
+
var x0 = 0,
|
|
43969
|
+
x1 = 1,
|
|
43970
|
+
n = 1,
|
|
43971
|
+
domain = [0.5],
|
|
43972
|
+
range = [0, 1],
|
|
43973
|
+
unknown;
|
|
43974
|
+
|
|
43975
|
+
function scale(x) {
|
|
43976
|
+
return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
|
43977
|
+
}
|
|
43978
|
+
|
|
43979
|
+
function rescale() {
|
|
43980
|
+
var i = -1;
|
|
43981
|
+
domain = new Array(n);
|
|
43982
|
+
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
|
43983
|
+
return scale;
|
|
43984
|
+
}
|
|
43985
|
+
|
|
43986
|
+
scale.domain = function(_) {
|
|
43987
|
+
return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
|
|
43988
|
+
};
|
|
43989
|
+
|
|
43990
|
+
scale.range = function(_) {
|
|
43991
|
+
return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
|
|
43992
|
+
};
|
|
43993
|
+
|
|
43994
|
+
scale.invertExtent = function(y) {
|
|
43995
|
+
var i = range.indexOf(y);
|
|
43996
|
+
return i < 0 ? [NaN, NaN]
|
|
43997
|
+
: i < 1 ? [x0, domain[0]]
|
|
43998
|
+
: i >= n ? [domain[n - 1], x1]
|
|
43999
|
+
: [domain[i - 1], domain[i]];
|
|
44000
|
+
};
|
|
44001
|
+
|
|
44002
|
+
scale.unknown = function(_) {
|
|
44003
|
+
return arguments.length ? (unknown = _, scale) : scale;
|
|
44004
|
+
};
|
|
44005
|
+
|
|
44006
|
+
scale.thresholds = function() {
|
|
44007
|
+
return domain.slice();
|
|
44008
|
+
};
|
|
44009
|
+
|
|
44010
|
+
scale.copy = function() {
|
|
44011
|
+
return quantize_quantize()
|
|
44012
|
+
.domain([x0, x1])
|
|
44013
|
+
.range(range)
|
|
44014
|
+
.unknown(unknown);
|
|
44015
|
+
};
|
|
44016
|
+
|
|
44017
|
+
return initRange.apply(linearish(scale), arguments);
|
|
44018
|
+
}
|
|
44019
|
+
|
|
44020
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/model/heatmap.js
|
|
44021
|
+
var model_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44022
|
+
var extendStatics = function (d, b) {
|
|
44023
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44024
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44025
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44026
|
+
return extendStatics(d, b);
|
|
44027
|
+
};
|
|
44028
|
+
return function (d, b) {
|
|
44029
|
+
extendStatics(d, b);
|
|
44030
|
+
function __() { this.constructor = d; }
|
|
44031
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44032
|
+
};
|
|
44033
|
+
})();
|
|
44034
|
+
var heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44035
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44036
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44037
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44038
|
+
r[k] = a[j];
|
|
44039
|
+
return r;
|
|
44040
|
+
};
|
|
44041
|
+
// Internal Imports
|
|
44042
|
+
|
|
44043
|
+
|
|
44044
|
+
|
|
44045
|
+
// d3 imports
|
|
44046
|
+
|
|
44047
|
+
|
|
44048
|
+
/** The gauge chart model layer */
|
|
44049
|
+
var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
44050
|
+
model_heatmap_extends(HeatmapModel, _super);
|
|
44051
|
+
function HeatmapModel(services) {
|
|
44052
|
+
var _this = _super.call(this, services) || this;
|
|
44053
|
+
_this.axisFlavor = AxisFlavor.HOVERABLE;
|
|
44054
|
+
_this._colorScale = undefined;
|
|
44055
|
+
// List of unique ranges and domains
|
|
44056
|
+
_this._domains = [];
|
|
44057
|
+
_this._ranges = [];
|
|
44058
|
+
_this._matrix = {};
|
|
44059
|
+
// Check which scale types are being used
|
|
44060
|
+
var axis = tools_Tools.getProperty(_this.getOptions(), 'axes');
|
|
44061
|
+
// Need to check options since scale service hasn't been instantiated
|
|
44062
|
+
if ((!!tools_Tools.getProperty(axis, 'left', 'scaleType') &&
|
|
44063
|
+
tools_Tools.getProperty(axis, 'left', 'scaleType') !==
|
|
44064
|
+
ScaleTypes.LABELS) ||
|
|
44065
|
+
(!!tools_Tools.getProperty(axis, 'right', 'scaleType') &&
|
|
44066
|
+
tools_Tools.getProperty(axis, 'right', 'scaleType') !==
|
|
44067
|
+
ScaleTypes.LABELS) ||
|
|
44068
|
+
(!!tools_Tools.getProperty(axis, 'top', 'scaleType') &&
|
|
44069
|
+
tools_Tools.getProperty(axis, 'top', 'scaleType') !==
|
|
44070
|
+
ScaleTypes.LABELS) ||
|
|
44071
|
+
(!!tools_Tools.getProperty(axis, 'bottom', 'scaleType') &&
|
|
44072
|
+
tools_Tools.getProperty(axis, 'bottom', 'scaleType') !==
|
|
44073
|
+
ScaleTypes.LABELS)) {
|
|
44074
|
+
throw Error('Heatmap only supports label scaletypes.');
|
|
44075
|
+
}
|
|
44076
|
+
return _this;
|
|
44077
|
+
}
|
|
44078
|
+
/**
|
|
44079
|
+
* Get min and maximum value of the display data
|
|
44080
|
+
* @returns Array consisting of smallest and largest values in data
|
|
44081
|
+
*/
|
|
44082
|
+
HeatmapModel.prototype.getValueDomain = function () {
|
|
44083
|
+
var data = this.getDisplayData().map(function (element) { return element.value; });
|
|
44084
|
+
var limits = src_extent(data);
|
|
44085
|
+
var domain = [];
|
|
44086
|
+
// Round extent values to the nearest multiple of 10
|
|
44087
|
+
// Axis rounds values to multiples of 2, 5, and 10s.
|
|
44088
|
+
limits.forEach(function (number, index) {
|
|
44089
|
+
var value = Number(number);
|
|
44090
|
+
if (index === 0 && value >= 0) {
|
|
44091
|
+
value = 0;
|
|
44092
|
+
}
|
|
44093
|
+
else if (value % 10 === 0 || value === 0) {
|
|
44094
|
+
value;
|
|
44095
|
+
}
|
|
44096
|
+
else if (value < 0) {
|
|
44097
|
+
value = Math.floor(value / 10) * 10;
|
|
44098
|
+
}
|
|
44099
|
+
else {
|
|
44100
|
+
value = Math.ceil(value / 10) * 10;
|
|
44101
|
+
}
|
|
44102
|
+
domain.push(value);
|
|
44103
|
+
});
|
|
44104
|
+
// Ensure the median of the range is 0
|
|
44105
|
+
if (domain[0] < 0 && domain[1] > 0) {
|
|
44106
|
+
if (Math.abs(domain[0]) > domain[1]) {
|
|
44107
|
+
domain[1] = Math.abs(domain[0]);
|
|
44108
|
+
}
|
|
44109
|
+
else {
|
|
44110
|
+
domain[0] = -domain[1];
|
|
44111
|
+
}
|
|
44112
|
+
}
|
|
44113
|
+
return domain;
|
|
44114
|
+
};
|
|
44115
|
+
/**
|
|
44116
|
+
* @override
|
|
44117
|
+
* @param value
|
|
44118
|
+
* @returns
|
|
44119
|
+
*/
|
|
44120
|
+
HeatmapModel.prototype.getFillColor = function (value) {
|
|
44121
|
+
return this._colorScale(value);
|
|
44122
|
+
};
|
|
44123
|
+
/**
|
|
44124
|
+
* Generate a list of all unique domains
|
|
44125
|
+
* @returns String[]
|
|
44126
|
+
*/
|
|
44127
|
+
HeatmapModel.prototype.getUniqueDomain = function () {
|
|
44128
|
+
if (tools_Tools.isEmpty(this._domains)) {
|
|
44129
|
+
var displayData = this.getDisplayData();
|
|
44130
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44131
|
+
var domainIdentifier_1 = cartesianScales.getDomainIdentifier();
|
|
44132
|
+
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
44133
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainXAxisPosition);
|
|
44134
|
+
// Use user defined domain if specified
|
|
44135
|
+
if (!!customDomain) {
|
|
44136
|
+
return customDomain;
|
|
44137
|
+
}
|
|
44138
|
+
// Get unique axis values & create a matrix
|
|
44139
|
+
this._domains = Array.from(new Set(displayData.map(function (d) {
|
|
44140
|
+
return d[domainIdentifier_1];
|
|
44141
|
+
})));
|
|
44142
|
+
}
|
|
44143
|
+
return this._domains;
|
|
44144
|
+
};
|
|
44145
|
+
/**
|
|
44146
|
+
* Generates a list of all unique ranges
|
|
44147
|
+
* @returns String[]
|
|
44148
|
+
*/
|
|
44149
|
+
HeatmapModel.prototype.getUniqueRanges = function () {
|
|
44150
|
+
if (tools_Tools.isEmpty(this._ranges)) {
|
|
44151
|
+
var displayData = this.getDisplayData();
|
|
44152
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44153
|
+
var rangeIdentifier_1 = cartesianScales.getRangeIdentifier();
|
|
44154
|
+
var mainYAxisPosition = cartesianScales.getMainYAxisPosition();
|
|
44155
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainYAxisPosition);
|
|
44156
|
+
// Use user defined domain if specified
|
|
44157
|
+
if (!!customDomain) {
|
|
44158
|
+
return customDomain;
|
|
44159
|
+
}
|
|
44160
|
+
// Get unique axis values & create a matrix
|
|
44161
|
+
this._ranges = Array.from(new Set(displayData.map(function (d) {
|
|
44162
|
+
return d[rangeIdentifier_1];
|
|
44163
|
+
})));
|
|
44164
|
+
}
|
|
44165
|
+
return this._ranges;
|
|
44166
|
+
};
|
|
44167
|
+
/**
|
|
44168
|
+
* Generates a matrix (If doesn't exist) and returns it
|
|
44169
|
+
* @returns Object
|
|
44170
|
+
*/
|
|
44171
|
+
HeatmapModel.prototype.getMatrix = function () {
|
|
44172
|
+
var _this = this;
|
|
44173
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44174
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44175
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44176
|
+
var domainIdentifier_2 = this.services.cartesianScales.getDomainIdentifier();
|
|
44177
|
+
var rangeIdentifier_2 = this.services.cartesianScales.getRangeIdentifier();
|
|
44178
|
+
// Create a column
|
|
44179
|
+
var range_1 = {};
|
|
44180
|
+
uniqueRange.forEach(function (ran) {
|
|
44181
|
+
// Initialize matrix to empty state
|
|
44182
|
+
range_1[ran] = {
|
|
44183
|
+
value: null,
|
|
44184
|
+
index: -1,
|
|
44185
|
+
};
|
|
44186
|
+
});
|
|
44187
|
+
// Complete the matrix by cloning the column to all domains
|
|
44188
|
+
uniqueDomain.forEach(function (dom) {
|
|
44189
|
+
_this._matrix[dom] = tools_Tools.clone(range_1);
|
|
44190
|
+
});
|
|
44191
|
+
// Fill in user passed data
|
|
44192
|
+
this.getDisplayData().forEach(function (d, i) {
|
|
44193
|
+
_this._matrix[d[domainIdentifier_2]][d[rangeIdentifier_2]] = {
|
|
44194
|
+
value: d['value'],
|
|
44195
|
+
index: i,
|
|
44196
|
+
};
|
|
44197
|
+
});
|
|
44198
|
+
}
|
|
44199
|
+
return this._matrix;
|
|
44200
|
+
};
|
|
44201
|
+
/**
|
|
44202
|
+
*
|
|
44203
|
+
* @param newData The new raw data to be set
|
|
44204
|
+
*/
|
|
44205
|
+
HeatmapModel.prototype.setData = function (newData) {
|
|
44206
|
+
var sanitizedData = this.sanitize(tools_Tools.clone(newData));
|
|
44207
|
+
var dataGroups = this.generateDataGroups(sanitizedData);
|
|
44208
|
+
this.set({
|
|
44209
|
+
data: sanitizedData,
|
|
44210
|
+
dataGroups: dataGroups,
|
|
44211
|
+
});
|
|
44212
|
+
// Set attributes to empty
|
|
44213
|
+
this._domains = [];
|
|
44214
|
+
this._ranges = [];
|
|
44215
|
+
this._matrix = {};
|
|
44216
|
+
return sanitizedData;
|
|
44217
|
+
};
|
|
44218
|
+
/**
|
|
44219
|
+
* Converts Object matrix into a single array
|
|
44220
|
+
* @returns Object[]
|
|
44221
|
+
*/
|
|
44222
|
+
HeatmapModel.prototype.getMatrixAsArray = function () {
|
|
44223
|
+
var _this = this;
|
|
44224
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44225
|
+
this.getMatrix();
|
|
44226
|
+
}
|
|
44227
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44228
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44229
|
+
var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
|
|
44230
|
+
var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
|
|
44231
|
+
var arr = [];
|
|
44232
|
+
uniqueDomain.forEach(function (domain) {
|
|
44233
|
+
uniqueRange.forEach(function (range) {
|
|
44234
|
+
var element = {
|
|
44235
|
+
value: _this._matrix[domain][range].value,
|
|
44236
|
+
index: _this._matrix[domain][range].index,
|
|
44237
|
+
};
|
|
44238
|
+
element[domainIdentifier] = domain;
|
|
44239
|
+
element[rangeIdentifier] = range;
|
|
44240
|
+
arr.push(element);
|
|
44241
|
+
});
|
|
44242
|
+
});
|
|
44243
|
+
return arr;
|
|
44244
|
+
};
|
|
44245
|
+
/**
|
|
44246
|
+
* Generate tabular data from display data
|
|
44247
|
+
* @returns Array<Object>
|
|
44248
|
+
*/
|
|
44249
|
+
HeatmapModel.prototype.getTabularDataArray = function () {
|
|
44250
|
+
var displayData = this.getDisplayData();
|
|
44251
|
+
var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
|
|
44252
|
+
var domainValueFormatter;
|
|
44253
|
+
var result = heatmap_spreadArrays([
|
|
44254
|
+
[primaryDomain.label, primaryRange.label, 'Value']
|
|
44255
|
+
], displayData.map(function (datum) { return [
|
|
44256
|
+
datum[primaryDomain.identifier] === null
|
|
44257
|
+
? '–'
|
|
44258
|
+
: domainValueFormatter
|
|
44259
|
+
? domainValueFormatter(datum[primaryDomain.identifier])
|
|
44260
|
+
: datum[primaryDomain.identifier],
|
|
44261
|
+
datum[primaryRange.identifier] === null
|
|
44262
|
+
? '–'
|
|
44263
|
+
: datum[primaryRange.identifier].toLocaleString(),
|
|
44264
|
+
datum['value'],
|
|
44265
|
+
]; }));
|
|
44266
|
+
return result;
|
|
44267
|
+
};
|
|
44268
|
+
// Uses quantize scale to return class names
|
|
44269
|
+
HeatmapModel.prototype.getColorClassName = function (configs) {
|
|
44270
|
+
return configs.originalClassName + " " + this._colorScale(configs.value);
|
|
44271
|
+
};
|
|
44272
|
+
HeatmapModel.prototype.setColorClassNames = function () {
|
|
44273
|
+
var options = this.getOptions();
|
|
44274
|
+
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
44275
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
44276
|
+
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
44277
|
+
// If domain consists of negative and positive values, use diverging palettes
|
|
44278
|
+
var domain = this.getValueDomain();
|
|
44279
|
+
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
44280
|
+
// Use default color pairing options if not in defined range
|
|
44281
|
+
if (colorPairingOption < 1 &&
|
|
44282
|
+
colorPairingOption > 4 &&
|
|
44283
|
+
colorScheme === 'mono') {
|
|
44284
|
+
colorPairingOption = 1;
|
|
44285
|
+
}
|
|
44286
|
+
else if (colorPairingOption < 1 &&
|
|
44287
|
+
colorPairingOption > 2 &&
|
|
44288
|
+
colorScheme === 'diverge') {
|
|
44289
|
+
colorPairingOption = 1;
|
|
44290
|
+
}
|
|
44291
|
+
// Uses css classes for fill
|
|
44292
|
+
var colorPairing = customColorsEnabled ? customColors : [];
|
|
44293
|
+
if (!customColorsEnabled) {
|
|
44294
|
+
// Add class names to list and the amount based on the color scheme
|
|
44295
|
+
// Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
|
|
44296
|
+
var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
|
|
44297
|
+
for (var i = 1; i < colorGroupingLength + 1; i++) {
|
|
44298
|
+
colorPairing.push("fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
|
|
44299
|
+
}
|
|
44300
|
+
}
|
|
44301
|
+
// Save scale type
|
|
44302
|
+
this._colorScale = quantize_quantize()
|
|
44303
|
+
.domain(this.getValueDomain())
|
|
44304
|
+
.range(colorPairing);
|
|
44305
|
+
};
|
|
44306
|
+
return HeatmapModel;
|
|
44307
|
+
}(cartesian_charts_ChartModelCartesian));
|
|
44308
|
+
|
|
44309
|
+
//# sourceMappingURL=../../src/model/heatmap.js.map
|
|
44310
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/heatmap.js
|
|
44311
|
+
var charts_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44312
|
+
var extendStatics = function (d, b) {
|
|
44313
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44314
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44315
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44316
|
+
return extendStatics(d, b);
|
|
44317
|
+
};
|
|
44318
|
+
return function (d, b) {
|
|
44319
|
+
extendStatics(d, b);
|
|
44320
|
+
function __() { this.constructor = d; }
|
|
44321
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44322
|
+
};
|
|
44323
|
+
})();
|
|
44324
|
+
var charts_heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44325
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44326
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44327
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44328
|
+
r[k] = a[j];
|
|
44329
|
+
return r;
|
|
44330
|
+
};
|
|
44331
|
+
// Internal Imports
|
|
44332
|
+
|
|
44333
|
+
|
|
44334
|
+
|
|
44335
|
+
|
|
44336
|
+
|
|
44337
|
+
|
|
44338
|
+
var heatmap_HeatmapChart = /** @class */ (function (_super) {
|
|
44339
|
+
charts_heatmap_extends(HeatmapChart, _super);
|
|
44340
|
+
function HeatmapChart(holder, chartConfigs) {
|
|
44341
|
+
var _this = _super.call(this, holder, chartConfigs) || this;
|
|
44342
|
+
_this.model = new heatmap_HeatmapModel(_this.services);
|
|
44343
|
+
// Merge the default options for this chart
|
|
44344
|
+
// With the user provided options
|
|
44345
|
+
_this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.heatmapChart, chartConfigs.options));
|
|
44346
|
+
// Initialize data, services, components etc.
|
|
44347
|
+
_this.init(holder, chartConfigs);
|
|
44348
|
+
return _this;
|
|
44349
|
+
}
|
|
44350
|
+
// Custom getChartComponents - Implements getChartComponents
|
|
44351
|
+
// Removes zoombar support and additional `features` that are not supported in heatmap
|
|
44352
|
+
HeatmapChart.prototype.getAxisChartComponents = function (graphFrameComponents, configs) {
|
|
44353
|
+
var options = this.model.getOptions();
|
|
44354
|
+
var toolbarEnabled = tools_Tools.getProperty(options, 'toolbar', 'enabled');
|
|
44355
|
+
this.services.cartesianScales.determineAxisDuality();
|
|
44356
|
+
this.services.cartesianScales.findDomainAndRangeAxes(); // need to do this before getMainXAxisPosition()
|
|
44357
|
+
this.services.cartesianScales.determineOrientation();
|
|
44358
|
+
var titleAvailable = !!this.model.getOptions().title;
|
|
44359
|
+
var titleComponent = {
|
|
44360
|
+
id: 'title',
|
|
44361
|
+
components: [new title_Title(this.model, this.services)],
|
|
44362
|
+
growth: LayoutGrowth.STRETCH,
|
|
44363
|
+
};
|
|
44364
|
+
var toolbarComponent = {
|
|
44365
|
+
id: 'toolbar',
|
|
44366
|
+
components: [new toolbar_Toolbar(this.model, this.services)],
|
|
44367
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44368
|
+
};
|
|
44369
|
+
var headerComponent = {
|
|
44370
|
+
id: 'header',
|
|
44371
|
+
components: [
|
|
44372
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays([
|
|
44373
|
+
// always add title to keep layout correct
|
|
44374
|
+
titleComponent
|
|
44375
|
+
], (toolbarEnabled ? [toolbarComponent] : [])), {
|
|
44376
|
+
direction: LayoutDirection.ROW,
|
|
44377
|
+
alignItems: LayoutAlignItems.CENTER,
|
|
44378
|
+
}),
|
|
44379
|
+
],
|
|
44380
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44381
|
+
};
|
|
44382
|
+
var legendComponent = {
|
|
44383
|
+
id: 'legend',
|
|
44384
|
+
components: [new color_scale_legend_ColorScaleLegend(this.model, this.services)],
|
|
44385
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44386
|
+
renderType: RenderTypes.SVG,
|
|
44387
|
+
};
|
|
44388
|
+
var graphFrameComponent = {
|
|
44389
|
+
id: 'graph-frame',
|
|
44390
|
+
components: graphFrameComponents,
|
|
44391
|
+
growth: LayoutGrowth.STRETCH,
|
|
44392
|
+
renderType: RenderTypes.SVG,
|
|
44393
|
+
};
|
|
44394
|
+
var isLegendEnabled = tools_Tools.getProperty(configs, 'legend', 'enabled') !== false &&
|
|
44395
|
+
this.model.getOptions().legend.enabled !== false;
|
|
44396
|
+
// Decide the position of the legend in reference to the chart
|
|
44397
|
+
var fullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;
|
|
44398
|
+
var legendSpacerComponent = {
|
|
44399
|
+
id: 'spacer',
|
|
44400
|
+
components: [new spacer_Spacer(this.model, this.services, { size: 15 })],
|
|
44401
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44402
|
+
};
|
|
44403
|
+
var fullFrameComponent = {
|
|
44404
|
+
id: 'full-frame',
|
|
44405
|
+
components: [
|
|
44406
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays((isLegendEnabled ? [legendComponent] : []), (isLegendEnabled ? [legendSpacerComponent] : []), [
|
|
44407
|
+
graphFrameComponent,
|
|
44408
|
+
]), {
|
|
44409
|
+
direction: fullFrameComponentDirection,
|
|
44410
|
+
}),
|
|
44411
|
+
],
|
|
44412
|
+
growth: LayoutGrowth.STRETCH,
|
|
44413
|
+
};
|
|
44414
|
+
var topLevelLayoutComponents = [];
|
|
44415
|
+
// header component is required for either title or toolbar
|
|
44416
|
+
if (titleAvailable || toolbarEnabled) {
|
|
44417
|
+
topLevelLayoutComponents.push(headerComponent);
|
|
44418
|
+
var titleSpacerComponent = {
|
|
44419
|
+
id: 'spacer',
|
|
44420
|
+
components: [
|
|
44421
|
+
new spacer_Spacer(this.model, this.services, toolbarEnabled ? { size: 15 } : undefined),
|
|
44422
|
+
],
|
|
44423
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44424
|
+
};
|
|
44425
|
+
topLevelLayoutComponents.push(titleSpacerComponent);
|
|
44426
|
+
}
|
|
44427
|
+
topLevelLayoutComponents.push(fullFrameComponent);
|
|
44428
|
+
return [
|
|
44429
|
+
new tooltip_axis_AxisChartsTooltip(this.model, this.services),
|
|
44430
|
+
new essentials_modal_Modal(this.model, this.services),
|
|
44431
|
+
new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
|
|
44432
|
+
direction: LayoutDirection.COLUMN,
|
|
44433
|
+
}),
|
|
44434
|
+
];
|
|
44435
|
+
};
|
|
44436
|
+
HeatmapChart.prototype.getComponents = function () {
|
|
44437
|
+
// Specify what to render inside the graph-frame
|
|
44438
|
+
var graphFrameComponents = [
|
|
44439
|
+
new two_dimensional_axes_TwoDimensionalAxes(this.model, this.services),
|
|
44440
|
+
new heatmap_Heatmap(this.model, this.services),
|
|
44441
|
+
];
|
|
44442
|
+
var components = this.getAxisChartComponents(graphFrameComponents);
|
|
44443
|
+
return components;
|
|
44444
|
+
};
|
|
44445
|
+
return HeatmapChart;
|
|
44446
|
+
}(axis_chart_AxisChart));
|
|
44447
|
+
|
|
44448
|
+
//# sourceMappingURL=../../src/charts/heatmap.js.map
|
|
42999
44449
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
|
|
43000
44450
|
|
|
43001
44451
|
|
|
@@ -43018,6 +44468,7 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
43018
44468
|
|
|
43019
44469
|
|
|
43020
44470
|
|
|
44471
|
+
|
|
43021
44472
|
|
|
43022
44473
|
|
|
43023
44474
|
//# sourceMappingURL=../../src/charts/index.js.map
|
|
@@ -44229,6 +45680,52 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44229
45680
|
)
|
|
44230
45681
|
|
|
44231
45682
|
/* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
|
|
45683
|
+
// 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&
|
|
45684
|
+
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"})}
|
|
45685
|
+
var ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns = []
|
|
45686
|
+
|
|
45687
|
+
|
|
45688
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
|
|
45689
|
+
|
|
45690
|
+
// 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&
|
|
45691
|
+
//
|
|
45692
|
+
//
|
|
45693
|
+
//
|
|
45694
|
+
//
|
|
45695
|
+
|
|
45696
|
+
|
|
45697
|
+
/* harmony default export */ var ccv_heatmap_chartvue_type_script_lang_js_ = ({
|
|
45698
|
+
name: 'CcvHeatmapChart',
|
|
45699
|
+
extends: ccv_base_chart,
|
|
45700
|
+
mounted: function mounted() {
|
|
45701
|
+
this.coreChart = new heatmap_HeatmapChart(this.$el, {
|
|
45702
|
+
data: this.data,
|
|
45703
|
+
options: this.options
|
|
45704
|
+
});
|
|
45705
|
+
}
|
|
45706
|
+
});
|
|
45707
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
|
|
45708
|
+
/* harmony default export */ var src_ccv_heatmap_chartvue_type_script_lang_js_ = (ccv_heatmap_chartvue_type_script_lang_js_);
|
|
45709
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue
|
|
45710
|
+
|
|
45711
|
+
|
|
45712
|
+
|
|
45713
|
+
|
|
45714
|
+
|
|
45715
|
+
/* normalize component */
|
|
45716
|
+
|
|
45717
|
+
var ccv_heatmap_chart_component = normalizeComponent(
|
|
45718
|
+
src_ccv_heatmap_chartvue_type_script_lang_js_,
|
|
45719
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_render,
|
|
45720
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns,
|
|
45721
|
+
false,
|
|
45722
|
+
null,
|
|
45723
|
+
null,
|
|
45724
|
+
null
|
|
45725
|
+
|
|
45726
|
+
)
|
|
45727
|
+
|
|
45728
|
+
/* harmony default export */ var ccv_heatmap_chart = (ccv_heatmap_chart_component.exports);
|
|
44232
45729
|
// CONCATENATED MODULE: ./src/index.js
|
|
44233
45730
|
|
|
44234
45731
|
|
|
@@ -44263,7 +45760,8 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44263
45760
|
|
|
44264
45761
|
|
|
44265
45762
|
|
|
44266
|
-
|
|
45763
|
+
|
|
45764
|
+
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];
|
|
44267
45765
|
/*
|
|
44268
45766
|
Allows the module to be used as a Vue plug-in, and has an install()
|
|
44269
45767
|
method (which is called when the plug-in loads) that registers all the
|
|
@@ -44363,6 +45861,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
|
|
|
44363
45861
|
/* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
|
|
44364
45862
|
/* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
|
|
44365
45863
|
/* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
|
|
45864
|
+
/* concated harmony reexport CcvHeatmapChart */__webpack_require__.d(__webpack_exports__, "CcvHeatmapChart", function() { return ccv_heatmap_chart; });
|
|
44366
45865
|
|
|
44367
45866
|
|
|
44368
45867
|
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
|