@carbon/charts-vue 0.53.3 → 0.54.1
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 +1790 -240
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +1790 -240
- 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; });
|
|
@@ -441,6 +443,7 @@ var events_Toolbar;
|
|
|
441
443
|
(function (Toolbar) {
|
|
442
444
|
Toolbar["SHOW_OVERFLOW_MENU"] = "show-toolbar-overflow-menu";
|
|
443
445
|
Toolbar["HIDE_OVERFLOW_MENU"] = "hide-toolbar-overflow-menu";
|
|
446
|
+
Toolbar["BUTTON_CLICK"] = "toolbar-button-click";
|
|
444
447
|
})(events_Toolbar || (events_Toolbar = {}));
|
|
445
448
|
/**
|
|
446
449
|
* enum of all events related to the zoom-bar
|
|
@@ -476,6 +479,9 @@ var events_Axis;
|
|
|
476
479
|
Axis["LABEL_MOUSEMOVE"] = "axis-label-mousemove";
|
|
477
480
|
Axis["LABEL_CLICK"] = "axis-label-click";
|
|
478
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";
|
|
479
485
|
})(events_Axis || (events_Axis = {}));
|
|
480
486
|
/**
|
|
481
487
|
* enum of all area graph events
|
|
@@ -651,6 +657,16 @@ var events_Meter;
|
|
|
651
657
|
Meter["METER_MOUSEOUT"] = "meter-mouseout";
|
|
652
658
|
Meter["METER_MOUSEMOVE"] = "meter-mousemove";
|
|
653
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 = {}));
|
|
654
670
|
//# sourceMappingURL=../../src/interfaces/events.js.map
|
|
655
671
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/enums.js
|
|
656
672
|
|
|
@@ -884,6 +900,7 @@ var ToolbarControlTypes;
|
|
|
884
900
|
ToolbarControlTypes["RESET_ZOOM"] = "Reset zoom";
|
|
885
901
|
ToolbarControlTypes["MAKE_FULLSCREEN"] = "Make fullscreen";
|
|
886
902
|
ToolbarControlTypes["SHOW_AS_DATATABLE"] = "Show as data-table";
|
|
903
|
+
ToolbarControlTypes["CUSTOM"] = "Custom";
|
|
887
904
|
})(ToolbarControlTypes || (ToolbarControlTypes = {}));
|
|
888
905
|
/**
|
|
889
906
|
* enum of title orientations for _vertical axes_
|
|
@@ -906,6 +923,31 @@ var LegendItemType;
|
|
|
906
923
|
LegendItemType["QUARTILE"] = "quartile";
|
|
907
924
|
LegendItemType["ZOOM"] = "zoom";
|
|
908
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 = {}));
|
|
909
951
|
//# sourceMappingURL=../../src/interfaces/enums.js.map
|
|
910
952
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/index.js
|
|
911
953
|
|
|
@@ -946,6 +988,9 @@ var configuration_non_customizable_axis = {
|
|
|
946
988
|
compareTo: 'marker',
|
|
947
989
|
},
|
|
948
990
|
paddingRatio: 0.1,
|
|
991
|
+
hover: {
|
|
992
|
+
rectanglePadding: 4,
|
|
993
|
+
},
|
|
949
994
|
};
|
|
950
995
|
var canvasZoomSettings = {
|
|
951
996
|
duration: 1000,
|
|
@@ -997,7 +1042,7 @@ var boxplot = {
|
|
|
997
1042
|
var configuration_non_customizable_histogram = {
|
|
998
1043
|
defaultBins: 10,
|
|
999
1044
|
};
|
|
1000
|
-
var
|
|
1045
|
+
var configuration_non_customizable_legend = {
|
|
1001
1046
|
items: {
|
|
1002
1047
|
status: {
|
|
1003
1048
|
ACTIVE: 1,
|
|
@@ -1050,6 +1095,11 @@ var legend = {
|
|
|
1050
1095
|
iconData: [{ x: 0, y: 0, width: 12, height: 12 }],
|
|
1051
1096
|
color: '#8D8D8D',
|
|
1052
1097
|
},
|
|
1098
|
+
color: {
|
|
1099
|
+
barWidth: 300,
|
|
1100
|
+
barHeight: 8,
|
|
1101
|
+
axisYTranslation: 10,
|
|
1102
|
+
},
|
|
1053
1103
|
};
|
|
1054
1104
|
var configuration_non_customizable_lines = {
|
|
1055
1105
|
opacity: {
|
|
@@ -1119,6 +1169,11 @@ var alluvial = {
|
|
|
1119
1169
|
selected: 1,
|
|
1120
1170
|
},
|
|
1121
1171
|
};
|
|
1172
|
+
var heatmap = {
|
|
1173
|
+
minCellDividerDimension: 16,
|
|
1174
|
+
// Ensures axes lines are displayed with or without stroke disabled
|
|
1175
|
+
chartPadding: 0.5,
|
|
1176
|
+
};
|
|
1122
1177
|
var spacers = {
|
|
1123
1178
|
default: {
|
|
1124
1179
|
size: 24,
|
|
@@ -8776,6 +8831,17 @@ var alluvialChart = tools_Tools.merge({}, chart, {
|
|
|
8776
8831
|
nodes: [],
|
|
8777
8832
|
},
|
|
8778
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
|
+
});
|
|
8779
8845
|
var configuration_options = {
|
|
8780
8846
|
chart: chart,
|
|
8781
8847
|
axisChart: axisChart,
|
|
@@ -8803,6 +8869,7 @@ var configuration_options = {
|
|
|
8803
8869
|
circlePackChart: circlePackChart,
|
|
8804
8870
|
wordCloudChart: wordCloudChart,
|
|
8805
8871
|
alluvialChart: alluvialChart,
|
|
8872
|
+
heatmapChart: heatmapChart,
|
|
8806
8873
|
};
|
|
8807
8874
|
|
|
8808
8875
|
//# sourceMappingURL=../src/configuration.js.map
|
|
@@ -9494,7 +9561,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9494
9561
|
if (!this.get('data')) {
|
|
9495
9562
|
return null;
|
|
9496
9563
|
}
|
|
9497
|
-
var ACTIVE =
|
|
9564
|
+
var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
|
|
9498
9565
|
var dataGroups = this.getDataGroups(groups);
|
|
9499
9566
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
9500
9567
|
var allDataFromDomain = this.getAllDataFromDomain(groups);
|
|
@@ -9539,7 +9606,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9539
9606
|
return this.get('dataGroups');
|
|
9540
9607
|
};
|
|
9541
9608
|
ChartModel.prototype.getActiveDataGroups = function (groups) {
|
|
9542
|
-
var ACTIVE =
|
|
9609
|
+
var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
|
|
9543
9610
|
return this.getDataGroups(groups).filter(function (dataGroup) { return dataGroup.status === ACTIVE; });
|
|
9544
9611
|
};
|
|
9545
9612
|
ChartModel.prototype.getDataGroupNames = function (groups) {
|
|
@@ -9811,7 +9878,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9811
9878
|
* Data labels
|
|
9812
9879
|
*/
|
|
9813
9880
|
ChartModel.prototype.toggleDataLabel = function (changedLabel) {
|
|
9814
|
-
var _a =
|
|
9881
|
+
var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
9815
9882
|
var dataGroups = this.getDataGroups();
|
|
9816
9883
|
var hasDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
|
|
9817
9884
|
var activeItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
|
|
@@ -10022,7 +10089,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
10022
10089
|
};
|
|
10023
10090
|
ChartModel.prototype.generateDataGroups = function (data) {
|
|
10024
10091
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
10025
|
-
var _a =
|
|
10092
|
+
var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
10026
10093
|
var options = this.getOptions();
|
|
10027
10094
|
var uniqueDataGroups = tools_Tools.removeArrayDuplicates(data.map(function (datum) { return datum[groupMapsTo]; }));
|
|
10028
10095
|
// check if selectedGroups can be applied to chart with current data groups
|
|
@@ -16011,6 +16078,22 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
|
|
|
16011
16078
|
this.dualAxes = true;
|
|
16012
16079
|
}
|
|
16013
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
|
+
};
|
|
16014
16097
|
CartesianScales.prototype.getOrientation = function () {
|
|
16015
16098
|
return this.orientation;
|
|
16016
16099
|
};
|
|
@@ -17528,6 +17611,11 @@ var zoom_Zoom = /** @class */ (function (_super) {
|
|
|
17528
17611
|
var cartesianScales = this.services.cartesianScales;
|
|
17529
17612
|
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
17530
17613
|
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
17614
|
+
var customDomain = tools_Tools.getProperty(this.model.getOptions(), 'axes', mainXAxisPosition, 'domain');
|
|
17615
|
+
// return custom domain if exists && valid
|
|
17616
|
+
if (Array.isArray(customDomain) && customDomain.length === 2) {
|
|
17617
|
+
return customDomain;
|
|
17618
|
+
}
|
|
17531
17619
|
// default to full range with extended domain
|
|
17532
17620
|
return cartesianScales.extendsDomain(mainXAxisPosition, src_extent(allZoomBarData, function (d) { return d[domainIdentifier]; }));
|
|
17533
17621
|
};
|
|
@@ -17906,7 +17994,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17906
17994
|
var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
|
|
17907
17995
|
var dataGroups = this.model.getDataGroups();
|
|
17908
17996
|
// Check if there are disabled legend items
|
|
17909
|
-
var DISABLED =
|
|
17997
|
+
var DISABLED = configuration_non_customizable_legend.items.status.DISABLED;
|
|
17910
17998
|
var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
|
|
17911
17999
|
var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
|
|
17912
18000
|
var svg = this.getComponentContainer()
|
|
@@ -17930,11 +18018,11 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17930
18018
|
addedLegendItems
|
|
17931
18019
|
.merge(svg.selectAll('div.legend-item'))
|
|
17932
18020
|
.classed('active', function (d, i) {
|
|
17933
|
-
return d.status ===
|
|
18021
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17934
18022
|
});
|
|
17935
18023
|
var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
|
|
17936
18024
|
svg.classed('clickable', legendClickable && dataGroups.length > 1);
|
|
17937
|
-
var checkboxRadius =
|
|
18025
|
+
var checkboxRadius = configuration_non_customizable_legend.checkbox.radius;
|
|
17938
18026
|
var addedCheckboxes = addedLegendItems
|
|
17939
18027
|
.append('div')
|
|
17940
18028
|
.classed('checkbox', true);
|
|
@@ -17947,7 +18035,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17947
18035
|
})
|
|
17948
18036
|
.attr('aria-checked', function (_a) {
|
|
17949
18037
|
var status = _a.status;
|
|
17950
|
-
return status ===
|
|
18038
|
+
return status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17951
18039
|
})
|
|
17952
18040
|
.attr('width', checkboxRadius * 2)
|
|
17953
18041
|
.attr('height', checkboxRadius * 2)
|
|
@@ -17959,13 +18047,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17959
18047
|
});
|
|
17960
18048
|
})
|
|
17961
18049
|
.style('background', function (d) {
|
|
17962
|
-
return d.status ===
|
|
18050
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE
|
|
17963
18051
|
? _this.model.getFillColor(d.name) ||
|
|
17964
18052
|
_this.model.getStrokeColor(d.name)
|
|
17965
18053
|
: null;
|
|
17966
18054
|
})
|
|
17967
18055
|
.classed('active', function (d, i) {
|
|
17968
|
-
return d.status ===
|
|
18056
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17969
18057
|
});
|
|
17970
18058
|
var addedCheckIcons = addedCheckboxes
|
|
17971
18059
|
.append('svg')
|
|
@@ -18050,7 +18138,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18050
18138
|
return dataGroups;
|
|
18051
18139
|
};
|
|
18052
18140
|
Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
|
|
18053
|
-
var _a =
|
|
18141
|
+
var _a = configuration_non_customizable_legend.area, width = _a.width, height = _a.height;
|
|
18054
18142
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18055
18143
|
// Circular icon
|
|
18056
18144
|
additionalItem
|
|
@@ -18063,7 +18151,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18063
18151
|
.style('height', height + "px");
|
|
18064
18152
|
}
|
|
18065
18153
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18066
|
-
var _b =
|
|
18154
|
+
var _b = configuration_non_customizable_legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
|
|
18067
18155
|
var circleEnter = additionalItem
|
|
18068
18156
|
.attr('fill', 'none')
|
|
18069
18157
|
.selectAll('circle')
|
|
@@ -18081,7 +18169,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18081
18169
|
.style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
|
|
18082
18170
|
}
|
|
18083
18171
|
else if (itemConfig.type === LegendItemType.LINE) {
|
|
18084
|
-
var lineConfig =
|
|
18172
|
+
var lineConfig = configuration_non_customizable_legend.line;
|
|
18085
18173
|
if (additionalItem.select('line.line').empty()) {
|
|
18086
18174
|
additionalItem
|
|
18087
18175
|
.append('line')
|
|
@@ -18108,13 +18196,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18108
18196
|
.attr('width', width)
|
|
18109
18197
|
.attr('height', height)
|
|
18110
18198
|
.style('fill', indexOfItem > 3 && !itemConfig.fill
|
|
18111
|
-
?
|
|
18199
|
+
? configuration_non_customizable_legend.area.fill
|
|
18112
18200
|
: itemConfig.fill)
|
|
18113
18201
|
.style('stroke', itemConfig.stroke);
|
|
18114
18202
|
}
|
|
18115
18203
|
}
|
|
18116
18204
|
else if (itemConfig.type === LegendItemType.SIZE) {
|
|
18117
|
-
var _c =
|
|
18205
|
+
var _c = configuration_non_customizable_legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
|
|
18118
18206
|
var sizeEnter = additionalItem
|
|
18119
18207
|
.attr('fill', 'none')
|
|
18120
18208
|
.attr('role', Roles.IMG)
|
|
@@ -18133,7 +18221,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18133
18221
|
.style('stroke-width', 1);
|
|
18134
18222
|
}
|
|
18135
18223
|
else if (itemConfig.type === LegendItemType.QUARTILE) {
|
|
18136
|
-
var iconData =
|
|
18224
|
+
var iconData = configuration_non_customizable_legend.quartile.iconData;
|
|
18137
18225
|
var quartileEnter = additionalItem
|
|
18138
18226
|
.selectAll('rect')
|
|
18139
18227
|
.attr('role', Roles.IMG)
|
|
@@ -18287,6 +18375,431 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18287
18375
|
}(component_Component));
|
|
18288
18376
|
|
|
18289
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
|
|
18290
18803
|
// EXTERNAL MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/carbon-components/node_modules/warning/browser.js
|
|
18291
18804
|
var browser = __webpack_require__("9b04");
|
|
18292
18805
|
|
|
@@ -33472,7 +33985,7 @@ function justify(node, n) {
|
|
|
33472
33985
|
return node.sourceLinks.length ? node.depth : n - 1;
|
|
33473
33986
|
}
|
|
33474
33987
|
|
|
33475
|
-
function
|
|
33988
|
+
function align_center(node) {
|
|
33476
33989
|
return node.targetLinks.length ? node.depth
|
|
33477
33990
|
: node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
|
|
33478
33991
|
: 0;
|
|
@@ -34646,6 +35159,376 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34646
35159
|
}(component_Component));
|
|
34647
35160
|
|
|
34648
35161
|
//# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
|
|
35162
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/heatmap.js
|
|
35163
|
+
var heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
35164
|
+
var extendStatics = function (d, b) {
|
|
35165
|
+
extendStatics = Object.setPrototypeOf ||
|
|
35166
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
35167
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
35168
|
+
return extendStatics(d, b);
|
|
35169
|
+
};
|
|
35170
|
+
return function (d, b) {
|
|
35171
|
+
extendStatics(d, b);
|
|
35172
|
+
function __() { this.constructor = d; }
|
|
35173
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
35174
|
+
};
|
|
35175
|
+
})();
|
|
35176
|
+
// Internal Imports
|
|
35177
|
+
|
|
35178
|
+
|
|
35179
|
+
|
|
35180
|
+
|
|
35181
|
+
|
|
35182
|
+
|
|
35183
|
+
// D3 Imports
|
|
35184
|
+
|
|
35185
|
+
|
|
35186
|
+
var heatmap_Heatmap = /** @class */ (function (_super) {
|
|
35187
|
+
heatmap_extends(Heatmap, _super);
|
|
35188
|
+
function Heatmap() {
|
|
35189
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35190
|
+
_this.type = 'heatmap';
|
|
35191
|
+
_this.renderType = RenderTypes.SVG;
|
|
35192
|
+
_this.matrix = {};
|
|
35193
|
+
_this.xBandwidth = 0;
|
|
35194
|
+
_this.yBandwidth = 0;
|
|
35195
|
+
_this.translationUnits = {
|
|
35196
|
+
x: 0,
|
|
35197
|
+
y: 0,
|
|
35198
|
+
};
|
|
35199
|
+
// Highlight elements that match the hovered axis item
|
|
35200
|
+
_this.handleAxisOnHover = function (event) {
|
|
35201
|
+
var detail = event.detail;
|
|
35202
|
+
var datum = detail.datum;
|
|
35203
|
+
// Unique ranges and domains
|
|
35204
|
+
var ranges = _this.model.getUniqueRanges();
|
|
35205
|
+
var domains = _this.model.getUniqueDomain();
|
|
35206
|
+
// Labels
|
|
35207
|
+
var domainLabel = _this.services.cartesianScales.getDomainLabel();
|
|
35208
|
+
var rangeLabel = _this.services.cartesianScales.getRangeLabel();
|
|
35209
|
+
// Scales
|
|
35210
|
+
var mainXScale = _this.services.cartesianScales.getMainXScale();
|
|
35211
|
+
var mainYScale = _this.services.cartesianScales.getMainYScale();
|
|
35212
|
+
var label = '', sum = 0, minimum = 0, maximum = 0;
|
|
35213
|
+
// Check to see where datum belongs
|
|
35214
|
+
if (_this.matrix[datum] !== undefined) {
|
|
35215
|
+
label = domainLabel;
|
|
35216
|
+
// Iterate through Object and get sum, min, and max
|
|
35217
|
+
ranges.forEach(function (element) {
|
|
35218
|
+
var value = _this.matrix[datum][element].value || 0;
|
|
35219
|
+
sum += value;
|
|
35220
|
+
minimum = value < minimum ? value : minimum;
|
|
35221
|
+
maximum = value > maximum ? value : maximum;
|
|
35222
|
+
});
|
|
35223
|
+
}
|
|
35224
|
+
else {
|
|
35225
|
+
label = rangeLabel;
|
|
35226
|
+
domains.forEach(function (element) {
|
|
35227
|
+
var value = _this.matrix[element][datum].value || 0;
|
|
35228
|
+
sum += value;
|
|
35229
|
+
minimum = value < minimum ? value : minimum;
|
|
35230
|
+
maximum = value > maximum ? value : maximum;
|
|
35231
|
+
});
|
|
35232
|
+
}
|
|
35233
|
+
if (mainXScale(datum) !== undefined) {
|
|
35234
|
+
_this.parent
|
|
35235
|
+
.select('g.multi-cell.column-highlight')
|
|
35236
|
+
.classed('highlighter-hidden', false)
|
|
35237
|
+
.attr('transform', "translate(" + mainXScale(datum) + ", " + min_min(mainYScale.range()) + ")");
|
|
35238
|
+
}
|
|
35239
|
+
else if (mainYScale(datum) !== undefined) {
|
|
35240
|
+
_this.parent
|
|
35241
|
+
.select('g.multi-cell.row-highlight')
|
|
35242
|
+
.classed('highlighter-hidden', false)
|
|
35243
|
+
.attr('transform', "translate(" + min_min(mainXScale.range()) + "," + mainYScale(datum) + ")");
|
|
35244
|
+
}
|
|
35245
|
+
// Dispatch tooltip show event
|
|
35246
|
+
_this.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35247
|
+
event: detail.event,
|
|
35248
|
+
hoveredElement: src_select(event.detail.element),
|
|
35249
|
+
items: [
|
|
35250
|
+
{
|
|
35251
|
+
label: label,
|
|
35252
|
+
value: datum,
|
|
35253
|
+
bold: true,
|
|
35254
|
+
},
|
|
35255
|
+
{
|
|
35256
|
+
label: 'Min',
|
|
35257
|
+
value: minimum,
|
|
35258
|
+
},
|
|
35259
|
+
{
|
|
35260
|
+
label: 'Max',
|
|
35261
|
+
value: maximum,
|
|
35262
|
+
},
|
|
35263
|
+
{
|
|
35264
|
+
label: 'Average',
|
|
35265
|
+
value: sum / domains.length,
|
|
35266
|
+
},
|
|
35267
|
+
],
|
|
35268
|
+
});
|
|
35269
|
+
};
|
|
35270
|
+
// Un-highlight all elements
|
|
35271
|
+
_this.handleAxisMouseOut = function (event) {
|
|
35272
|
+
// Hide column/row
|
|
35273
|
+
_this.parent
|
|
35274
|
+
.selectAll('g.multi-cell')
|
|
35275
|
+
.classed('highlighter-hidden', true);
|
|
35276
|
+
// Dispatch hide tooltip event
|
|
35277
|
+
_this.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35278
|
+
event: event,
|
|
35279
|
+
});
|
|
35280
|
+
};
|
|
35281
|
+
return _this;
|
|
35282
|
+
}
|
|
35283
|
+
Heatmap.prototype.init = function () {
|
|
35284
|
+
var eventsFragment = this.services.events;
|
|
35285
|
+
// Highlight correct cells on Axis item hovers
|
|
35286
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOVER, this.handleAxisOnHover);
|
|
35287
|
+
// Highlight correct cells on Axis item mouseouts
|
|
35288
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOUT, this.handleAxisMouseOut);
|
|
35289
|
+
// Highlight correct cells on Axis item focus
|
|
35290
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_FOCUS, this.handleAxisOnHover);
|
|
35291
|
+
// Highlight correct cells on Axis item blur
|
|
35292
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_BLUR, this.handleAxisMouseOut);
|
|
35293
|
+
};
|
|
35294
|
+
Heatmap.prototype.render = function (animate) {
|
|
35295
|
+
var _this = this;
|
|
35296
|
+
if (animate === void 0) { animate = true; }
|
|
35297
|
+
var svg = this.getComponentContainer({ withinChartClip: true });
|
|
35298
|
+
// Lower the chart so the axes are always visible
|
|
35299
|
+
svg.lower();
|
|
35300
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35301
|
+
this.matrix = this.model.getMatrix();
|
|
35302
|
+
svg.html('');
|
|
35303
|
+
if (tools_Tools.getProperty(this.getOptions(), 'data', 'loading')) {
|
|
35304
|
+
return;
|
|
35305
|
+
}
|
|
35306
|
+
// determine x and y axis scale
|
|
35307
|
+
var mainXScale = cartesianScales.getMainXScale();
|
|
35308
|
+
var mainYScale = cartesianScales.getMainYScale();
|
|
35309
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35310
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35311
|
+
// Get unique axis values & create a matrix
|
|
35312
|
+
var uniqueDomain = this.model.getUniqueDomain();
|
|
35313
|
+
var uniqueRange = this.model.getUniqueRanges();
|
|
35314
|
+
// Get matrix in the form of an array to create a single heatmap group
|
|
35315
|
+
var matrixArray = this.model.getMatrixAsArray();
|
|
35316
|
+
// Get available chart area
|
|
35317
|
+
var xRange = mainXScale.range();
|
|
35318
|
+
var yRange = mainYScale.range();
|
|
35319
|
+
// Determine rectangle dimensions based on the number of unique domain and range
|
|
35320
|
+
this.xBandwidth = Math.abs((xRange[1] - xRange[0]) / uniqueDomain.length);
|
|
35321
|
+
this.yBandwidth = Math.abs((yRange[1] - yRange[0]) / uniqueRange.length);
|
|
35322
|
+
var patternID = this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");
|
|
35323
|
+
// Create a striped pattern for missing data
|
|
35324
|
+
svg.append('defs')
|
|
35325
|
+
.append('pattern')
|
|
35326
|
+
.attr('id', patternID)
|
|
35327
|
+
.attr('width', 3)
|
|
35328
|
+
.attr('height', 3)
|
|
35329
|
+
.attr('patternUnits', 'userSpaceOnUse')
|
|
35330
|
+
.attr('patternTransform', 'rotate(45)')
|
|
35331
|
+
.append('rect')
|
|
35332
|
+
.classed('pattern-fill', true)
|
|
35333
|
+
.attr('width', 0.5)
|
|
35334
|
+
.attr('height', 8);
|
|
35335
|
+
var rectangles = svg
|
|
35336
|
+
.selectAll()
|
|
35337
|
+
.data(matrixArray)
|
|
35338
|
+
.enter()
|
|
35339
|
+
.append('g')
|
|
35340
|
+
.attr('class', function (d) { return "heat-" + d.index; })
|
|
35341
|
+
.classed('cell', true)
|
|
35342
|
+
.attr('transform', function (d) {
|
|
35343
|
+
return "translate(" + mainXScale(d[domainIdentifier]) + ", " + mainYScale(d[rangeIdentifier]) + ")";
|
|
35344
|
+
})
|
|
35345
|
+
.append('rect')
|
|
35346
|
+
.attr('class', function (d) {
|
|
35347
|
+
return _this.model.getColorClassName({
|
|
35348
|
+
value: d.value,
|
|
35349
|
+
originalClassName: "heat-" + d.index,
|
|
35350
|
+
});
|
|
35351
|
+
})
|
|
35352
|
+
.classed('heat', true)
|
|
35353
|
+
.classed('null-state', function (d) {
|
|
35354
|
+
return d.index === -1 || d.value === null ? true : false;
|
|
35355
|
+
})
|
|
35356
|
+
.attr('width', this.xBandwidth)
|
|
35357
|
+
.attr('height', this.yBandwidth)
|
|
35358
|
+
.style('fill', function (d) {
|
|
35359
|
+
// Check if a valid value exists
|
|
35360
|
+
if (d.index === -1 || d.value === null) {
|
|
35361
|
+
return "url(#" + patternID + ")";
|
|
35362
|
+
}
|
|
35363
|
+
return _this.model.getFillColor(Number(d.value));
|
|
35364
|
+
})
|
|
35365
|
+
.attr('aria-label', function (d) { return d.value; });
|
|
35366
|
+
// Cell highlight box
|
|
35367
|
+
this.createOuterBox('g.cell-highlight', this.xBandwidth, this.yBandwidth);
|
|
35368
|
+
// Column highlight box
|
|
35369
|
+
this.createOuterBox('g.multi-cell.column-highlight', this.xBandwidth, Math.abs(yRange[1] - yRange[0]));
|
|
35370
|
+
// Row highlight box
|
|
35371
|
+
this.createOuterBox('g.multi-cell.row-highlight', Math.abs(xRange[1] - xRange[0]), this.yBandwidth);
|
|
35372
|
+
if (this.determineDividerStatus()) {
|
|
35373
|
+
rectangles.style('stroke-width', '1px');
|
|
35374
|
+
this.parent.select('g.cell-highlight').classed('cell-2', true);
|
|
35375
|
+
}
|
|
35376
|
+
this.addEventListener();
|
|
35377
|
+
};
|
|
35378
|
+
/**
|
|
35379
|
+
* Generates a box using lines to create a hover effect
|
|
35380
|
+
* The lines have drop shadow in their respective direction
|
|
35381
|
+
* @param parentTag - tag name
|
|
35382
|
+
* @param xBandwidth - X length
|
|
35383
|
+
* @param yBandwidth - y length
|
|
35384
|
+
*/
|
|
35385
|
+
Heatmap.prototype.createOuterBox = function (parentTag, xBandwidth, yBandwidth) {
|
|
35386
|
+
// Create a highlighter in the parent component so the shadow and the lines do not get clipped
|
|
35387
|
+
var highlight = dom_utils_DOMUtils.appendOrSelect(this.parent, parentTag)
|
|
35388
|
+
.classed('shadows', true)
|
|
35389
|
+
.classed('highlighter-hidden', true);
|
|
35390
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.top')
|
|
35391
|
+
.attr('x1', -1)
|
|
35392
|
+
.attr('x2', xBandwidth + 1);
|
|
35393
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.left')
|
|
35394
|
+
.attr('x1', 0)
|
|
35395
|
+
.attr('y1', -1)
|
|
35396
|
+
.attr('x2', 0)
|
|
35397
|
+
.attr('y2', yBandwidth + 1);
|
|
35398
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.down')
|
|
35399
|
+
.attr('x1', -1)
|
|
35400
|
+
.attr('x2', xBandwidth + 1)
|
|
35401
|
+
.attr('y1', yBandwidth)
|
|
35402
|
+
.attr('y2', yBandwidth);
|
|
35403
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.right')
|
|
35404
|
+
.attr('x1', xBandwidth)
|
|
35405
|
+
.attr('x2', xBandwidth)
|
|
35406
|
+
.attr('y1', -1)
|
|
35407
|
+
.attr('y2', yBandwidth + 1);
|
|
35408
|
+
};
|
|
35409
|
+
Heatmap.prototype.determineDividerStatus = function () {
|
|
35410
|
+
// Add dividers if status is not off, will assume auto or on by default.
|
|
35411
|
+
var dividerStatus = tools_Tools.getProperty(this.getOptions(), 'heatmap', 'divider', 'state');
|
|
35412
|
+
// Determine if cell divider should be displayed
|
|
35413
|
+
if (dividerStatus !== DividerStatus.OFF) {
|
|
35414
|
+
if ((dividerStatus === DividerStatus.AUTO &&
|
|
35415
|
+
heatmap.minCellDividerDimension <=
|
|
35416
|
+
this.xBandwidth &&
|
|
35417
|
+
heatmap.minCellDividerDimension <=
|
|
35418
|
+
this.yBandwidth) ||
|
|
35419
|
+
dividerStatus === DividerStatus.ON) {
|
|
35420
|
+
return true;
|
|
35421
|
+
}
|
|
35422
|
+
}
|
|
35423
|
+
return false;
|
|
35424
|
+
};
|
|
35425
|
+
Heatmap.prototype.addEventListener = function () {
|
|
35426
|
+
var self = this;
|
|
35427
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35428
|
+
var options = this.getOptions();
|
|
35429
|
+
var totalLabel = lodash_es_get(options, 'tooltip.totalLabel');
|
|
35430
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35431
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35432
|
+
var domainLabel = cartesianScales.getDomainLabel();
|
|
35433
|
+
var rangeLabel = cartesianScales.getRangeLabel();
|
|
35434
|
+
this.parent
|
|
35435
|
+
.selectAll('g.cell')
|
|
35436
|
+
.on('mouseover', function (event, datum) {
|
|
35437
|
+
var cell = src_select(this);
|
|
35438
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35439
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35440
|
+
// Dispatch event and tooltip only if value exists
|
|
35441
|
+
if (!nullState) {
|
|
35442
|
+
// Get transformation value of node
|
|
35443
|
+
var transform = tools_Tools.getTranformOffsets(cell.attr('transform'));
|
|
35444
|
+
src_select('g.cell-highlight')
|
|
35445
|
+
.attr('transform', "translate(" + (transform.x + self.translationUnits.x) + ", " + (transform.y + self.translationUnits.y) + ")")
|
|
35446
|
+
.classed('highlighter-hidden', false);
|
|
35447
|
+
// Dispatch mouse over event
|
|
35448
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOVER, {
|
|
35449
|
+
event: event,
|
|
35450
|
+
element: hoveredElement,
|
|
35451
|
+
datum: datum,
|
|
35452
|
+
});
|
|
35453
|
+
// Dispatch tooltip show event
|
|
35454
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35455
|
+
event: event,
|
|
35456
|
+
items: [
|
|
35457
|
+
{
|
|
35458
|
+
label: domainLabel,
|
|
35459
|
+
value: datum[domainIdentifier],
|
|
35460
|
+
},
|
|
35461
|
+
{
|
|
35462
|
+
label: rangeLabel,
|
|
35463
|
+
value: datum[rangeIdentifier],
|
|
35464
|
+
},
|
|
35465
|
+
{
|
|
35466
|
+
label: totalLabel || 'Total',
|
|
35467
|
+
value: datum['value'],
|
|
35468
|
+
color: hoveredElement.style('fill'),
|
|
35469
|
+
},
|
|
35470
|
+
],
|
|
35471
|
+
});
|
|
35472
|
+
}
|
|
35473
|
+
})
|
|
35474
|
+
.on('mousemove', function (event, datum) {
|
|
35475
|
+
// Dispatch mouse move event
|
|
35476
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEMOVE, {
|
|
35477
|
+
event: event,
|
|
35478
|
+
element: src_select(this),
|
|
35479
|
+
datum: datum,
|
|
35480
|
+
});
|
|
35481
|
+
// Dispatch tooltip move event
|
|
35482
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
35483
|
+
event: event,
|
|
35484
|
+
});
|
|
35485
|
+
})
|
|
35486
|
+
.on('click', function (event, datum) {
|
|
35487
|
+
// Dispatch mouse click event
|
|
35488
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_CLICK, {
|
|
35489
|
+
event: event,
|
|
35490
|
+
element: src_select(this),
|
|
35491
|
+
datum: datum,
|
|
35492
|
+
});
|
|
35493
|
+
})
|
|
35494
|
+
.on('mouseout', function (event, datum) {
|
|
35495
|
+
var cell = src_select(this);
|
|
35496
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35497
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35498
|
+
src_select('g.cell-highlight').classed('highlighter-hidden', true);
|
|
35499
|
+
// Dispatch event and tooltip only if value exists
|
|
35500
|
+
if (!nullState) {
|
|
35501
|
+
// Dispatch mouse out event
|
|
35502
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOUT, {
|
|
35503
|
+
event: event,
|
|
35504
|
+
element: hoveredElement,
|
|
35505
|
+
datum: datum,
|
|
35506
|
+
});
|
|
35507
|
+
// Dispatch hide tooltip event
|
|
35508
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35509
|
+
event: event,
|
|
35510
|
+
hoveredElement: hoveredElement,
|
|
35511
|
+
});
|
|
35512
|
+
}
|
|
35513
|
+
});
|
|
35514
|
+
};
|
|
35515
|
+
// Remove event listeners
|
|
35516
|
+
Heatmap.prototype.destroy = function () {
|
|
35517
|
+
this.parent
|
|
35518
|
+
.selectAll('rect.heat')
|
|
35519
|
+
.on('mouseover', null)
|
|
35520
|
+
.on('mousemove', null)
|
|
35521
|
+
.on('click', null)
|
|
35522
|
+
.on('mouseout', null);
|
|
35523
|
+
// Remove legend listeners
|
|
35524
|
+
var eventsFragment = this.services.events;
|
|
35525
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleAxisOnHover);
|
|
35526
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_MOUSEOUT, this.handleAxisMouseOut);
|
|
35527
|
+
};
|
|
35528
|
+
return Heatmap;
|
|
35529
|
+
}(component_Component));
|
|
35530
|
+
|
|
35531
|
+
//# sourceMappingURL=../../../src/components/graphs/heatmap.js.map
|
|
34649
35532
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
|
|
34650
35533
|
var spacer_extends = (undefined && undefined.__extends) || (function () {
|
|
34651
35534
|
var extendStatics = function (d, b) {
|
|
@@ -34872,187 +35755,6 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
|
|
|
34872
35755
|
}(component_Component));
|
|
34873
35756
|
|
|
34874
35757
|
//# sourceMappingURL=../../../src/components/layout/layout.js.map
|
|
34875
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
|
|
34876
|
-
/* harmony default export */ var d3_axis_src_identity = (function(x) {
|
|
34877
|
-
return x;
|
|
34878
|
-
});
|
|
34879
|
-
|
|
34880
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
|
|
34881
|
-
|
|
34882
|
-
|
|
34883
|
-
var axis_top = 1,
|
|
34884
|
-
axis_right = 2,
|
|
34885
|
-
bottom = 3,
|
|
34886
|
-
axis_left = 4,
|
|
34887
|
-
axis_epsilon = 1e-6;
|
|
34888
|
-
|
|
34889
|
-
function axis_translateX(x) {
|
|
34890
|
-
return "translate(" + x + ",0)";
|
|
34891
|
-
}
|
|
34892
|
-
|
|
34893
|
-
function axis_translateY(y) {
|
|
34894
|
-
return "translate(0," + y + ")";
|
|
34895
|
-
}
|
|
34896
|
-
|
|
34897
|
-
function axis_number(scale) {
|
|
34898
|
-
return d => +scale(d);
|
|
34899
|
-
}
|
|
34900
|
-
|
|
34901
|
-
function axis_center(scale, offset) {
|
|
34902
|
-
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
34903
|
-
if (scale.round()) offset = Math.round(offset);
|
|
34904
|
-
return d => +scale(d) + offset;
|
|
34905
|
-
}
|
|
34906
|
-
|
|
34907
|
-
function entering() {
|
|
34908
|
-
return !this.__axis;
|
|
34909
|
-
}
|
|
34910
|
-
|
|
34911
|
-
function axis_axis(orient, scale) {
|
|
34912
|
-
var tickArguments = [],
|
|
34913
|
-
tickValues = null,
|
|
34914
|
-
tickFormat = null,
|
|
34915
|
-
tickSizeInner = 6,
|
|
34916
|
-
tickSizeOuter = 6,
|
|
34917
|
-
tickPadding = 3,
|
|
34918
|
-
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
34919
|
-
k = orient === axis_top || orient === axis_left ? -1 : 1,
|
|
34920
|
-
x = orient === axis_left || orient === axis_right ? "x" : "y",
|
|
34921
|
-
transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
|
|
34922
|
-
|
|
34923
|
-
function axis(context) {
|
|
34924
|
-
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
34925
|
-
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
|
|
34926
|
-
spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
|
34927
|
-
range = scale.range(),
|
|
34928
|
-
range0 = +range[0] + offset,
|
|
34929
|
-
range1 = +range[range.length - 1] + offset,
|
|
34930
|
-
position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
|
|
34931
|
-
selection = context.selection ? context.selection() : context,
|
|
34932
|
-
path = selection.selectAll(".domain").data([null]),
|
|
34933
|
-
tick = selection.selectAll(".tick").data(values, scale).order(),
|
|
34934
|
-
tickExit = tick.exit(),
|
|
34935
|
-
tickEnter = tick.enter().append("g").attr("class", "tick"),
|
|
34936
|
-
line = tick.select("line"),
|
|
34937
|
-
text = tick.select("text");
|
|
34938
|
-
|
|
34939
|
-
path = path.merge(path.enter().insert("path", ".tick")
|
|
34940
|
-
.attr("class", "domain")
|
|
34941
|
-
.attr("stroke", "currentColor"));
|
|
34942
|
-
|
|
34943
|
-
tick = tick.merge(tickEnter);
|
|
34944
|
-
|
|
34945
|
-
line = line.merge(tickEnter.append("line")
|
|
34946
|
-
.attr("stroke", "currentColor")
|
|
34947
|
-
.attr(x + "2", k * tickSizeInner));
|
|
34948
|
-
|
|
34949
|
-
text = text.merge(tickEnter.append("text")
|
|
34950
|
-
.attr("fill", "currentColor")
|
|
34951
|
-
.attr(x, k * spacing)
|
|
34952
|
-
.attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
34953
|
-
|
|
34954
|
-
if (context !== selection) {
|
|
34955
|
-
path = path.transition(context);
|
|
34956
|
-
tick = tick.transition(context);
|
|
34957
|
-
line = line.transition(context);
|
|
34958
|
-
text = text.transition(context);
|
|
34959
|
-
|
|
34960
|
-
tickExit = tickExit.transition(context)
|
|
34961
|
-
.attr("opacity", axis_epsilon)
|
|
34962
|
-
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
|
|
34963
|
-
|
|
34964
|
-
tickEnter
|
|
34965
|
-
.attr("opacity", axis_epsilon)
|
|
34966
|
-
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
|
|
34967
|
-
}
|
|
34968
|
-
|
|
34969
|
-
tickExit.remove();
|
|
34970
|
-
|
|
34971
|
-
path
|
|
34972
|
-
.attr("d", orient === axis_left || orient === axis_right
|
|
34973
|
-
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
34974
|
-
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
34975
|
-
|
|
34976
|
-
tick
|
|
34977
|
-
.attr("opacity", 1)
|
|
34978
|
-
.attr("transform", function(d) { return transform(position(d) + offset); });
|
|
34979
|
-
|
|
34980
|
-
line
|
|
34981
|
-
.attr(x + "2", k * tickSizeInner);
|
|
34982
|
-
|
|
34983
|
-
text
|
|
34984
|
-
.attr(x, k * spacing)
|
|
34985
|
-
.text(format);
|
|
34986
|
-
|
|
34987
|
-
selection.filter(entering)
|
|
34988
|
-
.attr("fill", "none")
|
|
34989
|
-
.attr("font-size", 10)
|
|
34990
|
-
.attr("font-family", "sans-serif")
|
|
34991
|
-
.attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
|
34992
|
-
|
|
34993
|
-
selection
|
|
34994
|
-
.each(function() { this.__axis = position; });
|
|
34995
|
-
}
|
|
34996
|
-
|
|
34997
|
-
axis.scale = function(_) {
|
|
34998
|
-
return arguments.length ? (scale = _, axis) : scale;
|
|
34999
|
-
};
|
|
35000
|
-
|
|
35001
|
-
axis.ticks = function() {
|
|
35002
|
-
return tickArguments = Array.from(arguments), axis;
|
|
35003
|
-
};
|
|
35004
|
-
|
|
35005
|
-
axis.tickArguments = function(_) {
|
|
35006
|
-
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
|
|
35007
|
-
};
|
|
35008
|
-
|
|
35009
|
-
axis.tickValues = function(_) {
|
|
35010
|
-
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
|
|
35011
|
-
};
|
|
35012
|
-
|
|
35013
|
-
axis.tickFormat = function(_) {
|
|
35014
|
-
return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
|
35015
|
-
};
|
|
35016
|
-
|
|
35017
|
-
axis.tickSize = function(_) {
|
|
35018
|
-
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
|
35019
|
-
};
|
|
35020
|
-
|
|
35021
|
-
axis.tickSizeInner = function(_) {
|
|
35022
|
-
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
|
35023
|
-
};
|
|
35024
|
-
|
|
35025
|
-
axis.tickSizeOuter = function(_) {
|
|
35026
|
-
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
|
35027
|
-
};
|
|
35028
|
-
|
|
35029
|
-
axis.tickPadding = function(_) {
|
|
35030
|
-
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
|
35031
|
-
};
|
|
35032
|
-
|
|
35033
|
-
axis.offset = function(_) {
|
|
35034
|
-
return arguments.length ? (offset = +_, axis) : offset;
|
|
35035
|
-
};
|
|
35036
|
-
|
|
35037
|
-
return axis;
|
|
35038
|
-
}
|
|
35039
|
-
|
|
35040
|
-
function axisTop(scale) {
|
|
35041
|
-
return axis_axis(axis_top, scale);
|
|
35042
|
-
}
|
|
35043
|
-
|
|
35044
|
-
function axisRight(scale) {
|
|
35045
|
-
return axis_axis(axis_right, scale);
|
|
35046
|
-
}
|
|
35047
|
-
|
|
35048
|
-
function axisBottom(scale) {
|
|
35049
|
-
return axis_axis(bottom, scale);
|
|
35050
|
-
}
|
|
35051
|
-
|
|
35052
|
-
function axisLeft(scale) {
|
|
35053
|
-
return axis_axis(axis_left, scale);
|
|
35054
|
-
}
|
|
35055
|
-
|
|
35056
35758
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/axis.js
|
|
35057
35759
|
var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
35058
35760
|
var extendStatics = function (d, b) {
|
|
@@ -35081,9 +35783,16 @@ var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
|
35081
35783
|
var axis_Axis = /** @class */ (function (_super) {
|
|
35082
35784
|
axis_extends(Axis, _super);
|
|
35083
35785
|
function Axis(model, services, configs) {
|
|
35786
|
+
var _a;
|
|
35084
35787
|
var _this = _super.call(this, model, services, configs) || this;
|
|
35085
35788
|
_this.type = 'axes';
|
|
35086
35789
|
_this.renderType = RenderTypes.SVG;
|
|
35790
|
+
_this.truncation = (_a = {},
|
|
35791
|
+
_a[AxisPositions.LEFT] = false,
|
|
35792
|
+
_a[AxisPositions.RIGHT] = false,
|
|
35793
|
+
_a[AxisPositions.TOP] = false,
|
|
35794
|
+
_a[AxisPositions.BOTTOM] = false,
|
|
35795
|
+
_a);
|
|
35087
35796
|
if (configs) {
|
|
35088
35797
|
_this.configs = configs;
|
|
35089
35798
|
}
|
|
@@ -35511,11 +36220,13 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35511
36220
|
.select("g.axis." + axisPosition + " g.ticks g.tick")
|
|
35512
36221
|
.html();
|
|
35513
36222
|
container.selectAll('g.ticks g.tick').html(tick_html);
|
|
36223
|
+
var self_1 = this;
|
|
35514
36224
|
container
|
|
35515
36225
|
.selectAll('g.tick text')
|
|
35516
36226
|
.data(axisTickLabels)
|
|
35517
36227
|
.text(function (d) {
|
|
35518
36228
|
if (d.length > truncationThreshold) {
|
|
36229
|
+
self_1.truncation[axisPosition] = true;
|
|
35519
36230
|
return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
|
|
35520
36231
|
}
|
|
35521
36232
|
else {
|
|
@@ -35550,8 +36261,6 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35550
36261
|
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
35551
36262
|
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
35552
36263
|
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
35553
|
-
var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
|
|
35554
|
-
axisOptions.scaleType === ScaleTypes.TIME;
|
|
35555
36264
|
var self = this;
|
|
35556
36265
|
container
|
|
35557
36266
|
.selectAll('g.tick text')
|
|
@@ -35632,6 +36341,242 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35632
36341
|
}(component_Component));
|
|
35633
36342
|
|
|
35634
36343
|
//# sourceMappingURL=../../../src/components/axes/axis.js.map
|
|
36344
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/hover-axis.js
|
|
36345
|
+
var hover_axis_extends = (undefined && undefined.__extends) || (function () {
|
|
36346
|
+
var extendStatics = function (d, b) {
|
|
36347
|
+
extendStatics = Object.setPrototypeOf ||
|
|
36348
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
36349
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
36350
|
+
return extendStatics(d, b);
|
|
36351
|
+
};
|
|
36352
|
+
return function (d, b) {
|
|
36353
|
+
extendStatics(d, b);
|
|
36354
|
+
function __() { this.constructor = d; }
|
|
36355
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
36356
|
+
};
|
|
36357
|
+
})();
|
|
36358
|
+
var hover_axis_assign = (undefined && undefined.__assign) || function () {
|
|
36359
|
+
hover_axis_assign = Object.assign || function(t) {
|
|
36360
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
36361
|
+
s = arguments[i];
|
|
36362
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
36363
|
+
t[p] = s[p];
|
|
36364
|
+
}
|
|
36365
|
+
return t;
|
|
36366
|
+
};
|
|
36367
|
+
return hover_axis_assign.apply(this, arguments);
|
|
36368
|
+
};
|
|
36369
|
+
// Internal Imports
|
|
36370
|
+
|
|
36371
|
+
|
|
36372
|
+
|
|
36373
|
+
|
|
36374
|
+
|
|
36375
|
+
// D3 Imports
|
|
36376
|
+
|
|
36377
|
+
var hover_axis_HoverAxis = /** @class */ (function (_super) {
|
|
36378
|
+
hover_axis_extends(HoverAxis, _super);
|
|
36379
|
+
function HoverAxis(model, services, configs) {
|
|
36380
|
+
return _super.call(this, model, services, configs) || this;
|
|
36381
|
+
}
|
|
36382
|
+
HoverAxis.prototype.render = function (animate) {
|
|
36383
|
+
if (animate === void 0) { animate = true; }
|
|
36384
|
+
_super.prototype.render.call(this, animate);
|
|
36385
|
+
// Remove existing event listeners to avoid flashing behavior
|
|
36386
|
+
_super.prototype.destroy.call(this);
|
|
36387
|
+
var axisPosition = this.configs.position;
|
|
36388
|
+
var svg = this.getComponentContainer();
|
|
36389
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36390
|
+
var self = this;
|
|
36391
|
+
container.selectAll('g.tick').each(function (_, index) {
|
|
36392
|
+
var g = src_select(this);
|
|
36393
|
+
g.classed('tick-hover', true).attr('tabindex', index === 0 ? 0 : -1);
|
|
36394
|
+
var textNode = g.select('text');
|
|
36395
|
+
var _a = dom_utils_DOMUtils.getSVGElementSize(textNode, {
|
|
36396
|
+
useBBox: true,
|
|
36397
|
+
}), width = _a.width, height = _a.height;
|
|
36398
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(g, 'rect.axis-holder');
|
|
36399
|
+
var x = 0, y = 0;
|
|
36400
|
+
// Depending on axis position, apply correct translation & rotation to align the rect
|
|
36401
|
+
// with the text
|
|
36402
|
+
switch (axisPosition) {
|
|
36403
|
+
case AxisPositions.LEFT:
|
|
36404
|
+
x = -width + Number(textNode.attr('x'));
|
|
36405
|
+
y = -(height / 2);
|
|
36406
|
+
break;
|
|
36407
|
+
case AxisPositions.RIGHT:
|
|
36408
|
+
x = Math.abs(Number(textNode.attr('x')));
|
|
36409
|
+
y = -(height / 2);
|
|
36410
|
+
break;
|
|
36411
|
+
case AxisPositions.TOP:
|
|
36412
|
+
x = -(width / 2);
|
|
36413
|
+
y = -height + Number(textNode.attr('y')) / 2;
|
|
36414
|
+
if (self.truncation[axisPosition]) {
|
|
36415
|
+
x = 0;
|
|
36416
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36417
|
+
}
|
|
36418
|
+
break;
|
|
36419
|
+
case AxisPositions.BOTTOM:
|
|
36420
|
+
x = -(width / 2);
|
|
36421
|
+
y = height / 2 - 2;
|
|
36422
|
+
if (self.truncation[axisPosition]) {
|
|
36423
|
+
x = -width;
|
|
36424
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36425
|
+
}
|
|
36426
|
+
break;
|
|
36427
|
+
}
|
|
36428
|
+
// Translates x position -4 left to keep center after padding
|
|
36429
|
+
// Adds padding on left & right
|
|
36430
|
+
rectangle
|
|
36431
|
+
.attr('x', x - configuration_non_customizable_axis.hover.rectanglePadding)
|
|
36432
|
+
.attr('y', y)
|
|
36433
|
+
.attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
|
|
36434
|
+
.attr('height', height)
|
|
36435
|
+
.lower();
|
|
36436
|
+
// Add keyboard event listeners to each group element
|
|
36437
|
+
g.on('keydown', function (event) {
|
|
36438
|
+
// Choose specific arrow key depending on the axis
|
|
36439
|
+
if (axisPosition === AxisPositions.LEFT ||
|
|
36440
|
+
axisPosition === AxisPositions.RIGHT) {
|
|
36441
|
+
if (event.key && event.key === 'ArrowUp') {
|
|
36442
|
+
self.goNext(this, event);
|
|
36443
|
+
}
|
|
36444
|
+
else if (event.key && event.key === 'ArrowDown') {
|
|
36445
|
+
self.goPrevious(this, event);
|
|
36446
|
+
}
|
|
36447
|
+
}
|
|
36448
|
+
else {
|
|
36449
|
+
if (event.key && event.key === 'ArrowLeft') {
|
|
36450
|
+
self.goPrevious(this, event);
|
|
36451
|
+
}
|
|
36452
|
+
else if (event.key && event.key === 'ArrowRight') {
|
|
36453
|
+
self.goNext(this, event);
|
|
36454
|
+
}
|
|
36455
|
+
}
|
|
36456
|
+
});
|
|
36457
|
+
});
|
|
36458
|
+
// Add event listeners to element group
|
|
36459
|
+
this.addEventListeners();
|
|
36460
|
+
};
|
|
36461
|
+
HoverAxis.prototype.addEventListeners = function () {
|
|
36462
|
+
var svg = this.getComponentContainer();
|
|
36463
|
+
var axisPosition = this.configs.position;
|
|
36464
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36465
|
+
var options = this.getOptions();
|
|
36466
|
+
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
36467
|
+
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
36468
|
+
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
36469
|
+
var self = this;
|
|
36470
|
+
container
|
|
36471
|
+
.selectAll('g.tick.tick-hover')
|
|
36472
|
+
.on('mouseover', function (event) {
|
|
36473
|
+
var hoveredElement = src_select(this).select('text');
|
|
36474
|
+
var datum = hoveredElement.datum();
|
|
36475
|
+
// Dispatch mouse event
|
|
36476
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
|
|
36477
|
+
event: event,
|
|
36478
|
+
element: hoveredElement,
|
|
36479
|
+
datum: datum,
|
|
36480
|
+
});
|
|
36481
|
+
if (axisScaleType === ScaleTypes.LABELS &&
|
|
36482
|
+
datum.length > truncationThreshold) {
|
|
36483
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
36484
|
+
event: event,
|
|
36485
|
+
element: hoveredElement,
|
|
36486
|
+
datum: datum,
|
|
36487
|
+
});
|
|
36488
|
+
}
|
|
36489
|
+
})
|
|
36490
|
+
.on('mousemove', function (event) {
|
|
36491
|
+
var hoveredElement = src_select(this).select('text');
|
|
36492
|
+
var datum = hoveredElement.datum();
|
|
36493
|
+
// Dispatch mouse event
|
|
36494
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
|
|
36495
|
+
event: event,
|
|
36496
|
+
element: hoveredElement,
|
|
36497
|
+
datum: datum,
|
|
36498
|
+
});
|
|
36499
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
36500
|
+
event: event,
|
|
36501
|
+
});
|
|
36502
|
+
})
|
|
36503
|
+
.on('click', function (event) {
|
|
36504
|
+
// Dispatch mouse event
|
|
36505
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
|
|
36506
|
+
event: event,
|
|
36507
|
+
element: src_select(this).select('text'),
|
|
36508
|
+
datum: src_select(this).select('text').datum(),
|
|
36509
|
+
});
|
|
36510
|
+
})
|
|
36511
|
+
.on('mouseout', function (event) {
|
|
36512
|
+
// Dispatch mouse event
|
|
36513
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
|
|
36514
|
+
event: event,
|
|
36515
|
+
element: src_select(this).select('text'),
|
|
36516
|
+
datum: src_select(this).select('text').datum(),
|
|
36517
|
+
});
|
|
36518
|
+
if (axisScaleType === ScaleTypes.LABELS) {
|
|
36519
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE);
|
|
36520
|
+
}
|
|
36521
|
+
})
|
|
36522
|
+
.on('focus', function (event) {
|
|
36523
|
+
var coordinates = { clientX: 0, clientY: 0 };
|
|
36524
|
+
if (event.target) {
|
|
36525
|
+
// Focus element since we are using arrow keys
|
|
36526
|
+
event.target.focus();
|
|
36527
|
+
var boundingRect = event.target.getBoundingClientRect();
|
|
36528
|
+
coordinates.clientX = boundingRect.x;
|
|
36529
|
+
coordinates.clientY = boundingRect.y;
|
|
36530
|
+
}
|
|
36531
|
+
// Dispatch focus event
|
|
36532
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_FOCUS, {
|
|
36533
|
+
event: hover_axis_assign(hover_axis_assign({}, event), coordinates),
|
|
36534
|
+
element: src_select(this),
|
|
36535
|
+
datum: src_select(this).select('text').datum(),
|
|
36536
|
+
});
|
|
36537
|
+
})
|
|
36538
|
+
.on('blur', function (event) {
|
|
36539
|
+
// Dispatch blur event
|
|
36540
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
|
|
36541
|
+
event: event,
|
|
36542
|
+
element: src_select(this),
|
|
36543
|
+
datum: src_select(this).select('text').datum(),
|
|
36544
|
+
});
|
|
36545
|
+
});
|
|
36546
|
+
};
|
|
36547
|
+
// Focus on the next HTML element sibling
|
|
36548
|
+
HoverAxis.prototype.goNext = function (element, event) {
|
|
36549
|
+
if (element.nextElementSibling &&
|
|
36550
|
+
element.nextElementSibling.tagName !== 'path') {
|
|
36551
|
+
element.nextElementSibling.dispatchEvent(new Event('focus'));
|
|
36552
|
+
}
|
|
36553
|
+
event.preventDefault();
|
|
36554
|
+
};
|
|
36555
|
+
// Focus on the previous HTML element sibling
|
|
36556
|
+
HoverAxis.prototype.goPrevious = function (element, event) {
|
|
36557
|
+
if (element.previousElementSibling &&
|
|
36558
|
+
element.previousElementSibling.tagName !== 'path') {
|
|
36559
|
+
element.previousElementSibling.dispatchEvent(new Event('focus'));
|
|
36560
|
+
}
|
|
36561
|
+
event.preventDefault();
|
|
36562
|
+
};
|
|
36563
|
+
HoverAxis.prototype.destroy = function () {
|
|
36564
|
+
var svg = this.getComponentContainer();
|
|
36565
|
+
var axisPosition = this.configs.position;
|
|
36566
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36567
|
+
// Remove event listeners
|
|
36568
|
+
container
|
|
36569
|
+
.selectAll('g.tick.tick-hover')
|
|
36570
|
+
.on('mouseover', null)
|
|
36571
|
+
.on('mousemove', null)
|
|
36572
|
+
.on('mouseout', null)
|
|
36573
|
+
.on('focus', null)
|
|
36574
|
+
.on('blur', null);
|
|
36575
|
+
};
|
|
36576
|
+
return HoverAxis;
|
|
36577
|
+
}(axis_Axis));
|
|
36578
|
+
|
|
36579
|
+
//# sourceMappingURL=../../../src/components/axes/hover-axis.js.map
|
|
35635
36580
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/two-dimensional-axes.js
|
|
35636
36581
|
var two_dimensional_axes_extends = (undefined && undefined.__extends) || (function () {
|
|
35637
36582
|
var extendStatics = function (d, b) {
|
|
@@ -35653,6 +36598,7 @@ var two_dimensional_axes_extends = (undefined && undefined.__extends) || (functi
|
|
|
35653
36598
|
|
|
35654
36599
|
|
|
35655
36600
|
|
|
36601
|
+
|
|
35656
36602
|
var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
35657
36603
|
two_dimensional_axes_extends(TwoDimensionalAxes, _super);
|
|
35658
36604
|
function TwoDimensionalAxes() {
|
|
@@ -35687,11 +36633,14 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35687
36633
|
var axisPosition = AxisPositions[axisPositionKey];
|
|
35688
36634
|
if (_this.configs.axes[axisPosition] &&
|
|
35689
36635
|
!_this.children[axisPosition]) {
|
|
35690
|
-
var
|
|
36636
|
+
var configs = {
|
|
35691
36637
|
position: axisPosition,
|
|
35692
36638
|
axes: _this.configs.axes,
|
|
35693
36639
|
margins: _this.margins,
|
|
35694
|
-
}
|
|
36640
|
+
};
|
|
36641
|
+
var axisComponent = _this.model.axisFlavor === AxisFlavor.DEFAULT
|
|
36642
|
+
? new axis_Axis(_this.model, _this.services, configs)
|
|
36643
|
+
: new hover_axis_HoverAxis(_this.model, _this.services, configs);
|
|
35695
36644
|
// Set model, services & parent for the new axis component
|
|
35696
36645
|
axisComponent.setModel(_this.model);
|
|
35697
36646
|
axisComponent.setServices(_this.services);
|
|
@@ -35742,6 +36691,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35742
36691
|
break;
|
|
35743
36692
|
}
|
|
35744
36693
|
});
|
|
36694
|
+
this.services.events.dispatchEvent(Events.Axis.RENDER_COMPLETE);
|
|
35745
36695
|
// If the new margins are different than the existing ones
|
|
35746
36696
|
var isNotEqual = Object.keys(margins).some(function (marginKey) {
|
|
35747
36697
|
return _this.margins[marginKey] !== margins[marginKey];
|
|
@@ -38635,23 +39585,26 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38635
39585
|
var self_1 = this;
|
|
38636
39586
|
var allToolbarControls = enteringToolbarControls
|
|
38637
39587
|
.merge(toolbarControls)
|
|
38638
|
-
.classed('disabled', function (d) {
|
|
38639
|
-
|
|
38640
|
-
})
|
|
38641
|
-
.attr('aria-disabled', function (d) {
|
|
38642
|
-
return d.shouldBeDisabled ? d.shouldBeDisabled() : false;
|
|
38643
|
-
})
|
|
39588
|
+
.classed('disabled', function (d) { return d.shouldBeDisabled(); })
|
|
39589
|
+
.attr('aria-disabled', function (d) { return d.shouldBeDisabled(); })
|
|
38644
39590
|
.attr('aria-label', function (d) { return d.title; })
|
|
38645
|
-
.html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.
|
|
39591
|
+
.html(function (d) { return "\n\t\t\t<button\n\t\t\t\tclass=\"bx--overflow-menu__trigger\"\n\t\t\t\taria-haspopup=\"true\" aria-expanded=\"false\" id=\"" + _this.services.domUtils.generateElementIDString("control-" + d.id) + "\" aria-label=\"" + d.title + "\">\n\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\" style=\"will-change: transform; width: " + (d.iconSVG.width !== undefined ? d.iconSVG.width : '20px') + "; height: " + (d.iconSVG.height !== undefined
|
|
39592
|
+
? d.iconSVG.height
|
|
39593
|
+
: '20px') + "\" xmlns=\"http://www.w3.org/2000/svg\" class=\"bx--overflow-menu__icon\" viewBox=\"0 0 32 32\" aria-hidden=\"true\">\n\t\t\t\t\t" + d.iconSVG.content + "\n\t\t\t\t</svg>\n\t\t\t</button>"; })
|
|
38646
39594
|
.each(function (d, index) {
|
|
39595
|
+
var _this = this;
|
|
38647
39596
|
src_select(this)
|
|
38648
39597
|
.select('button')
|
|
38649
|
-
.on('click',
|
|
39598
|
+
.on('click', function (event) {
|
|
39599
|
+
if (!d.shouldBeDisabled()) {
|
|
39600
|
+
self_1.triggerFunctionAndEvent(d, event, _this);
|
|
39601
|
+
}
|
|
39602
|
+
})
|
|
38650
39603
|
.on('keydown', function (event) {
|
|
38651
39604
|
if ((event.key && event.key === 'Enter') ||
|
|
38652
39605
|
event.key === ' ') {
|
|
38653
39606
|
event.preventDefault();
|
|
38654
|
-
|
|
39607
|
+
self_1.triggerFunctionAndEvent(d, event, _this);
|
|
38655
39608
|
}
|
|
38656
39609
|
else if (event.key && event.key === 'ArrowLeft') {
|
|
38657
39610
|
self_1.focusOnPreviousEnabledToolbarItem(index);
|
|
@@ -38805,15 +39758,13 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38805
39758
|
var element = src_select("#" + _this.services.domUtils.generateElementIDString("control-" + menuItem.id));
|
|
38806
39759
|
if (element !== null) {
|
|
38807
39760
|
element.on('click', function () {
|
|
38808
|
-
|
|
38809
|
-
menuItem.clickFunction();
|
|
39761
|
+
self_2.triggerFunctionAndEvent(menuItem, event, element.node());
|
|
38810
39762
|
// hide overflow menu
|
|
38811
39763
|
self_2.updateOverflowMenu(false);
|
|
38812
39764
|
});
|
|
38813
39765
|
element.on('keydown', function (keyEvent) {
|
|
38814
39766
|
if (keyEvent && keyEvent.key === 'Enter') {
|
|
38815
|
-
|
|
38816
|
-
menuItem.clickFunction();
|
|
39767
|
+
self_2.triggerFunctionAndEvent(menuItem, event, element.node());
|
|
38817
39768
|
}
|
|
38818
39769
|
else if (keyEvent && keyEvent.key === 'ArrowUp') {
|
|
38819
39770
|
// focus on previous menu item
|
|
@@ -38840,35 +39791,75 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38840
39791
|
event.stopImmediatePropagation();
|
|
38841
39792
|
}
|
|
38842
39793
|
};
|
|
39794
|
+
// Calls passed function && dispatches event
|
|
39795
|
+
Toolbar.prototype.triggerFunctionAndEvent = function (control, event, element) {
|
|
39796
|
+
// Call custom function only if it exists
|
|
39797
|
+
if (typeof control.clickFunction === 'function') {
|
|
39798
|
+
control.clickFunction(event);
|
|
39799
|
+
}
|
|
39800
|
+
// Dispatch selection event
|
|
39801
|
+
this.services.events.dispatchEvent(Events.Toolbar.BUTTON_CLICK, {
|
|
39802
|
+
control: control,
|
|
39803
|
+
event: event,
|
|
39804
|
+
element: element,
|
|
39805
|
+
});
|
|
39806
|
+
};
|
|
38843
39807
|
Toolbar.prototype.getControlConfigs = function () {
|
|
38844
39808
|
var _this = this;
|
|
38845
|
-
var numberOfIcons = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'numberOfIcons')
|
|
39809
|
+
var numberOfIcons = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'numberOfIcons') -
|
|
39810
|
+
1;
|
|
38846
39811
|
var controls = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'controls');
|
|
38847
|
-
var controlList = [];
|
|
38848
39812
|
var overflowSpecificControls = [];
|
|
39813
|
+
var buttonList = [];
|
|
39814
|
+
var overflowList = [];
|
|
38849
39815
|
controls.forEach(function (control) {
|
|
38850
|
-
var controlConfig =
|
|
39816
|
+
var controlConfig = null;
|
|
39817
|
+
// check if button is custom or default control
|
|
39818
|
+
if (control.type === ToolbarControlTypes.CUSTOM) {
|
|
39819
|
+
// add generic id if missing
|
|
39820
|
+
if (tools_Tools.getProperty(control, 'id') === null) {
|
|
39821
|
+
// add id directly to the data passed so that id isn't reassigned on rerender
|
|
39822
|
+
control.id = "toolbar-button-" + Toolbar.buttonID++;
|
|
39823
|
+
}
|
|
39824
|
+
// define function if missing
|
|
39825
|
+
if (tools_Tools.getProperty(control, 'shouldBeDisabled') === null) {
|
|
39826
|
+
control.shouldBeDisabled = function () { return false; };
|
|
39827
|
+
}
|
|
39828
|
+
controlConfig = control;
|
|
39829
|
+
}
|
|
39830
|
+
else {
|
|
39831
|
+
controlConfig = _this.getControlConfigByType(control.type);
|
|
39832
|
+
}
|
|
38851
39833
|
// add to list if config is valid
|
|
38852
39834
|
if (controlConfig) {
|
|
38853
39835
|
controlConfig.text = control.text ? control.text : control.type;
|
|
38854
39836
|
if (controlConfig.id.indexOf('toolbar-export') !== -1) {
|
|
38855
39837
|
overflowSpecificControls.push(controlConfig);
|
|
38856
39838
|
}
|
|
39839
|
+
else if (buttonList.length < numberOfIcons) {
|
|
39840
|
+
// check if icon exists else assign to the overflow list
|
|
39841
|
+
if (tools_Tools.getProperty(controlConfig, 'iconSVG', 'content') === null) {
|
|
39842
|
+
overflowList.push(controlConfig);
|
|
39843
|
+
}
|
|
39844
|
+
else {
|
|
39845
|
+
buttonList.push(controlConfig);
|
|
39846
|
+
}
|
|
39847
|
+
}
|
|
38857
39848
|
else {
|
|
38858
|
-
|
|
39849
|
+
overflowList.push(controlConfig);
|
|
38859
39850
|
}
|
|
38860
39851
|
}
|
|
38861
39852
|
});
|
|
38862
|
-
|
|
38863
|
-
|
|
39853
|
+
// Ensures the `export` controls are always at the bottom
|
|
39854
|
+
overflowList.push.apply(overflowList, overflowSpecificControls);
|
|
39855
|
+
if (!overflowList.length) {
|
|
38864
39856
|
return {
|
|
38865
|
-
buttonList:
|
|
39857
|
+
buttonList: buttonList,
|
|
38866
39858
|
};
|
|
38867
39859
|
}
|
|
38868
39860
|
return {
|
|
38869
|
-
|
|
38870
|
-
|
|
38871
|
-
overflowMenuItemList: controlList.concat(overflowSpecificControls),
|
|
39861
|
+
buttonList: buttonList,
|
|
39862
|
+
overflowMenuItemList: overflowList,
|
|
38872
39863
|
};
|
|
38873
39864
|
};
|
|
38874
39865
|
Toolbar.prototype.getToolbarButtonItems = function () {
|
|
@@ -38897,7 +39888,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38897
39888
|
id: 'toolbar-overflow-menu',
|
|
38898
39889
|
title: 'More options',
|
|
38899
39890
|
shouldBeDisabled: function () { return false; },
|
|
38900
|
-
|
|
39891
|
+
iconSVG: {
|
|
39892
|
+
content: "<circle cx=\"16\" cy=\"8\" r=\"2\"></circle>\n\t\t\t\t<circle cx=\"16\" cy=\"16\" r=\"2\"></circle>\n\t\t\t\t<circle cx=\"16\" cy=\"24\" r=\"2\"></circle>",
|
|
39893
|
+
},
|
|
38901
39894
|
clickFunction: function (event) { return _this.toggleOverflowMenu(event); },
|
|
38902
39895
|
};
|
|
38903
39896
|
};
|
|
@@ -38917,7 +39910,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38917
39910
|
shouldBeDisabled: function () {
|
|
38918
39911
|
return _this.services.zoom.isMinZoomDomain();
|
|
38919
39912
|
},
|
|
38920
|
-
|
|
39913
|
+
iconSVG: {
|
|
39914
|
+
content: this.getControlIconByType(controlType),
|
|
39915
|
+
},
|
|
38921
39916
|
clickFunction: function () { return _this.services.zoom.zoomIn(); },
|
|
38922
39917
|
};
|
|
38923
39918
|
}
|
|
@@ -38930,7 +39925,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38930
39925
|
shouldBeDisabled: function () {
|
|
38931
39926
|
return _this.services.zoom.isMaxZoomDomain();
|
|
38932
39927
|
},
|
|
38933
|
-
|
|
39928
|
+
iconSVG: {
|
|
39929
|
+
content: this.getControlIconByType(controlType),
|
|
39930
|
+
},
|
|
38934
39931
|
clickFunction: function () { return _this.services.zoom.zoomOut(); },
|
|
38935
39932
|
};
|
|
38936
39933
|
}
|
|
@@ -38943,7 +39940,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38943
39940
|
shouldBeDisabled: function () {
|
|
38944
39941
|
return _this.services.zoom.isMaxZoomDomain();
|
|
38945
39942
|
},
|
|
38946
|
-
|
|
39943
|
+
iconSVG: {
|
|
39944
|
+
content: this.getControlIconByType(controlType),
|
|
39945
|
+
},
|
|
38947
39946
|
clickFunction: function () {
|
|
38948
39947
|
return _this.services.zoom.resetZoomDomain();
|
|
38949
39948
|
},
|
|
@@ -38953,10 +39952,12 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38953
39952
|
case ToolbarControlTypes.MAKE_FULLSCREEN:
|
|
38954
39953
|
controlConfig = {
|
|
38955
39954
|
id: 'toolbar-makefullscreen',
|
|
39955
|
+
iconSVG: {
|
|
39956
|
+
content: this.getControlIconByType(controlType),
|
|
39957
|
+
width: '15px',
|
|
39958
|
+
height: '15px',
|
|
39959
|
+
},
|
|
38956
39960
|
title: 'Make fullscreen',
|
|
38957
|
-
iconSVGContent: this.getControlIconByType(controlType),
|
|
38958
|
-
iconWidth: '15px',
|
|
38959
|
-
iconHight: '15px',
|
|
38960
39961
|
shouldBeDisabled: function () { return false; },
|
|
38961
39962
|
clickFunction: function () {
|
|
38962
39963
|
_this.services.domUtils.toggleFullscreen();
|
|
@@ -38966,8 +39967,10 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38966
39967
|
case ToolbarControlTypes.SHOW_AS_DATATABLE:
|
|
38967
39968
|
controlConfig = {
|
|
38968
39969
|
id: 'toolbar-showasdatatable',
|
|
39970
|
+
iconSVG: {
|
|
39971
|
+
content: this.getControlIconByType(controlType),
|
|
39972
|
+
},
|
|
38969
39973
|
title: 'Show as table',
|
|
38970
|
-
iconSVGContent: this.getControlIconByType(controlType),
|
|
38971
39974
|
shouldBeDisabled: function () { return displayData.length === 0; },
|
|
38972
39975
|
clickFunction: function () {
|
|
38973
39976
|
return _this.services.events.dispatchEvent(Events.Modal.SHOW);
|
|
@@ -38979,7 +39982,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38979
39982
|
id: 'toolbar-export-CSV',
|
|
38980
39983
|
title: 'Export as CSV',
|
|
38981
39984
|
shouldBeDisabled: function () { return false; },
|
|
38982
|
-
|
|
39985
|
+
iconSVG: {
|
|
39986
|
+
content: this.getControlIconByType(controlType),
|
|
39987
|
+
},
|
|
38983
39988
|
clickFunction: function () { return _this.model.exportToCSV(); },
|
|
38984
39989
|
};
|
|
38985
39990
|
break;
|
|
@@ -38988,7 +39993,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38988
39993
|
id: 'toolbar-export-PNG',
|
|
38989
39994
|
title: 'Export as PNG',
|
|
38990
39995
|
shouldBeDisabled: function () { return false; },
|
|
38991
|
-
|
|
39996
|
+
iconSVG: {
|
|
39997
|
+
content: this.getControlIconByType(controlType),
|
|
39998
|
+
},
|
|
38992
39999
|
clickFunction: function () { return _this.services.domUtils.exportToPNG(); },
|
|
38993
40000
|
};
|
|
38994
40001
|
break;
|
|
@@ -38997,7 +40004,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38997
40004
|
id: 'toolbar-export-JPG',
|
|
38998
40005
|
title: 'Export as JPG',
|
|
38999
40006
|
shouldBeDisabled: function () { return false; },
|
|
39000
|
-
|
|
40007
|
+
iconSVG: {
|
|
40008
|
+
content: this.getControlIconByType(controlType),
|
|
40009
|
+
},
|
|
39001
40010
|
clickFunction: function () { return _this.services.domUtils.exportToJPG(); },
|
|
39002
40011
|
};
|
|
39003
40012
|
break;
|
|
@@ -39030,6 +40039,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39030
40039
|
throw Error('Not supported toolbar control type: ' + controlType);
|
|
39031
40040
|
}
|
|
39032
40041
|
};
|
|
40042
|
+
Toolbar.buttonID = 0;
|
|
39033
40043
|
return Toolbar;
|
|
39034
40044
|
}(component_Component));
|
|
39035
40045
|
|
|
@@ -39725,6 +40735,7 @@ var tee = {
|
|
|
39725
40735
|
|
|
39726
40736
|
|
|
39727
40737
|
|
|
40738
|
+
|
|
39728
40739
|
// GRAPHS
|
|
39729
40740
|
|
|
39730
40741
|
|
|
@@ -39748,6 +40759,7 @@ var tee = {
|
|
|
39748
40759
|
|
|
39749
40760
|
|
|
39750
40761
|
|
|
40762
|
+
|
|
39751
40763
|
|
|
39752
40764
|
|
|
39753
40765
|
// Layout
|
|
@@ -40001,7 +41013,9 @@ var cartesian_charts_spreadArrays = (undefined && undefined.__spreadArrays) || f
|
|
|
40001
41013
|
var cartesian_charts_ChartModelCartesian = /** @class */ (function (_super) {
|
|
40002
41014
|
cartesian_charts_extends(ChartModelCartesian, _super);
|
|
40003
41015
|
function ChartModelCartesian(services) {
|
|
40004
|
-
|
|
41016
|
+
var _this = _super.call(this, services) || this;
|
|
41017
|
+
_this.axisFlavor = AxisFlavor.DEFAULT;
|
|
41018
|
+
return _this;
|
|
40005
41019
|
}
|
|
40006
41020
|
// get the scales information
|
|
40007
41021
|
// needed for getTabularArray()
|
|
@@ -42929,6 +43943,493 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
42929
43943
|
}(chart_Chart));
|
|
42930
43944
|
|
|
42931
43945
|
//# sourceMappingURL=../../src/charts/alluvial.js.map
|
|
43946
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-scale/src/quantize.js
|
|
43947
|
+
|
|
43948
|
+
|
|
43949
|
+
|
|
43950
|
+
|
|
43951
|
+
function quantize_quantize() {
|
|
43952
|
+
var x0 = 0,
|
|
43953
|
+
x1 = 1,
|
|
43954
|
+
n = 1,
|
|
43955
|
+
domain = [0.5],
|
|
43956
|
+
range = [0, 1],
|
|
43957
|
+
unknown;
|
|
43958
|
+
|
|
43959
|
+
function scale(x) {
|
|
43960
|
+
return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
|
43961
|
+
}
|
|
43962
|
+
|
|
43963
|
+
function rescale() {
|
|
43964
|
+
var i = -1;
|
|
43965
|
+
domain = new Array(n);
|
|
43966
|
+
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
|
43967
|
+
return scale;
|
|
43968
|
+
}
|
|
43969
|
+
|
|
43970
|
+
scale.domain = function(_) {
|
|
43971
|
+
return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
|
|
43972
|
+
};
|
|
43973
|
+
|
|
43974
|
+
scale.range = function(_) {
|
|
43975
|
+
return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
|
|
43976
|
+
};
|
|
43977
|
+
|
|
43978
|
+
scale.invertExtent = function(y) {
|
|
43979
|
+
var i = range.indexOf(y);
|
|
43980
|
+
return i < 0 ? [NaN, NaN]
|
|
43981
|
+
: i < 1 ? [x0, domain[0]]
|
|
43982
|
+
: i >= n ? [domain[n - 1], x1]
|
|
43983
|
+
: [domain[i - 1], domain[i]];
|
|
43984
|
+
};
|
|
43985
|
+
|
|
43986
|
+
scale.unknown = function(_) {
|
|
43987
|
+
return arguments.length ? (unknown = _, scale) : scale;
|
|
43988
|
+
};
|
|
43989
|
+
|
|
43990
|
+
scale.thresholds = function() {
|
|
43991
|
+
return domain.slice();
|
|
43992
|
+
};
|
|
43993
|
+
|
|
43994
|
+
scale.copy = function() {
|
|
43995
|
+
return quantize_quantize()
|
|
43996
|
+
.domain([x0, x1])
|
|
43997
|
+
.range(range)
|
|
43998
|
+
.unknown(unknown);
|
|
43999
|
+
};
|
|
44000
|
+
|
|
44001
|
+
return initRange.apply(linearish(scale), arguments);
|
|
44002
|
+
}
|
|
44003
|
+
|
|
44004
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/model/heatmap.js
|
|
44005
|
+
var model_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44006
|
+
var extendStatics = function (d, b) {
|
|
44007
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44008
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44009
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44010
|
+
return extendStatics(d, b);
|
|
44011
|
+
};
|
|
44012
|
+
return function (d, b) {
|
|
44013
|
+
extendStatics(d, b);
|
|
44014
|
+
function __() { this.constructor = d; }
|
|
44015
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44016
|
+
};
|
|
44017
|
+
})();
|
|
44018
|
+
var heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44019
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44020
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44021
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44022
|
+
r[k] = a[j];
|
|
44023
|
+
return r;
|
|
44024
|
+
};
|
|
44025
|
+
// Internal Imports
|
|
44026
|
+
|
|
44027
|
+
|
|
44028
|
+
|
|
44029
|
+
// d3 imports
|
|
44030
|
+
|
|
44031
|
+
|
|
44032
|
+
/** The gauge chart model layer */
|
|
44033
|
+
var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
44034
|
+
model_heatmap_extends(HeatmapModel, _super);
|
|
44035
|
+
function HeatmapModel(services) {
|
|
44036
|
+
var _this = _super.call(this, services) || this;
|
|
44037
|
+
_this.axisFlavor = AxisFlavor.HOVERABLE;
|
|
44038
|
+
_this._colorScale = undefined;
|
|
44039
|
+
// List of unique ranges and domains
|
|
44040
|
+
_this._domains = [];
|
|
44041
|
+
_this._ranges = [];
|
|
44042
|
+
_this._matrix = {};
|
|
44043
|
+
// Check which scale types are being used
|
|
44044
|
+
var axis = tools_Tools.getProperty(_this.getOptions(), 'axes');
|
|
44045
|
+
// Need to check options since scale service hasn't been instantiated
|
|
44046
|
+
if ((!!tools_Tools.getProperty(axis, 'left', 'scaleType') &&
|
|
44047
|
+
tools_Tools.getProperty(axis, 'left', 'scaleType') !==
|
|
44048
|
+
ScaleTypes.LABELS) ||
|
|
44049
|
+
(!!tools_Tools.getProperty(axis, 'right', 'scaleType') &&
|
|
44050
|
+
tools_Tools.getProperty(axis, 'right', 'scaleType') !==
|
|
44051
|
+
ScaleTypes.LABELS) ||
|
|
44052
|
+
(!!tools_Tools.getProperty(axis, 'top', 'scaleType') &&
|
|
44053
|
+
tools_Tools.getProperty(axis, 'top', 'scaleType') !==
|
|
44054
|
+
ScaleTypes.LABELS) ||
|
|
44055
|
+
(!!tools_Tools.getProperty(axis, 'bottom', 'scaleType') &&
|
|
44056
|
+
tools_Tools.getProperty(axis, 'bottom', 'scaleType') !==
|
|
44057
|
+
ScaleTypes.LABELS)) {
|
|
44058
|
+
throw Error('Heatmap only supports label scaletypes.');
|
|
44059
|
+
}
|
|
44060
|
+
return _this;
|
|
44061
|
+
}
|
|
44062
|
+
/**
|
|
44063
|
+
* Get min and maximum value of the display data
|
|
44064
|
+
* @returns Array consisting of smallest and largest values in data
|
|
44065
|
+
*/
|
|
44066
|
+
HeatmapModel.prototype.getValueDomain = function () {
|
|
44067
|
+
var data = this.getDisplayData().map(function (element) { return element.value; });
|
|
44068
|
+
var limits = src_extent(data);
|
|
44069
|
+
var domain = [];
|
|
44070
|
+
// Round extent values to the nearest multiple of 10
|
|
44071
|
+
// Axis rounds values to multiples of 2, 5, and 10s.
|
|
44072
|
+
limits.forEach(function (number, index) {
|
|
44073
|
+
var value = Number(number);
|
|
44074
|
+
if (index === 0 && value >= 0) {
|
|
44075
|
+
value = 0;
|
|
44076
|
+
}
|
|
44077
|
+
else if (value % 10 === 0 || value === 0) {
|
|
44078
|
+
value;
|
|
44079
|
+
}
|
|
44080
|
+
else if (value < 0) {
|
|
44081
|
+
value = Math.floor(value / 10) * 10;
|
|
44082
|
+
}
|
|
44083
|
+
else {
|
|
44084
|
+
value = Math.ceil(value / 10) * 10;
|
|
44085
|
+
}
|
|
44086
|
+
domain.push(value);
|
|
44087
|
+
});
|
|
44088
|
+
// Ensure the median of the range is 0
|
|
44089
|
+
if (domain[0] < 0 && domain[1] > 0) {
|
|
44090
|
+
if (Math.abs(domain[0]) > domain[1]) {
|
|
44091
|
+
domain[1] = Math.abs(domain[0]);
|
|
44092
|
+
}
|
|
44093
|
+
else {
|
|
44094
|
+
domain[0] = -domain[1];
|
|
44095
|
+
}
|
|
44096
|
+
}
|
|
44097
|
+
return domain;
|
|
44098
|
+
};
|
|
44099
|
+
/**
|
|
44100
|
+
* @override
|
|
44101
|
+
* @param value
|
|
44102
|
+
* @returns
|
|
44103
|
+
*/
|
|
44104
|
+
HeatmapModel.prototype.getFillColor = function (value) {
|
|
44105
|
+
return this._colorScale(value);
|
|
44106
|
+
};
|
|
44107
|
+
/**
|
|
44108
|
+
* Generate a list of all unique domains
|
|
44109
|
+
* @returns String[]
|
|
44110
|
+
*/
|
|
44111
|
+
HeatmapModel.prototype.getUniqueDomain = function () {
|
|
44112
|
+
if (tools_Tools.isEmpty(this._domains)) {
|
|
44113
|
+
var displayData = this.getDisplayData();
|
|
44114
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44115
|
+
var domainIdentifier_1 = cartesianScales.getDomainIdentifier();
|
|
44116
|
+
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
44117
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainXAxisPosition);
|
|
44118
|
+
// Use user defined domain if specified
|
|
44119
|
+
if (!!customDomain) {
|
|
44120
|
+
return customDomain;
|
|
44121
|
+
}
|
|
44122
|
+
// Get unique axis values & create a matrix
|
|
44123
|
+
this._domains = Array.from(new Set(displayData.map(function (d) {
|
|
44124
|
+
return d[domainIdentifier_1];
|
|
44125
|
+
})));
|
|
44126
|
+
}
|
|
44127
|
+
return this._domains;
|
|
44128
|
+
};
|
|
44129
|
+
/**
|
|
44130
|
+
* Generates a list of all unique ranges
|
|
44131
|
+
* @returns String[]
|
|
44132
|
+
*/
|
|
44133
|
+
HeatmapModel.prototype.getUniqueRanges = function () {
|
|
44134
|
+
if (tools_Tools.isEmpty(this._ranges)) {
|
|
44135
|
+
var displayData = this.getDisplayData();
|
|
44136
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44137
|
+
var rangeIdentifier_1 = cartesianScales.getRangeIdentifier();
|
|
44138
|
+
var mainYAxisPosition = cartesianScales.getMainYAxisPosition();
|
|
44139
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainYAxisPosition);
|
|
44140
|
+
// Use user defined domain if specified
|
|
44141
|
+
if (!!customDomain) {
|
|
44142
|
+
return customDomain;
|
|
44143
|
+
}
|
|
44144
|
+
// Get unique axis values & create a matrix
|
|
44145
|
+
this._ranges = Array.from(new Set(displayData.map(function (d) {
|
|
44146
|
+
return d[rangeIdentifier_1];
|
|
44147
|
+
})));
|
|
44148
|
+
}
|
|
44149
|
+
return this._ranges;
|
|
44150
|
+
};
|
|
44151
|
+
/**
|
|
44152
|
+
* Generates a matrix (If doesn't exist) and returns it
|
|
44153
|
+
* @returns Object
|
|
44154
|
+
*/
|
|
44155
|
+
HeatmapModel.prototype.getMatrix = function () {
|
|
44156
|
+
var _this = this;
|
|
44157
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44158
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44159
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44160
|
+
var domainIdentifier_2 = this.services.cartesianScales.getDomainIdentifier();
|
|
44161
|
+
var rangeIdentifier_2 = this.services.cartesianScales.getRangeIdentifier();
|
|
44162
|
+
// Create a column
|
|
44163
|
+
var range_1 = {};
|
|
44164
|
+
uniqueRange.forEach(function (ran) {
|
|
44165
|
+
// Initialize matrix to empty state
|
|
44166
|
+
range_1[ran] = {
|
|
44167
|
+
value: null,
|
|
44168
|
+
index: -1,
|
|
44169
|
+
};
|
|
44170
|
+
});
|
|
44171
|
+
// Complete the matrix by cloning the column to all domains
|
|
44172
|
+
uniqueDomain.forEach(function (dom) {
|
|
44173
|
+
_this._matrix[dom] = tools_Tools.clone(range_1);
|
|
44174
|
+
});
|
|
44175
|
+
// Fill in user passed data
|
|
44176
|
+
this.getDisplayData().forEach(function (d, i) {
|
|
44177
|
+
_this._matrix[d[domainIdentifier_2]][d[rangeIdentifier_2]] = {
|
|
44178
|
+
value: d['value'],
|
|
44179
|
+
index: i,
|
|
44180
|
+
};
|
|
44181
|
+
});
|
|
44182
|
+
}
|
|
44183
|
+
return this._matrix;
|
|
44184
|
+
};
|
|
44185
|
+
/**
|
|
44186
|
+
*
|
|
44187
|
+
* @param newData The new raw data to be set
|
|
44188
|
+
*/
|
|
44189
|
+
HeatmapModel.prototype.setData = function (newData) {
|
|
44190
|
+
var sanitizedData = this.sanitize(tools_Tools.clone(newData));
|
|
44191
|
+
var dataGroups = this.generateDataGroups(sanitizedData);
|
|
44192
|
+
this.set({
|
|
44193
|
+
data: sanitizedData,
|
|
44194
|
+
dataGroups: dataGroups,
|
|
44195
|
+
});
|
|
44196
|
+
// Set attributes to empty
|
|
44197
|
+
this._domains = [];
|
|
44198
|
+
this._ranges = [];
|
|
44199
|
+
this._matrix = {};
|
|
44200
|
+
return sanitizedData;
|
|
44201
|
+
};
|
|
44202
|
+
/**
|
|
44203
|
+
* Converts Object matrix into a single array
|
|
44204
|
+
* @returns Object[]
|
|
44205
|
+
*/
|
|
44206
|
+
HeatmapModel.prototype.getMatrixAsArray = function () {
|
|
44207
|
+
var _this = this;
|
|
44208
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44209
|
+
this.getMatrix();
|
|
44210
|
+
}
|
|
44211
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44212
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44213
|
+
var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
|
|
44214
|
+
var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
|
|
44215
|
+
var arr = [];
|
|
44216
|
+
uniqueDomain.forEach(function (domain) {
|
|
44217
|
+
uniqueRange.forEach(function (range) {
|
|
44218
|
+
var element = {
|
|
44219
|
+
value: _this._matrix[domain][range].value,
|
|
44220
|
+
index: _this._matrix[domain][range].index,
|
|
44221
|
+
};
|
|
44222
|
+
element[domainIdentifier] = domain;
|
|
44223
|
+
element[rangeIdentifier] = range;
|
|
44224
|
+
arr.push(element);
|
|
44225
|
+
});
|
|
44226
|
+
});
|
|
44227
|
+
return arr;
|
|
44228
|
+
};
|
|
44229
|
+
/**
|
|
44230
|
+
* Generate tabular data from display data
|
|
44231
|
+
* @returns Array<Object>
|
|
44232
|
+
*/
|
|
44233
|
+
HeatmapModel.prototype.getTabularDataArray = function () {
|
|
44234
|
+
var displayData = this.getDisplayData();
|
|
44235
|
+
var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
|
|
44236
|
+
var domainValueFormatter;
|
|
44237
|
+
var result = heatmap_spreadArrays([
|
|
44238
|
+
[primaryDomain.label, primaryRange.label, 'Value']
|
|
44239
|
+
], displayData.map(function (datum) { return [
|
|
44240
|
+
datum[primaryDomain.identifier] === null
|
|
44241
|
+
? '–'
|
|
44242
|
+
: domainValueFormatter
|
|
44243
|
+
? domainValueFormatter(datum[primaryDomain.identifier])
|
|
44244
|
+
: datum[primaryDomain.identifier],
|
|
44245
|
+
datum[primaryRange.identifier] === null
|
|
44246
|
+
? '–'
|
|
44247
|
+
: datum[primaryRange.identifier].toLocaleString(),
|
|
44248
|
+
datum['value'],
|
|
44249
|
+
]; }));
|
|
44250
|
+
return result;
|
|
44251
|
+
};
|
|
44252
|
+
// Uses quantize scale to return class names
|
|
44253
|
+
HeatmapModel.prototype.getColorClassName = function (configs) {
|
|
44254
|
+
return configs.originalClassName + " " + this._colorScale(configs.value);
|
|
44255
|
+
};
|
|
44256
|
+
HeatmapModel.prototype.setColorClassNames = function () {
|
|
44257
|
+
var options = this.getOptions();
|
|
44258
|
+
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
44259
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
44260
|
+
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
44261
|
+
// If domain consists of negative and positive values, use diverging palettes
|
|
44262
|
+
var domain = this.getValueDomain();
|
|
44263
|
+
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
44264
|
+
// Use default color pairing options if not in defined range
|
|
44265
|
+
if (colorPairingOption < 1 &&
|
|
44266
|
+
colorPairingOption > 4 &&
|
|
44267
|
+
colorScheme === 'mono') {
|
|
44268
|
+
colorPairingOption = 1;
|
|
44269
|
+
}
|
|
44270
|
+
else if (colorPairingOption < 1 &&
|
|
44271
|
+
colorPairingOption > 2 &&
|
|
44272
|
+
colorScheme === 'diverge') {
|
|
44273
|
+
colorPairingOption = 1;
|
|
44274
|
+
}
|
|
44275
|
+
// Uses css classes for fill
|
|
44276
|
+
var colorPairing = customColorsEnabled ? customColors : [];
|
|
44277
|
+
if (!customColorsEnabled) {
|
|
44278
|
+
// Add class names to list and the amount based on the color scheme
|
|
44279
|
+
// Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
|
|
44280
|
+
var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
|
|
44281
|
+
for (var i = 1; i < colorGroupingLength + 1; i++) {
|
|
44282
|
+
colorPairing.push("fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
|
|
44283
|
+
}
|
|
44284
|
+
}
|
|
44285
|
+
// Save scale type
|
|
44286
|
+
this._colorScale = quantize_quantize()
|
|
44287
|
+
.domain(this.getValueDomain())
|
|
44288
|
+
.range(colorPairing);
|
|
44289
|
+
};
|
|
44290
|
+
return HeatmapModel;
|
|
44291
|
+
}(cartesian_charts_ChartModelCartesian));
|
|
44292
|
+
|
|
44293
|
+
//# sourceMappingURL=../../src/model/heatmap.js.map
|
|
44294
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/heatmap.js
|
|
44295
|
+
var charts_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44296
|
+
var extendStatics = function (d, b) {
|
|
44297
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44298
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44299
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44300
|
+
return extendStatics(d, b);
|
|
44301
|
+
};
|
|
44302
|
+
return function (d, b) {
|
|
44303
|
+
extendStatics(d, b);
|
|
44304
|
+
function __() { this.constructor = d; }
|
|
44305
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44306
|
+
};
|
|
44307
|
+
})();
|
|
44308
|
+
var charts_heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44309
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44310
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44311
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44312
|
+
r[k] = a[j];
|
|
44313
|
+
return r;
|
|
44314
|
+
};
|
|
44315
|
+
// Internal Imports
|
|
44316
|
+
|
|
44317
|
+
|
|
44318
|
+
|
|
44319
|
+
|
|
44320
|
+
|
|
44321
|
+
|
|
44322
|
+
var heatmap_HeatmapChart = /** @class */ (function (_super) {
|
|
44323
|
+
charts_heatmap_extends(HeatmapChart, _super);
|
|
44324
|
+
function HeatmapChart(holder, chartConfigs) {
|
|
44325
|
+
var _this = _super.call(this, holder, chartConfigs) || this;
|
|
44326
|
+
_this.model = new heatmap_HeatmapModel(_this.services);
|
|
44327
|
+
// Merge the default options for this chart
|
|
44328
|
+
// With the user provided options
|
|
44329
|
+
_this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.heatmapChart, chartConfigs.options));
|
|
44330
|
+
// Initialize data, services, components etc.
|
|
44331
|
+
_this.init(holder, chartConfigs);
|
|
44332
|
+
return _this;
|
|
44333
|
+
}
|
|
44334
|
+
// Custom getChartComponents - Implements getChartComponents
|
|
44335
|
+
// Removes zoombar support and additional `features` that are not supported in heatmap
|
|
44336
|
+
HeatmapChart.prototype.getAxisChartComponents = function (graphFrameComponents, configs) {
|
|
44337
|
+
var options = this.model.getOptions();
|
|
44338
|
+
var toolbarEnabled = tools_Tools.getProperty(options, 'toolbar', 'enabled');
|
|
44339
|
+
this.services.cartesianScales.determineAxisDuality();
|
|
44340
|
+
this.services.cartesianScales.findDomainAndRangeAxes(); // need to do this before getMainXAxisPosition()
|
|
44341
|
+
this.services.cartesianScales.determineOrientation();
|
|
44342
|
+
var titleAvailable = !!this.model.getOptions().title;
|
|
44343
|
+
var titleComponent = {
|
|
44344
|
+
id: 'title',
|
|
44345
|
+
components: [new title_Title(this.model, this.services)],
|
|
44346
|
+
growth: LayoutGrowth.STRETCH,
|
|
44347
|
+
};
|
|
44348
|
+
var toolbarComponent = {
|
|
44349
|
+
id: 'toolbar',
|
|
44350
|
+
components: [new toolbar_Toolbar(this.model, this.services)],
|
|
44351
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44352
|
+
};
|
|
44353
|
+
var headerComponent = {
|
|
44354
|
+
id: 'header',
|
|
44355
|
+
components: [
|
|
44356
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays([
|
|
44357
|
+
// always add title to keep layout correct
|
|
44358
|
+
titleComponent
|
|
44359
|
+
], (toolbarEnabled ? [toolbarComponent] : [])), {
|
|
44360
|
+
direction: LayoutDirection.ROW,
|
|
44361
|
+
alignItems: LayoutAlignItems.CENTER,
|
|
44362
|
+
}),
|
|
44363
|
+
],
|
|
44364
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44365
|
+
};
|
|
44366
|
+
var legendComponent = {
|
|
44367
|
+
id: 'legend',
|
|
44368
|
+
components: [new color_scale_legend_ColorScaleLegend(this.model, this.services)],
|
|
44369
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44370
|
+
renderType: RenderTypes.SVG,
|
|
44371
|
+
};
|
|
44372
|
+
var graphFrameComponent = {
|
|
44373
|
+
id: 'graph-frame',
|
|
44374
|
+
components: graphFrameComponents,
|
|
44375
|
+
growth: LayoutGrowth.STRETCH,
|
|
44376
|
+
renderType: RenderTypes.SVG,
|
|
44377
|
+
};
|
|
44378
|
+
var isLegendEnabled = tools_Tools.getProperty(configs, 'legend', 'enabled') !== false &&
|
|
44379
|
+
this.model.getOptions().legend.enabled !== false;
|
|
44380
|
+
// Decide the position of the legend in reference to the chart
|
|
44381
|
+
var fullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;
|
|
44382
|
+
var legendSpacerComponent = {
|
|
44383
|
+
id: 'spacer',
|
|
44384
|
+
components: [new spacer_Spacer(this.model, this.services, { size: 15 })],
|
|
44385
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44386
|
+
};
|
|
44387
|
+
var fullFrameComponent = {
|
|
44388
|
+
id: 'full-frame',
|
|
44389
|
+
components: [
|
|
44390
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays((isLegendEnabled ? [legendComponent] : []), (isLegendEnabled ? [legendSpacerComponent] : []), [
|
|
44391
|
+
graphFrameComponent,
|
|
44392
|
+
]), {
|
|
44393
|
+
direction: fullFrameComponentDirection,
|
|
44394
|
+
}),
|
|
44395
|
+
],
|
|
44396
|
+
growth: LayoutGrowth.STRETCH,
|
|
44397
|
+
};
|
|
44398
|
+
var topLevelLayoutComponents = [];
|
|
44399
|
+
// header component is required for either title or toolbar
|
|
44400
|
+
if (titleAvailable || toolbarEnabled) {
|
|
44401
|
+
topLevelLayoutComponents.push(headerComponent);
|
|
44402
|
+
var titleSpacerComponent = {
|
|
44403
|
+
id: 'spacer',
|
|
44404
|
+
components: [
|
|
44405
|
+
new spacer_Spacer(this.model, this.services, toolbarEnabled ? { size: 15 } : undefined),
|
|
44406
|
+
],
|
|
44407
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44408
|
+
};
|
|
44409
|
+
topLevelLayoutComponents.push(titleSpacerComponent);
|
|
44410
|
+
}
|
|
44411
|
+
topLevelLayoutComponents.push(fullFrameComponent);
|
|
44412
|
+
return [
|
|
44413
|
+
new tooltip_axis_AxisChartsTooltip(this.model, this.services),
|
|
44414
|
+
new essentials_modal_Modal(this.model, this.services),
|
|
44415
|
+
new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
|
|
44416
|
+
direction: LayoutDirection.COLUMN,
|
|
44417
|
+
}),
|
|
44418
|
+
];
|
|
44419
|
+
};
|
|
44420
|
+
HeatmapChart.prototype.getComponents = function () {
|
|
44421
|
+
// Specify what to render inside the graph-frame
|
|
44422
|
+
var graphFrameComponents = [
|
|
44423
|
+
new two_dimensional_axes_TwoDimensionalAxes(this.model, this.services),
|
|
44424
|
+
new heatmap_Heatmap(this.model, this.services),
|
|
44425
|
+
];
|
|
44426
|
+
var components = this.getAxisChartComponents(graphFrameComponents);
|
|
44427
|
+
return components;
|
|
44428
|
+
};
|
|
44429
|
+
return HeatmapChart;
|
|
44430
|
+
}(axis_chart_AxisChart));
|
|
44431
|
+
|
|
44432
|
+
//# sourceMappingURL=../../src/charts/heatmap.js.map
|
|
42932
44433
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
|
|
42933
44434
|
|
|
42934
44435
|
|
|
@@ -42951,6 +44452,7 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
42951
44452
|
|
|
42952
44453
|
|
|
42953
44454
|
|
|
44455
|
+
|
|
42954
44456
|
|
|
42955
44457
|
|
|
42956
44458
|
//# sourceMappingURL=../../src/charts/index.js.map
|
|
@@ -44162,6 +45664,52 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44162
45664
|
)
|
|
44163
45665
|
|
|
44164
45666
|
/* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
|
|
45667
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"624081f5-vue-loader-template"}!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
|
|
45668
|
+
var ccv_heatmap_chartvue_type_template_id_b6ba687e_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ccv-heatmap-chart"})}
|
|
45669
|
+
var ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns = []
|
|
45670
|
+
|
|
45671
|
+
|
|
45672
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
|
|
45673
|
+
|
|
45674
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--12-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/thread-loader/dist/cjs.js!/home/runner/work/carbon-charts/carbon-charts/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
|
|
45675
|
+
//
|
|
45676
|
+
//
|
|
45677
|
+
//
|
|
45678
|
+
//
|
|
45679
|
+
|
|
45680
|
+
|
|
45681
|
+
/* harmony default export */ var ccv_heatmap_chartvue_type_script_lang_js_ = ({
|
|
45682
|
+
name: 'CcvHeatmapChart',
|
|
45683
|
+
extends: ccv_base_chart,
|
|
45684
|
+
mounted: function mounted() {
|
|
45685
|
+
this.coreChart = new heatmap_HeatmapChart(this.$el, {
|
|
45686
|
+
data: this.data,
|
|
45687
|
+
options: this.options
|
|
45688
|
+
});
|
|
45689
|
+
}
|
|
45690
|
+
});
|
|
45691
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
|
|
45692
|
+
/* harmony default export */ var src_ccv_heatmap_chartvue_type_script_lang_js_ = (ccv_heatmap_chartvue_type_script_lang_js_);
|
|
45693
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue
|
|
45694
|
+
|
|
45695
|
+
|
|
45696
|
+
|
|
45697
|
+
|
|
45698
|
+
|
|
45699
|
+
/* normalize component */
|
|
45700
|
+
|
|
45701
|
+
var ccv_heatmap_chart_component = normalizeComponent(
|
|
45702
|
+
src_ccv_heatmap_chartvue_type_script_lang_js_,
|
|
45703
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_render,
|
|
45704
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns,
|
|
45705
|
+
false,
|
|
45706
|
+
null,
|
|
45707
|
+
null,
|
|
45708
|
+
null
|
|
45709
|
+
|
|
45710
|
+
)
|
|
45711
|
+
|
|
45712
|
+
/* harmony default export */ var ccv_heatmap_chart = (ccv_heatmap_chart_component.exports);
|
|
44165
45713
|
// CONCATENATED MODULE: ./src/index.js
|
|
44166
45714
|
|
|
44167
45715
|
|
|
@@ -44196,7 +45744,8 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44196
45744
|
|
|
44197
45745
|
|
|
44198
45746
|
|
|
44199
|
-
|
|
45747
|
+
|
|
45748
|
+
var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_chart, ccv_grouped_bar_chart, ccv_stacked_bar_chart, ccv_boxplot_chart, ccv_bubble_chart, ccv_bullet_chart, ccv_donut_chart, ccv_gauge_chart, ccv_histogram_chart, ccv_line_chart, ccv_lollipop_chart, ccv_pie_chart, ccv_scatter_chart, ccv_meter_chart, ccv_radar_chart, ccv_combo_chart, ccv_tree_chart, ccv_treemap_chart, ccv_circle_pack_chart, ccv_wordcloud_chart, ccv_alluvial_chart, ccv_heatmap_chart];
|
|
44200
45749
|
/*
|
|
44201
45750
|
Allows the module to be used as a Vue plug-in, and has an install()
|
|
44202
45751
|
method (which is called when the plug-in loads) that registers all the
|
|
@@ -44296,6 +45845,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
|
|
|
44296
45845
|
/* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
|
|
44297
45846
|
/* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
|
|
44298
45847
|
/* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
|
|
45848
|
+
/* concated harmony reexport CcvHeatmapChart */__webpack_require__.d(__webpack_exports__, "CcvHeatmapChart", function() { return ccv_heatmap_chart; });
|
|
44299
45849
|
|
|
44300
45850
|
|
|
44301
45851
|
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
|