@carbon/charts-vue 0.53.5 → 0.54.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 legend; });
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; });
@@ -486,6 +488,9 @@ var events_Axis;
486
488
  Axis["LABEL_MOUSEMOVE"] = "axis-label-mousemove";
487
489
  Axis["LABEL_CLICK"] = "axis-label-click";
488
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";
489
494
  })(events_Axis || (events_Axis = {}));
490
495
  /**
491
496
  * enum of all area graph events
@@ -661,6 +666,16 @@ var events_Meter;
661
666
  Meter["METER_MOUSEOUT"] = "meter-mouseout";
662
667
  Meter["METER_MOUSEMOVE"] = "meter-mousemove";
663
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 = {}));
664
679
  //# sourceMappingURL=../../src/interfaces/events.js.map
665
680
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/enums.js
666
681
 
@@ -917,6 +932,31 @@ var LegendItemType;
917
932
  LegendItemType["QUARTILE"] = "quartile";
918
933
  LegendItemType["ZOOM"] = "zoom";
919
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 = {}));
920
960
  //# sourceMappingURL=../../src/interfaces/enums.js.map
921
961
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/interfaces/index.js
922
962
 
@@ -957,6 +997,9 @@ var configuration_non_customizable_axis = {
957
997
  compareTo: 'marker',
958
998
  },
959
999
  paddingRatio: 0.1,
1000
+ hover: {
1001
+ rectanglePadding: 4,
1002
+ },
960
1003
  };
961
1004
  var canvasZoomSettings = {
962
1005
  duration: 1000,
@@ -1008,7 +1051,7 @@ var boxplot = {
1008
1051
  var configuration_non_customizable_histogram = {
1009
1052
  defaultBins: 10,
1010
1053
  };
1011
- var legend = {
1054
+ var configuration_non_customizable_legend = {
1012
1055
  items: {
1013
1056
  status: {
1014
1057
  ACTIVE: 1,
@@ -1061,6 +1104,11 @@ var legend = {
1061
1104
  iconData: [{ x: 0, y: 0, width: 12, height: 12 }],
1062
1105
  color: '#8D8D8D',
1063
1106
  },
1107
+ color: {
1108
+ barWidth: 300,
1109
+ barHeight: 8,
1110
+ axisYTranslation: 10,
1111
+ },
1064
1112
  };
1065
1113
  var configuration_non_customizable_lines = {
1066
1114
  opacity: {
@@ -1130,6 +1178,11 @@ var alluvial = {
1130
1178
  selected: 1,
1131
1179
  },
1132
1180
  };
1181
+ var heatmap = {
1182
+ minCellDividerDimension: 16,
1183
+ // Ensures axes lines are displayed with or without stroke disabled
1184
+ chartPadding: 0.5,
1185
+ };
1133
1186
  var spacers = {
1134
1187
  default: {
1135
1188
  size: 24,
@@ -8787,6 +8840,17 @@ var alluvialChart = tools_Tools.merge({}, chart, {
8787
8840
  nodes: [],
8788
8841
  },
8789
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
+ });
8790
8854
  var configuration_options = {
8791
8855
  chart: chart,
8792
8856
  axisChart: axisChart,
@@ -8814,6 +8878,7 @@ var configuration_options = {
8814
8878
  circlePackChart: circlePackChart,
8815
8879
  wordCloudChart: wordCloudChart,
8816
8880
  alluvialChart: alluvialChart,
8881
+ heatmapChart: heatmapChart,
8817
8882
  };
8818
8883
 
8819
8884
  //# sourceMappingURL=../src/configuration.js.map
@@ -9505,7 +9570,7 @@ var model_ChartModel = /** @class */ (function () {
9505
9570
  if (!this.get('data')) {
9506
9571
  return null;
9507
9572
  }
9508
- var ACTIVE = legend.items.status.ACTIVE;
9573
+ var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
9509
9574
  var dataGroups = this.getDataGroups(groups);
9510
9575
  var groupMapsTo = this.getOptions().data.groupMapsTo;
9511
9576
  var allDataFromDomain = this.getAllDataFromDomain(groups);
@@ -9550,7 +9615,7 @@ var model_ChartModel = /** @class */ (function () {
9550
9615
  return this.get('dataGroups');
9551
9616
  };
9552
9617
  ChartModel.prototype.getActiveDataGroups = function (groups) {
9553
- var ACTIVE = legend.items.status.ACTIVE;
9618
+ var ACTIVE = configuration_non_customizable_legend.items.status.ACTIVE;
9554
9619
  return this.getDataGroups(groups).filter(function (dataGroup) { return dataGroup.status === ACTIVE; });
9555
9620
  };
9556
9621
  ChartModel.prototype.getDataGroupNames = function (groups) {
@@ -9657,7 +9722,7 @@ var model_ChartModel = /** @class */ (function () {
9657
9722
  };
9658
9723
  ChartModel.prototype.getStackKeys = function (_a) {
9659
9724
  var _this = this;
9660
- var _b = _a.bins, bins = _b === void 0 ? null : _b, _c = _a.groups, groups = _c === void 0 ? null : _c;
9725
+ var _b = _a === void 0 ? { bins: null, groups: null } : _a, _c = _b.bins, bins = _c === void 0 ? null : _c, _d = _b.groups, groups = _d === void 0 ? null : _d;
9661
9726
  var options = this.getOptions();
9662
9727
  var displayData = this.getDisplayData(groups);
9663
9728
  var stackKeys;
@@ -9822,7 +9887,7 @@ var model_ChartModel = /** @class */ (function () {
9822
9887
  * Data labels
9823
9888
  */
9824
9889
  ChartModel.prototype.toggleDataLabel = function (changedLabel) {
9825
- var _a = legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
9890
+ var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
9826
9891
  var dataGroups = this.getDataGroups();
9827
9892
  var hasDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
9828
9893
  var activeItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
@@ -10033,7 +10098,7 @@ var model_ChartModel = /** @class */ (function () {
10033
10098
  };
10034
10099
  ChartModel.prototype.generateDataGroups = function (data) {
10035
10100
  var groupMapsTo = this.getOptions().data.groupMapsTo;
10036
- var _a = legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
10101
+ var _a = configuration_non_customizable_legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
10037
10102
  var options = this.getOptions();
10038
10103
  var uniqueDataGroups = tools_Tools.removeArrayDuplicates(data.map(function (datum) { return datum[groupMapsTo]; }));
10039
10104
  // check if selectedGroups can be applied to chart with current data groups
@@ -16022,6 +16087,22 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16022
16087
  this.dualAxes = true;
16023
16088
  }
16024
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
+ };
16025
16106
  CartesianScales.prototype.getOrientation = function () {
16026
16107
  return this.orientation;
16027
16108
  };
@@ -17922,7 +18003,7 @@ var legend_Legend = /** @class */ (function (_super) {
17922
18003
  var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
17923
18004
  var dataGroups = this.model.getDataGroups();
17924
18005
  // Check if there are disabled legend items
17925
- var DISABLED = legend.items.status.DISABLED;
18006
+ var DISABLED = configuration_non_customizable_legend.items.status.DISABLED;
17926
18007
  var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
17927
18008
  var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
17928
18009
  var svg = this.getComponentContainer()
@@ -17946,11 +18027,11 @@ var legend_Legend = /** @class */ (function (_super) {
17946
18027
  addedLegendItems
17947
18028
  .merge(svg.selectAll('div.legend-item'))
17948
18029
  .classed('active', function (d, i) {
17949
- return d.status === legend.items.status.ACTIVE;
18030
+ return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
17950
18031
  });
17951
18032
  var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
17952
18033
  svg.classed('clickable', legendClickable && dataGroups.length > 1);
17953
- var checkboxRadius = legend.checkbox.radius;
18034
+ var checkboxRadius = configuration_non_customizable_legend.checkbox.radius;
17954
18035
  var addedCheckboxes = addedLegendItems
17955
18036
  .append('div')
17956
18037
  .classed('checkbox', true);
@@ -17963,7 +18044,7 @@ var legend_Legend = /** @class */ (function (_super) {
17963
18044
  })
17964
18045
  .attr('aria-checked', function (_a) {
17965
18046
  var status = _a.status;
17966
- return status === legend.items.status.ACTIVE;
18047
+ return status === configuration_non_customizable_legend.items.status.ACTIVE;
17967
18048
  })
17968
18049
  .attr('width', checkboxRadius * 2)
17969
18050
  .attr('height', checkboxRadius * 2)
@@ -17975,13 +18056,13 @@ var legend_Legend = /** @class */ (function (_super) {
17975
18056
  });
17976
18057
  })
17977
18058
  .style('background', function (d) {
17978
- return d.status === legend.items.status.ACTIVE
18059
+ return d.status === configuration_non_customizable_legend.items.status.ACTIVE
17979
18060
  ? _this.model.getFillColor(d.name) ||
17980
18061
  _this.model.getStrokeColor(d.name)
17981
18062
  : null;
17982
18063
  })
17983
18064
  .classed('active', function (d, i) {
17984
- return d.status === legend.items.status.ACTIVE;
18065
+ return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
17985
18066
  });
17986
18067
  var addedCheckIcons = addedCheckboxes
17987
18068
  .append('svg')
@@ -18066,7 +18147,7 @@ var legend_Legend = /** @class */ (function (_super) {
18066
18147
  return dataGroups;
18067
18148
  };
18068
18149
  Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
18069
- var _a = legend.area, width = _a.width, height = _a.height;
18150
+ var _a = configuration_non_customizable_legend.area, width = _a.width, height = _a.height;
18070
18151
  if (itemConfig.type === LegendItemType.RADIUS) {
18071
18152
  // Circular icon
18072
18153
  additionalItem
@@ -18079,7 +18160,7 @@ var legend_Legend = /** @class */ (function (_super) {
18079
18160
  .style('height', height + "px");
18080
18161
  }
18081
18162
  if (itemConfig.type === LegendItemType.RADIUS) {
18082
- var _b = legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
18163
+ var _b = configuration_non_customizable_legend.radius, iconData = _b.iconData, fill = _b.fill, stroke = _b.stroke;
18083
18164
  var circleEnter = additionalItem
18084
18165
  .attr('fill', 'none')
18085
18166
  .selectAll('circle')
@@ -18097,7 +18178,7 @@ var legend_Legend = /** @class */ (function (_super) {
18097
18178
  .style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
18098
18179
  }
18099
18180
  else if (itemConfig.type === LegendItemType.LINE) {
18100
- var lineConfig = legend.line;
18181
+ var lineConfig = configuration_non_customizable_legend.line;
18101
18182
  if (additionalItem.select('line.line').empty()) {
18102
18183
  additionalItem
18103
18184
  .append('line')
@@ -18124,13 +18205,13 @@ var legend_Legend = /** @class */ (function (_super) {
18124
18205
  .attr('width', width)
18125
18206
  .attr('height', height)
18126
18207
  .style('fill', indexOfItem > 3 && !itemConfig.fill
18127
- ? legend.area.fill
18208
+ ? configuration_non_customizable_legend.area.fill
18128
18209
  : itemConfig.fill)
18129
18210
  .style('stroke', itemConfig.stroke);
18130
18211
  }
18131
18212
  }
18132
18213
  else if (itemConfig.type === LegendItemType.SIZE) {
18133
- var _c = legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
18214
+ var _c = configuration_non_customizable_legend.size, iconData = _c.iconData, fill = _c.fill, stroke = _c.stroke;
18134
18215
  var sizeEnter = additionalItem
18135
18216
  .attr('fill', 'none')
18136
18217
  .attr('role', Roles.IMG)
@@ -18149,7 +18230,7 @@ var legend_Legend = /** @class */ (function (_super) {
18149
18230
  .style('stroke-width', 1);
18150
18231
  }
18151
18232
  else if (itemConfig.type === LegendItemType.QUARTILE) {
18152
- var iconData = legend.quartile.iconData;
18233
+ var iconData = configuration_non_customizable_legend.quartile.iconData;
18153
18234
  var quartileEnter = additionalItem
18154
18235
  .selectAll('rect')
18155
18236
  .attr('role', Roles.IMG)
@@ -18303,6 +18384,431 @@ var legend_Legend = /** @class */ (function (_super) {
18303
18384
  }(component_Component));
18304
18385
 
18305
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
18306
18812
  // EXTERNAL MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/carbon-components/node_modules/warning/browser.js
18307
18813
  var browser = __webpack_require__("9b04");
18308
18814
 
@@ -25485,6 +25991,7 @@ var bar_stacked_extends = (undefined && undefined.__extends) || (function () {
25485
25991
 
25486
25992
 
25487
25993
 
25994
+
25488
25995
  // D3 Imports
25489
25996
 
25490
25997
  var bar_stacked_StackedBar = /** @class */ (function (_super) {
@@ -25716,6 +26223,21 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
25716
26223
  });
25717
26224
  });
25718
26225
  };
26226
+ StackedBar.prototype.getBarWidth = function () {
26227
+ var options = this.getOptions();
26228
+ if (tools_Tools.getProperty(options, "bars", "width")) {
26229
+ return options.bars.width;
26230
+ }
26231
+ var mainXScale = this.services.cartesianScales.getMainXScale();
26232
+ var chartWidth = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
26233
+ useAttrs: true,
26234
+ }).width;
26235
+ var numberOfDomainValues = this.model.getStackKeys().length;
26236
+ if (!mainXScale.step) {
26237
+ return Math.min(options.bars.maxWidth, (chartWidth * 0.25) / numberOfDomainValues);
26238
+ }
26239
+ return Math.min(options.bars.maxWidth, mainXScale.step() / 2);
26240
+ };
25719
26241
  StackedBar.prototype.destroy = function () {
25720
26242
  // Remove event listeners
25721
26243
  this.parent
@@ -33488,7 +34010,7 @@ function justify(node, n) {
33488
34010
  return node.sourceLinks.length ? node.depth : n - 1;
33489
34011
  }
33490
34012
 
33491
- function center(node) {
34013
+ function align_center(node) {
33492
34014
  return node.targetLinks.length ? node.depth
33493
34015
  : node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
33494
34016
  : 0;
@@ -34662,6 +35184,376 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34662
35184
  }(component_Component));
34663
35185
 
34664
35186
  //# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
35187
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/heatmap.js
35188
+ var heatmap_extends = (undefined && undefined.__extends) || (function () {
35189
+ var extendStatics = function (d, b) {
35190
+ extendStatics = Object.setPrototypeOf ||
35191
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35192
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
35193
+ return extendStatics(d, b);
35194
+ };
35195
+ return function (d, b) {
35196
+ extendStatics(d, b);
35197
+ function __() { this.constructor = d; }
35198
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35199
+ };
35200
+ })();
35201
+ // Internal Imports
35202
+
35203
+
35204
+
35205
+
35206
+
35207
+
35208
+ // D3 Imports
35209
+
35210
+
35211
+ var heatmap_Heatmap = /** @class */ (function (_super) {
35212
+ heatmap_extends(Heatmap, _super);
35213
+ function Heatmap() {
35214
+ var _this = _super !== null && _super.apply(this, arguments) || this;
35215
+ _this.type = 'heatmap';
35216
+ _this.renderType = RenderTypes.SVG;
35217
+ _this.matrix = {};
35218
+ _this.xBandwidth = 0;
35219
+ _this.yBandwidth = 0;
35220
+ _this.translationUnits = {
35221
+ x: 0,
35222
+ y: 0,
35223
+ };
35224
+ // Highlight elements that match the hovered axis item
35225
+ _this.handleAxisOnHover = function (event) {
35226
+ var detail = event.detail;
35227
+ var datum = detail.datum;
35228
+ // Unique ranges and domains
35229
+ var ranges = _this.model.getUniqueRanges();
35230
+ var domains = _this.model.getUniqueDomain();
35231
+ // Labels
35232
+ var domainLabel = _this.services.cartesianScales.getDomainLabel();
35233
+ var rangeLabel = _this.services.cartesianScales.getRangeLabel();
35234
+ // Scales
35235
+ var mainXScale = _this.services.cartesianScales.getMainXScale();
35236
+ var mainYScale = _this.services.cartesianScales.getMainYScale();
35237
+ var label = '', sum = 0, minimum = 0, maximum = 0;
35238
+ // Check to see where datum belongs
35239
+ if (_this.matrix[datum] !== undefined) {
35240
+ label = domainLabel;
35241
+ // Iterate through Object and get sum, min, and max
35242
+ ranges.forEach(function (element) {
35243
+ var value = _this.matrix[datum][element].value || 0;
35244
+ sum += value;
35245
+ minimum = value < minimum ? value : minimum;
35246
+ maximum = value > maximum ? value : maximum;
35247
+ });
35248
+ }
35249
+ else {
35250
+ label = rangeLabel;
35251
+ domains.forEach(function (element) {
35252
+ var value = _this.matrix[element][datum].value || 0;
35253
+ sum += value;
35254
+ minimum = value < minimum ? value : minimum;
35255
+ maximum = value > maximum ? value : maximum;
35256
+ });
35257
+ }
35258
+ if (mainXScale(datum) !== undefined) {
35259
+ _this.parent
35260
+ .select('g.multi-cell.column-highlight')
35261
+ .classed('highlighter-hidden', false)
35262
+ .attr('transform', "translate(" + mainXScale(datum) + ", " + min_min(mainYScale.range()) + ")");
35263
+ }
35264
+ else if (mainYScale(datum) !== undefined) {
35265
+ _this.parent
35266
+ .select('g.multi-cell.row-highlight')
35267
+ .classed('highlighter-hidden', false)
35268
+ .attr('transform', "translate(" + min_min(mainXScale.range()) + "," + mainYScale(datum) + ")");
35269
+ }
35270
+ // Dispatch tooltip show event
35271
+ _this.services.events.dispatchEvent(Events.Tooltip.SHOW, {
35272
+ event: detail.event,
35273
+ hoveredElement: src_select(event.detail.element),
35274
+ items: [
35275
+ {
35276
+ label: label,
35277
+ value: datum,
35278
+ bold: true,
35279
+ },
35280
+ {
35281
+ label: 'Min',
35282
+ value: minimum,
35283
+ },
35284
+ {
35285
+ label: 'Max',
35286
+ value: maximum,
35287
+ },
35288
+ {
35289
+ label: 'Average',
35290
+ value: sum / domains.length,
35291
+ },
35292
+ ],
35293
+ });
35294
+ };
35295
+ // Un-highlight all elements
35296
+ _this.handleAxisMouseOut = function (event) {
35297
+ // Hide column/row
35298
+ _this.parent
35299
+ .selectAll('g.multi-cell')
35300
+ .classed('highlighter-hidden', true);
35301
+ // Dispatch hide tooltip event
35302
+ _this.services.events.dispatchEvent(Events.Tooltip.HIDE, {
35303
+ event: event,
35304
+ });
35305
+ };
35306
+ return _this;
35307
+ }
35308
+ Heatmap.prototype.init = function () {
35309
+ var eventsFragment = this.services.events;
35310
+ // Highlight correct cells on Axis item hovers
35311
+ eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOVER, this.handleAxisOnHover);
35312
+ // Highlight correct cells on Axis item mouseouts
35313
+ eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOUT, this.handleAxisMouseOut);
35314
+ // Highlight correct cells on Axis item focus
35315
+ eventsFragment.addEventListener(Events.Axis.LABEL_FOCUS, this.handleAxisOnHover);
35316
+ // Highlight correct cells on Axis item blur
35317
+ eventsFragment.addEventListener(Events.Axis.LABEL_BLUR, this.handleAxisMouseOut);
35318
+ };
35319
+ Heatmap.prototype.render = function (animate) {
35320
+ var _this = this;
35321
+ if (animate === void 0) { animate = true; }
35322
+ var svg = this.getComponentContainer({ withinChartClip: true });
35323
+ // Lower the chart so the axes are always visible
35324
+ svg.lower();
35325
+ var cartesianScales = this.services.cartesianScales;
35326
+ this.matrix = this.model.getMatrix();
35327
+ svg.html('');
35328
+ if (tools_Tools.getProperty(this.getOptions(), 'data', 'loading')) {
35329
+ return;
35330
+ }
35331
+ // determine x and y axis scale
35332
+ var mainXScale = cartesianScales.getMainXScale();
35333
+ var mainYScale = cartesianScales.getMainYScale();
35334
+ var domainIdentifier = cartesianScales.getDomainIdentifier();
35335
+ var rangeIdentifier = cartesianScales.getRangeIdentifier();
35336
+ // Get unique axis values & create a matrix
35337
+ var uniqueDomain = this.model.getUniqueDomain();
35338
+ var uniqueRange = this.model.getUniqueRanges();
35339
+ // Get matrix in the form of an array to create a single heatmap group
35340
+ var matrixArray = this.model.getMatrixAsArray();
35341
+ // Get available chart area
35342
+ var xRange = mainXScale.range();
35343
+ var yRange = mainYScale.range();
35344
+ // Determine rectangle dimensions based on the number of unique domain and range
35345
+ this.xBandwidth = Math.abs((xRange[1] - xRange[0]) / uniqueDomain.length);
35346
+ this.yBandwidth = Math.abs((yRange[1] - yRange[0]) / uniqueRange.length);
35347
+ var patternID = this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");
35348
+ // Create a striped pattern for missing data
35349
+ svg.append('defs')
35350
+ .append('pattern')
35351
+ .attr('id', patternID)
35352
+ .attr('width', 3)
35353
+ .attr('height', 3)
35354
+ .attr('patternUnits', 'userSpaceOnUse')
35355
+ .attr('patternTransform', 'rotate(45)')
35356
+ .append('rect')
35357
+ .classed('pattern-fill', true)
35358
+ .attr('width', 0.5)
35359
+ .attr('height', 8);
35360
+ var rectangles = svg
35361
+ .selectAll()
35362
+ .data(matrixArray)
35363
+ .enter()
35364
+ .append('g')
35365
+ .attr('class', function (d) { return "heat-" + d.index; })
35366
+ .classed('cell', true)
35367
+ .attr('transform', function (d) {
35368
+ return "translate(" + mainXScale(d[domainIdentifier]) + ", " + mainYScale(d[rangeIdentifier]) + ")";
35369
+ })
35370
+ .append('rect')
35371
+ .attr('class', function (d) {
35372
+ return _this.model.getColorClassName({
35373
+ value: d.value,
35374
+ originalClassName: "heat-" + d.index,
35375
+ });
35376
+ })
35377
+ .classed('heat', true)
35378
+ .classed('null-state', function (d) {
35379
+ return d.index === -1 || d.value === null ? true : false;
35380
+ })
35381
+ .attr('width', this.xBandwidth)
35382
+ .attr('height', this.yBandwidth)
35383
+ .style('fill', function (d) {
35384
+ // Check if a valid value exists
35385
+ if (d.index === -1 || d.value === null) {
35386
+ return "url(#" + patternID + ")";
35387
+ }
35388
+ return _this.model.getFillColor(Number(d.value));
35389
+ })
35390
+ .attr('aria-label', function (d) { return d.value; });
35391
+ // Cell highlight box
35392
+ this.createOuterBox('g.cell-highlight', this.xBandwidth, this.yBandwidth);
35393
+ // Column highlight box
35394
+ this.createOuterBox('g.multi-cell.column-highlight', this.xBandwidth, Math.abs(yRange[1] - yRange[0]));
35395
+ // Row highlight box
35396
+ this.createOuterBox('g.multi-cell.row-highlight', Math.abs(xRange[1] - xRange[0]), this.yBandwidth);
35397
+ if (this.determineDividerStatus()) {
35398
+ rectangles.style('stroke-width', '1px');
35399
+ this.parent.select('g.cell-highlight').classed('cell-2', true);
35400
+ }
35401
+ this.addEventListener();
35402
+ };
35403
+ /**
35404
+ * Generates a box using lines to create a hover effect
35405
+ * The lines have drop shadow in their respective direction
35406
+ * @param parentTag - tag name
35407
+ * @param xBandwidth - X length
35408
+ * @param yBandwidth - y length
35409
+ */
35410
+ Heatmap.prototype.createOuterBox = function (parentTag, xBandwidth, yBandwidth) {
35411
+ // Create a highlighter in the parent component so the shadow and the lines do not get clipped
35412
+ var highlight = dom_utils_DOMUtils.appendOrSelect(this.parent, parentTag)
35413
+ .classed('shadows', true)
35414
+ .classed('highlighter-hidden', true);
35415
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.top')
35416
+ .attr('x1', -1)
35417
+ .attr('x2', xBandwidth + 1);
35418
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.left')
35419
+ .attr('x1', 0)
35420
+ .attr('y1', -1)
35421
+ .attr('x2', 0)
35422
+ .attr('y2', yBandwidth + 1);
35423
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.down')
35424
+ .attr('x1', -1)
35425
+ .attr('x2', xBandwidth + 1)
35426
+ .attr('y1', yBandwidth)
35427
+ .attr('y2', yBandwidth);
35428
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.right')
35429
+ .attr('x1', xBandwidth)
35430
+ .attr('x2', xBandwidth)
35431
+ .attr('y1', -1)
35432
+ .attr('y2', yBandwidth + 1);
35433
+ };
35434
+ Heatmap.prototype.determineDividerStatus = function () {
35435
+ // Add dividers if status is not off, will assume auto or on by default.
35436
+ var dividerStatus = tools_Tools.getProperty(this.getOptions(), 'heatmap', 'divider', 'state');
35437
+ // Determine if cell divider should be displayed
35438
+ if (dividerStatus !== DividerStatus.OFF) {
35439
+ if ((dividerStatus === DividerStatus.AUTO &&
35440
+ heatmap.minCellDividerDimension <=
35441
+ this.xBandwidth &&
35442
+ heatmap.minCellDividerDimension <=
35443
+ this.yBandwidth) ||
35444
+ dividerStatus === DividerStatus.ON) {
35445
+ return true;
35446
+ }
35447
+ }
35448
+ return false;
35449
+ };
35450
+ Heatmap.prototype.addEventListener = function () {
35451
+ var self = this;
35452
+ var cartesianScales = this.services.cartesianScales;
35453
+ var options = this.getOptions();
35454
+ var totalLabel = lodash_es_get(options, 'tooltip.totalLabel');
35455
+ var domainIdentifier = cartesianScales.getDomainIdentifier();
35456
+ var rangeIdentifier = cartesianScales.getRangeIdentifier();
35457
+ var domainLabel = cartesianScales.getDomainLabel();
35458
+ var rangeLabel = cartesianScales.getRangeLabel();
35459
+ this.parent
35460
+ .selectAll('g.cell')
35461
+ .on('mouseover', function (event, datum) {
35462
+ var cell = src_select(this);
35463
+ var hoveredElement = cell.select('rect.heat');
35464
+ var nullState = hoveredElement.classed('null-state');
35465
+ // Dispatch event and tooltip only if value exists
35466
+ if (!nullState) {
35467
+ // Get transformation value of node
35468
+ var transform = tools_Tools.getTranformOffsets(cell.attr('transform'));
35469
+ src_select('g.cell-highlight')
35470
+ .attr('transform', "translate(" + (transform.x + self.translationUnits.x) + ", " + (transform.y + self.translationUnits.y) + ")")
35471
+ .classed('highlighter-hidden', false);
35472
+ // Dispatch mouse over event
35473
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOVER, {
35474
+ event: event,
35475
+ element: hoveredElement,
35476
+ datum: datum,
35477
+ });
35478
+ // Dispatch tooltip show event
35479
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
35480
+ event: event,
35481
+ items: [
35482
+ {
35483
+ label: domainLabel,
35484
+ value: datum[domainIdentifier],
35485
+ },
35486
+ {
35487
+ label: rangeLabel,
35488
+ value: datum[rangeIdentifier],
35489
+ },
35490
+ {
35491
+ label: totalLabel || 'Total',
35492
+ value: datum['value'],
35493
+ color: hoveredElement.style('fill'),
35494
+ },
35495
+ ],
35496
+ });
35497
+ }
35498
+ })
35499
+ .on('mousemove', function (event, datum) {
35500
+ // Dispatch mouse move event
35501
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEMOVE, {
35502
+ event: event,
35503
+ element: src_select(this),
35504
+ datum: datum,
35505
+ });
35506
+ // Dispatch tooltip move event
35507
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
35508
+ event: event,
35509
+ });
35510
+ })
35511
+ .on('click', function (event, datum) {
35512
+ // Dispatch mouse click event
35513
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_CLICK, {
35514
+ event: event,
35515
+ element: src_select(this),
35516
+ datum: datum,
35517
+ });
35518
+ })
35519
+ .on('mouseout', function (event, datum) {
35520
+ var cell = src_select(this);
35521
+ var hoveredElement = cell.select('rect.heat');
35522
+ var nullState = hoveredElement.classed('null-state');
35523
+ src_select('g.cell-highlight').classed('highlighter-hidden', true);
35524
+ // Dispatch event and tooltip only if value exists
35525
+ if (!nullState) {
35526
+ // Dispatch mouse out event
35527
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOUT, {
35528
+ event: event,
35529
+ element: hoveredElement,
35530
+ datum: datum,
35531
+ });
35532
+ // Dispatch hide tooltip event
35533
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
35534
+ event: event,
35535
+ hoveredElement: hoveredElement,
35536
+ });
35537
+ }
35538
+ });
35539
+ };
35540
+ // Remove event listeners
35541
+ Heatmap.prototype.destroy = function () {
35542
+ this.parent
35543
+ .selectAll('rect.heat')
35544
+ .on('mouseover', null)
35545
+ .on('mousemove', null)
35546
+ .on('click', null)
35547
+ .on('mouseout', null);
35548
+ // Remove legend listeners
35549
+ var eventsFragment = this.services.events;
35550
+ eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleAxisOnHover);
35551
+ eventsFragment.removeEventListener(Events.Legend.ITEM_MOUSEOUT, this.handleAxisMouseOut);
35552
+ };
35553
+ return Heatmap;
35554
+ }(component_Component));
35555
+
35556
+ //# sourceMappingURL=../../../src/components/graphs/heatmap.js.map
34665
35557
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
34666
35558
  var spacer_extends = (undefined && undefined.__extends) || (function () {
34667
35559
  var extendStatics = function (d, b) {
@@ -34888,187 +35780,6 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
34888
35780
  }(component_Component));
34889
35781
 
34890
35782
  //# sourceMappingURL=../../../src/components/layout/layout.js.map
34891
- // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
34892
- /* harmony default export */ var d3_axis_src_identity = (function(x) {
34893
- return x;
34894
- });
34895
-
34896
- // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
34897
-
34898
-
34899
- var axis_top = 1,
34900
- axis_right = 2,
34901
- bottom = 3,
34902
- axis_left = 4,
34903
- axis_epsilon = 1e-6;
34904
-
34905
- function axis_translateX(x) {
34906
- return "translate(" + x + ",0)";
34907
- }
34908
-
34909
- function axis_translateY(y) {
34910
- return "translate(0," + y + ")";
34911
- }
34912
-
34913
- function axis_number(scale) {
34914
- return d => +scale(d);
34915
- }
34916
-
34917
- function axis_center(scale, offset) {
34918
- offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
34919
- if (scale.round()) offset = Math.round(offset);
34920
- return d => +scale(d) + offset;
34921
- }
34922
-
34923
- function entering() {
34924
- return !this.__axis;
34925
- }
34926
-
34927
- function axis_axis(orient, scale) {
34928
- var tickArguments = [],
34929
- tickValues = null,
34930
- tickFormat = null,
34931
- tickSizeInner = 6,
34932
- tickSizeOuter = 6,
34933
- tickPadding = 3,
34934
- offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
34935
- k = orient === axis_top || orient === axis_left ? -1 : 1,
34936
- x = orient === axis_left || orient === axis_right ? "x" : "y",
34937
- transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
34938
-
34939
- function axis(context) {
34940
- var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
34941
- format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
34942
- spacing = Math.max(tickSizeInner, 0) + tickPadding,
34943
- range = scale.range(),
34944
- range0 = +range[0] + offset,
34945
- range1 = +range[range.length - 1] + offset,
34946
- position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
34947
- selection = context.selection ? context.selection() : context,
34948
- path = selection.selectAll(".domain").data([null]),
34949
- tick = selection.selectAll(".tick").data(values, scale).order(),
34950
- tickExit = tick.exit(),
34951
- tickEnter = tick.enter().append("g").attr("class", "tick"),
34952
- line = tick.select("line"),
34953
- text = tick.select("text");
34954
-
34955
- path = path.merge(path.enter().insert("path", ".tick")
34956
- .attr("class", "domain")
34957
- .attr("stroke", "currentColor"));
34958
-
34959
- tick = tick.merge(tickEnter);
34960
-
34961
- line = line.merge(tickEnter.append("line")
34962
- .attr("stroke", "currentColor")
34963
- .attr(x + "2", k * tickSizeInner));
34964
-
34965
- text = text.merge(tickEnter.append("text")
34966
- .attr("fill", "currentColor")
34967
- .attr(x, k * spacing)
34968
- .attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
34969
-
34970
- if (context !== selection) {
34971
- path = path.transition(context);
34972
- tick = tick.transition(context);
34973
- line = line.transition(context);
34974
- text = text.transition(context);
34975
-
34976
- tickExit = tickExit.transition(context)
34977
- .attr("opacity", axis_epsilon)
34978
- .attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
34979
-
34980
- tickEnter
34981
- .attr("opacity", axis_epsilon)
34982
- .attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
34983
- }
34984
-
34985
- tickExit.remove();
34986
-
34987
- path
34988
- .attr("d", orient === axis_left || orient === axis_right
34989
- ? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
34990
- : (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
34991
-
34992
- tick
34993
- .attr("opacity", 1)
34994
- .attr("transform", function(d) { return transform(position(d) + offset); });
34995
-
34996
- line
34997
- .attr(x + "2", k * tickSizeInner);
34998
-
34999
- text
35000
- .attr(x, k * spacing)
35001
- .text(format);
35002
-
35003
- selection.filter(entering)
35004
- .attr("fill", "none")
35005
- .attr("font-size", 10)
35006
- .attr("font-family", "sans-serif")
35007
- .attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
35008
-
35009
- selection
35010
- .each(function() { this.__axis = position; });
35011
- }
35012
-
35013
- axis.scale = function(_) {
35014
- return arguments.length ? (scale = _, axis) : scale;
35015
- };
35016
-
35017
- axis.ticks = function() {
35018
- return tickArguments = Array.from(arguments), axis;
35019
- };
35020
-
35021
- axis.tickArguments = function(_) {
35022
- return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
35023
- };
35024
-
35025
- axis.tickValues = function(_) {
35026
- return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
35027
- };
35028
-
35029
- axis.tickFormat = function(_) {
35030
- return arguments.length ? (tickFormat = _, axis) : tickFormat;
35031
- };
35032
-
35033
- axis.tickSize = function(_) {
35034
- return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
35035
- };
35036
-
35037
- axis.tickSizeInner = function(_) {
35038
- return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
35039
- };
35040
-
35041
- axis.tickSizeOuter = function(_) {
35042
- return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
35043
- };
35044
-
35045
- axis.tickPadding = function(_) {
35046
- return arguments.length ? (tickPadding = +_, axis) : tickPadding;
35047
- };
35048
-
35049
- axis.offset = function(_) {
35050
- return arguments.length ? (offset = +_, axis) : offset;
35051
- };
35052
-
35053
- return axis;
35054
- }
35055
-
35056
- function axisTop(scale) {
35057
- return axis_axis(axis_top, scale);
35058
- }
35059
-
35060
- function axisRight(scale) {
35061
- return axis_axis(axis_right, scale);
35062
- }
35063
-
35064
- function axisBottom(scale) {
35065
- return axis_axis(bottom, scale);
35066
- }
35067
-
35068
- function axisLeft(scale) {
35069
- return axis_axis(axis_left, scale);
35070
- }
35071
-
35072
35783
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/axis.js
35073
35784
  var axis_extends = (undefined && undefined.__extends) || (function () {
35074
35785
  var extendStatics = function (d, b) {
@@ -35097,9 +35808,16 @@ var axis_extends = (undefined && undefined.__extends) || (function () {
35097
35808
  var axis_Axis = /** @class */ (function (_super) {
35098
35809
  axis_extends(Axis, _super);
35099
35810
  function Axis(model, services, configs) {
35811
+ var _a;
35100
35812
  var _this = _super.call(this, model, services, configs) || this;
35101
35813
  _this.type = 'axes';
35102
35814
  _this.renderType = RenderTypes.SVG;
35815
+ _this.truncation = (_a = {},
35816
+ _a[AxisPositions.LEFT] = false,
35817
+ _a[AxisPositions.RIGHT] = false,
35818
+ _a[AxisPositions.TOP] = false,
35819
+ _a[AxisPositions.BOTTOM] = false,
35820
+ _a);
35103
35821
  if (configs) {
35104
35822
  _this.configs = configs;
35105
35823
  }
@@ -35527,11 +36245,13 @@ var axis_Axis = /** @class */ (function (_super) {
35527
36245
  .select("g.axis." + axisPosition + " g.ticks g.tick")
35528
36246
  .html();
35529
36247
  container.selectAll('g.ticks g.tick').html(tick_html);
36248
+ var self_1 = this;
35530
36249
  container
35531
36250
  .selectAll('g.tick text')
35532
36251
  .data(axisTickLabels)
35533
36252
  .text(function (d) {
35534
36253
  if (d.length > truncationThreshold) {
36254
+ self_1.truncation[axisPosition] = true;
35535
36255
  return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
35536
36256
  }
35537
36257
  else {
@@ -35566,8 +36286,6 @@ var axis_Axis = /** @class */ (function (_super) {
35566
36286
  var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
35567
36287
  var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
35568
36288
  var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
35569
- var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
35570
- axisOptions.scaleType === ScaleTypes.TIME;
35571
36289
  var self = this;
35572
36290
  container
35573
36291
  .selectAll('g.tick text')
@@ -35648,6 +36366,242 @@ var axis_Axis = /** @class */ (function (_super) {
35648
36366
  }(component_Component));
35649
36367
 
35650
36368
  //# sourceMappingURL=../../../src/components/axes/axis.js.map
36369
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/hover-axis.js
36370
+ var hover_axis_extends = (undefined && undefined.__extends) || (function () {
36371
+ var extendStatics = function (d, b) {
36372
+ extendStatics = Object.setPrototypeOf ||
36373
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
36374
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
36375
+ return extendStatics(d, b);
36376
+ };
36377
+ return function (d, b) {
36378
+ extendStatics(d, b);
36379
+ function __() { this.constructor = d; }
36380
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36381
+ };
36382
+ })();
36383
+ var hover_axis_assign = (undefined && undefined.__assign) || function () {
36384
+ hover_axis_assign = Object.assign || function(t) {
36385
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
36386
+ s = arguments[i];
36387
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
36388
+ t[p] = s[p];
36389
+ }
36390
+ return t;
36391
+ };
36392
+ return hover_axis_assign.apply(this, arguments);
36393
+ };
36394
+ // Internal Imports
36395
+
36396
+
36397
+
36398
+
36399
+
36400
+ // D3 Imports
36401
+
36402
+ var hover_axis_HoverAxis = /** @class */ (function (_super) {
36403
+ hover_axis_extends(HoverAxis, _super);
36404
+ function HoverAxis(model, services, configs) {
36405
+ return _super.call(this, model, services, configs) || this;
36406
+ }
36407
+ HoverAxis.prototype.render = function (animate) {
36408
+ if (animate === void 0) { animate = true; }
36409
+ _super.prototype.render.call(this, animate);
36410
+ // Remove existing event listeners to avoid flashing behavior
36411
+ _super.prototype.destroy.call(this);
36412
+ var axisPosition = this.configs.position;
36413
+ var svg = this.getComponentContainer();
36414
+ var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
36415
+ var self = this;
36416
+ container.selectAll('g.tick').each(function (_, index) {
36417
+ var g = src_select(this);
36418
+ g.classed('tick-hover', true).attr('tabindex', index === 0 ? 0 : -1);
36419
+ var textNode = g.select('text');
36420
+ var _a = dom_utils_DOMUtils.getSVGElementSize(textNode, {
36421
+ useBBox: true,
36422
+ }), width = _a.width, height = _a.height;
36423
+ var rectangle = dom_utils_DOMUtils.appendOrSelect(g, 'rect.axis-holder');
36424
+ var x = 0, y = 0;
36425
+ // Depending on axis position, apply correct translation & rotation to align the rect
36426
+ // with the text
36427
+ switch (axisPosition) {
36428
+ case AxisPositions.LEFT:
36429
+ x = -width + Number(textNode.attr('x'));
36430
+ y = -(height / 2);
36431
+ break;
36432
+ case AxisPositions.RIGHT:
36433
+ x = Math.abs(Number(textNode.attr('x')));
36434
+ y = -(height / 2);
36435
+ break;
36436
+ case AxisPositions.TOP:
36437
+ x = -(width / 2);
36438
+ y = -height + Number(textNode.attr('y')) / 2;
36439
+ if (self.truncation[axisPosition]) {
36440
+ x = 0;
36441
+ rectangle.attr('transform', "rotate(-45)");
36442
+ }
36443
+ break;
36444
+ case AxisPositions.BOTTOM:
36445
+ x = -(width / 2);
36446
+ y = height / 2 - 2;
36447
+ if (self.truncation[axisPosition]) {
36448
+ x = -width;
36449
+ rectangle.attr('transform', "rotate(-45)");
36450
+ }
36451
+ break;
36452
+ }
36453
+ // Translates x position -4 left to keep center after padding
36454
+ // Adds padding on left & right
36455
+ rectangle
36456
+ .attr('x', x - configuration_non_customizable_axis.hover.rectanglePadding)
36457
+ .attr('y', y)
36458
+ .attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
36459
+ .attr('height', height)
36460
+ .lower();
36461
+ // Add keyboard event listeners to each group element
36462
+ g.on('keydown', function (event) {
36463
+ // Choose specific arrow key depending on the axis
36464
+ if (axisPosition === AxisPositions.LEFT ||
36465
+ axisPosition === AxisPositions.RIGHT) {
36466
+ if (event.key && event.key === 'ArrowUp') {
36467
+ self.goNext(this, event);
36468
+ }
36469
+ else if (event.key && event.key === 'ArrowDown') {
36470
+ self.goPrevious(this, event);
36471
+ }
36472
+ }
36473
+ else {
36474
+ if (event.key && event.key === 'ArrowLeft') {
36475
+ self.goPrevious(this, event);
36476
+ }
36477
+ else if (event.key && event.key === 'ArrowRight') {
36478
+ self.goNext(this, event);
36479
+ }
36480
+ }
36481
+ });
36482
+ });
36483
+ // Add event listeners to element group
36484
+ this.addEventListeners();
36485
+ };
36486
+ HoverAxis.prototype.addEventListeners = function () {
36487
+ var svg = this.getComponentContainer();
36488
+ var axisPosition = this.configs.position;
36489
+ var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
36490
+ var options = this.getOptions();
36491
+ var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
36492
+ var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
36493
+ var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
36494
+ var self = this;
36495
+ container
36496
+ .selectAll('g.tick.tick-hover')
36497
+ .on('mouseover', function (event) {
36498
+ var hoveredElement = src_select(this).select('text');
36499
+ var datum = hoveredElement.datum();
36500
+ // Dispatch mouse event
36501
+ self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
36502
+ event: event,
36503
+ element: hoveredElement,
36504
+ datum: datum,
36505
+ });
36506
+ if (axisScaleType === ScaleTypes.LABELS &&
36507
+ datum.length > truncationThreshold) {
36508
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
36509
+ event: event,
36510
+ element: hoveredElement,
36511
+ datum: datum,
36512
+ });
36513
+ }
36514
+ })
36515
+ .on('mousemove', function (event) {
36516
+ var hoveredElement = src_select(this).select('text');
36517
+ var datum = hoveredElement.datum();
36518
+ // Dispatch mouse event
36519
+ self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
36520
+ event: event,
36521
+ element: hoveredElement,
36522
+ datum: datum,
36523
+ });
36524
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
36525
+ event: event,
36526
+ });
36527
+ })
36528
+ .on('click', function (event) {
36529
+ // Dispatch mouse event
36530
+ self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
36531
+ event: event,
36532
+ element: src_select(this).select('text'),
36533
+ datum: src_select(this).select('text').datum(),
36534
+ });
36535
+ })
36536
+ .on('mouseout', function (event) {
36537
+ // Dispatch mouse event
36538
+ self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
36539
+ event: event,
36540
+ element: src_select(this).select('text'),
36541
+ datum: src_select(this).select('text').datum(),
36542
+ });
36543
+ if (axisScaleType === ScaleTypes.LABELS) {
36544
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
36545
+ }
36546
+ })
36547
+ .on('focus', function (event) {
36548
+ var coordinates = { clientX: 0, clientY: 0 };
36549
+ if (event.target) {
36550
+ // Focus element since we are using arrow keys
36551
+ event.target.focus();
36552
+ var boundingRect = event.target.getBoundingClientRect();
36553
+ coordinates.clientX = boundingRect.x;
36554
+ coordinates.clientY = boundingRect.y;
36555
+ }
36556
+ // Dispatch focus event
36557
+ self.services.events.dispatchEvent(Events.Axis.LABEL_FOCUS, {
36558
+ event: hover_axis_assign(hover_axis_assign({}, event), coordinates),
36559
+ element: src_select(this),
36560
+ datum: src_select(this).select('text').datum(),
36561
+ });
36562
+ })
36563
+ .on('blur', function (event) {
36564
+ // Dispatch blur event
36565
+ self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
36566
+ event: event,
36567
+ element: src_select(this),
36568
+ datum: src_select(this).select('text').datum(),
36569
+ });
36570
+ });
36571
+ };
36572
+ // Focus on the next HTML element sibling
36573
+ HoverAxis.prototype.goNext = function (element, event) {
36574
+ if (element.nextElementSibling &&
36575
+ element.nextElementSibling.tagName !== 'path') {
36576
+ element.nextElementSibling.dispatchEvent(new Event('focus'));
36577
+ }
36578
+ event.preventDefault();
36579
+ };
36580
+ // Focus on the previous HTML element sibling
36581
+ HoverAxis.prototype.goPrevious = function (element, event) {
36582
+ if (element.previousElementSibling &&
36583
+ element.previousElementSibling.tagName !== 'path') {
36584
+ element.previousElementSibling.dispatchEvent(new Event('focus'));
36585
+ }
36586
+ event.preventDefault();
36587
+ };
36588
+ HoverAxis.prototype.destroy = function () {
36589
+ var svg = this.getComponentContainer();
36590
+ var axisPosition = this.configs.position;
36591
+ var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
36592
+ // Remove event listeners
36593
+ container
36594
+ .selectAll('g.tick.tick-hover')
36595
+ .on('mouseover', null)
36596
+ .on('mousemove', null)
36597
+ .on('mouseout', null)
36598
+ .on('focus', null)
36599
+ .on('blur', null);
36600
+ };
36601
+ return HoverAxis;
36602
+ }(axis_Axis));
36603
+
36604
+ //# sourceMappingURL=../../../src/components/axes/hover-axis.js.map
35651
36605
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/two-dimensional-axes.js
35652
36606
  var two_dimensional_axes_extends = (undefined && undefined.__extends) || (function () {
35653
36607
  var extendStatics = function (d, b) {
@@ -35669,6 +36623,7 @@ var two_dimensional_axes_extends = (undefined && undefined.__extends) || (functi
35669
36623
 
35670
36624
 
35671
36625
 
36626
+
35672
36627
  var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
35673
36628
  two_dimensional_axes_extends(TwoDimensionalAxes, _super);
35674
36629
  function TwoDimensionalAxes() {
@@ -35703,11 +36658,14 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
35703
36658
  var axisPosition = AxisPositions[axisPositionKey];
35704
36659
  if (_this.configs.axes[axisPosition] &&
35705
36660
  !_this.children[axisPosition]) {
35706
- var axisComponent = new axis_Axis(_this.model, _this.services, {
36661
+ var configs = {
35707
36662
  position: axisPosition,
35708
36663
  axes: _this.configs.axes,
35709
36664
  margins: _this.margins,
35710
- });
36665
+ };
36666
+ var axisComponent = _this.model.axisFlavor === AxisFlavor.DEFAULT
36667
+ ? new axis_Axis(_this.model, _this.services, configs)
36668
+ : new hover_axis_HoverAxis(_this.model, _this.services, configs);
35711
36669
  // Set model, services & parent for the new axis component
35712
36670
  axisComponent.setModel(_this.model);
35713
36671
  axisComponent.setServices(_this.services);
@@ -35758,6 +36716,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
35758
36716
  break;
35759
36717
  }
35760
36718
  });
36719
+ this.services.events.dispatchEvent(Events.Axis.RENDER_COMPLETE);
35761
36720
  // If the new margins are different than the existing ones
35762
36721
  var isNotEqual = Object.keys(margins).some(function (marginKey) {
35763
36722
  return _this.margins[marginKey] !== margins[marginKey];
@@ -39801,6 +40760,7 @@ var tee = {
39801
40760
 
39802
40761
 
39803
40762
 
40763
+
39804
40764
  // GRAPHS
39805
40765
 
39806
40766
 
@@ -39824,6 +40784,7 @@ var tee = {
39824
40784
 
39825
40785
 
39826
40786
 
40787
+
39827
40788
 
39828
40789
 
39829
40790
  // Layout
@@ -40077,7 +41038,9 @@ var cartesian_charts_spreadArrays = (undefined && undefined.__spreadArrays) || f
40077
41038
  var cartesian_charts_ChartModelCartesian = /** @class */ (function (_super) {
40078
41039
  cartesian_charts_extends(ChartModelCartesian, _super);
40079
41040
  function ChartModelCartesian(services) {
40080
- return _super.call(this, services) || this;
41041
+ var _this = _super.call(this, services) || this;
41042
+ _this.axisFlavor = AxisFlavor.DEFAULT;
41043
+ return _this;
40081
41044
  }
40082
41045
  // get the scales information
40083
41046
  // needed for getTabularArray()
@@ -43005,6 +43968,493 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
43005
43968
  }(chart_Chart));
43006
43969
 
43007
43970
  //# sourceMappingURL=../../src/charts/alluvial.js.map
43971
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-scale/src/quantize.js
43972
+
43973
+
43974
+
43975
+
43976
+ function quantize_quantize() {
43977
+ var x0 = 0,
43978
+ x1 = 1,
43979
+ n = 1,
43980
+ domain = [0.5],
43981
+ range = [0, 1],
43982
+ unknown;
43983
+
43984
+ function scale(x) {
43985
+ return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
43986
+ }
43987
+
43988
+ function rescale() {
43989
+ var i = -1;
43990
+ domain = new Array(n);
43991
+ while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
43992
+ return scale;
43993
+ }
43994
+
43995
+ scale.domain = function(_) {
43996
+ return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
43997
+ };
43998
+
43999
+ scale.range = function(_) {
44000
+ return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
44001
+ };
44002
+
44003
+ scale.invertExtent = function(y) {
44004
+ var i = range.indexOf(y);
44005
+ return i < 0 ? [NaN, NaN]
44006
+ : i < 1 ? [x0, domain[0]]
44007
+ : i >= n ? [domain[n - 1], x1]
44008
+ : [domain[i - 1], domain[i]];
44009
+ };
44010
+
44011
+ scale.unknown = function(_) {
44012
+ return arguments.length ? (unknown = _, scale) : scale;
44013
+ };
44014
+
44015
+ scale.thresholds = function() {
44016
+ return domain.slice();
44017
+ };
44018
+
44019
+ scale.copy = function() {
44020
+ return quantize_quantize()
44021
+ .domain([x0, x1])
44022
+ .range(range)
44023
+ .unknown(unknown);
44024
+ };
44025
+
44026
+ return initRange.apply(linearish(scale), arguments);
44027
+ }
44028
+
44029
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/model/heatmap.js
44030
+ var model_heatmap_extends = (undefined && undefined.__extends) || (function () {
44031
+ var extendStatics = function (d, b) {
44032
+ extendStatics = Object.setPrototypeOf ||
44033
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44034
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44035
+ return extendStatics(d, b);
44036
+ };
44037
+ return function (d, b) {
44038
+ extendStatics(d, b);
44039
+ function __() { this.constructor = d; }
44040
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44041
+ };
44042
+ })();
44043
+ var heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
44044
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
44045
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
44046
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
44047
+ r[k] = a[j];
44048
+ return r;
44049
+ };
44050
+ // Internal Imports
44051
+
44052
+
44053
+
44054
+ // d3 imports
44055
+
44056
+
44057
+ /** The gauge chart model layer */
44058
+ var heatmap_HeatmapModel = /** @class */ (function (_super) {
44059
+ model_heatmap_extends(HeatmapModel, _super);
44060
+ function HeatmapModel(services) {
44061
+ var _this = _super.call(this, services) || this;
44062
+ _this.axisFlavor = AxisFlavor.HOVERABLE;
44063
+ _this._colorScale = undefined;
44064
+ // List of unique ranges and domains
44065
+ _this._domains = [];
44066
+ _this._ranges = [];
44067
+ _this._matrix = {};
44068
+ // Check which scale types are being used
44069
+ var axis = tools_Tools.getProperty(_this.getOptions(), 'axes');
44070
+ // Need to check options since scale service hasn't been instantiated
44071
+ if ((!!tools_Tools.getProperty(axis, 'left', 'scaleType') &&
44072
+ tools_Tools.getProperty(axis, 'left', 'scaleType') !==
44073
+ ScaleTypes.LABELS) ||
44074
+ (!!tools_Tools.getProperty(axis, 'right', 'scaleType') &&
44075
+ tools_Tools.getProperty(axis, 'right', 'scaleType') !==
44076
+ ScaleTypes.LABELS) ||
44077
+ (!!tools_Tools.getProperty(axis, 'top', 'scaleType') &&
44078
+ tools_Tools.getProperty(axis, 'top', 'scaleType') !==
44079
+ ScaleTypes.LABELS) ||
44080
+ (!!tools_Tools.getProperty(axis, 'bottom', 'scaleType') &&
44081
+ tools_Tools.getProperty(axis, 'bottom', 'scaleType') !==
44082
+ ScaleTypes.LABELS)) {
44083
+ throw Error('Heatmap only supports label scaletypes.');
44084
+ }
44085
+ return _this;
44086
+ }
44087
+ /**
44088
+ * Get min and maximum value of the display data
44089
+ * @returns Array consisting of smallest and largest values in data
44090
+ */
44091
+ HeatmapModel.prototype.getValueDomain = function () {
44092
+ var data = this.getDisplayData().map(function (element) { return element.value; });
44093
+ var limits = src_extent(data);
44094
+ var domain = [];
44095
+ // Round extent values to the nearest multiple of 10
44096
+ // Axis rounds values to multiples of 2, 5, and 10s.
44097
+ limits.forEach(function (number, index) {
44098
+ var value = Number(number);
44099
+ if (index === 0 && value >= 0) {
44100
+ value = 0;
44101
+ }
44102
+ else if (value % 10 === 0 || value === 0) {
44103
+ value;
44104
+ }
44105
+ else if (value < 0) {
44106
+ value = Math.floor(value / 10) * 10;
44107
+ }
44108
+ else {
44109
+ value = Math.ceil(value / 10) * 10;
44110
+ }
44111
+ domain.push(value);
44112
+ });
44113
+ // Ensure the median of the range is 0
44114
+ if (domain[0] < 0 && domain[1] > 0) {
44115
+ if (Math.abs(domain[0]) > domain[1]) {
44116
+ domain[1] = Math.abs(domain[0]);
44117
+ }
44118
+ else {
44119
+ domain[0] = -domain[1];
44120
+ }
44121
+ }
44122
+ return domain;
44123
+ };
44124
+ /**
44125
+ * @override
44126
+ * @param value
44127
+ * @returns
44128
+ */
44129
+ HeatmapModel.prototype.getFillColor = function (value) {
44130
+ return this._colorScale(value);
44131
+ };
44132
+ /**
44133
+ * Generate a list of all unique domains
44134
+ * @returns String[]
44135
+ */
44136
+ HeatmapModel.prototype.getUniqueDomain = function () {
44137
+ if (tools_Tools.isEmpty(this._domains)) {
44138
+ var displayData = this.getDisplayData();
44139
+ var cartesianScales = this.services.cartesianScales;
44140
+ var domainIdentifier_1 = cartesianScales.getDomainIdentifier();
44141
+ var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
44142
+ var customDomain = cartesianScales.getCustomDomainValuesByposition(mainXAxisPosition);
44143
+ // Use user defined domain if specified
44144
+ if (!!customDomain) {
44145
+ return customDomain;
44146
+ }
44147
+ // Get unique axis values & create a matrix
44148
+ this._domains = Array.from(new Set(displayData.map(function (d) {
44149
+ return d[domainIdentifier_1];
44150
+ })));
44151
+ }
44152
+ return this._domains;
44153
+ };
44154
+ /**
44155
+ * Generates a list of all unique ranges
44156
+ * @returns String[]
44157
+ */
44158
+ HeatmapModel.prototype.getUniqueRanges = function () {
44159
+ if (tools_Tools.isEmpty(this._ranges)) {
44160
+ var displayData = this.getDisplayData();
44161
+ var cartesianScales = this.services.cartesianScales;
44162
+ var rangeIdentifier_1 = cartesianScales.getRangeIdentifier();
44163
+ var mainYAxisPosition = cartesianScales.getMainYAxisPosition();
44164
+ var customDomain = cartesianScales.getCustomDomainValuesByposition(mainYAxisPosition);
44165
+ // Use user defined domain if specified
44166
+ if (!!customDomain) {
44167
+ return customDomain;
44168
+ }
44169
+ // Get unique axis values & create a matrix
44170
+ this._ranges = Array.from(new Set(displayData.map(function (d) {
44171
+ return d[rangeIdentifier_1];
44172
+ })));
44173
+ }
44174
+ return this._ranges;
44175
+ };
44176
+ /**
44177
+ * Generates a matrix (If doesn't exist) and returns it
44178
+ * @returns Object
44179
+ */
44180
+ HeatmapModel.prototype.getMatrix = function () {
44181
+ var _this = this;
44182
+ if (tools_Tools.isEmpty(this._matrix)) {
44183
+ var uniqueDomain = this.getUniqueDomain();
44184
+ var uniqueRange = this.getUniqueRanges();
44185
+ var domainIdentifier_2 = this.services.cartesianScales.getDomainIdentifier();
44186
+ var rangeIdentifier_2 = this.services.cartesianScales.getRangeIdentifier();
44187
+ // Create a column
44188
+ var range_1 = {};
44189
+ uniqueRange.forEach(function (ran) {
44190
+ // Initialize matrix to empty state
44191
+ range_1[ran] = {
44192
+ value: null,
44193
+ index: -1,
44194
+ };
44195
+ });
44196
+ // Complete the matrix by cloning the column to all domains
44197
+ uniqueDomain.forEach(function (dom) {
44198
+ _this._matrix[dom] = tools_Tools.clone(range_1);
44199
+ });
44200
+ // Fill in user passed data
44201
+ this.getDisplayData().forEach(function (d, i) {
44202
+ _this._matrix[d[domainIdentifier_2]][d[rangeIdentifier_2]] = {
44203
+ value: d['value'],
44204
+ index: i,
44205
+ };
44206
+ });
44207
+ }
44208
+ return this._matrix;
44209
+ };
44210
+ /**
44211
+ *
44212
+ * @param newData The new raw data to be set
44213
+ */
44214
+ HeatmapModel.prototype.setData = function (newData) {
44215
+ var sanitizedData = this.sanitize(tools_Tools.clone(newData));
44216
+ var dataGroups = this.generateDataGroups(sanitizedData);
44217
+ this.set({
44218
+ data: sanitizedData,
44219
+ dataGroups: dataGroups,
44220
+ });
44221
+ // Set attributes to empty
44222
+ this._domains = [];
44223
+ this._ranges = [];
44224
+ this._matrix = {};
44225
+ return sanitizedData;
44226
+ };
44227
+ /**
44228
+ * Converts Object matrix into a single array
44229
+ * @returns Object[]
44230
+ */
44231
+ HeatmapModel.prototype.getMatrixAsArray = function () {
44232
+ var _this = this;
44233
+ if (tools_Tools.isEmpty(this._matrix)) {
44234
+ this.getMatrix();
44235
+ }
44236
+ var uniqueDomain = this.getUniqueDomain();
44237
+ var uniqueRange = this.getUniqueRanges();
44238
+ var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
44239
+ var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
44240
+ var arr = [];
44241
+ uniqueDomain.forEach(function (domain) {
44242
+ uniqueRange.forEach(function (range) {
44243
+ var element = {
44244
+ value: _this._matrix[domain][range].value,
44245
+ index: _this._matrix[domain][range].index,
44246
+ };
44247
+ element[domainIdentifier] = domain;
44248
+ element[rangeIdentifier] = range;
44249
+ arr.push(element);
44250
+ });
44251
+ });
44252
+ return arr;
44253
+ };
44254
+ /**
44255
+ * Generate tabular data from display data
44256
+ * @returns Array<Object>
44257
+ */
44258
+ HeatmapModel.prototype.getTabularDataArray = function () {
44259
+ var displayData = this.getDisplayData();
44260
+ var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
44261
+ var domainValueFormatter;
44262
+ var result = heatmap_spreadArrays([
44263
+ [primaryDomain.label, primaryRange.label, 'Value']
44264
+ ], displayData.map(function (datum) { return [
44265
+ datum[primaryDomain.identifier] === null
44266
+ ? '&ndash;'
44267
+ : domainValueFormatter
44268
+ ? domainValueFormatter(datum[primaryDomain.identifier])
44269
+ : datum[primaryDomain.identifier],
44270
+ datum[primaryRange.identifier] === null
44271
+ ? '&ndash;'
44272
+ : datum[primaryRange.identifier].toLocaleString(),
44273
+ datum['value'],
44274
+ ]; }));
44275
+ return result;
44276
+ };
44277
+ // Uses quantize scale to return class names
44278
+ HeatmapModel.prototype.getColorClassName = function (configs) {
44279
+ return configs.originalClassName + " " + this._colorScale(configs.value);
44280
+ };
44281
+ HeatmapModel.prototype.setColorClassNames = function () {
44282
+ var options = this.getOptions();
44283
+ var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
44284
+ var customColorsEnabled = !tools_Tools.isEmpty(customColors);
44285
+ var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
44286
+ // If domain consists of negative and positive values, use diverging palettes
44287
+ var domain = this.getValueDomain();
44288
+ var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
44289
+ // Use default color pairing options if not in defined range
44290
+ if (colorPairingOption < 1 &&
44291
+ colorPairingOption > 4 &&
44292
+ colorScheme === 'mono') {
44293
+ colorPairingOption = 1;
44294
+ }
44295
+ else if (colorPairingOption < 1 &&
44296
+ colorPairingOption > 2 &&
44297
+ colorScheme === 'diverge') {
44298
+ colorPairingOption = 1;
44299
+ }
44300
+ // Uses css classes for fill
44301
+ var colorPairing = customColorsEnabled ? customColors : [];
44302
+ if (!customColorsEnabled) {
44303
+ // Add class names to list and the amount based on the color scheme
44304
+ // Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
44305
+ var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
44306
+ for (var i = 1; i < colorGroupingLength + 1; i++) {
44307
+ colorPairing.push("fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
44308
+ }
44309
+ }
44310
+ // Save scale type
44311
+ this._colorScale = quantize_quantize()
44312
+ .domain(this.getValueDomain())
44313
+ .range(colorPairing);
44314
+ };
44315
+ return HeatmapModel;
44316
+ }(cartesian_charts_ChartModelCartesian));
44317
+
44318
+ //# sourceMappingURL=../../src/model/heatmap.js.map
44319
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/heatmap.js
44320
+ var charts_heatmap_extends = (undefined && undefined.__extends) || (function () {
44321
+ var extendStatics = function (d, b) {
44322
+ extendStatics = Object.setPrototypeOf ||
44323
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44324
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44325
+ return extendStatics(d, b);
44326
+ };
44327
+ return function (d, b) {
44328
+ extendStatics(d, b);
44329
+ function __() { this.constructor = d; }
44330
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44331
+ };
44332
+ })();
44333
+ var charts_heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
44334
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
44335
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
44336
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
44337
+ r[k] = a[j];
44338
+ return r;
44339
+ };
44340
+ // Internal Imports
44341
+
44342
+
44343
+
44344
+
44345
+
44346
+
44347
+ var heatmap_HeatmapChart = /** @class */ (function (_super) {
44348
+ charts_heatmap_extends(HeatmapChart, _super);
44349
+ function HeatmapChart(holder, chartConfigs) {
44350
+ var _this = _super.call(this, holder, chartConfigs) || this;
44351
+ _this.model = new heatmap_HeatmapModel(_this.services);
44352
+ // Merge the default options for this chart
44353
+ // With the user provided options
44354
+ _this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.heatmapChart, chartConfigs.options));
44355
+ // Initialize data, services, components etc.
44356
+ _this.init(holder, chartConfigs);
44357
+ return _this;
44358
+ }
44359
+ // Custom getChartComponents - Implements getChartComponents
44360
+ // Removes zoombar support and additional `features` that are not supported in heatmap
44361
+ HeatmapChart.prototype.getAxisChartComponents = function (graphFrameComponents, configs) {
44362
+ var options = this.model.getOptions();
44363
+ var toolbarEnabled = tools_Tools.getProperty(options, 'toolbar', 'enabled');
44364
+ this.services.cartesianScales.determineAxisDuality();
44365
+ this.services.cartesianScales.findDomainAndRangeAxes(); // need to do this before getMainXAxisPosition()
44366
+ this.services.cartesianScales.determineOrientation();
44367
+ var titleAvailable = !!this.model.getOptions().title;
44368
+ var titleComponent = {
44369
+ id: 'title',
44370
+ components: [new title_Title(this.model, this.services)],
44371
+ growth: LayoutGrowth.STRETCH,
44372
+ };
44373
+ var toolbarComponent = {
44374
+ id: 'toolbar',
44375
+ components: [new toolbar_Toolbar(this.model, this.services)],
44376
+ growth: LayoutGrowth.PREFERRED,
44377
+ };
44378
+ var headerComponent = {
44379
+ id: 'header',
44380
+ components: [
44381
+ new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays([
44382
+ // always add title to keep layout correct
44383
+ titleComponent
44384
+ ], (toolbarEnabled ? [toolbarComponent] : [])), {
44385
+ direction: LayoutDirection.ROW,
44386
+ alignItems: LayoutAlignItems.CENTER,
44387
+ }),
44388
+ ],
44389
+ growth: LayoutGrowth.PREFERRED,
44390
+ };
44391
+ var legendComponent = {
44392
+ id: 'legend',
44393
+ components: [new color_scale_legend_ColorScaleLegend(this.model, this.services)],
44394
+ growth: LayoutGrowth.PREFERRED,
44395
+ renderType: RenderTypes.SVG,
44396
+ };
44397
+ var graphFrameComponent = {
44398
+ id: 'graph-frame',
44399
+ components: graphFrameComponents,
44400
+ growth: LayoutGrowth.STRETCH,
44401
+ renderType: RenderTypes.SVG,
44402
+ };
44403
+ var isLegendEnabled = tools_Tools.getProperty(configs, 'legend', 'enabled') !== false &&
44404
+ this.model.getOptions().legend.enabled !== false;
44405
+ // Decide the position of the legend in reference to the chart
44406
+ var fullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;
44407
+ var legendSpacerComponent = {
44408
+ id: 'spacer',
44409
+ components: [new spacer_Spacer(this.model, this.services, { size: 15 })],
44410
+ growth: LayoutGrowth.PREFERRED,
44411
+ };
44412
+ var fullFrameComponent = {
44413
+ id: 'full-frame',
44414
+ components: [
44415
+ new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays((isLegendEnabled ? [legendComponent] : []), (isLegendEnabled ? [legendSpacerComponent] : []), [
44416
+ graphFrameComponent,
44417
+ ]), {
44418
+ direction: fullFrameComponentDirection,
44419
+ }),
44420
+ ],
44421
+ growth: LayoutGrowth.STRETCH,
44422
+ };
44423
+ var topLevelLayoutComponents = [];
44424
+ // header component is required for either title or toolbar
44425
+ if (titleAvailable || toolbarEnabled) {
44426
+ topLevelLayoutComponents.push(headerComponent);
44427
+ var titleSpacerComponent = {
44428
+ id: 'spacer',
44429
+ components: [
44430
+ new spacer_Spacer(this.model, this.services, toolbarEnabled ? { size: 15 } : undefined),
44431
+ ],
44432
+ growth: LayoutGrowth.PREFERRED,
44433
+ };
44434
+ topLevelLayoutComponents.push(titleSpacerComponent);
44435
+ }
44436
+ topLevelLayoutComponents.push(fullFrameComponent);
44437
+ return [
44438
+ new tooltip_axis_AxisChartsTooltip(this.model, this.services),
44439
+ new essentials_modal_Modal(this.model, this.services),
44440
+ new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
44441
+ direction: LayoutDirection.COLUMN,
44442
+ }),
44443
+ ];
44444
+ };
44445
+ HeatmapChart.prototype.getComponents = function () {
44446
+ // Specify what to render inside the graph-frame
44447
+ var graphFrameComponents = [
44448
+ new two_dimensional_axes_TwoDimensionalAxes(this.model, this.services),
44449
+ new heatmap_Heatmap(this.model, this.services),
44450
+ ];
44451
+ var components = this.getAxisChartComponents(graphFrameComponents);
44452
+ return components;
44453
+ };
44454
+ return HeatmapChart;
44455
+ }(axis_chart_AxisChart));
44456
+
44457
+ //# sourceMappingURL=../../src/charts/heatmap.js.map
43008
44458
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
43009
44459
 
43010
44460
 
@@ -43027,6 +44477,7 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
43027
44477
 
43028
44478
 
43029
44479
 
44480
+
43030
44481
 
43031
44482
 
43032
44483
  //# sourceMappingURL=../../src/charts/index.js.map
@@ -44238,6 +45689,52 @@ var ccv_alluvial_chart_component = normalizeComponent(
44238
45689
  )
44239
45690
 
44240
45691
  /* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
45692
+ // 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&
45693
+ 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"})}
45694
+ var ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns = []
45695
+
45696
+
45697
+ // CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
45698
+
45699
+ // 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&
45700
+ //
45701
+ //
45702
+ //
45703
+ //
45704
+
45705
+
45706
+ /* harmony default export */ var ccv_heatmap_chartvue_type_script_lang_js_ = ({
45707
+ name: 'CcvHeatmapChart',
45708
+ extends: ccv_base_chart,
45709
+ mounted: function mounted() {
45710
+ this.coreChart = new heatmap_HeatmapChart(this.$el, {
45711
+ data: this.data,
45712
+ options: this.options
45713
+ });
45714
+ }
45715
+ });
45716
+ // CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
45717
+ /* harmony default export */ var src_ccv_heatmap_chartvue_type_script_lang_js_ = (ccv_heatmap_chartvue_type_script_lang_js_);
45718
+ // CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue
45719
+
45720
+
45721
+
45722
+
45723
+
45724
+ /* normalize component */
45725
+
45726
+ var ccv_heatmap_chart_component = normalizeComponent(
45727
+ src_ccv_heatmap_chartvue_type_script_lang_js_,
45728
+ ccv_heatmap_chartvue_type_template_id_b6ba687e_render,
45729
+ ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns,
45730
+ false,
45731
+ null,
45732
+ null,
45733
+ null
45734
+
45735
+ )
45736
+
45737
+ /* harmony default export */ var ccv_heatmap_chart = (ccv_heatmap_chart_component.exports);
44241
45738
  // CONCATENATED MODULE: ./src/index.js
44242
45739
 
44243
45740
 
@@ -44272,7 +45769,8 @@ var ccv_alluvial_chart_component = normalizeComponent(
44272
45769
 
44273
45770
 
44274
45771
 
44275
- 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];
45772
+
45773
+ 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];
44276
45774
  /*
44277
45775
  Allows the module to be used as a Vue plug-in, and has an install()
44278
45776
  method (which is called when the plug-in loads) that registers all the
@@ -44372,6 +45870,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
44372
45870
  /* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
44373
45871
  /* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
44374
45872
  /* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
45873
+ /* concated harmony reexport CcvHeatmapChart */__webpack_require__.d(__webpack_exports__, "CcvHeatmapChart", function() { return ccv_heatmap_chart; });
44375
45874
 
44376
45875
 
44377
45876
  /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);