@carbon/charts-vue 0.53.2 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/charts-vue.common.js +1796 -240
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +1796 -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.umd.js
CHANGED
|
@@ -319,6 +319,7 @@ __webpack_require__.d(events_namespaceObject, "Legend", function() { return even
|
|
|
319
319
|
__webpack_require__.d(events_namespaceObject, "CirclePack", function() { return events_CirclePack; });
|
|
320
320
|
__webpack_require__.d(events_namespaceObject, "Alluvial", function() { return events_Alluvial; });
|
|
321
321
|
__webpack_require__.d(events_namespaceObject, "Meter", function() { return events_Meter; });
|
|
322
|
+
__webpack_require__.d(events_namespaceObject, "Heatmap", function() { return events_Heatmap; });
|
|
322
323
|
var configuration_namespaceObject = {};
|
|
323
324
|
__webpack_require__.r(configuration_namespaceObject);
|
|
324
325
|
__webpack_require__.d(configuration_namespaceObject, "grid", function() { return grid; });
|
|
@@ -333,12 +334,13 @@ __webpack_require__.d(configuration_namespaceObject, "circlePack", function() {
|
|
|
333
334
|
__webpack_require__.d(configuration_namespaceObject, "color", function() { return configuration_non_customizable_color; });
|
|
334
335
|
__webpack_require__.d(configuration_namespaceObject, "boxplot", function() { return boxplot; });
|
|
335
336
|
__webpack_require__.d(configuration_namespaceObject, "histogram", function() { return configuration_non_customizable_histogram; });
|
|
336
|
-
__webpack_require__.d(configuration_namespaceObject, "legend", function() { return
|
|
337
|
+
__webpack_require__.d(configuration_namespaceObject, "legend", function() { return configuration_non_customizable_legend; });
|
|
337
338
|
__webpack_require__.d(configuration_namespaceObject, "lines", function() { return configuration_non_customizable_lines; });
|
|
338
339
|
__webpack_require__.d(configuration_namespaceObject, "meter", function() { return meter; });
|
|
339
340
|
__webpack_require__.d(configuration_namespaceObject, "pie", function() { return configuration_non_customizable_pie; });
|
|
340
341
|
__webpack_require__.d(configuration_namespaceObject, "radar", function() { return radar; });
|
|
341
342
|
__webpack_require__.d(configuration_namespaceObject, "alluvial", function() { return alluvial; });
|
|
343
|
+
__webpack_require__.d(configuration_namespaceObject, "heatmap", function() { return heatmap; });
|
|
342
344
|
__webpack_require__.d(configuration_namespaceObject, "spacers", function() { return spacers; });
|
|
343
345
|
__webpack_require__.d(configuration_namespaceObject, "tooltips", function() { return tooltips; });
|
|
344
346
|
__webpack_require__.d(configuration_namespaceObject, "transitions", function() { return configuration_non_customizable_transitions; });
|
|
@@ -450,6 +452,7 @@ var events_Toolbar;
|
|
|
450
452
|
(function (Toolbar) {
|
|
451
453
|
Toolbar["SHOW_OVERFLOW_MENU"] = "show-toolbar-overflow-menu";
|
|
452
454
|
Toolbar["HIDE_OVERFLOW_MENU"] = "hide-toolbar-overflow-menu";
|
|
455
|
+
Toolbar["BUTTON_CLICK"] = "toolbar-button-click";
|
|
453
456
|
})(events_Toolbar || (events_Toolbar = {}));
|
|
454
457
|
/**
|
|
455
458
|
* enum of all events related to the zoom-bar
|
|
@@ -485,6 +488,9 @@ var events_Axis;
|
|
|
485
488
|
Axis["LABEL_MOUSEMOVE"] = "axis-label-mousemove";
|
|
486
489
|
Axis["LABEL_CLICK"] = "axis-label-click";
|
|
487
490
|
Axis["LABEL_MOUSEOUT"] = "axis-label-mouseout";
|
|
491
|
+
Axis["LABEL_FOCUS"] = "axis-label-focus";
|
|
492
|
+
Axis["LABEL_BLUR"] = "axis-label-blur";
|
|
493
|
+
Axis["RENDER_COMPLETE"] = "axis-render-complete";
|
|
488
494
|
})(events_Axis || (events_Axis = {}));
|
|
489
495
|
/**
|
|
490
496
|
* enum of all area graph events
|
|
@@ -660,6 +666,16 @@ var events_Meter;
|
|
|
660
666
|
Meter["METER_MOUSEOUT"] = "meter-mouseout";
|
|
661
667
|
Meter["METER_MOUSEMOVE"] = "meter-mousemove";
|
|
662
668
|
})(events_Meter || (events_Meter = {}));
|
|
669
|
+
/**
|
|
670
|
+
* enum of all heatmap related events
|
|
671
|
+
*/
|
|
672
|
+
var events_Heatmap;
|
|
673
|
+
(function (Heatmap) {
|
|
674
|
+
Heatmap["HEATMAP_MOUSEOVER"] = "heatmap-mouseover";
|
|
675
|
+
Heatmap["HEATMAP_CLICK"] = "heatmap-click";
|
|
676
|
+
Heatmap["HEATMAP_MOUSEOUT"] = "heatmap-mouseout";
|
|
677
|
+
Heatmap["HEATMAP_MOUSEMOVE"] = "hetmap-mousemove";
|
|
678
|
+
})(events_Heatmap || (events_Heatmap = {}));
|
|
663
679
|
//# sourceMappingURL=../../src/interfaces/events.js.map
|
|
664
680
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/enums.js
|
|
665
681
|
|
|
@@ -893,6 +909,7 @@ var ToolbarControlTypes;
|
|
|
893
909
|
ToolbarControlTypes["RESET_ZOOM"] = "Reset zoom";
|
|
894
910
|
ToolbarControlTypes["MAKE_FULLSCREEN"] = "Make fullscreen";
|
|
895
911
|
ToolbarControlTypes["SHOW_AS_DATATABLE"] = "Show as data-table";
|
|
912
|
+
ToolbarControlTypes["CUSTOM"] = "Custom";
|
|
896
913
|
})(ToolbarControlTypes || (ToolbarControlTypes = {}));
|
|
897
914
|
/**
|
|
898
915
|
* enum of title orientations for _vertical axes_
|
|
@@ -915,6 +932,31 @@ var LegendItemType;
|
|
|
915
932
|
LegendItemType["QUARTILE"] = "quartile";
|
|
916
933
|
LegendItemType["ZOOM"] = "zoom";
|
|
917
934
|
})(LegendItemType || (LegendItemType = {}));
|
|
935
|
+
/**
|
|
936
|
+
* enum of color legend types
|
|
937
|
+
*/
|
|
938
|
+
var ColorLegendType;
|
|
939
|
+
(function (ColorLegendType) {
|
|
940
|
+
ColorLegendType["LINEAR"] = "linear";
|
|
941
|
+
ColorLegendType["QUANTIZE"] = "quantize";
|
|
942
|
+
})(ColorLegendType || (ColorLegendType = {}));
|
|
943
|
+
/**
|
|
944
|
+
* enum of divider status for heatmap
|
|
945
|
+
*/
|
|
946
|
+
var DividerStatus;
|
|
947
|
+
(function (DividerStatus) {
|
|
948
|
+
DividerStatus["ON"] = "on";
|
|
949
|
+
DividerStatus["AUTO"] = "auto";
|
|
950
|
+
DividerStatus["OFF"] = "off";
|
|
951
|
+
})(DividerStatus || (DividerStatus = {}));
|
|
952
|
+
/**
|
|
953
|
+
* enum of axis flavor
|
|
954
|
+
*/
|
|
955
|
+
var AxisFlavor;
|
|
956
|
+
(function (AxisFlavor) {
|
|
957
|
+
AxisFlavor["DEFAULT"] = "default";
|
|
958
|
+
AxisFlavor["HOVERABLE"] = "hoverable";
|
|
959
|
+
})(AxisFlavor || (AxisFlavor = {}));
|
|
918
960
|
//# sourceMappingURL=../../src/interfaces/enums.js.map
|
|
919
961
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/index.js
|
|
920
962
|
|
|
@@ -955,6 +997,9 @@ var configuration_non_customizable_axis = {
|
|
|
955
997
|
compareTo: 'marker',
|
|
956
998
|
},
|
|
957
999
|
paddingRatio: 0.1,
|
|
1000
|
+
hover: {
|
|
1001
|
+
rectanglePadding: 4,
|
|
1002
|
+
},
|
|
958
1003
|
};
|
|
959
1004
|
var canvasZoomSettings = {
|
|
960
1005
|
duration: 1000,
|
|
@@ -1006,7 +1051,7 @@ var boxplot = {
|
|
|
1006
1051
|
var configuration_non_customizable_histogram = {
|
|
1007
1052
|
defaultBins: 10,
|
|
1008
1053
|
};
|
|
1009
|
-
var
|
|
1054
|
+
var configuration_non_customizable_legend = {
|
|
1010
1055
|
items: {
|
|
1011
1056
|
status: {
|
|
1012
1057
|
ACTIVE: 1,
|
|
@@ -1059,6 +1104,11 @@ var legend = {
|
|
|
1059
1104
|
iconData: [{ x: 0, y: 0, width: 12, height: 12 }],
|
|
1060
1105
|
color: '#8D8D8D',
|
|
1061
1106
|
},
|
|
1107
|
+
color: {
|
|
1108
|
+
barWidth: 300,
|
|
1109
|
+
barHeight: 8,
|
|
1110
|
+
axisYTranslation: 10,
|
|
1111
|
+
},
|
|
1062
1112
|
};
|
|
1063
1113
|
var configuration_non_customizable_lines = {
|
|
1064
1114
|
opacity: {
|
|
@@ -1128,6 +1178,11 @@ var alluvial = {
|
|
|
1128
1178
|
selected: 1,
|
|
1129
1179
|
},
|
|
1130
1180
|
};
|
|
1181
|
+
var heatmap = {
|
|
1182
|
+
minCellDividerDimension: 16,
|
|
1183
|
+
// Ensures axes lines are displayed with or without stroke disabled
|
|
1184
|
+
chartPadding: 0.5,
|
|
1185
|
+
};
|
|
1131
1186
|
var spacers = {
|
|
1132
1187
|
default: {
|
|
1133
1188
|
size: 24,
|
|
@@ -8785,6 +8840,17 @@ var alluvialChart = tools_Tools.merge({}, chart, {
|
|
|
8785
8840
|
nodes: [],
|
|
8786
8841
|
},
|
|
8787
8842
|
});
|
|
8843
|
+
var heatmapChart = tools_Tools.merge({}, chart, {
|
|
8844
|
+
axes: configuration_axes,
|
|
8845
|
+
heatmap: {
|
|
8846
|
+
divider: {
|
|
8847
|
+
state: DividerStatus.AUTO,
|
|
8848
|
+
},
|
|
8849
|
+
colorLegend: {
|
|
8850
|
+
type: 'linear',
|
|
8851
|
+
},
|
|
8852
|
+
},
|
|
8853
|
+
});
|
|
8788
8854
|
var configuration_options = {
|
|
8789
8855
|
chart: chart,
|
|
8790
8856
|
axisChart: axisChart,
|
|
@@ -8812,6 +8878,7 @@ var configuration_options = {
|
|
|
8812
8878
|
circlePackChart: circlePackChart,
|
|
8813
8879
|
wordCloudChart: wordCloudChart,
|
|
8814
8880
|
alluvialChart: alluvialChart,
|
|
8881
|
+
heatmapChart: heatmapChart,
|
|
8815
8882
|
};
|
|
8816
8883
|
|
|
8817
8884
|
//# sourceMappingURL=../src/configuration.js.map
|
|
@@ -9503,7 +9570,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9503
9570
|
if (!this.get('data')) {
|
|
9504
9571
|
return null;
|
|
9505
9572
|
}
|
|
9506
|
-
var ACTIVE =
|
|
9573
|
+
var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
|
|
9507
9574
|
var dataGroups = this.getDataGroups(groups);
|
|
9508
9575
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
9509
9576
|
var allDataFromDomain = this.getAllDataFromDomain(groups);
|
|
@@ -9548,7 +9615,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9548
9615
|
return this.get('dataGroups');
|
|
9549
9616
|
};
|
|
9550
9617
|
ChartModel.prototype.getActiveDataGroups = function (groups) {
|
|
9551
|
-
var ACTIVE =
|
|
9618
|
+
var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
|
|
9552
9619
|
return this.getDataGroups(groups).filter(function (dataGroup) { return dataGroup.status === ACTIVE; });
|
|
9553
9620
|
};
|
|
9554
9621
|
ChartModel.prototype.getDataGroupNames = function (groups) {
|
|
@@ -9820,7 +9887,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9820
9887
|
* Data labels
|
|
9821
9888
|
*/
|
|
9822
9889
|
ChartModel.prototype.toggleDataLabel = function (changedLabel) {
|
|
9823
|
-
var _a =
|
|
9890
|
+
var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
9824
9891
|
var dataGroups = this.getDataGroups();
|
|
9825
9892
|
var hasDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
|
|
9826
9893
|
var activeItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
|
|
@@ -10031,7 +10098,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
10031
10098
|
};
|
|
10032
10099
|
ChartModel.prototype.generateDataGroups = function (data) {
|
|
10033
10100
|
var groupMapsTo = this.getOptions().data.groupMapsTo;
|
|
10034
|
-
var _a =
|
|
10101
|
+
var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
|
|
10035
10102
|
var options = this.getOptions();
|
|
10036
10103
|
var uniqueDataGroups = tools_Tools.removeArrayDuplicates(data.map(function (datum) { return datum[groupMapsTo]; }));
|
|
10037
10104
|
// check if selectedGroups can be applied to chart with current data groups
|
|
@@ -16020,6 +16087,22 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
|
|
|
16020
16087
|
this.dualAxes = true;
|
|
16021
16088
|
}
|
|
16022
16089
|
};
|
|
16090
|
+
CartesianScales.prototype.getCustomDomainValuesByposition = function (axisPosition) {
|
|
16091
|
+
var domain = tools_Tools.getProperty(this.model.getOptions(), 'axes', axisPosition, 'domain');
|
|
16092
|
+
// Check if domain is an array
|
|
16093
|
+
if (domain && !Array.isArray(domain)) {
|
|
16094
|
+
throw new Error("Domain in " + axisPosition + " axis is not a valid array");
|
|
16095
|
+
}
|
|
16096
|
+
// Determine number of elements passed in domain depending on scale types
|
|
16097
|
+
if (Array.isArray(domain)) {
|
|
16098
|
+
if ((this.scaleTypes[axisPosition] === ScaleTypes.LINEAR ||
|
|
16099
|
+
this.scaleTypes[axisPosition] === ScaleTypes.TIME) &&
|
|
16100
|
+
domain.length !== 2) {
|
|
16101
|
+
throw new Error("There can only be 2 elements in domain for scale type: " + this.scaleTypes[axisPosition]);
|
|
16102
|
+
}
|
|
16103
|
+
}
|
|
16104
|
+
return domain;
|
|
16105
|
+
};
|
|
16023
16106
|
CartesianScales.prototype.getOrientation = function () {
|
|
16024
16107
|
return this.orientation;
|
|
16025
16108
|
};
|
|
@@ -17537,6 +17620,11 @@ var zoom_Zoom = /** @class */ (function (_super) {
|
|
|
17537
17620
|
var cartesianScales = this.services.cartesianScales;
|
|
17538
17621
|
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
17539
17622
|
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
17623
|
+
var customDomain = tools_Tools.getProperty(this.model.getOptions(), 'axes', mainXAxisPosition, 'domain');
|
|
17624
|
+
// return custom domain if exists && valid
|
|
17625
|
+
if (Array.isArray(customDomain) && customDomain.length === 2) {
|
|
17626
|
+
return customDomain;
|
|
17627
|
+
}
|
|
17540
17628
|
// default to full range with extended domain
|
|
17541
17629
|
return cartesianScales.extendsDomain(mainXAxisPosition, src_extent(allZoomBarData, function (d) { return d[domainIdentifier]; }));
|
|
17542
17630
|
};
|
|
@@ -17915,7 +18003,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17915
18003
|
var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
|
|
17916
18004
|
var dataGroups = this.model.getDataGroups();
|
|
17917
18005
|
// Check if there are disabled legend items
|
|
17918
|
-
var DISABLED =
|
|
18006
|
+
var DISABLED = configuration_non_customizable_legend.items.status.DISABLED;
|
|
17919
18007
|
var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
|
|
17920
18008
|
var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
|
|
17921
18009
|
var svg = this.getComponentContainer()
|
|
@@ -17939,11 +18027,11 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17939
18027
|
addedLegendItems
|
|
17940
18028
|
.merge(svg.selectAll('div.legend-item'))
|
|
17941
18029
|
.classed('active', function (d, i) {
|
|
17942
|
-
return d.status ===
|
|
18030
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17943
18031
|
});
|
|
17944
18032
|
var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
|
|
17945
18033
|
svg.classed('clickable', legendClickable && dataGroups.length > 1);
|
|
17946
|
-
var checkboxRadius =
|
|
18034
|
+
var checkboxRadius = configuration_non_customizable_legend.checkbox.radius;
|
|
17947
18035
|
var addedCheckboxes = addedLegendItems
|
|
17948
18036
|
.append('div')
|
|
17949
18037
|
.classed('checkbox', true);
|
|
@@ -17956,7 +18044,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17956
18044
|
})
|
|
17957
18045
|
.attr('aria-checked', function (_a) {
|
|
17958
18046
|
var status = _a.status;
|
|
17959
|
-
return status ===
|
|
18047
|
+
return status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17960
18048
|
})
|
|
17961
18049
|
.attr('width', checkboxRadius * 2)
|
|
17962
18050
|
.attr('height', checkboxRadius * 2)
|
|
@@ -17968,13 +18056,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
17968
18056
|
});
|
|
17969
18057
|
})
|
|
17970
18058
|
.style('background', function (d) {
|
|
17971
|
-
return d.status ===
|
|
18059
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE
|
|
17972
18060
|
? _this.model.getFillColor(d.name) ||
|
|
17973
18061
|
_this.model.getStrokeColor(d.name)
|
|
17974
18062
|
: null;
|
|
17975
18063
|
})
|
|
17976
18064
|
.classed('active', function (d, i) {
|
|
17977
|
-
return d.status ===
|
|
18065
|
+
return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
|
|
17978
18066
|
});
|
|
17979
18067
|
var addedCheckIcons = addedCheckboxes
|
|
17980
18068
|
.append('svg')
|
|
@@ -18059,7 +18147,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18059
18147
|
return dataGroups;
|
|
18060
18148
|
};
|
|
18061
18149
|
Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
|
|
18062
|
-
var _a =
|
|
18150
|
+
var _a = configuration_non_customizable_legend.area, width = _a.width, height = _a.height;
|
|
18063
18151
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18064
18152
|
// Circular icon
|
|
18065
18153
|
additionalItem
|
|
@@ -18072,7 +18160,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18072
18160
|
.style('height', height + "px");
|
|
18073
18161
|
}
|
|
18074
18162
|
if (itemConfig.type === LegendItemType.RADIUS) {
|
|
18075
|
-
var _b =
|
|
18163
|
+
var _b = configuration_non_customizable_legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
|
|
18076
18164
|
var circleEnter = additionalItem
|
|
18077
18165
|
.attr('fill', 'none')
|
|
18078
18166
|
.selectAll('circle')
|
|
@@ -18090,7 +18178,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18090
18178
|
.style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
|
|
18091
18179
|
}
|
|
18092
18180
|
else if (itemConfig.type === LegendItemType.LINE) {
|
|
18093
|
-
var lineConfig =
|
|
18181
|
+
var lineConfig = configuration_non_customizable_legend.line;
|
|
18094
18182
|
if (additionalItem.select('line.line').empty()) {
|
|
18095
18183
|
additionalItem
|
|
18096
18184
|
.append('line')
|
|
@@ -18117,13 +18205,13 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18117
18205
|
.attr('width', width)
|
|
18118
18206
|
.attr('height', height)
|
|
18119
18207
|
.style('fill', indexOfItem > 3 && !itemConfig.fill
|
|
18120
|
-
?
|
|
18208
|
+
? configuration_non_customizable_legend.area.fill
|
|
18121
18209
|
: itemConfig.fill)
|
|
18122
18210
|
.style('stroke', itemConfig.stroke);
|
|
18123
18211
|
}
|
|
18124
18212
|
}
|
|
18125
18213
|
else if (itemConfig.type === LegendItemType.SIZE) {
|
|
18126
|
-
var _c =
|
|
18214
|
+
var _c = configuration_non_customizable_legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
|
|
18127
18215
|
var sizeEnter = additionalItem
|
|
18128
18216
|
.attr('fill', 'none')
|
|
18129
18217
|
.attr('role', Roles.IMG)
|
|
@@ -18142,7 +18230,7 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18142
18230
|
.style('stroke-width', 1);
|
|
18143
18231
|
}
|
|
18144
18232
|
else if (itemConfig.type === LegendItemType.QUARTILE) {
|
|
18145
|
-
var iconData =
|
|
18233
|
+
var iconData = configuration_non_customizable_legend.quartile.iconData;
|
|
18146
18234
|
var quartileEnter = additionalItem
|
|
18147
18235
|
.selectAll('rect')
|
|
18148
18236
|
.attr('role', Roles.IMG)
|
|
@@ -18296,6 +18384,431 @@ var legend_Legend = /** @class */ (function (_super) {
|
|
|
18296
18384
|
}(component_Component));
|
|
18297
18385
|
|
|
18298
18386
|
//# sourceMappingURL=../../../src/components/essentials/legend.js.map
|
|
18387
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
|
|
18388
|
+
/* harmony default export */ var d3_axis_src_identity = (function(x) {
|
|
18389
|
+
return x;
|
|
18390
|
+
});
|
|
18391
|
+
|
|
18392
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
|
|
18393
|
+
|
|
18394
|
+
|
|
18395
|
+
var axis_top = 1,
|
|
18396
|
+
axis_right = 2,
|
|
18397
|
+
bottom = 3,
|
|
18398
|
+
axis_left = 4,
|
|
18399
|
+
axis_epsilon = 1e-6;
|
|
18400
|
+
|
|
18401
|
+
function axis_translateX(x) {
|
|
18402
|
+
return "translate(" + x + ",0)";
|
|
18403
|
+
}
|
|
18404
|
+
|
|
18405
|
+
function axis_translateY(y) {
|
|
18406
|
+
return "translate(0," + y + ")";
|
|
18407
|
+
}
|
|
18408
|
+
|
|
18409
|
+
function axis_number(scale) {
|
|
18410
|
+
return d => +scale(d);
|
|
18411
|
+
}
|
|
18412
|
+
|
|
18413
|
+
function center(scale, offset) {
|
|
18414
|
+
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
18415
|
+
if (scale.round()) offset = Math.round(offset);
|
|
18416
|
+
return d => +scale(d) + offset;
|
|
18417
|
+
}
|
|
18418
|
+
|
|
18419
|
+
function entering() {
|
|
18420
|
+
return !this.__axis;
|
|
18421
|
+
}
|
|
18422
|
+
|
|
18423
|
+
function axis_axis(orient, scale) {
|
|
18424
|
+
var tickArguments = [],
|
|
18425
|
+
tickValues = null,
|
|
18426
|
+
tickFormat = null,
|
|
18427
|
+
tickSizeInner = 6,
|
|
18428
|
+
tickSizeOuter = 6,
|
|
18429
|
+
tickPadding = 3,
|
|
18430
|
+
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
18431
|
+
k = orient === axis_top || orient === axis_left ? -1 : 1,
|
|
18432
|
+
x = orient === axis_left || orient === axis_right ? "x" : "y",
|
|
18433
|
+
transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
|
|
18434
|
+
|
|
18435
|
+
function axis(context) {
|
|
18436
|
+
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
18437
|
+
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
|
|
18438
|
+
spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
|
18439
|
+
range = scale.range(),
|
|
18440
|
+
range0 = +range[0] + offset,
|
|
18441
|
+
range1 = +range[range.length - 1] + offset,
|
|
18442
|
+
position = (scale.bandwidth ? center : axis_number)(scale.copy(), offset),
|
|
18443
|
+
selection = context.selection ? context.selection() : context,
|
|
18444
|
+
path = selection.selectAll(".domain").data([null]),
|
|
18445
|
+
tick = selection.selectAll(".tick").data(values, scale).order(),
|
|
18446
|
+
tickExit = tick.exit(),
|
|
18447
|
+
tickEnter = tick.enter().append("g").attr("class", "tick"),
|
|
18448
|
+
line = tick.select("line"),
|
|
18449
|
+
text = tick.select("text");
|
|
18450
|
+
|
|
18451
|
+
path = path.merge(path.enter().insert("path", ".tick")
|
|
18452
|
+
.attr("class", "domain")
|
|
18453
|
+
.attr("stroke", "currentColor"));
|
|
18454
|
+
|
|
18455
|
+
tick = tick.merge(tickEnter);
|
|
18456
|
+
|
|
18457
|
+
line = line.merge(tickEnter.append("line")
|
|
18458
|
+
.attr("stroke", "currentColor")
|
|
18459
|
+
.attr(x + "2", k * tickSizeInner));
|
|
18460
|
+
|
|
18461
|
+
text = text.merge(tickEnter.append("text")
|
|
18462
|
+
.attr("fill", "currentColor")
|
|
18463
|
+
.attr(x, k * spacing)
|
|
18464
|
+
.attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
18465
|
+
|
|
18466
|
+
if (context !== selection) {
|
|
18467
|
+
path = path.transition(context);
|
|
18468
|
+
tick = tick.transition(context);
|
|
18469
|
+
line = line.transition(context);
|
|
18470
|
+
text = text.transition(context);
|
|
18471
|
+
|
|
18472
|
+
tickExit = tickExit.transition(context)
|
|
18473
|
+
.attr("opacity", axis_epsilon)
|
|
18474
|
+
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
|
|
18475
|
+
|
|
18476
|
+
tickEnter
|
|
18477
|
+
.attr("opacity", axis_epsilon)
|
|
18478
|
+
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
|
|
18479
|
+
}
|
|
18480
|
+
|
|
18481
|
+
tickExit.remove();
|
|
18482
|
+
|
|
18483
|
+
path
|
|
18484
|
+
.attr("d", orient === axis_left || orient === axis_right
|
|
18485
|
+
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
18486
|
+
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
18487
|
+
|
|
18488
|
+
tick
|
|
18489
|
+
.attr("opacity", 1)
|
|
18490
|
+
.attr("transform", function(d) { return transform(position(d) + offset); });
|
|
18491
|
+
|
|
18492
|
+
line
|
|
18493
|
+
.attr(x + "2", k * tickSizeInner);
|
|
18494
|
+
|
|
18495
|
+
text
|
|
18496
|
+
.attr(x, k * spacing)
|
|
18497
|
+
.text(format);
|
|
18498
|
+
|
|
18499
|
+
selection.filter(entering)
|
|
18500
|
+
.attr("fill", "none")
|
|
18501
|
+
.attr("font-size", 10)
|
|
18502
|
+
.attr("font-family", "sans-serif")
|
|
18503
|
+
.attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
|
18504
|
+
|
|
18505
|
+
selection
|
|
18506
|
+
.each(function() { this.__axis = position; });
|
|
18507
|
+
}
|
|
18508
|
+
|
|
18509
|
+
axis.scale = function(_) {
|
|
18510
|
+
return arguments.length ? (scale = _, axis) : scale;
|
|
18511
|
+
};
|
|
18512
|
+
|
|
18513
|
+
axis.ticks = function() {
|
|
18514
|
+
return tickArguments = Array.from(arguments), axis;
|
|
18515
|
+
};
|
|
18516
|
+
|
|
18517
|
+
axis.tickArguments = function(_) {
|
|
18518
|
+
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
|
|
18519
|
+
};
|
|
18520
|
+
|
|
18521
|
+
axis.tickValues = function(_) {
|
|
18522
|
+
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
|
|
18523
|
+
};
|
|
18524
|
+
|
|
18525
|
+
axis.tickFormat = function(_) {
|
|
18526
|
+
return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
|
18527
|
+
};
|
|
18528
|
+
|
|
18529
|
+
axis.tickSize = function(_) {
|
|
18530
|
+
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
|
18531
|
+
};
|
|
18532
|
+
|
|
18533
|
+
axis.tickSizeInner = function(_) {
|
|
18534
|
+
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
|
18535
|
+
};
|
|
18536
|
+
|
|
18537
|
+
axis.tickSizeOuter = function(_) {
|
|
18538
|
+
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
|
18539
|
+
};
|
|
18540
|
+
|
|
18541
|
+
axis.tickPadding = function(_) {
|
|
18542
|
+
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
|
18543
|
+
};
|
|
18544
|
+
|
|
18545
|
+
axis.offset = function(_) {
|
|
18546
|
+
return arguments.length ? (offset = +_, axis) : offset;
|
|
18547
|
+
};
|
|
18548
|
+
|
|
18549
|
+
return axis;
|
|
18550
|
+
}
|
|
18551
|
+
|
|
18552
|
+
function axisTop(scale) {
|
|
18553
|
+
return axis_axis(axis_top, scale);
|
|
18554
|
+
}
|
|
18555
|
+
|
|
18556
|
+
function axisRight(scale) {
|
|
18557
|
+
return axis_axis(axis_right, scale);
|
|
18558
|
+
}
|
|
18559
|
+
|
|
18560
|
+
function axisBottom(scale) {
|
|
18561
|
+
return axis_axis(bottom, scale);
|
|
18562
|
+
}
|
|
18563
|
+
|
|
18564
|
+
function axisLeft(scale) {
|
|
18565
|
+
return axis_axis(axis_left, scale);
|
|
18566
|
+
}
|
|
18567
|
+
|
|
18568
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-interpolate/src/quantize.js
|
|
18569
|
+
/* harmony default export */ var quantize = (function(interpolator, n) {
|
|
18570
|
+
var samples = new Array(n);
|
|
18571
|
+
for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
|
|
18572
|
+
return samples;
|
|
18573
|
+
});
|
|
18574
|
+
|
|
18575
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/essentials/color-scale-legend.js
|
|
18576
|
+
var color_scale_legend_extends = (undefined && undefined.__extends) || (function () {
|
|
18577
|
+
var extendStatics = function (d, b) {
|
|
18578
|
+
extendStatics = Object.setPrototypeOf ||
|
|
18579
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
18580
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
18581
|
+
return extendStatics(d, b);
|
|
18582
|
+
};
|
|
18583
|
+
return function (d, b) {
|
|
18584
|
+
extendStatics(d, b);
|
|
18585
|
+
function __() { this.constructor = d; }
|
|
18586
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
18587
|
+
};
|
|
18588
|
+
})();
|
|
18589
|
+
// Internal Imports
|
|
18590
|
+
|
|
18591
|
+
|
|
18592
|
+
|
|
18593
|
+
|
|
18594
|
+
|
|
18595
|
+
// D3 imports
|
|
18596
|
+
|
|
18597
|
+
|
|
18598
|
+
|
|
18599
|
+
var color_scale_legend_ColorScaleLegend = /** @class */ (function (_super) {
|
|
18600
|
+
color_scale_legend_extends(ColorScaleLegend, _super);
|
|
18601
|
+
function ColorScaleLegend() {
|
|
18602
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
18603
|
+
_this.type = 'color-legend';
|
|
18604
|
+
_this.renderType = RenderTypes.SVG;
|
|
18605
|
+
_this.gradient_id = 'gradient-id-' + Math.floor(Math.random() * 99999999999);
|
|
18606
|
+
_this.handleAxisComplete = function (event) {
|
|
18607
|
+
var svg = _this.getComponentContainer();
|
|
18608
|
+
var width = dom_utils_DOMUtils.getSVGElementSize(svg, {
|
|
18609
|
+
useAttrs: true,
|
|
18610
|
+
}).width;
|
|
18611
|
+
var isDataLoading = tools_Tools.getProperty(_this.getOptions(), 'data', 'loading');
|
|
18612
|
+
if (width > configuration_non_customizable_legend.color.barWidth && !isDataLoading) {
|
|
18613
|
+
var title = tools_Tools.getProperty(_this.getOptions(), 'heatmap', 'colorLegend', 'title');
|
|
18614
|
+
var cartesianScales = _this.services.cartesianScales;
|
|
18615
|
+
// Get available chart area
|
|
18616
|
+
var mainXScale = cartesianScales.getMainXScale();
|
|
18617
|
+
var xDimensions = mainXScale.range();
|
|
18618
|
+
// Align legend with the axis
|
|
18619
|
+
if (xDimensions[0] > 1) {
|
|
18620
|
+
svg.select('g.legend').attr('transform', "translate(" + xDimensions[0] + ", 0)");
|
|
18621
|
+
if (title) {
|
|
18622
|
+
var textWidth = dom_utils_DOMUtils.getSVGElementSize(svg.select('g.legend-title').select('text'), { useBBox: true }).width;
|
|
18623
|
+
// -9 since LEFT y-axis labels are moved towards the left by 9 by d3
|
|
18624
|
+
var availableSpace = xDimensions[0] - textWidth - 9;
|
|
18625
|
+
// If space is available align the the label with the axis labels
|
|
18626
|
+
if (availableSpace > 1) {
|
|
18627
|
+
svg.select('g.legend-title').attr('transform', "translate(" + availableSpace + ", 0)");
|
|
18628
|
+
}
|
|
18629
|
+
else {
|
|
18630
|
+
// Move the legend down by 16 pixels to display legend text on top
|
|
18631
|
+
svg.select('g.legend').attr('transform', "translate(" + xDimensions[0] + ", 16)");
|
|
18632
|
+
// Align legend title with start of axis
|
|
18633
|
+
svg.select('g.legend-title').attr('transform', "translate(" + xDimensions[0] + ", 0)");
|
|
18634
|
+
}
|
|
18635
|
+
}
|
|
18636
|
+
}
|
|
18637
|
+
}
|
|
18638
|
+
};
|
|
18639
|
+
return _this;
|
|
18640
|
+
}
|
|
18641
|
+
ColorScaleLegend.prototype.init = function () {
|
|
18642
|
+
var eventsFragment = this.services.events;
|
|
18643
|
+
// Highlight correct circle on legend item hovers
|
|
18644
|
+
eventsFragment.addEventListener(Events.Axis.RENDER_COMPLETE, this.handleAxisComplete);
|
|
18645
|
+
};
|
|
18646
|
+
ColorScaleLegend.prototype.render = function (animate) {
|
|
18647
|
+
if (animate === void 0) { animate = false; }
|
|
18648
|
+
var options = this.getOptions();
|
|
18649
|
+
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
18650
|
+
var colorScaleType = tools_Tools.getProperty(options, 'heatmap', 'colorLegend', 'type');
|
|
18651
|
+
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
18652
|
+
var title = tools_Tools.getProperty(options, 'heatmap', 'colorLegend', 'title');
|
|
18653
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
18654
|
+
var domain = this.model.getValueDomain();
|
|
18655
|
+
var svg = this.getComponentContainer();
|
|
18656
|
+
// Clear DOM if loading
|
|
18657
|
+
var isDataLoading = tools_Tools.getProperty(this.getOptions(), 'data', 'loading');
|
|
18658
|
+
if (isDataLoading) {
|
|
18659
|
+
svg.html('');
|
|
18660
|
+
return;
|
|
18661
|
+
}
|
|
18662
|
+
var legend = dom_utils_DOMUtils.appendOrSelect(svg, 'g.legend');
|
|
18663
|
+
var axis = dom_utils_DOMUtils.appendOrSelect(legend, 'g.legend-axis');
|
|
18664
|
+
var width = dom_utils_DOMUtils.getSVGElementSize(svg, {
|
|
18665
|
+
useAttrs: true,
|
|
18666
|
+
}).width;
|
|
18667
|
+
var barWidth = configuration_non_customizable_legend.color.barWidth;
|
|
18668
|
+
if (width <= configuration_non_customizable_legend.color.barWidth) {
|
|
18669
|
+
barWidth = width;
|
|
18670
|
+
}
|
|
18671
|
+
if (title) {
|
|
18672
|
+
var legendTitleGroup = dom_utils_DOMUtils.appendOrSelect(svg, 'g.legend-title');
|
|
18673
|
+
var legendTitle = dom_utils_DOMUtils.appendOrSelect(legendTitleGroup, 'text');
|
|
18674
|
+
legendTitle.text(title).attr('dy', '0.7em');
|
|
18675
|
+
// Move the legend down by 16 pixels to display legend text on top
|
|
18676
|
+
legend.attr('transform', "translate(0, 16)");
|
|
18677
|
+
}
|
|
18678
|
+
// If domain consists of negative and positive values, use diverging palettes
|
|
18679
|
+
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
18680
|
+
// Use default color pairing options if not in defined range
|
|
18681
|
+
if (colorPairingOption < 1 &&
|
|
18682
|
+
colorPairingOption > 4 &&
|
|
18683
|
+
colorScheme === 'mono') {
|
|
18684
|
+
colorPairingOption = 1;
|
|
18685
|
+
}
|
|
18686
|
+
else if (colorPairingOption < 1 &&
|
|
18687
|
+
colorPairingOption > 2 &&
|
|
18688
|
+
colorScheme === 'diverge') {
|
|
18689
|
+
colorPairingOption = 1;
|
|
18690
|
+
}
|
|
18691
|
+
var colorPairing = [];
|
|
18692
|
+
// Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
|
|
18693
|
+
var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
|
|
18694
|
+
if (!customColorsEnabled) {
|
|
18695
|
+
// Add class names to list and the amount based on the color scheme
|
|
18696
|
+
for (var i = 1; i < colorGroupingLength + 1; i++) {
|
|
18697
|
+
colorPairing.push(colorScaleType === ColorLegendType.LINEAR
|
|
18698
|
+
? "stop-color-" + colorScheme + "-" + colorPairingOption + "-" + i
|
|
18699
|
+
: "fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
|
|
18700
|
+
}
|
|
18701
|
+
}
|
|
18702
|
+
else {
|
|
18703
|
+
// Use custom colors
|
|
18704
|
+
colorPairing = customColors;
|
|
18705
|
+
}
|
|
18706
|
+
if (colorScaleType === ColorLegendType.LINEAR) {
|
|
18707
|
+
var stopLengthPercentage_1 = 100 / (colorPairing.length - 1);
|
|
18708
|
+
// Generate the gradient
|
|
18709
|
+
var linearGradient = dom_utils_DOMUtils.appendOrSelect(legend, 'linearGradient');
|
|
18710
|
+
linearGradient
|
|
18711
|
+
.attr('id', this.gradient_id + "-legend")
|
|
18712
|
+
.selectAll('stop')
|
|
18713
|
+
.data(colorPairing)
|
|
18714
|
+
.enter()
|
|
18715
|
+
.append('stop')
|
|
18716
|
+
.attr('offset', function (_, i) { return i * stopLengthPercentage_1 + "%"; })
|
|
18717
|
+
.attr('class', function (_, i) { return colorPairing[i]; })
|
|
18718
|
+
.attr('stop-color', function (d) { return d; });
|
|
18719
|
+
// Create the legend container
|
|
18720
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(legend, 'rect');
|
|
18721
|
+
rectangle
|
|
18722
|
+
.attr('width', barWidth)
|
|
18723
|
+
.attr('height', configuration_non_customizable_legend.color.barHeight)
|
|
18724
|
+
.style('fill', "url(#" + this.gradient_id + "-legend)");
|
|
18725
|
+
// Create scale & ticks
|
|
18726
|
+
var linearScale = linear_linear()
|
|
18727
|
+
.domain(domain)
|
|
18728
|
+
.range([0, barWidth]);
|
|
18729
|
+
domain.splice(1, 0, (domain[0] + domain[1]) / 2);
|
|
18730
|
+
var xAxis = axisBottom(linearScale)
|
|
18731
|
+
.tickSize(0)
|
|
18732
|
+
.tickValues(domain);
|
|
18733
|
+
// Align axes at the bottom of the rectangle and delete the domain line
|
|
18734
|
+
axis.attr('transform', "translate(0," + configuration_non_customizable_legend.color.axisYTranslation + ")").call(xAxis);
|
|
18735
|
+
// Remove domain
|
|
18736
|
+
axis.select('.domain').remove();
|
|
18737
|
+
// Align text to fit in container
|
|
18738
|
+
axis.style('text-anchor', 'start');
|
|
18739
|
+
}
|
|
18740
|
+
else if (colorScaleType === ColorLegendType.QUANTIZE) {
|
|
18741
|
+
// Generate equal chunks between range to act as ticks
|
|
18742
|
+
var interpolator = src_round(domain[0], domain[1]);
|
|
18743
|
+
var quant_1 = quantize(interpolator, colorPairing.length);
|
|
18744
|
+
// If divergent && non-custom color, remove 0/white from being displayed
|
|
18745
|
+
if (!customColorsEnabled && colorScheme === 'diverge') {
|
|
18746
|
+
colorPairing.splice(colorPairing.length / 2, 1);
|
|
18747
|
+
}
|
|
18748
|
+
var colorScaleBand_1 = band()
|
|
18749
|
+
.domain(colorPairing)
|
|
18750
|
+
.range([0, barWidth]);
|
|
18751
|
+
// Render the quantized rectangles
|
|
18752
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(legend, 'g.quantized-rect');
|
|
18753
|
+
rectangle
|
|
18754
|
+
.selectAll('rect')
|
|
18755
|
+
.data(colorScaleBand_1.domain())
|
|
18756
|
+
.join('rect')
|
|
18757
|
+
.attr('x', function (d) { return colorScaleBand_1(d); })
|
|
18758
|
+
.attr('y', 0)
|
|
18759
|
+
.attr('width', Math.max(0, colorScaleBand_1.bandwidth()) - 1)
|
|
18760
|
+
.attr('height', configuration_non_customizable_legend.color.barHeight)
|
|
18761
|
+
.attr('class', function (d) { return d; })
|
|
18762
|
+
.attr('fill', function (d) { return d; });
|
|
18763
|
+
var xAxis = axisBottom(colorScaleBand_1)
|
|
18764
|
+
.tickSize(0)
|
|
18765
|
+
.tickValues(colorPairing)
|
|
18766
|
+
.tickFormat(function (_, i) {
|
|
18767
|
+
// Display every other tick to create space
|
|
18768
|
+
if (!customColorsEnabled &&
|
|
18769
|
+
((i + 1) % 2 === 0 || i === colorPairing.length - 1)) {
|
|
18770
|
+
return null;
|
|
18771
|
+
}
|
|
18772
|
+
// Use the quant interpolators as ticks
|
|
18773
|
+
return quant_1[i].toString();
|
|
18774
|
+
});
|
|
18775
|
+
// Align axis to match bandwidth start after initial (white)
|
|
18776
|
+
var axisTranslation = colorScaleBand_1.bandwidth() / 2;
|
|
18777
|
+
axis.attr('transform', "translate(" + (!customColorsEnabled && colorScheme === 'diverge' ? '-' : '') + axisTranslation + ", " + configuration_non_customizable_legend.color.axisYTranslation + ")").call(xAxis);
|
|
18778
|
+
// Append the last tick
|
|
18779
|
+
var firstTick = axis.select('g.tick').clone(true);
|
|
18780
|
+
firstTick
|
|
18781
|
+
.attr('transform', "translate(" + (barWidth +
|
|
18782
|
+
(!customColorsEnabled && colorScheme === 'diverge'
|
|
18783
|
+
? axisTranslation
|
|
18784
|
+
: -axisTranslation)) + ", 0)")
|
|
18785
|
+
.classed('final-tick', true)
|
|
18786
|
+
.select('text')
|
|
18787
|
+
.text(quant_1[quant_1.length - 1]);
|
|
18788
|
+
axis.enter().append(firstTick.node());
|
|
18789
|
+
axis.select('.domain').remove();
|
|
18790
|
+
}
|
|
18791
|
+
else {
|
|
18792
|
+
throw Error('Entered color legend type is not supported.');
|
|
18793
|
+
}
|
|
18794
|
+
// Translate last axis tick if barWidth equals chart width
|
|
18795
|
+
if (width <= configuration_non_customizable_legend.color.barWidth) {
|
|
18796
|
+
var lastTick = axis.select('g.tick:last-of-type text');
|
|
18797
|
+
var width_1 = dom_utils_DOMUtils.getSVGElementSize(lastTick, {
|
|
18798
|
+
useBBox: true,
|
|
18799
|
+
}).width;
|
|
18800
|
+
lastTick.attr('x', "-" + width_1);
|
|
18801
|
+
}
|
|
18802
|
+
};
|
|
18803
|
+
ColorScaleLegend.prototype.destroy = function () {
|
|
18804
|
+
// Remove legend listeners
|
|
18805
|
+
var eventsFragment = this.services.events;
|
|
18806
|
+
eventsFragment.removeEventListener(Events.Axis.RENDER_COMPLETE, this.handleAxisComplete);
|
|
18807
|
+
};
|
|
18808
|
+
return ColorScaleLegend;
|
|
18809
|
+
}(legend_Legend));
|
|
18810
|
+
|
|
18811
|
+
//# sourceMappingURL=../../../src/components/essentials/color-scale-legend.js.map
|
|
18299
18812
|
// EXTERNAL MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/carbon-components/node_modules/warning/browser.js
|
|
18300
18813
|
var browser = __webpack_require__("9b04");
|
|
18301
18814
|
|
|
@@ -33481,7 +33994,7 @@ function justify(node, n) {
|
|
|
33481
33994
|
return node.sourceLinks.length ? node.depth : n - 1;
|
|
33482
33995
|
}
|
|
33483
33996
|
|
|
33484
|
-
function
|
|
33997
|
+
function align_center(node) {
|
|
33485
33998
|
return node.targetLinks.length ? node.depth
|
|
33486
33999
|
: node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
|
|
33487
34000
|
: 0;
|
|
@@ -34655,6 +35168,376 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
|
|
|
34655
35168
|
}(component_Component));
|
|
34656
35169
|
|
|
34657
35170
|
//# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
|
|
35171
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/heatmap.js
|
|
35172
|
+
var heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
35173
|
+
var extendStatics = function (d, b) {
|
|
35174
|
+
extendStatics = Object.setPrototypeOf ||
|
|
35175
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
35176
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
35177
|
+
return extendStatics(d, b);
|
|
35178
|
+
};
|
|
35179
|
+
return function (d, b) {
|
|
35180
|
+
extendStatics(d, b);
|
|
35181
|
+
function __() { this.constructor = d; }
|
|
35182
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
35183
|
+
};
|
|
35184
|
+
})();
|
|
35185
|
+
// Internal Imports
|
|
35186
|
+
|
|
35187
|
+
|
|
35188
|
+
|
|
35189
|
+
|
|
35190
|
+
|
|
35191
|
+
|
|
35192
|
+
// D3 Imports
|
|
35193
|
+
|
|
35194
|
+
|
|
35195
|
+
var heatmap_Heatmap = /** @class */ (function (_super) {
|
|
35196
|
+
heatmap_extends(Heatmap, _super);
|
|
35197
|
+
function Heatmap() {
|
|
35198
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
35199
|
+
_this.type = 'heatmap';
|
|
35200
|
+
_this.renderType = RenderTypes.SVG;
|
|
35201
|
+
_this.matrix = {};
|
|
35202
|
+
_this.xBandwidth = 0;
|
|
35203
|
+
_this.yBandwidth = 0;
|
|
35204
|
+
_this.translationUnits = {
|
|
35205
|
+
x: 0,
|
|
35206
|
+
y: 0,
|
|
35207
|
+
};
|
|
35208
|
+
// Highlight elements that match the hovered axis item
|
|
35209
|
+
_this.handleAxisOnHover = function (event) {
|
|
35210
|
+
var detail = event.detail;
|
|
35211
|
+
var datum = detail.datum;
|
|
35212
|
+
// Unique ranges and domains
|
|
35213
|
+
var ranges = _this.model.getUniqueRanges();
|
|
35214
|
+
var domains = _this.model.getUniqueDomain();
|
|
35215
|
+
// Labels
|
|
35216
|
+
var domainLabel = _this.services.cartesianScales.getDomainLabel();
|
|
35217
|
+
var rangeLabel = _this.services.cartesianScales.getRangeLabel();
|
|
35218
|
+
// Scales
|
|
35219
|
+
var mainXScale = _this.services.cartesianScales.getMainXScale();
|
|
35220
|
+
var mainYScale = _this.services.cartesianScales.getMainYScale();
|
|
35221
|
+
var label = '', sum = 0, minimum = 0, maximum = 0;
|
|
35222
|
+
// Check to see where datum belongs
|
|
35223
|
+
if (_this.matrix[datum] !== undefined) {
|
|
35224
|
+
label = domainLabel;
|
|
35225
|
+
// Iterate through Object and get sum, min, and max
|
|
35226
|
+
ranges.forEach(function (element) {
|
|
35227
|
+
var value = _this.matrix[datum][element].value || 0;
|
|
35228
|
+
sum += value;
|
|
35229
|
+
minimum = value < minimum ? value : minimum;
|
|
35230
|
+
maximum = value > maximum ? value : maximum;
|
|
35231
|
+
});
|
|
35232
|
+
}
|
|
35233
|
+
else {
|
|
35234
|
+
label = rangeLabel;
|
|
35235
|
+
domains.forEach(function (element) {
|
|
35236
|
+
var value = _this.matrix[element][datum].value || 0;
|
|
35237
|
+
sum += value;
|
|
35238
|
+
minimum = value < minimum ? value : minimum;
|
|
35239
|
+
maximum = value > maximum ? value : maximum;
|
|
35240
|
+
});
|
|
35241
|
+
}
|
|
35242
|
+
if (mainXScale(datum) !== undefined) {
|
|
35243
|
+
_this.parent
|
|
35244
|
+
.select('g.multi-cell.column-highlight')
|
|
35245
|
+
.classed('highlighter-hidden', false)
|
|
35246
|
+
.attr('transform', "translate(" + mainXScale(datum) + ", " + min_min(mainYScale.range()) + ")");
|
|
35247
|
+
}
|
|
35248
|
+
else if (mainYScale(datum) !== undefined) {
|
|
35249
|
+
_this.parent
|
|
35250
|
+
.select('g.multi-cell.row-highlight')
|
|
35251
|
+
.classed('highlighter-hidden', false)
|
|
35252
|
+
.attr('transform', "translate(" + min_min(mainXScale.range()) + "," + mainYScale(datum) + ")");
|
|
35253
|
+
}
|
|
35254
|
+
// Dispatch tooltip show event
|
|
35255
|
+
_this.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35256
|
+
event: detail.event,
|
|
35257
|
+
hoveredElement: src_select(event.detail.element),
|
|
35258
|
+
items: [
|
|
35259
|
+
{
|
|
35260
|
+
label: label,
|
|
35261
|
+
value: datum,
|
|
35262
|
+
bold: true,
|
|
35263
|
+
},
|
|
35264
|
+
{
|
|
35265
|
+
label: 'Min',
|
|
35266
|
+
value: minimum,
|
|
35267
|
+
},
|
|
35268
|
+
{
|
|
35269
|
+
label: 'Max',
|
|
35270
|
+
value: maximum,
|
|
35271
|
+
},
|
|
35272
|
+
{
|
|
35273
|
+
label: 'Average',
|
|
35274
|
+
value: sum / domains.length,
|
|
35275
|
+
},
|
|
35276
|
+
],
|
|
35277
|
+
});
|
|
35278
|
+
};
|
|
35279
|
+
// Un-highlight all elements
|
|
35280
|
+
_this.handleAxisMouseOut = function (event) {
|
|
35281
|
+
// Hide column/row
|
|
35282
|
+
_this.parent
|
|
35283
|
+
.selectAll('g.multi-cell')
|
|
35284
|
+
.classed('highlighter-hidden', true);
|
|
35285
|
+
// Dispatch hide tooltip event
|
|
35286
|
+
_this.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35287
|
+
event: event,
|
|
35288
|
+
});
|
|
35289
|
+
};
|
|
35290
|
+
return _this;
|
|
35291
|
+
}
|
|
35292
|
+
Heatmap.prototype.init = function () {
|
|
35293
|
+
var eventsFragment = this.services.events;
|
|
35294
|
+
// Highlight correct cells on Axis item hovers
|
|
35295
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOVER, this.handleAxisOnHover);
|
|
35296
|
+
// Highlight correct cells on Axis item mouseouts
|
|
35297
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOUT, this.handleAxisMouseOut);
|
|
35298
|
+
// Highlight correct cells on Axis item focus
|
|
35299
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_FOCUS, this.handleAxisOnHover);
|
|
35300
|
+
// Highlight correct cells on Axis item blur
|
|
35301
|
+
eventsFragment.addEventListener(Events.Axis.LABEL_BLUR, this.handleAxisMouseOut);
|
|
35302
|
+
};
|
|
35303
|
+
Heatmap.prototype.render = function (animate) {
|
|
35304
|
+
var _this = this;
|
|
35305
|
+
if (animate === void 0) { animate = true; }
|
|
35306
|
+
var svg = this.getComponentContainer({ withinChartClip: true });
|
|
35307
|
+
// Lower the chart so the axes are always visible
|
|
35308
|
+
svg.lower();
|
|
35309
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35310
|
+
this.matrix = this.model.getMatrix();
|
|
35311
|
+
svg.html('');
|
|
35312
|
+
if (tools_Tools.getProperty(this.getOptions(), 'data', 'loading')) {
|
|
35313
|
+
return;
|
|
35314
|
+
}
|
|
35315
|
+
// determine x and y axis scale
|
|
35316
|
+
var mainXScale = cartesianScales.getMainXScale();
|
|
35317
|
+
var mainYScale = cartesianScales.getMainYScale();
|
|
35318
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35319
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35320
|
+
// Get unique axis values & create a matrix
|
|
35321
|
+
var uniqueDomain = this.model.getUniqueDomain();
|
|
35322
|
+
var uniqueRange = this.model.getUniqueRanges();
|
|
35323
|
+
// Get matrix in the form of an array to create a single heatmap group
|
|
35324
|
+
var matrixArray = this.model.getMatrixAsArray();
|
|
35325
|
+
// Get available chart area
|
|
35326
|
+
var xRange = mainXScale.range();
|
|
35327
|
+
var yRange = mainYScale.range();
|
|
35328
|
+
// Determine rectangle dimensions based on the number of unique domain and range
|
|
35329
|
+
this.xBandwidth = Math.abs((xRange[1] - xRange[0]) / uniqueDomain.length);
|
|
35330
|
+
this.yBandwidth = Math.abs((yRange[1] - yRange[0]) / uniqueRange.length);
|
|
35331
|
+
var patternID = this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");
|
|
35332
|
+
// Create a striped pattern for missing data
|
|
35333
|
+
svg.append('defs')
|
|
35334
|
+
.append('pattern')
|
|
35335
|
+
.attr('id', patternID)
|
|
35336
|
+
.attr('width', 3)
|
|
35337
|
+
.attr('height', 3)
|
|
35338
|
+
.attr('patternUnits', 'userSpaceOnUse')
|
|
35339
|
+
.attr('patternTransform', 'rotate(45)')
|
|
35340
|
+
.append('rect')
|
|
35341
|
+
.classed('pattern-fill', true)
|
|
35342
|
+
.attr('width', 0.5)
|
|
35343
|
+
.attr('height', 8);
|
|
35344
|
+
var rectangles = svg
|
|
35345
|
+
.selectAll()
|
|
35346
|
+
.data(matrixArray)
|
|
35347
|
+
.enter()
|
|
35348
|
+
.append('g')
|
|
35349
|
+
.attr('class', function (d) { return "heat-" + d.index; })
|
|
35350
|
+
.classed('cell', true)
|
|
35351
|
+
.attr('transform', function (d) {
|
|
35352
|
+
return "translate(" + mainXScale(d[domainIdentifier]) + ", " + mainYScale(d[rangeIdentifier]) + ")";
|
|
35353
|
+
})
|
|
35354
|
+
.append('rect')
|
|
35355
|
+
.attr('class', function (d) {
|
|
35356
|
+
return _this.model.getColorClassName({
|
|
35357
|
+
value: d.value,
|
|
35358
|
+
originalClassName: "heat-" + d.index,
|
|
35359
|
+
});
|
|
35360
|
+
})
|
|
35361
|
+
.classed('heat', true)
|
|
35362
|
+
.classed('null-state', function (d) {
|
|
35363
|
+
return d.index === -1 || d.value === null ? true : false;
|
|
35364
|
+
})
|
|
35365
|
+
.attr('width', this.xBandwidth)
|
|
35366
|
+
.attr('height', this.yBandwidth)
|
|
35367
|
+
.style('fill', function (d) {
|
|
35368
|
+
// Check if a valid value exists
|
|
35369
|
+
if (d.index === -1 || d.value === null) {
|
|
35370
|
+
return "url(#" + patternID + ")";
|
|
35371
|
+
}
|
|
35372
|
+
return _this.model.getFillColor(Number(d.value));
|
|
35373
|
+
})
|
|
35374
|
+
.attr('aria-label', function (d) { return d.value; });
|
|
35375
|
+
// Cell highlight box
|
|
35376
|
+
this.createOuterBox('g.cell-highlight', this.xBandwidth, this.yBandwidth);
|
|
35377
|
+
// Column highlight box
|
|
35378
|
+
this.createOuterBox('g.multi-cell.column-highlight', this.xBandwidth, Math.abs(yRange[1] - yRange[0]));
|
|
35379
|
+
// Row highlight box
|
|
35380
|
+
this.createOuterBox('g.multi-cell.row-highlight', Math.abs(xRange[1] - xRange[0]), this.yBandwidth);
|
|
35381
|
+
if (this.determineDividerStatus()) {
|
|
35382
|
+
rectangles.style('stroke-width', '1px');
|
|
35383
|
+
this.parent.select('g.cell-highlight').classed('cell-2', true);
|
|
35384
|
+
}
|
|
35385
|
+
this.addEventListener();
|
|
35386
|
+
};
|
|
35387
|
+
/**
|
|
35388
|
+
* Generates a box using lines to create a hover effect
|
|
35389
|
+
* The lines have drop shadow in their respective direction
|
|
35390
|
+
* @param parentTag - tag name
|
|
35391
|
+
* @param xBandwidth - X length
|
|
35392
|
+
* @param yBandwidth - y length
|
|
35393
|
+
*/
|
|
35394
|
+
Heatmap.prototype.createOuterBox = function (parentTag, xBandwidth, yBandwidth) {
|
|
35395
|
+
// Create a highlighter in the parent component so the shadow and the lines do not get clipped
|
|
35396
|
+
var highlight = dom_utils_DOMUtils.appendOrSelect(this.parent, parentTag)
|
|
35397
|
+
.classed('shadows', true)
|
|
35398
|
+
.classed('highlighter-hidden', true);
|
|
35399
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.top')
|
|
35400
|
+
.attr('x1', -1)
|
|
35401
|
+
.attr('x2', xBandwidth + 1);
|
|
35402
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.left')
|
|
35403
|
+
.attr('x1', 0)
|
|
35404
|
+
.attr('y1', -1)
|
|
35405
|
+
.attr('x2', 0)
|
|
35406
|
+
.attr('y2', yBandwidth + 1);
|
|
35407
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.down')
|
|
35408
|
+
.attr('x1', -1)
|
|
35409
|
+
.attr('x2', xBandwidth + 1)
|
|
35410
|
+
.attr('y1', yBandwidth)
|
|
35411
|
+
.attr('y2', yBandwidth);
|
|
35412
|
+
dom_utils_DOMUtils.appendOrSelect(highlight, 'line.right')
|
|
35413
|
+
.attr('x1', xBandwidth)
|
|
35414
|
+
.attr('x2', xBandwidth)
|
|
35415
|
+
.attr('y1', -1)
|
|
35416
|
+
.attr('y2', yBandwidth + 1);
|
|
35417
|
+
};
|
|
35418
|
+
Heatmap.prototype.determineDividerStatus = function () {
|
|
35419
|
+
// Add dividers if status is not off, will assume auto or on by default.
|
|
35420
|
+
var dividerStatus = tools_Tools.getProperty(this.getOptions(), 'heatmap', 'divider', 'state');
|
|
35421
|
+
// Determine if cell divider should be displayed
|
|
35422
|
+
if (dividerStatus !== DividerStatus.OFF) {
|
|
35423
|
+
if ((dividerStatus === DividerStatus.AUTO &&
|
|
35424
|
+
heatmap.minCellDividerDimension <=
|
|
35425
|
+
this.xBandwidth &&
|
|
35426
|
+
heatmap.minCellDividerDimension <=
|
|
35427
|
+
this.yBandwidth) ||
|
|
35428
|
+
dividerStatus === DividerStatus.ON) {
|
|
35429
|
+
return true;
|
|
35430
|
+
}
|
|
35431
|
+
}
|
|
35432
|
+
return false;
|
|
35433
|
+
};
|
|
35434
|
+
Heatmap.prototype.addEventListener = function () {
|
|
35435
|
+
var self = this;
|
|
35436
|
+
var cartesianScales = this.services.cartesianScales;
|
|
35437
|
+
var options = this.getOptions();
|
|
35438
|
+
var totalLabel = lodash_es_get(options, 'tooltip.totalLabel');
|
|
35439
|
+
var domainIdentifier = cartesianScales.getDomainIdentifier();
|
|
35440
|
+
var rangeIdentifier = cartesianScales.getRangeIdentifier();
|
|
35441
|
+
var domainLabel = cartesianScales.getDomainLabel();
|
|
35442
|
+
var rangeLabel = cartesianScales.getRangeLabel();
|
|
35443
|
+
this.parent
|
|
35444
|
+
.selectAll('g.cell')
|
|
35445
|
+
.on('mouseover', function (event, datum) {
|
|
35446
|
+
var cell = src_select(this);
|
|
35447
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35448
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35449
|
+
// Dispatch event and tooltip only if value exists
|
|
35450
|
+
if (!nullState) {
|
|
35451
|
+
// Get transformation value of node
|
|
35452
|
+
var transform = tools_Tools.getTranformOffsets(cell.attr('transform'));
|
|
35453
|
+
src_select('g.cell-highlight')
|
|
35454
|
+
.attr('transform', "translate(" + (transform.x + self.translationUnits.x) + ", " + (transform.y + self.translationUnits.y) + ")")
|
|
35455
|
+
.classed('highlighter-hidden', false);
|
|
35456
|
+
// Dispatch mouse over event
|
|
35457
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOVER, {
|
|
35458
|
+
event: event,
|
|
35459
|
+
element: hoveredElement,
|
|
35460
|
+
datum: datum,
|
|
35461
|
+
});
|
|
35462
|
+
// Dispatch tooltip show event
|
|
35463
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
35464
|
+
event: event,
|
|
35465
|
+
items: [
|
|
35466
|
+
{
|
|
35467
|
+
label: domainLabel,
|
|
35468
|
+
value: datum[domainIdentifier],
|
|
35469
|
+
},
|
|
35470
|
+
{
|
|
35471
|
+
label: rangeLabel,
|
|
35472
|
+
value: datum[rangeIdentifier],
|
|
35473
|
+
},
|
|
35474
|
+
{
|
|
35475
|
+
label: totalLabel || 'Total',
|
|
35476
|
+
value: datum['value'],
|
|
35477
|
+
color: hoveredElement.style('fill'),
|
|
35478
|
+
},
|
|
35479
|
+
],
|
|
35480
|
+
});
|
|
35481
|
+
}
|
|
35482
|
+
})
|
|
35483
|
+
.on('mousemove', function (event, datum) {
|
|
35484
|
+
// Dispatch mouse move event
|
|
35485
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEMOVE, {
|
|
35486
|
+
event: event,
|
|
35487
|
+
element: src_select(this),
|
|
35488
|
+
datum: datum,
|
|
35489
|
+
});
|
|
35490
|
+
// Dispatch tooltip move event
|
|
35491
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
35492
|
+
event: event,
|
|
35493
|
+
});
|
|
35494
|
+
})
|
|
35495
|
+
.on('click', function (event, datum) {
|
|
35496
|
+
// Dispatch mouse click event
|
|
35497
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_CLICK, {
|
|
35498
|
+
event: event,
|
|
35499
|
+
element: src_select(this),
|
|
35500
|
+
datum: datum,
|
|
35501
|
+
});
|
|
35502
|
+
})
|
|
35503
|
+
.on('mouseout', function (event, datum) {
|
|
35504
|
+
var cell = src_select(this);
|
|
35505
|
+
var hoveredElement = cell.select('rect.heat');
|
|
35506
|
+
var nullState = hoveredElement.classed('null-state');
|
|
35507
|
+
src_select('g.cell-highlight').classed('highlighter-hidden', true);
|
|
35508
|
+
// Dispatch event and tooltip only if value exists
|
|
35509
|
+
if (!nullState) {
|
|
35510
|
+
// Dispatch mouse out event
|
|
35511
|
+
self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOUT, {
|
|
35512
|
+
event: event,
|
|
35513
|
+
element: hoveredElement,
|
|
35514
|
+
datum: datum,
|
|
35515
|
+
});
|
|
35516
|
+
// Dispatch hide tooltip event
|
|
35517
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
|
|
35518
|
+
event: event,
|
|
35519
|
+
hoveredElement: hoveredElement,
|
|
35520
|
+
});
|
|
35521
|
+
}
|
|
35522
|
+
});
|
|
35523
|
+
};
|
|
35524
|
+
// Remove event listeners
|
|
35525
|
+
Heatmap.prototype.destroy = function () {
|
|
35526
|
+
this.parent
|
|
35527
|
+
.selectAll('rect.heat')
|
|
35528
|
+
.on('mouseover', null)
|
|
35529
|
+
.on('mousemove', null)
|
|
35530
|
+
.on('click', null)
|
|
35531
|
+
.on('mouseout', null);
|
|
35532
|
+
// Remove legend listeners
|
|
35533
|
+
var eventsFragment = this.services.events;
|
|
35534
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleAxisOnHover);
|
|
35535
|
+
eventsFragment.removeEventListener(Events.Legend.ITEM_MOUSEOUT, this.handleAxisMouseOut);
|
|
35536
|
+
};
|
|
35537
|
+
return Heatmap;
|
|
35538
|
+
}(component_Component));
|
|
35539
|
+
|
|
35540
|
+
//# sourceMappingURL=../../../src/components/graphs/heatmap.js.map
|
|
34658
35541
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
|
|
34659
35542
|
var spacer_extends = (undefined && undefined.__extends) || (function () {
|
|
34660
35543
|
var extendStatics = function (d, b) {
|
|
@@ -34881,187 +35764,6 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
|
|
|
34881
35764
|
}(component_Component));
|
|
34882
35765
|
|
|
34883
35766
|
//# sourceMappingURL=../../../src/components/layout/layout.js.map
|
|
34884
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
|
|
34885
|
-
/* harmony default export */ var d3_axis_src_identity = (function(x) {
|
|
34886
|
-
return x;
|
|
34887
|
-
});
|
|
34888
|
-
|
|
34889
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
|
|
34890
|
-
|
|
34891
|
-
|
|
34892
|
-
var axis_top = 1,
|
|
34893
|
-
axis_right = 2,
|
|
34894
|
-
bottom = 3,
|
|
34895
|
-
axis_left = 4,
|
|
34896
|
-
axis_epsilon = 1e-6;
|
|
34897
|
-
|
|
34898
|
-
function axis_translateX(x) {
|
|
34899
|
-
return "translate(" + x + ",0)";
|
|
34900
|
-
}
|
|
34901
|
-
|
|
34902
|
-
function axis_translateY(y) {
|
|
34903
|
-
return "translate(0," + y + ")";
|
|
34904
|
-
}
|
|
34905
|
-
|
|
34906
|
-
function axis_number(scale) {
|
|
34907
|
-
return d => +scale(d);
|
|
34908
|
-
}
|
|
34909
|
-
|
|
34910
|
-
function axis_center(scale, offset) {
|
|
34911
|
-
offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
|
|
34912
|
-
if (scale.round()) offset = Math.round(offset);
|
|
34913
|
-
return d => +scale(d) + offset;
|
|
34914
|
-
}
|
|
34915
|
-
|
|
34916
|
-
function entering() {
|
|
34917
|
-
return !this.__axis;
|
|
34918
|
-
}
|
|
34919
|
-
|
|
34920
|
-
function axis_axis(orient, scale) {
|
|
34921
|
-
var tickArguments = [],
|
|
34922
|
-
tickValues = null,
|
|
34923
|
-
tickFormat = null,
|
|
34924
|
-
tickSizeInner = 6,
|
|
34925
|
-
tickSizeOuter = 6,
|
|
34926
|
-
tickPadding = 3,
|
|
34927
|
-
offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
|
|
34928
|
-
k = orient === axis_top || orient === axis_left ? -1 : 1,
|
|
34929
|
-
x = orient === axis_left || orient === axis_right ? "x" : "y",
|
|
34930
|
-
transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
|
|
34931
|
-
|
|
34932
|
-
function axis(context) {
|
|
34933
|
-
var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
|
|
34934
|
-
format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
|
|
34935
|
-
spacing = Math.max(tickSizeInner, 0) + tickPadding,
|
|
34936
|
-
range = scale.range(),
|
|
34937
|
-
range0 = +range[0] + offset,
|
|
34938
|
-
range1 = +range[range.length - 1] + offset,
|
|
34939
|
-
position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
|
|
34940
|
-
selection = context.selection ? context.selection() : context,
|
|
34941
|
-
path = selection.selectAll(".domain").data([null]),
|
|
34942
|
-
tick = selection.selectAll(".tick").data(values, scale).order(),
|
|
34943
|
-
tickExit = tick.exit(),
|
|
34944
|
-
tickEnter = tick.enter().append("g").attr("class", "tick"),
|
|
34945
|
-
line = tick.select("line"),
|
|
34946
|
-
text = tick.select("text");
|
|
34947
|
-
|
|
34948
|
-
path = path.merge(path.enter().insert("path", ".tick")
|
|
34949
|
-
.attr("class", "domain")
|
|
34950
|
-
.attr("stroke", "currentColor"));
|
|
34951
|
-
|
|
34952
|
-
tick = tick.merge(tickEnter);
|
|
34953
|
-
|
|
34954
|
-
line = line.merge(tickEnter.append("line")
|
|
34955
|
-
.attr("stroke", "currentColor")
|
|
34956
|
-
.attr(x + "2", k * tickSizeInner));
|
|
34957
|
-
|
|
34958
|
-
text = text.merge(tickEnter.append("text")
|
|
34959
|
-
.attr("fill", "currentColor")
|
|
34960
|
-
.attr(x, k * spacing)
|
|
34961
|
-
.attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
|
|
34962
|
-
|
|
34963
|
-
if (context !== selection) {
|
|
34964
|
-
path = path.transition(context);
|
|
34965
|
-
tick = tick.transition(context);
|
|
34966
|
-
line = line.transition(context);
|
|
34967
|
-
text = text.transition(context);
|
|
34968
|
-
|
|
34969
|
-
tickExit = tickExit.transition(context)
|
|
34970
|
-
.attr("opacity", axis_epsilon)
|
|
34971
|
-
.attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
|
|
34972
|
-
|
|
34973
|
-
tickEnter
|
|
34974
|
-
.attr("opacity", axis_epsilon)
|
|
34975
|
-
.attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
|
|
34976
|
-
}
|
|
34977
|
-
|
|
34978
|
-
tickExit.remove();
|
|
34979
|
-
|
|
34980
|
-
path
|
|
34981
|
-
.attr("d", orient === axis_left || orient === axis_right
|
|
34982
|
-
? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
|
|
34983
|
-
: (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
|
|
34984
|
-
|
|
34985
|
-
tick
|
|
34986
|
-
.attr("opacity", 1)
|
|
34987
|
-
.attr("transform", function(d) { return transform(position(d) + offset); });
|
|
34988
|
-
|
|
34989
|
-
line
|
|
34990
|
-
.attr(x + "2", k * tickSizeInner);
|
|
34991
|
-
|
|
34992
|
-
text
|
|
34993
|
-
.attr(x, k * spacing)
|
|
34994
|
-
.text(format);
|
|
34995
|
-
|
|
34996
|
-
selection.filter(entering)
|
|
34997
|
-
.attr("fill", "none")
|
|
34998
|
-
.attr("font-size", 10)
|
|
34999
|
-
.attr("font-family", "sans-serif")
|
|
35000
|
-
.attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
|
|
35001
|
-
|
|
35002
|
-
selection
|
|
35003
|
-
.each(function() { this.__axis = position; });
|
|
35004
|
-
}
|
|
35005
|
-
|
|
35006
|
-
axis.scale = function(_) {
|
|
35007
|
-
return arguments.length ? (scale = _, axis) : scale;
|
|
35008
|
-
};
|
|
35009
|
-
|
|
35010
|
-
axis.ticks = function() {
|
|
35011
|
-
return tickArguments = Array.from(arguments), axis;
|
|
35012
|
-
};
|
|
35013
|
-
|
|
35014
|
-
axis.tickArguments = function(_) {
|
|
35015
|
-
return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
|
|
35016
|
-
};
|
|
35017
|
-
|
|
35018
|
-
axis.tickValues = function(_) {
|
|
35019
|
-
return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
|
|
35020
|
-
};
|
|
35021
|
-
|
|
35022
|
-
axis.tickFormat = function(_) {
|
|
35023
|
-
return arguments.length ? (tickFormat = _, axis) : tickFormat;
|
|
35024
|
-
};
|
|
35025
|
-
|
|
35026
|
-
axis.tickSize = function(_) {
|
|
35027
|
-
return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
|
|
35028
|
-
};
|
|
35029
|
-
|
|
35030
|
-
axis.tickSizeInner = function(_) {
|
|
35031
|
-
return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
|
|
35032
|
-
};
|
|
35033
|
-
|
|
35034
|
-
axis.tickSizeOuter = function(_) {
|
|
35035
|
-
return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
|
|
35036
|
-
};
|
|
35037
|
-
|
|
35038
|
-
axis.tickPadding = function(_) {
|
|
35039
|
-
return arguments.length ? (tickPadding = +_, axis) : tickPadding;
|
|
35040
|
-
};
|
|
35041
|
-
|
|
35042
|
-
axis.offset = function(_) {
|
|
35043
|
-
return arguments.length ? (offset = +_, axis) : offset;
|
|
35044
|
-
};
|
|
35045
|
-
|
|
35046
|
-
return axis;
|
|
35047
|
-
}
|
|
35048
|
-
|
|
35049
|
-
function axisTop(scale) {
|
|
35050
|
-
return axis_axis(axis_top, scale);
|
|
35051
|
-
}
|
|
35052
|
-
|
|
35053
|
-
function axisRight(scale) {
|
|
35054
|
-
return axis_axis(axis_right, scale);
|
|
35055
|
-
}
|
|
35056
|
-
|
|
35057
|
-
function axisBottom(scale) {
|
|
35058
|
-
return axis_axis(bottom, scale);
|
|
35059
|
-
}
|
|
35060
|
-
|
|
35061
|
-
function axisLeft(scale) {
|
|
35062
|
-
return axis_axis(axis_left, scale);
|
|
35063
|
-
}
|
|
35064
|
-
|
|
35065
35767
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/axis.js
|
|
35066
35768
|
var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
35067
35769
|
var extendStatics = function (d, b) {
|
|
@@ -35090,9 +35792,16 @@ var axis_extends = (undefined && undefined.__extends) || (function () {
|
|
|
35090
35792
|
var axis_Axis = /** @class */ (function (_super) {
|
|
35091
35793
|
axis_extends(Axis, _super);
|
|
35092
35794
|
function Axis(model, services, configs) {
|
|
35795
|
+
var _a;
|
|
35093
35796
|
var _this = _super.call(this, model, services, configs) || this;
|
|
35094
35797
|
_this.type = 'axes';
|
|
35095
35798
|
_this.renderType = RenderTypes.SVG;
|
|
35799
|
+
_this.truncation = (_a = {},
|
|
35800
|
+
_a[AxisPositions.LEFT] = false,
|
|
35801
|
+
_a[AxisPositions.RIGHT] = false,
|
|
35802
|
+
_a[AxisPositions.TOP] = false,
|
|
35803
|
+
_a[AxisPositions.BOTTOM] = false,
|
|
35804
|
+
_a);
|
|
35096
35805
|
if (configs) {
|
|
35097
35806
|
_this.configs = configs;
|
|
35098
35807
|
}
|
|
@@ -35520,11 +36229,13 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35520
36229
|
.select("g.axis." + axisPosition + " g.ticks g.tick")
|
|
35521
36230
|
.html();
|
|
35522
36231
|
container.selectAll('g.ticks g.tick').html(tick_html);
|
|
36232
|
+
var self_1 = this;
|
|
35523
36233
|
container
|
|
35524
36234
|
.selectAll('g.tick text')
|
|
35525
36235
|
.data(axisTickLabels)
|
|
35526
36236
|
.text(function (d) {
|
|
35527
36237
|
if (d.length > truncationThreshold) {
|
|
36238
|
+
self_1.truncation[axisPosition] = true;
|
|
35528
36239
|
return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
|
|
35529
36240
|
}
|
|
35530
36241
|
else {
|
|
@@ -35559,8 +36270,6 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35559
36270
|
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
35560
36271
|
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
35561
36272
|
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
35562
|
-
var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
|
|
35563
|
-
axisOptions.scaleType === ScaleTypes.TIME;
|
|
35564
36273
|
var self = this;
|
|
35565
36274
|
container
|
|
35566
36275
|
.selectAll('g.tick text')
|
|
@@ -35641,6 +36350,242 @@ var axis_Axis = /** @class */ (function (_super) {
|
|
|
35641
36350
|
}(component_Component));
|
|
35642
36351
|
|
|
35643
36352
|
//# sourceMappingURL=../../../src/components/axes/axis.js.map
|
|
36353
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/hover-axis.js
|
|
36354
|
+
var hover_axis_extends = (undefined && undefined.__extends) || (function () {
|
|
36355
|
+
var extendStatics = function (d, b) {
|
|
36356
|
+
extendStatics = Object.setPrototypeOf ||
|
|
36357
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
36358
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
36359
|
+
return extendStatics(d, b);
|
|
36360
|
+
};
|
|
36361
|
+
return function (d, b) {
|
|
36362
|
+
extendStatics(d, b);
|
|
36363
|
+
function __() { this.constructor = d; }
|
|
36364
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
36365
|
+
};
|
|
36366
|
+
})();
|
|
36367
|
+
var hover_axis_assign = (undefined && undefined.__assign) || function () {
|
|
36368
|
+
hover_axis_assign = Object.assign || function(t) {
|
|
36369
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
36370
|
+
s = arguments[i];
|
|
36371
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
36372
|
+
t[p] = s[p];
|
|
36373
|
+
}
|
|
36374
|
+
return t;
|
|
36375
|
+
};
|
|
36376
|
+
return hover_axis_assign.apply(this, arguments);
|
|
36377
|
+
};
|
|
36378
|
+
// Internal Imports
|
|
36379
|
+
|
|
36380
|
+
|
|
36381
|
+
|
|
36382
|
+
|
|
36383
|
+
|
|
36384
|
+
// D3 Imports
|
|
36385
|
+
|
|
36386
|
+
var hover_axis_HoverAxis = /** @class */ (function (_super) {
|
|
36387
|
+
hover_axis_extends(HoverAxis, _super);
|
|
36388
|
+
function HoverAxis(model, services, configs) {
|
|
36389
|
+
return _super.call(this, model, services, configs) || this;
|
|
36390
|
+
}
|
|
36391
|
+
HoverAxis.prototype.render = function (animate) {
|
|
36392
|
+
if (animate === void 0) { animate = true; }
|
|
36393
|
+
_super.prototype.render.call(this, animate);
|
|
36394
|
+
// Remove existing event listeners to avoid flashing behavior
|
|
36395
|
+
_super.prototype.destroy.call(this);
|
|
36396
|
+
var axisPosition = this.configs.position;
|
|
36397
|
+
var svg = this.getComponentContainer();
|
|
36398
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36399
|
+
var self = this;
|
|
36400
|
+
container.selectAll('g.tick').each(function (_, index) {
|
|
36401
|
+
var g = src_select(this);
|
|
36402
|
+
g.classed('tick-hover', true).attr('tabindex', index === 0 ? 0 : -1);
|
|
36403
|
+
var textNode = g.select('text');
|
|
36404
|
+
var _a = dom_utils_DOMUtils.getSVGElementSize(textNode, {
|
|
36405
|
+
useBBox: true,
|
|
36406
|
+
}), width = _a.width, height = _a.height;
|
|
36407
|
+
var rectangle = dom_utils_DOMUtils.appendOrSelect(g, 'rect.axis-holder');
|
|
36408
|
+
var x = 0, y = 0;
|
|
36409
|
+
// Depending on axis position, apply correct translation & rotation to align the rect
|
|
36410
|
+
// with the text
|
|
36411
|
+
switch (axisPosition) {
|
|
36412
|
+
case AxisPositions.LEFT:
|
|
36413
|
+
x = -width + Number(textNode.attr('x'));
|
|
36414
|
+
y = -(height / 2);
|
|
36415
|
+
break;
|
|
36416
|
+
case AxisPositions.RIGHT:
|
|
36417
|
+
x = Math.abs(Number(textNode.attr('x')));
|
|
36418
|
+
y = -(height / 2);
|
|
36419
|
+
break;
|
|
36420
|
+
case AxisPositions.TOP:
|
|
36421
|
+
x = -(width / 2);
|
|
36422
|
+
y = -height + Number(textNode.attr('y')) / 2;
|
|
36423
|
+
if (self.truncation[axisPosition]) {
|
|
36424
|
+
x = 0;
|
|
36425
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36426
|
+
}
|
|
36427
|
+
break;
|
|
36428
|
+
case AxisPositions.BOTTOM:
|
|
36429
|
+
x = -(width / 2);
|
|
36430
|
+
y = height / 2 - 2;
|
|
36431
|
+
if (self.truncation[axisPosition]) {
|
|
36432
|
+
x = -width;
|
|
36433
|
+
rectangle.attr('transform', "rotate(-45)");
|
|
36434
|
+
}
|
|
36435
|
+
break;
|
|
36436
|
+
}
|
|
36437
|
+
// Translates x position -4 left to keep center after padding
|
|
36438
|
+
// Adds padding on left & right
|
|
36439
|
+
rectangle
|
|
36440
|
+
.attr('x', x - configuration_non_customizable_axis.hover.rectanglePadding)
|
|
36441
|
+
.attr('y', y)
|
|
36442
|
+
.attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
|
|
36443
|
+
.attr('height', height)
|
|
36444
|
+
.lower();
|
|
36445
|
+
// Add keyboard event listeners to each group element
|
|
36446
|
+
g.on('keydown', function (event) {
|
|
36447
|
+
// Choose specific arrow key depending on the axis
|
|
36448
|
+
if (axisPosition === AxisPositions.LEFT ||
|
|
36449
|
+
axisPosition === AxisPositions.RIGHT) {
|
|
36450
|
+
if (event.key && event.key === 'ArrowUp') {
|
|
36451
|
+
self.goNext(this, event);
|
|
36452
|
+
}
|
|
36453
|
+
else if (event.key && event.key === 'ArrowDown') {
|
|
36454
|
+
self.goPrevious(this, event);
|
|
36455
|
+
}
|
|
36456
|
+
}
|
|
36457
|
+
else {
|
|
36458
|
+
if (event.key && event.key === 'ArrowLeft') {
|
|
36459
|
+
self.goPrevious(this, event);
|
|
36460
|
+
}
|
|
36461
|
+
else if (event.key && event.key === 'ArrowRight') {
|
|
36462
|
+
self.goNext(this, event);
|
|
36463
|
+
}
|
|
36464
|
+
}
|
|
36465
|
+
});
|
|
36466
|
+
});
|
|
36467
|
+
// Add event listeners to element group
|
|
36468
|
+
this.addEventListeners();
|
|
36469
|
+
};
|
|
36470
|
+
HoverAxis.prototype.addEventListeners = function () {
|
|
36471
|
+
var svg = this.getComponentContainer();
|
|
36472
|
+
var axisPosition = this.configs.position;
|
|
36473
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36474
|
+
var options = this.getOptions();
|
|
36475
|
+
var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
|
|
36476
|
+
var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
|
|
36477
|
+
var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
|
|
36478
|
+
var self = this;
|
|
36479
|
+
container
|
|
36480
|
+
.selectAll('g.tick.tick-hover')
|
|
36481
|
+
.on('mouseover', function (event) {
|
|
36482
|
+
var hoveredElement = src_select(this).select('text');
|
|
36483
|
+
var datum = hoveredElement.datum();
|
|
36484
|
+
// Dispatch mouse event
|
|
36485
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
|
|
36486
|
+
event: event,
|
|
36487
|
+
element: hoveredElement,
|
|
36488
|
+
datum: datum,
|
|
36489
|
+
});
|
|
36490
|
+
if (axisScaleType === ScaleTypes.LABELS &&
|
|
36491
|
+
datum.length > truncationThreshold) {
|
|
36492
|
+
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
36493
|
+
event: event,
|
|
36494
|
+
element: hoveredElement,
|
|
36495
|
+
datum: datum,
|
|
36496
|
+
});
|
|
36497
|
+
}
|
|
36498
|
+
})
|
|
36499
|
+
.on('mousemove', function (event) {
|
|
36500
|
+
var hoveredElement = src_select(this).select('text');
|
|
36501
|
+
var datum = hoveredElement.datum();
|
|
36502
|
+
// Dispatch mouse event
|
|
36503
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
|
|
36504
|
+
event: event,
|
|
36505
|
+
element: hoveredElement,
|
|
36506
|
+
datum: datum,
|
|
36507
|
+
});
|
|
36508
|
+
self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
|
|
36509
|
+
event: event,
|
|
36510
|
+
});
|
|
36511
|
+
})
|
|
36512
|
+
.on('click', function (event) {
|
|
36513
|
+
// Dispatch mouse event
|
|
36514
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
|
|
36515
|
+
event: event,
|
|
36516
|
+
element: src_select(this).select('text'),
|
|
36517
|
+
datum: src_select(this).select('text').datum(),
|
|
36518
|
+
});
|
|
36519
|
+
})
|
|
36520
|
+
.on('mouseout', function (event) {
|
|
36521
|
+
// Dispatch mouse event
|
|
36522
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
|
|
36523
|
+
event: event,
|
|
36524
|
+
element: src_select(this).select('text'),
|
|
36525
|
+
datum: src_select(this).select('text').datum(),
|
|
36526
|
+
});
|
|
36527
|
+
if (axisScaleType === ScaleTypes.LABELS) {
|
|
36528
|
+
self.services.events.dispatchEvent(Events.Tooltip.HIDE);
|
|
36529
|
+
}
|
|
36530
|
+
})
|
|
36531
|
+
.on('focus', function (event) {
|
|
36532
|
+
var coordinates = { clientX: 0, clientY: 0 };
|
|
36533
|
+
if (event.target) {
|
|
36534
|
+
// Focus element since we are using arrow keys
|
|
36535
|
+
event.target.focus();
|
|
36536
|
+
var boundingRect = event.target.getBoundingClientRect();
|
|
36537
|
+
coordinates.clientX = boundingRect.x;
|
|
36538
|
+
coordinates.clientY = boundingRect.y;
|
|
36539
|
+
}
|
|
36540
|
+
// Dispatch focus event
|
|
36541
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_FOCUS, {
|
|
36542
|
+
event: hover_axis_assign(hover_axis_assign({}, event), coordinates),
|
|
36543
|
+
element: src_select(this),
|
|
36544
|
+
datum: src_select(this).select('text').datum(),
|
|
36545
|
+
});
|
|
36546
|
+
})
|
|
36547
|
+
.on('blur', function (event) {
|
|
36548
|
+
// Dispatch blur event
|
|
36549
|
+
self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
|
|
36550
|
+
event: event,
|
|
36551
|
+
element: src_select(this),
|
|
36552
|
+
datum: src_select(this).select('text').datum(),
|
|
36553
|
+
});
|
|
36554
|
+
});
|
|
36555
|
+
};
|
|
36556
|
+
// Focus on the next HTML element sibling
|
|
36557
|
+
HoverAxis.prototype.goNext = function (element, event) {
|
|
36558
|
+
if (element.nextElementSibling &&
|
|
36559
|
+
element.nextElementSibling.tagName !== 'path') {
|
|
36560
|
+
element.nextElementSibling.dispatchEvent(new Event('focus'));
|
|
36561
|
+
}
|
|
36562
|
+
event.preventDefault();
|
|
36563
|
+
};
|
|
36564
|
+
// Focus on the previous HTML element sibling
|
|
36565
|
+
HoverAxis.prototype.goPrevious = function (element, event) {
|
|
36566
|
+
if (element.previousElementSibling &&
|
|
36567
|
+
element.previousElementSibling.tagName !== 'path') {
|
|
36568
|
+
element.previousElementSibling.dispatchEvent(new Event('focus'));
|
|
36569
|
+
}
|
|
36570
|
+
event.preventDefault();
|
|
36571
|
+
};
|
|
36572
|
+
HoverAxis.prototype.destroy = function () {
|
|
36573
|
+
var svg = this.getComponentContainer();
|
|
36574
|
+
var axisPosition = this.configs.position;
|
|
36575
|
+
var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
|
|
36576
|
+
// Remove event listeners
|
|
36577
|
+
container
|
|
36578
|
+
.selectAll('g.tick.tick-hover')
|
|
36579
|
+
.on('mouseover', null)
|
|
36580
|
+
.on('mousemove', null)
|
|
36581
|
+
.on('mouseout', null)
|
|
36582
|
+
.on('focus', null)
|
|
36583
|
+
.on('blur', null);
|
|
36584
|
+
};
|
|
36585
|
+
return HoverAxis;
|
|
36586
|
+
}(axis_Axis));
|
|
36587
|
+
|
|
36588
|
+
//# sourceMappingURL=../../../src/components/axes/hover-axis.js.map
|
|
35644
36589
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/two-dimensional-axes.js
|
|
35645
36590
|
var two_dimensional_axes_extends = (undefined && undefined.__extends) || (function () {
|
|
35646
36591
|
var extendStatics = function (d, b) {
|
|
@@ -35662,6 +36607,7 @@ var two_dimensional_axes_extends = (undefined && undefined.__extends) || (functi
|
|
|
35662
36607
|
|
|
35663
36608
|
|
|
35664
36609
|
|
|
36610
|
+
|
|
35665
36611
|
var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
35666
36612
|
two_dimensional_axes_extends(TwoDimensionalAxes, _super);
|
|
35667
36613
|
function TwoDimensionalAxes() {
|
|
@@ -35696,11 +36642,14 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35696
36642
|
var axisPosition = AxisPositions[axisPositionKey];
|
|
35697
36643
|
if (_this.configs.axes[axisPosition] &&
|
|
35698
36644
|
!_this.children[axisPosition]) {
|
|
35699
|
-
var
|
|
36645
|
+
var configs = {
|
|
35700
36646
|
position: axisPosition,
|
|
35701
36647
|
axes: _this.configs.axes,
|
|
35702
36648
|
margins: _this.margins,
|
|
35703
|
-
}
|
|
36649
|
+
};
|
|
36650
|
+
var axisComponent = _this.model.axisFlavor === AxisFlavor.DEFAULT
|
|
36651
|
+
? new axis_Axis(_this.model, _this.services, configs)
|
|
36652
|
+
: new hover_axis_HoverAxis(_this.model, _this.services, configs);
|
|
35704
36653
|
// Set model, services & parent for the new axis component
|
|
35705
36654
|
axisComponent.setModel(_this.model);
|
|
35706
36655
|
axisComponent.setServices(_this.services);
|
|
@@ -35751,6 +36700,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
|
|
|
35751
36700
|
break;
|
|
35752
36701
|
}
|
|
35753
36702
|
});
|
|
36703
|
+
this.services.events.dispatchEvent(Events.Axis.RENDER_COMPLETE);
|
|
35754
36704
|
// If the new margins are different than the existing ones
|
|
35755
36705
|
var isNotEqual = Object.keys(margins).some(function (marginKey) {
|
|
35756
36706
|
return _this.margins[marginKey] !== margins[marginKey];
|
|
@@ -38613,6 +39563,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38613
39563
|
var isDataLoading = tools_Tools.getProperty(this.getOptions(), 'data', 'loading');
|
|
38614
39564
|
if (isDataLoading) {
|
|
38615
39565
|
container.html('');
|
|
39566
|
+
// Set overflow menu to null if data is loading
|
|
39567
|
+
// This will render in a new overflow menu when data is done loading
|
|
39568
|
+
this.overflowMenu = null;
|
|
38616
39569
|
}
|
|
38617
39570
|
else {
|
|
38618
39571
|
if (!this.overflowMenu) {
|
|
@@ -38641,23 +39594,26 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38641
39594
|
var self_1 = this;
|
|
38642
39595
|
var allToolbarControls = enteringToolbarControls
|
|
38643
39596
|
.merge(toolbarControls)
|
|
38644
|
-
.classed('disabled', function (d) {
|
|
38645
|
-
|
|
38646
|
-
})
|
|
38647
|
-
.attr('aria-disabled', function (d) {
|
|
38648
|
-
return d.shouldBeDisabled ? d.shouldBeDisabled() : false;
|
|
38649
|
-
})
|
|
39597
|
+
.classed('disabled', function (d) { return d.shouldBeDisabled(); })
|
|
39598
|
+
.attr('aria-disabled', function (d) { return d.shouldBeDisabled(); })
|
|
38650
39599
|
.attr('aria-label', function (d) { return d.title; })
|
|
38651
|
-
.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.
|
|
39600
|
+
.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
|
|
39601
|
+
? d.iconSVG.height
|
|
39602
|
+
: '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>"; })
|
|
38652
39603
|
.each(function (d, index) {
|
|
39604
|
+
var _this = this;
|
|
38653
39605
|
src_select(this)
|
|
38654
39606
|
.select('button')
|
|
38655
|
-
.on('click',
|
|
39607
|
+
.on('click', function (event) {
|
|
39608
|
+
if (!d.shouldBeDisabled()) {
|
|
39609
|
+
self_1.triggerFunctionAndEvent(d, event, _this);
|
|
39610
|
+
}
|
|
39611
|
+
})
|
|
38656
39612
|
.on('keydown', function (event) {
|
|
38657
39613
|
if ((event.key && event.key === 'Enter') ||
|
|
38658
39614
|
event.key === ' ') {
|
|
38659
39615
|
event.preventDefault();
|
|
38660
|
-
|
|
39616
|
+
self_1.triggerFunctionAndEvent(d, event, _this);
|
|
38661
39617
|
}
|
|
38662
39618
|
else if (event.key && event.key === 'ArrowLeft') {
|
|
38663
39619
|
self_1.focusOnPreviousEnabledToolbarItem(index);
|
|
@@ -38706,6 +39662,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38706
39662
|
};
|
|
38707
39663
|
// show/hide overflow menu
|
|
38708
39664
|
Toolbar.prototype.updateOverflowMenu = function (show) {
|
|
39665
|
+
if (!this.overflowMenu) {
|
|
39666
|
+
return;
|
|
39667
|
+
}
|
|
38709
39668
|
this.overflowMenu.classed('is-open', show);
|
|
38710
39669
|
// update overflow button background
|
|
38711
39670
|
if (this.overflowButton) {
|
|
@@ -38808,15 +39767,13 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38808
39767
|
var element = src_select("#" + _this.services.domUtils.generateElementIDString("control-" + menuItem.id));
|
|
38809
39768
|
if (element !== null) {
|
|
38810
39769
|
element.on('click', function () {
|
|
38811
|
-
|
|
38812
|
-
menuItem.clickFunction();
|
|
39770
|
+
self_2.triggerFunctionAndEvent(menuItem, event, element.node());
|
|
38813
39771
|
// hide overflow menu
|
|
38814
39772
|
self_2.updateOverflowMenu(false);
|
|
38815
39773
|
});
|
|
38816
39774
|
element.on('keydown', function (keyEvent) {
|
|
38817
39775
|
if (keyEvent && keyEvent.key === 'Enter') {
|
|
38818
|
-
|
|
38819
|
-
menuItem.clickFunction();
|
|
39776
|
+
self_2.triggerFunctionAndEvent(menuItem, event, element.node());
|
|
38820
39777
|
}
|
|
38821
39778
|
else if (keyEvent && keyEvent.key === 'ArrowUp') {
|
|
38822
39779
|
// focus on previous menu item
|
|
@@ -38843,35 +39800,75 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38843
39800
|
event.stopImmediatePropagation();
|
|
38844
39801
|
}
|
|
38845
39802
|
};
|
|
39803
|
+
// Calls passed function && dispatches event
|
|
39804
|
+
Toolbar.prototype.triggerFunctionAndEvent = function (control, event, element) {
|
|
39805
|
+
// Call custom function only if it exists
|
|
39806
|
+
if (typeof control.clickFunction === 'function') {
|
|
39807
|
+
control.clickFunction(event);
|
|
39808
|
+
}
|
|
39809
|
+
// Dispatch selection event
|
|
39810
|
+
this.services.events.dispatchEvent(Events.Toolbar.BUTTON_CLICK, {
|
|
39811
|
+
control: control,
|
|
39812
|
+
event: event,
|
|
39813
|
+
element: element,
|
|
39814
|
+
});
|
|
39815
|
+
};
|
|
38846
39816
|
Toolbar.prototype.getControlConfigs = function () {
|
|
38847
39817
|
var _this = this;
|
|
38848
|
-
var numberOfIcons = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'numberOfIcons')
|
|
39818
|
+
var numberOfIcons = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'numberOfIcons') -
|
|
39819
|
+
1;
|
|
38849
39820
|
var controls = tools_Tools.getProperty(this.getOptions(), 'toolbar', 'controls');
|
|
38850
|
-
var controlList = [];
|
|
38851
39821
|
var overflowSpecificControls = [];
|
|
39822
|
+
var buttonList = [];
|
|
39823
|
+
var overflowList = [];
|
|
38852
39824
|
controls.forEach(function (control) {
|
|
38853
|
-
var controlConfig =
|
|
39825
|
+
var controlConfig = null;
|
|
39826
|
+
// check if button is custom or default control
|
|
39827
|
+
if (control.type === ToolbarControlTypes.CUSTOM) {
|
|
39828
|
+
// add generic id if missing
|
|
39829
|
+
if (tools_Tools.getProperty(control, 'id') === null) {
|
|
39830
|
+
// add id directly to the data passed so that id isn't reassigned on rerender
|
|
39831
|
+
control.id = "toolbar-button-" + Toolbar.buttonID++;
|
|
39832
|
+
}
|
|
39833
|
+
// define function if missing
|
|
39834
|
+
if (tools_Tools.getProperty(control, 'shouldBeDisabled') === null) {
|
|
39835
|
+
control.shouldBeDisabled = function () { return false; };
|
|
39836
|
+
}
|
|
39837
|
+
controlConfig = control;
|
|
39838
|
+
}
|
|
39839
|
+
else {
|
|
39840
|
+
controlConfig = _this.getControlConfigByType(control.type);
|
|
39841
|
+
}
|
|
38854
39842
|
// add to list if config is valid
|
|
38855
39843
|
if (controlConfig) {
|
|
38856
39844
|
controlConfig.text = control.text ? control.text : control.type;
|
|
38857
39845
|
if (controlConfig.id.indexOf('toolbar-export') !== -1) {
|
|
38858
39846
|
overflowSpecificControls.push(controlConfig);
|
|
38859
39847
|
}
|
|
39848
|
+
else if (buttonList.length < numberOfIcons) {
|
|
39849
|
+
// check if icon exists else assign to the overflow list
|
|
39850
|
+
if (tools_Tools.getProperty(controlConfig, 'iconSVG', 'content') === null) {
|
|
39851
|
+
overflowList.push(controlConfig);
|
|
39852
|
+
}
|
|
39853
|
+
else {
|
|
39854
|
+
buttonList.push(controlConfig);
|
|
39855
|
+
}
|
|
39856
|
+
}
|
|
38860
39857
|
else {
|
|
38861
|
-
|
|
39858
|
+
overflowList.push(controlConfig);
|
|
38862
39859
|
}
|
|
38863
39860
|
}
|
|
38864
39861
|
});
|
|
38865
|
-
|
|
38866
|
-
|
|
39862
|
+
// Ensures the `export` controls are always at the bottom
|
|
39863
|
+
overflowList.push.apply(overflowList, overflowSpecificControls);
|
|
39864
|
+
if (!overflowList.length) {
|
|
38867
39865
|
return {
|
|
38868
|
-
buttonList:
|
|
39866
|
+
buttonList: buttonList,
|
|
38869
39867
|
};
|
|
38870
39868
|
}
|
|
38871
39869
|
return {
|
|
38872
|
-
|
|
38873
|
-
|
|
38874
|
-
overflowMenuItemList: controlList.concat(overflowSpecificControls),
|
|
39870
|
+
buttonList: buttonList,
|
|
39871
|
+
overflowMenuItemList: overflowList,
|
|
38875
39872
|
};
|
|
38876
39873
|
};
|
|
38877
39874
|
Toolbar.prototype.getToolbarButtonItems = function () {
|
|
@@ -38900,7 +39897,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38900
39897
|
id: 'toolbar-overflow-menu',
|
|
38901
39898
|
title: 'More options',
|
|
38902
39899
|
shouldBeDisabled: function () { return false; },
|
|
38903
|
-
|
|
39900
|
+
iconSVG: {
|
|
39901
|
+
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>",
|
|
39902
|
+
},
|
|
38904
39903
|
clickFunction: function (event) { return _this.toggleOverflowMenu(event); },
|
|
38905
39904
|
};
|
|
38906
39905
|
};
|
|
@@ -38920,7 +39919,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38920
39919
|
shouldBeDisabled: function () {
|
|
38921
39920
|
return _this.services.zoom.isMinZoomDomain();
|
|
38922
39921
|
},
|
|
38923
|
-
|
|
39922
|
+
iconSVG: {
|
|
39923
|
+
content: this.getControlIconByType(controlType),
|
|
39924
|
+
},
|
|
38924
39925
|
clickFunction: function () { return _this.services.zoom.zoomIn(); },
|
|
38925
39926
|
};
|
|
38926
39927
|
}
|
|
@@ -38933,7 +39934,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38933
39934
|
shouldBeDisabled: function () {
|
|
38934
39935
|
return _this.services.zoom.isMaxZoomDomain();
|
|
38935
39936
|
},
|
|
38936
|
-
|
|
39937
|
+
iconSVG: {
|
|
39938
|
+
content: this.getControlIconByType(controlType),
|
|
39939
|
+
},
|
|
38937
39940
|
clickFunction: function () { return _this.services.zoom.zoomOut(); },
|
|
38938
39941
|
};
|
|
38939
39942
|
}
|
|
@@ -38946,7 +39949,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38946
39949
|
shouldBeDisabled: function () {
|
|
38947
39950
|
return _this.services.zoom.isMaxZoomDomain();
|
|
38948
39951
|
},
|
|
38949
|
-
|
|
39952
|
+
iconSVG: {
|
|
39953
|
+
content: this.getControlIconByType(controlType),
|
|
39954
|
+
},
|
|
38950
39955
|
clickFunction: function () {
|
|
38951
39956
|
return _this.services.zoom.resetZoomDomain();
|
|
38952
39957
|
},
|
|
@@ -38956,10 +39961,12 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38956
39961
|
case ToolbarControlTypes.MAKE_FULLSCREEN:
|
|
38957
39962
|
controlConfig = {
|
|
38958
39963
|
id: 'toolbar-makefullscreen',
|
|
39964
|
+
iconSVG: {
|
|
39965
|
+
content: this.getControlIconByType(controlType),
|
|
39966
|
+
width: '15px',
|
|
39967
|
+
height: '15px',
|
|
39968
|
+
},
|
|
38959
39969
|
title: 'Make fullscreen',
|
|
38960
|
-
iconSVGContent: this.getControlIconByType(controlType),
|
|
38961
|
-
iconWidth: '15px',
|
|
38962
|
-
iconHight: '15px',
|
|
38963
39970
|
shouldBeDisabled: function () { return false; },
|
|
38964
39971
|
clickFunction: function () {
|
|
38965
39972
|
_this.services.domUtils.toggleFullscreen();
|
|
@@ -38969,8 +39976,10 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38969
39976
|
case ToolbarControlTypes.SHOW_AS_DATATABLE:
|
|
38970
39977
|
controlConfig = {
|
|
38971
39978
|
id: 'toolbar-showasdatatable',
|
|
39979
|
+
iconSVG: {
|
|
39980
|
+
content: this.getControlIconByType(controlType),
|
|
39981
|
+
},
|
|
38972
39982
|
title: 'Show as table',
|
|
38973
|
-
iconSVGContent: this.getControlIconByType(controlType),
|
|
38974
39983
|
shouldBeDisabled: function () { return displayData.length === 0; },
|
|
38975
39984
|
clickFunction: function () {
|
|
38976
39985
|
return _this.services.events.dispatchEvent(Events.Modal.SHOW);
|
|
@@ -38982,7 +39991,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38982
39991
|
id: 'toolbar-export-CSV',
|
|
38983
39992
|
title: 'Export as CSV',
|
|
38984
39993
|
shouldBeDisabled: function () { return false; },
|
|
38985
|
-
|
|
39994
|
+
iconSVG: {
|
|
39995
|
+
content: this.getControlIconByType(controlType),
|
|
39996
|
+
},
|
|
38986
39997
|
clickFunction: function () { return _this.model.exportToCSV(); },
|
|
38987
39998
|
};
|
|
38988
39999
|
break;
|
|
@@ -38991,7 +40002,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
38991
40002
|
id: 'toolbar-export-PNG',
|
|
38992
40003
|
title: 'Export as PNG',
|
|
38993
40004
|
shouldBeDisabled: function () { return false; },
|
|
38994
|
-
|
|
40005
|
+
iconSVG: {
|
|
40006
|
+
content: this.getControlIconByType(controlType),
|
|
40007
|
+
},
|
|
38995
40008
|
clickFunction: function () { return _this.services.domUtils.exportToPNG(); },
|
|
38996
40009
|
};
|
|
38997
40010
|
break;
|
|
@@ -39000,7 +40013,9 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39000
40013
|
id: 'toolbar-export-JPG',
|
|
39001
40014
|
title: 'Export as JPG',
|
|
39002
40015
|
shouldBeDisabled: function () { return false; },
|
|
39003
|
-
|
|
40016
|
+
iconSVG: {
|
|
40017
|
+
content: this.getControlIconByType(controlType),
|
|
40018
|
+
},
|
|
39004
40019
|
clickFunction: function () { return _this.services.domUtils.exportToJPG(); },
|
|
39005
40020
|
};
|
|
39006
40021
|
break;
|
|
@@ -39033,6 +40048,7 @@ var toolbar_Toolbar = /** @class */ (function (_super) {
|
|
|
39033
40048
|
throw Error('Not supported toolbar control type: ' + controlType);
|
|
39034
40049
|
}
|
|
39035
40050
|
};
|
|
40051
|
+
Toolbar.buttonID = 0;
|
|
39036
40052
|
return Toolbar;
|
|
39037
40053
|
}(component_Component));
|
|
39038
40054
|
|
|
@@ -39728,6 +40744,7 @@ var tee = {
|
|
|
39728
40744
|
|
|
39729
40745
|
|
|
39730
40746
|
|
|
40747
|
+
|
|
39731
40748
|
// GRAPHS
|
|
39732
40749
|
|
|
39733
40750
|
|
|
@@ -39751,6 +40768,7 @@ var tee = {
|
|
|
39751
40768
|
|
|
39752
40769
|
|
|
39753
40770
|
|
|
40771
|
+
|
|
39754
40772
|
|
|
39755
40773
|
|
|
39756
40774
|
// Layout
|
|
@@ -40004,7 +41022,9 @@ var cartesian_charts_spreadArrays = (undefined && undefined.__spreadArrays) || f
|
|
|
40004
41022
|
var cartesian_charts_ChartModelCartesian = /** @class */ (function (_super) {
|
|
40005
41023
|
cartesian_charts_extends(ChartModelCartesian, _super);
|
|
40006
41024
|
function ChartModelCartesian(services) {
|
|
40007
|
-
|
|
41025
|
+
var _this = _super.call(this, services) || this;
|
|
41026
|
+
_this.axisFlavor = AxisFlavor.DEFAULT;
|
|
41027
|
+
return _this;
|
|
40008
41028
|
}
|
|
40009
41029
|
// get the scales information
|
|
40010
41030
|
// needed for getTabularArray()
|
|
@@ -42932,6 +43952,493 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
42932
43952
|
}(chart_Chart));
|
|
42933
43953
|
|
|
42934
43954
|
//# sourceMappingURL=../../src/charts/alluvial.js.map
|
|
43955
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-scale/src/quantize.js
|
|
43956
|
+
|
|
43957
|
+
|
|
43958
|
+
|
|
43959
|
+
|
|
43960
|
+
function quantize_quantize() {
|
|
43961
|
+
var x0 = 0,
|
|
43962
|
+
x1 = 1,
|
|
43963
|
+
n = 1,
|
|
43964
|
+
domain = [0.5],
|
|
43965
|
+
range = [0, 1],
|
|
43966
|
+
unknown;
|
|
43967
|
+
|
|
43968
|
+
function scale(x) {
|
|
43969
|
+
return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
|
|
43970
|
+
}
|
|
43971
|
+
|
|
43972
|
+
function rescale() {
|
|
43973
|
+
var i = -1;
|
|
43974
|
+
domain = new Array(n);
|
|
43975
|
+
while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
|
|
43976
|
+
return scale;
|
|
43977
|
+
}
|
|
43978
|
+
|
|
43979
|
+
scale.domain = function(_) {
|
|
43980
|
+
return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
|
|
43981
|
+
};
|
|
43982
|
+
|
|
43983
|
+
scale.range = function(_) {
|
|
43984
|
+
return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
|
|
43985
|
+
};
|
|
43986
|
+
|
|
43987
|
+
scale.invertExtent = function(y) {
|
|
43988
|
+
var i = range.indexOf(y);
|
|
43989
|
+
return i < 0 ? [NaN, NaN]
|
|
43990
|
+
: i < 1 ? [x0, domain[0]]
|
|
43991
|
+
: i >= n ? [domain[n - 1], x1]
|
|
43992
|
+
: [domain[i - 1], domain[i]];
|
|
43993
|
+
};
|
|
43994
|
+
|
|
43995
|
+
scale.unknown = function(_) {
|
|
43996
|
+
return arguments.length ? (unknown = _, scale) : scale;
|
|
43997
|
+
};
|
|
43998
|
+
|
|
43999
|
+
scale.thresholds = function() {
|
|
44000
|
+
return domain.slice();
|
|
44001
|
+
};
|
|
44002
|
+
|
|
44003
|
+
scale.copy = function() {
|
|
44004
|
+
return quantize_quantize()
|
|
44005
|
+
.domain([x0, x1])
|
|
44006
|
+
.range(range)
|
|
44007
|
+
.unknown(unknown);
|
|
44008
|
+
};
|
|
44009
|
+
|
|
44010
|
+
return initRange.apply(linearish(scale), arguments);
|
|
44011
|
+
}
|
|
44012
|
+
|
|
44013
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/model/heatmap.js
|
|
44014
|
+
var model_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44015
|
+
var extendStatics = function (d, b) {
|
|
44016
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44017
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44018
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44019
|
+
return extendStatics(d, b);
|
|
44020
|
+
};
|
|
44021
|
+
return function (d, b) {
|
|
44022
|
+
extendStatics(d, b);
|
|
44023
|
+
function __() { this.constructor = d; }
|
|
44024
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44025
|
+
};
|
|
44026
|
+
})();
|
|
44027
|
+
var heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44028
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44029
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44030
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44031
|
+
r[k] = a[j];
|
|
44032
|
+
return r;
|
|
44033
|
+
};
|
|
44034
|
+
// Internal Imports
|
|
44035
|
+
|
|
44036
|
+
|
|
44037
|
+
|
|
44038
|
+
// d3 imports
|
|
44039
|
+
|
|
44040
|
+
|
|
44041
|
+
/** The gauge chart model layer */
|
|
44042
|
+
var heatmap_HeatmapModel = /** @class */ (function (_super) {
|
|
44043
|
+
model_heatmap_extends(HeatmapModel, _super);
|
|
44044
|
+
function HeatmapModel(services) {
|
|
44045
|
+
var _this = _super.call(this, services) || this;
|
|
44046
|
+
_this.axisFlavor = AxisFlavor.HOVERABLE;
|
|
44047
|
+
_this._colorScale = undefined;
|
|
44048
|
+
// List of unique ranges and domains
|
|
44049
|
+
_this._domains = [];
|
|
44050
|
+
_this._ranges = [];
|
|
44051
|
+
_this._matrix = {};
|
|
44052
|
+
// Check which scale types are being used
|
|
44053
|
+
var axis = tools_Tools.getProperty(_this.getOptions(), 'axes');
|
|
44054
|
+
// Need to check options since scale service hasn't been instantiated
|
|
44055
|
+
if ((!!tools_Tools.getProperty(axis, 'left', 'scaleType') &&
|
|
44056
|
+
tools_Tools.getProperty(axis, 'left', 'scaleType') !==
|
|
44057
|
+
ScaleTypes.LABELS) ||
|
|
44058
|
+
(!!tools_Tools.getProperty(axis, 'right', 'scaleType') &&
|
|
44059
|
+
tools_Tools.getProperty(axis, 'right', 'scaleType') !==
|
|
44060
|
+
ScaleTypes.LABELS) ||
|
|
44061
|
+
(!!tools_Tools.getProperty(axis, 'top', 'scaleType') &&
|
|
44062
|
+
tools_Tools.getProperty(axis, 'top', 'scaleType') !==
|
|
44063
|
+
ScaleTypes.LABELS) ||
|
|
44064
|
+
(!!tools_Tools.getProperty(axis, 'bottom', 'scaleType') &&
|
|
44065
|
+
tools_Tools.getProperty(axis, 'bottom', 'scaleType') !==
|
|
44066
|
+
ScaleTypes.LABELS)) {
|
|
44067
|
+
throw Error('Heatmap only supports label scaletypes.');
|
|
44068
|
+
}
|
|
44069
|
+
return _this;
|
|
44070
|
+
}
|
|
44071
|
+
/**
|
|
44072
|
+
* Get min and maximum value of the display data
|
|
44073
|
+
* @returns Array consisting of smallest and largest values in data
|
|
44074
|
+
*/
|
|
44075
|
+
HeatmapModel.prototype.getValueDomain = function () {
|
|
44076
|
+
var data = this.getDisplayData().map(function (element) { return element.value; });
|
|
44077
|
+
var limits = src_extent(data);
|
|
44078
|
+
var domain = [];
|
|
44079
|
+
// Round extent values to the nearest multiple of 10
|
|
44080
|
+
// Axis rounds values to multiples of 2, 5, and 10s.
|
|
44081
|
+
limits.forEach(function (number, index) {
|
|
44082
|
+
var value = Number(number);
|
|
44083
|
+
if (index === 0 && value >= 0) {
|
|
44084
|
+
value = 0;
|
|
44085
|
+
}
|
|
44086
|
+
else if (value % 10 === 0 || value === 0) {
|
|
44087
|
+
value;
|
|
44088
|
+
}
|
|
44089
|
+
else if (value < 0) {
|
|
44090
|
+
value = Math.floor(value / 10) * 10;
|
|
44091
|
+
}
|
|
44092
|
+
else {
|
|
44093
|
+
value = Math.ceil(value / 10) * 10;
|
|
44094
|
+
}
|
|
44095
|
+
domain.push(value);
|
|
44096
|
+
});
|
|
44097
|
+
// Ensure the median of the range is 0
|
|
44098
|
+
if (domain[0] < 0 && domain[1] > 0) {
|
|
44099
|
+
if (Math.abs(domain[0]) > domain[1]) {
|
|
44100
|
+
domain[1] = Math.abs(domain[0]);
|
|
44101
|
+
}
|
|
44102
|
+
else {
|
|
44103
|
+
domain[0] = -domain[1];
|
|
44104
|
+
}
|
|
44105
|
+
}
|
|
44106
|
+
return domain;
|
|
44107
|
+
};
|
|
44108
|
+
/**
|
|
44109
|
+
* @override
|
|
44110
|
+
* @param value
|
|
44111
|
+
* @returns
|
|
44112
|
+
*/
|
|
44113
|
+
HeatmapModel.prototype.getFillColor = function (value) {
|
|
44114
|
+
return this._colorScale(value);
|
|
44115
|
+
};
|
|
44116
|
+
/**
|
|
44117
|
+
* Generate a list of all unique domains
|
|
44118
|
+
* @returns String[]
|
|
44119
|
+
*/
|
|
44120
|
+
HeatmapModel.prototype.getUniqueDomain = function () {
|
|
44121
|
+
if (tools_Tools.isEmpty(this._domains)) {
|
|
44122
|
+
var displayData = this.getDisplayData();
|
|
44123
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44124
|
+
var domainIdentifier_1 = cartesianScales.getDomainIdentifier();
|
|
44125
|
+
var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
|
|
44126
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainXAxisPosition);
|
|
44127
|
+
// Use user defined domain if specified
|
|
44128
|
+
if (!!customDomain) {
|
|
44129
|
+
return customDomain;
|
|
44130
|
+
}
|
|
44131
|
+
// Get unique axis values & create a matrix
|
|
44132
|
+
this._domains = Array.from(new Set(displayData.map(function (d) {
|
|
44133
|
+
return d[domainIdentifier_1];
|
|
44134
|
+
})));
|
|
44135
|
+
}
|
|
44136
|
+
return this._domains;
|
|
44137
|
+
};
|
|
44138
|
+
/**
|
|
44139
|
+
* Generates a list of all unique ranges
|
|
44140
|
+
* @returns String[]
|
|
44141
|
+
*/
|
|
44142
|
+
HeatmapModel.prototype.getUniqueRanges = function () {
|
|
44143
|
+
if (tools_Tools.isEmpty(this._ranges)) {
|
|
44144
|
+
var displayData = this.getDisplayData();
|
|
44145
|
+
var cartesianScales = this.services.cartesianScales;
|
|
44146
|
+
var rangeIdentifier_1 = cartesianScales.getRangeIdentifier();
|
|
44147
|
+
var mainYAxisPosition = cartesianScales.getMainYAxisPosition();
|
|
44148
|
+
var customDomain = cartesianScales.getCustomDomainValuesByposition(mainYAxisPosition);
|
|
44149
|
+
// Use user defined domain if specified
|
|
44150
|
+
if (!!customDomain) {
|
|
44151
|
+
return customDomain;
|
|
44152
|
+
}
|
|
44153
|
+
// Get unique axis values & create a matrix
|
|
44154
|
+
this._ranges = Array.from(new Set(displayData.map(function (d) {
|
|
44155
|
+
return d[rangeIdentifier_1];
|
|
44156
|
+
})));
|
|
44157
|
+
}
|
|
44158
|
+
return this._ranges;
|
|
44159
|
+
};
|
|
44160
|
+
/**
|
|
44161
|
+
* Generates a matrix (If doesn't exist) and returns it
|
|
44162
|
+
* @returns Object
|
|
44163
|
+
*/
|
|
44164
|
+
HeatmapModel.prototype.getMatrix = function () {
|
|
44165
|
+
var _this = this;
|
|
44166
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44167
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44168
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44169
|
+
var domainIdentifier_2 = this.services.cartesianScales.getDomainIdentifier();
|
|
44170
|
+
var rangeIdentifier_2 = this.services.cartesianScales.getRangeIdentifier();
|
|
44171
|
+
// Create a column
|
|
44172
|
+
var range_1 = {};
|
|
44173
|
+
uniqueRange.forEach(function (ran) {
|
|
44174
|
+
// Initialize matrix to empty state
|
|
44175
|
+
range_1[ran] = {
|
|
44176
|
+
value: null,
|
|
44177
|
+
index: -1,
|
|
44178
|
+
};
|
|
44179
|
+
});
|
|
44180
|
+
// Complete the matrix by cloning the column to all domains
|
|
44181
|
+
uniqueDomain.forEach(function (dom) {
|
|
44182
|
+
_this._matrix[dom] = tools_Tools.clone(range_1);
|
|
44183
|
+
});
|
|
44184
|
+
// Fill in user passed data
|
|
44185
|
+
this.getDisplayData().forEach(function (d, i) {
|
|
44186
|
+
_this._matrix[d[domainIdentifier_2]][d[rangeIdentifier_2]] = {
|
|
44187
|
+
value: d['value'],
|
|
44188
|
+
index: i,
|
|
44189
|
+
};
|
|
44190
|
+
});
|
|
44191
|
+
}
|
|
44192
|
+
return this._matrix;
|
|
44193
|
+
};
|
|
44194
|
+
/**
|
|
44195
|
+
*
|
|
44196
|
+
* @param newData The new raw data to be set
|
|
44197
|
+
*/
|
|
44198
|
+
HeatmapModel.prototype.setData = function (newData) {
|
|
44199
|
+
var sanitizedData = this.sanitize(tools_Tools.clone(newData));
|
|
44200
|
+
var dataGroups = this.generateDataGroups(sanitizedData);
|
|
44201
|
+
this.set({
|
|
44202
|
+
data: sanitizedData,
|
|
44203
|
+
dataGroups: dataGroups,
|
|
44204
|
+
});
|
|
44205
|
+
// Set attributes to empty
|
|
44206
|
+
this._domains = [];
|
|
44207
|
+
this._ranges = [];
|
|
44208
|
+
this._matrix = {};
|
|
44209
|
+
return sanitizedData;
|
|
44210
|
+
};
|
|
44211
|
+
/**
|
|
44212
|
+
* Converts Object matrix into a single array
|
|
44213
|
+
* @returns Object[]
|
|
44214
|
+
*/
|
|
44215
|
+
HeatmapModel.prototype.getMatrixAsArray = function () {
|
|
44216
|
+
var _this = this;
|
|
44217
|
+
if (tools_Tools.isEmpty(this._matrix)) {
|
|
44218
|
+
this.getMatrix();
|
|
44219
|
+
}
|
|
44220
|
+
var uniqueDomain = this.getUniqueDomain();
|
|
44221
|
+
var uniqueRange = this.getUniqueRanges();
|
|
44222
|
+
var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
|
|
44223
|
+
var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
|
|
44224
|
+
var arr = [];
|
|
44225
|
+
uniqueDomain.forEach(function (domain) {
|
|
44226
|
+
uniqueRange.forEach(function (range) {
|
|
44227
|
+
var element = {
|
|
44228
|
+
value: _this._matrix[domain][range].value,
|
|
44229
|
+
index: _this._matrix[domain][range].index,
|
|
44230
|
+
};
|
|
44231
|
+
element[domainIdentifier] = domain;
|
|
44232
|
+
element[rangeIdentifier] = range;
|
|
44233
|
+
arr.push(element);
|
|
44234
|
+
});
|
|
44235
|
+
});
|
|
44236
|
+
return arr;
|
|
44237
|
+
};
|
|
44238
|
+
/**
|
|
44239
|
+
* Generate tabular data from display data
|
|
44240
|
+
* @returns Array<Object>
|
|
44241
|
+
*/
|
|
44242
|
+
HeatmapModel.prototype.getTabularDataArray = function () {
|
|
44243
|
+
var displayData = this.getDisplayData();
|
|
44244
|
+
var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
|
|
44245
|
+
var domainValueFormatter;
|
|
44246
|
+
var result = heatmap_spreadArrays([
|
|
44247
|
+
[primaryDomain.label, primaryRange.label, 'Value']
|
|
44248
|
+
], displayData.map(function (datum) { return [
|
|
44249
|
+
datum[primaryDomain.identifier] === null
|
|
44250
|
+
? '–'
|
|
44251
|
+
: domainValueFormatter
|
|
44252
|
+
? domainValueFormatter(datum[primaryDomain.identifier])
|
|
44253
|
+
: datum[primaryDomain.identifier],
|
|
44254
|
+
datum[primaryRange.identifier] === null
|
|
44255
|
+
? '–'
|
|
44256
|
+
: datum[primaryRange.identifier].toLocaleString(),
|
|
44257
|
+
datum['value'],
|
|
44258
|
+
]; }));
|
|
44259
|
+
return result;
|
|
44260
|
+
};
|
|
44261
|
+
// Uses quantize scale to return class names
|
|
44262
|
+
HeatmapModel.prototype.getColorClassName = function (configs) {
|
|
44263
|
+
return configs.originalClassName + " " + this._colorScale(configs.value);
|
|
44264
|
+
};
|
|
44265
|
+
HeatmapModel.prototype.setColorClassNames = function () {
|
|
44266
|
+
var options = this.getOptions();
|
|
44267
|
+
var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
|
|
44268
|
+
var customColorsEnabled = !tools_Tools.isEmpty(customColors);
|
|
44269
|
+
var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
|
|
44270
|
+
// If domain consists of negative and positive values, use diverging palettes
|
|
44271
|
+
var domain = this.getValueDomain();
|
|
44272
|
+
var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
|
|
44273
|
+
// Use default color pairing options if not in defined range
|
|
44274
|
+
if (colorPairingOption < 1 &&
|
|
44275
|
+
colorPairingOption > 4 &&
|
|
44276
|
+
colorScheme === 'mono') {
|
|
44277
|
+
colorPairingOption = 1;
|
|
44278
|
+
}
|
|
44279
|
+
else if (colorPairingOption < 1 &&
|
|
44280
|
+
colorPairingOption > 2 &&
|
|
44281
|
+
colorScheme === 'diverge') {
|
|
44282
|
+
colorPairingOption = 1;
|
|
44283
|
+
}
|
|
44284
|
+
// Uses css classes for fill
|
|
44285
|
+
var colorPairing = customColorsEnabled ? customColors : [];
|
|
44286
|
+
if (!customColorsEnabled) {
|
|
44287
|
+
// Add class names to list and the amount based on the color scheme
|
|
44288
|
+
// Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
|
|
44289
|
+
var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
|
|
44290
|
+
for (var i = 1; i < colorGroupingLength + 1; i++) {
|
|
44291
|
+
colorPairing.push("fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
|
|
44292
|
+
}
|
|
44293
|
+
}
|
|
44294
|
+
// Save scale type
|
|
44295
|
+
this._colorScale = quantize_quantize()
|
|
44296
|
+
.domain(this.getValueDomain())
|
|
44297
|
+
.range(colorPairing);
|
|
44298
|
+
};
|
|
44299
|
+
return HeatmapModel;
|
|
44300
|
+
}(cartesian_charts_ChartModelCartesian));
|
|
44301
|
+
|
|
44302
|
+
//# sourceMappingURL=../../src/model/heatmap.js.map
|
|
44303
|
+
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/heatmap.js
|
|
44304
|
+
var charts_heatmap_extends = (undefined && undefined.__extends) || (function () {
|
|
44305
|
+
var extendStatics = function (d, b) {
|
|
44306
|
+
extendStatics = Object.setPrototypeOf ||
|
|
44307
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
44308
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
44309
|
+
return extendStatics(d, b);
|
|
44310
|
+
};
|
|
44311
|
+
return function (d, b) {
|
|
44312
|
+
extendStatics(d, b);
|
|
44313
|
+
function __() { this.constructor = d; }
|
|
44314
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
44315
|
+
};
|
|
44316
|
+
})();
|
|
44317
|
+
var charts_heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
|
|
44318
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
44319
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
44320
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
44321
|
+
r[k] = a[j];
|
|
44322
|
+
return r;
|
|
44323
|
+
};
|
|
44324
|
+
// Internal Imports
|
|
44325
|
+
|
|
44326
|
+
|
|
44327
|
+
|
|
44328
|
+
|
|
44329
|
+
|
|
44330
|
+
|
|
44331
|
+
var heatmap_HeatmapChart = /** @class */ (function (_super) {
|
|
44332
|
+
charts_heatmap_extends(HeatmapChart, _super);
|
|
44333
|
+
function HeatmapChart(holder, chartConfigs) {
|
|
44334
|
+
var _this = _super.call(this, holder, chartConfigs) || this;
|
|
44335
|
+
_this.model = new heatmap_HeatmapModel(_this.services);
|
|
44336
|
+
// Merge the default options for this chart
|
|
44337
|
+
// With the user provided options
|
|
44338
|
+
_this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.heatmapChart, chartConfigs.options));
|
|
44339
|
+
// Initialize data, services, components etc.
|
|
44340
|
+
_this.init(holder, chartConfigs);
|
|
44341
|
+
return _this;
|
|
44342
|
+
}
|
|
44343
|
+
// Custom getChartComponents - Implements getChartComponents
|
|
44344
|
+
// Removes zoombar support and additional `features` that are not supported in heatmap
|
|
44345
|
+
HeatmapChart.prototype.getAxisChartComponents = function (graphFrameComponents, configs) {
|
|
44346
|
+
var options = this.model.getOptions();
|
|
44347
|
+
var toolbarEnabled = tools_Tools.getProperty(options, 'toolbar', 'enabled');
|
|
44348
|
+
this.services.cartesianScales.determineAxisDuality();
|
|
44349
|
+
this.services.cartesianScales.findDomainAndRangeAxes(); // need to do this before getMainXAxisPosition()
|
|
44350
|
+
this.services.cartesianScales.determineOrientation();
|
|
44351
|
+
var titleAvailable = !!this.model.getOptions().title;
|
|
44352
|
+
var titleComponent = {
|
|
44353
|
+
id: 'title',
|
|
44354
|
+
components: [new title_Title(this.model, this.services)],
|
|
44355
|
+
growth: LayoutGrowth.STRETCH,
|
|
44356
|
+
};
|
|
44357
|
+
var toolbarComponent = {
|
|
44358
|
+
id: 'toolbar',
|
|
44359
|
+
components: [new toolbar_Toolbar(this.model, this.services)],
|
|
44360
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44361
|
+
};
|
|
44362
|
+
var headerComponent = {
|
|
44363
|
+
id: 'header',
|
|
44364
|
+
components: [
|
|
44365
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays([
|
|
44366
|
+
// always add title to keep layout correct
|
|
44367
|
+
titleComponent
|
|
44368
|
+
], (toolbarEnabled ? [toolbarComponent] : [])), {
|
|
44369
|
+
direction: LayoutDirection.ROW,
|
|
44370
|
+
alignItems: LayoutAlignItems.CENTER,
|
|
44371
|
+
}),
|
|
44372
|
+
],
|
|
44373
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44374
|
+
};
|
|
44375
|
+
var legendComponent = {
|
|
44376
|
+
id: 'legend',
|
|
44377
|
+
components: [new color_scale_legend_ColorScaleLegend(this.model, this.services)],
|
|
44378
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44379
|
+
renderType: RenderTypes.SVG,
|
|
44380
|
+
};
|
|
44381
|
+
var graphFrameComponent = {
|
|
44382
|
+
id: 'graph-frame',
|
|
44383
|
+
components: graphFrameComponents,
|
|
44384
|
+
growth: LayoutGrowth.STRETCH,
|
|
44385
|
+
renderType: RenderTypes.SVG,
|
|
44386
|
+
};
|
|
44387
|
+
var isLegendEnabled = tools_Tools.getProperty(configs, 'legend', 'enabled') !== false &&
|
|
44388
|
+
this.model.getOptions().legend.enabled !== false;
|
|
44389
|
+
// Decide the position of the legend in reference to the chart
|
|
44390
|
+
var fullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;
|
|
44391
|
+
var legendSpacerComponent = {
|
|
44392
|
+
id: 'spacer',
|
|
44393
|
+
components: [new spacer_Spacer(this.model, this.services, { size: 15 })],
|
|
44394
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44395
|
+
};
|
|
44396
|
+
var fullFrameComponent = {
|
|
44397
|
+
id: 'full-frame',
|
|
44398
|
+
components: [
|
|
44399
|
+
new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays((isLegendEnabled ? [legendComponent] : []), (isLegendEnabled ? [legendSpacerComponent] : []), [
|
|
44400
|
+
graphFrameComponent,
|
|
44401
|
+
]), {
|
|
44402
|
+
direction: fullFrameComponentDirection,
|
|
44403
|
+
}),
|
|
44404
|
+
],
|
|
44405
|
+
growth: LayoutGrowth.STRETCH,
|
|
44406
|
+
};
|
|
44407
|
+
var topLevelLayoutComponents = [];
|
|
44408
|
+
// header component is required for either title or toolbar
|
|
44409
|
+
if (titleAvailable || toolbarEnabled) {
|
|
44410
|
+
topLevelLayoutComponents.push(headerComponent);
|
|
44411
|
+
var titleSpacerComponent = {
|
|
44412
|
+
id: 'spacer',
|
|
44413
|
+
components: [
|
|
44414
|
+
new spacer_Spacer(this.model, this.services, toolbarEnabled ? { size: 15 } : undefined),
|
|
44415
|
+
],
|
|
44416
|
+
growth: LayoutGrowth.PREFERRED,
|
|
44417
|
+
};
|
|
44418
|
+
topLevelLayoutComponents.push(titleSpacerComponent);
|
|
44419
|
+
}
|
|
44420
|
+
topLevelLayoutComponents.push(fullFrameComponent);
|
|
44421
|
+
return [
|
|
44422
|
+
new tooltip_axis_AxisChartsTooltip(this.model, this.services),
|
|
44423
|
+
new essentials_modal_Modal(this.model, this.services),
|
|
44424
|
+
new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
|
|
44425
|
+
direction: LayoutDirection.COLUMN,
|
|
44426
|
+
}),
|
|
44427
|
+
];
|
|
44428
|
+
};
|
|
44429
|
+
HeatmapChart.prototype.getComponents = function () {
|
|
44430
|
+
// Specify what to render inside the graph-frame
|
|
44431
|
+
var graphFrameComponents = [
|
|
44432
|
+
new two_dimensional_axes_TwoDimensionalAxes(this.model, this.services),
|
|
44433
|
+
new heatmap_Heatmap(this.model, this.services),
|
|
44434
|
+
];
|
|
44435
|
+
var components = this.getAxisChartComponents(graphFrameComponents);
|
|
44436
|
+
return components;
|
|
44437
|
+
};
|
|
44438
|
+
return HeatmapChart;
|
|
44439
|
+
}(axis_chart_AxisChart));
|
|
44440
|
+
|
|
44441
|
+
//# sourceMappingURL=../../src/charts/heatmap.js.map
|
|
42935
44442
|
// CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
|
|
42936
44443
|
|
|
42937
44444
|
|
|
@@ -42954,6 +44461,7 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
|
|
|
42954
44461
|
|
|
42955
44462
|
|
|
42956
44463
|
|
|
44464
|
+
|
|
42957
44465
|
|
|
42958
44466
|
|
|
42959
44467
|
//# sourceMappingURL=../../src/charts/index.js.map
|
|
@@ -44165,6 +45673,52 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44165
45673
|
)
|
|
44166
45674
|
|
|
44167
45675
|
/* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
|
|
45676
|
+
// 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&
|
|
45677
|
+
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"})}
|
|
45678
|
+
var ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns = []
|
|
45679
|
+
|
|
45680
|
+
|
|
45681
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
|
|
45682
|
+
|
|
45683
|
+
// 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&
|
|
45684
|
+
//
|
|
45685
|
+
//
|
|
45686
|
+
//
|
|
45687
|
+
//
|
|
45688
|
+
|
|
45689
|
+
|
|
45690
|
+
/* harmony default export */ var ccv_heatmap_chartvue_type_script_lang_js_ = ({
|
|
45691
|
+
name: 'CcvHeatmapChart',
|
|
45692
|
+
extends: ccv_base_chart,
|
|
45693
|
+
mounted: function mounted() {
|
|
45694
|
+
this.coreChart = new heatmap_HeatmapChart(this.$el, {
|
|
45695
|
+
data: this.data,
|
|
45696
|
+
options: this.options
|
|
45697
|
+
});
|
|
45698
|
+
}
|
|
45699
|
+
});
|
|
45700
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
|
|
45701
|
+
/* harmony default export */ var src_ccv_heatmap_chartvue_type_script_lang_js_ = (ccv_heatmap_chartvue_type_script_lang_js_);
|
|
45702
|
+
// CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue
|
|
45703
|
+
|
|
45704
|
+
|
|
45705
|
+
|
|
45706
|
+
|
|
45707
|
+
|
|
45708
|
+
/* normalize component */
|
|
45709
|
+
|
|
45710
|
+
var ccv_heatmap_chart_component = normalizeComponent(
|
|
45711
|
+
src_ccv_heatmap_chartvue_type_script_lang_js_,
|
|
45712
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_render,
|
|
45713
|
+
ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns,
|
|
45714
|
+
false,
|
|
45715
|
+
null,
|
|
45716
|
+
null,
|
|
45717
|
+
null
|
|
45718
|
+
|
|
45719
|
+
)
|
|
45720
|
+
|
|
45721
|
+
/* harmony default export */ var ccv_heatmap_chart = (ccv_heatmap_chart_component.exports);
|
|
44168
45722
|
// CONCATENATED MODULE: ./src/index.js
|
|
44169
45723
|
|
|
44170
45724
|
|
|
@@ -44199,7 +45753,8 @@ var ccv_alluvial_chart_component = normalizeComponent(
|
|
|
44199
45753
|
|
|
44200
45754
|
|
|
44201
45755
|
|
|
44202
|
-
|
|
45756
|
+
|
|
45757
|
+
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];
|
|
44203
45758
|
/*
|
|
44204
45759
|
Allows the module to be used as a Vue plug-in, and has an install()
|
|
44205
45760
|
method (which is called when the plug-in loads) that registers all the
|
|
@@ -44299,6 +45854,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
|
|
|
44299
45854
|
/* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
|
|
44300
45855
|
/* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
|
|
44301
45856
|
/* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
|
|
45857
|
+
/* concated harmony reexport CcvHeatmapChart */__webpack_require__.d(__webpack_exports__, "CcvHeatmapChart", function() { return ccv_heatmap_chart; });
|
|
44302
45858
|
|
|
44303
45859
|
|
|
44304
45860
|
/* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);
|