@carbon/charts-vue 0.53.4 → 0.54.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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) {
@@ -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
  };
@@ -17539,6 +17620,11 @@ var zoom_Zoom = /** @class */ (function (_super) {
17539
17620
  var cartesianScales = this.services.cartesianScales;
17540
17621
  var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
17541
17622
  var domainIdentifier = cartesianScales.getDomainIdentifier();
17623
+ var customDomain = tools_Tools.getProperty(this.model.getOptions(), 'axes', mainXAxisPosition, 'domain');
17624
+ // return custom domain if exists && valid
17625
+ if (Array.isArray(customDomain) && customDomain.length === 2) {
17626
+ return customDomain;
17627
+ }
17542
17628
  // default to full range with extended domain
17543
17629
  return cartesianScales.extendsDomain(mainXAxisPosition, src_extent(allZoomBarData, function (d) { return d[domainIdentifier]; }));
17544
17630
  };
@@ -17917,7 +18003,7 @@ var legend_Legend = /** @class */ (function (_super) {
17917
18003
  var legendOrientation = tools_Tools.getProperty(options, 'legend', 'orientation');
17918
18004
  var dataGroups = this.model.getDataGroups();
17919
18005
  // Check if there are disabled legend items
17920
- var DISABLED = legend.items.status.DISABLED;
18006
+ var DISABLED = configuration_non_customizable_legend.items.status.DISABLED;
17921
18007
  var hasDeactivatedItems = dataGroups.some(function (dataGroup) { return dataGroup.status === DISABLED; });
17922
18008
  var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
17923
18009
  var svg = this.getComponentContainer()
@@ -17941,11 +18027,11 @@ var legend_Legend = /** @class */ (function (_super) {
17941
18027
  addedLegendItems
17942
18028
  .merge(svg.selectAll('div.legend-item'))
17943
18029
  .classed('active', function (d, i) {
17944
- return d.status === legend.items.status.ACTIVE;
18030
+ return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
17945
18031
  });
17946
18032
  var legendClickable = tools_Tools.getProperty(this.getOptions(), 'legend', 'clickable');
17947
18033
  svg.classed('clickable', legendClickable && dataGroups.length > 1);
17948
- var checkboxRadius = legend.checkbox.radius;
18034
+ var checkboxRadius = configuration_non_customizable_legend.checkbox.radius;
17949
18035
  var addedCheckboxes = addedLegendItems
17950
18036
  .append('div')
17951
18037
  .classed('checkbox', true);
@@ -17958,7 +18044,7 @@ var legend_Legend = /** @class */ (function (_super) {
17958
18044
  })
17959
18045
  .attr('aria-checked', function (_a) {
17960
18046
  var status = _a.status;
17961
- return status === legend.items.status.ACTIVE;
18047
+ return status === configuration_non_customizable_legend.items.status.ACTIVE;
17962
18048
  })
17963
18049
  .attr('width', checkboxRadius * 2)
17964
18050
  .attr('height', checkboxRadius * 2)
@@ -17970,13 +18056,13 @@ var legend_Legend = /** @class */ (function (_super) {
17970
18056
  });
17971
18057
  })
17972
18058
  .style('background', function (d) {
17973
- return d.status === legend.items.status.ACTIVE
18059
+ return d.status === configuration_non_customizable_legend.items.status.ACTIVE
17974
18060
  ? _this.model.getFillColor(d.name) ||
17975
18061
  _this.model.getStrokeColor(d.name)
17976
18062
  : null;
17977
18063
  })
17978
18064
  .classed('active', function (d, i) {
17979
- return d.status === legend.items.status.ACTIVE;
18065
+ return d.status === configuration_non_customizable_legend.items.status.ACTIVE;
17980
18066
  });
17981
18067
  var addedCheckIcons = addedCheckboxes
17982
18068
  .append('svg')
@@ -18061,7 +18147,7 @@ var legend_Legend = /** @class */ (function (_super) {
18061
18147
  return dataGroups;
18062
18148
  };
18063
18149
  Legend.prototype.addAdditionalItem = function (additionalItem, itemConfig, indexOfItem) {
18064
- var _a = legend.area, width = _a.width, height = _a.height;
18150
+ var _a = configuration_non_customizable_legend.area, width = _a.width, height = _a.height;
18065
18151
  if (itemConfig.type === LegendItemType.RADIUS) {
18066
18152
  // Circular icon
18067
18153
  additionalItem
@@ -18074,7 +18160,7 @@ var legend_Legend = /** @class */ (function (_super) {
18074
18160
  .style('height', height + "px");
18075
18161
  }
18076
18162
  if (itemConfig.type === LegendItemType.RADIUS) {
18077
- 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;
18078
18164
  var circleEnter = additionalItem
18079
18165
  .attr('fill', 'none')
18080
18166
  .selectAll('circle')
@@ -18092,7 +18178,7 @@ var legend_Legend = /** @class */ (function (_super) {
18092
18178
  .style('stroke', itemConfig.stroke ? itemConfig.stroke : stroke);
18093
18179
  }
18094
18180
  else if (itemConfig.type === LegendItemType.LINE) {
18095
- var lineConfig = legend.line;
18181
+ var lineConfig = configuration_non_customizable_legend.line;
18096
18182
  if (additionalItem.select('line.line').empty()) {
18097
18183
  additionalItem
18098
18184
  .append('line')
@@ -18119,13 +18205,13 @@ var legend_Legend = /** @class */ (function (_super) {
18119
18205
  .attr('width', width)
18120
18206
  .attr('height', height)
18121
18207
  .style('fill', indexOfItem > 3 && !itemConfig.fill
18122
- ? legend.area.fill
18208
+ ? configuration_non_customizable_legend.area.fill
18123
18209
  : itemConfig.fill)
18124
18210
  .style('stroke', itemConfig.stroke);
18125
18211
  }
18126
18212
  }
18127
18213
  else if (itemConfig.type === LegendItemType.SIZE) {
18128
- 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;
18129
18215
  var sizeEnter = additionalItem
18130
18216
  .attr('fill', 'none')
18131
18217
  .attr('role', Roles.IMG)
@@ -18144,7 +18230,7 @@ var legend_Legend = /** @class */ (function (_super) {
18144
18230
  .style('stroke-width', 1);
18145
18231
  }
18146
18232
  else if (itemConfig.type === LegendItemType.QUARTILE) {
18147
- var iconData = legend.quartile.iconData;
18233
+ var iconData = configuration_non_customizable_legend.quartile.iconData;
18148
18234
  var quartileEnter = additionalItem
18149
18235
  .selectAll('rect')
18150
18236
  .attr('role', Roles.IMG)
@@ -18298,6 +18384,431 @@ var legend_Legend = /** @class */ (function (_super) {
18298
18384
  }(component_Component));
18299
18385
 
18300
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
18301
18812
  // EXTERNAL MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/carbon-components/node_modules/warning/browser.js
18302
18813
  var browser = __webpack_require__("9b04");
18303
18814
 
@@ -33483,7 +33994,7 @@ function justify(node, n) {
33483
33994
  return node.sourceLinks.length ? node.depth : n - 1;
33484
33995
  }
33485
33996
 
33486
- function center(node) {
33997
+ function align_center(node) {
33487
33998
  return node.targetLinks.length ? node.depth
33488
33999
  : node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
33489
34000
  : 0;
@@ -34657,6 +35168,376 @@ var alluvial_Alluvial = /** @class */ (function (_super) {
34657
35168
  }(component_Component));
34658
35169
 
34659
35170
  //# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
35171
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/heatmap.js
35172
+ var heatmap_extends = (undefined && undefined.__extends) || (function () {
35173
+ var extendStatics = function (d, b) {
35174
+ extendStatics = Object.setPrototypeOf ||
35175
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35176
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
35177
+ return extendStatics(d, b);
35178
+ };
35179
+ return function (d, b) {
35180
+ extendStatics(d, b);
35181
+ function __() { this.constructor = d; }
35182
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35183
+ };
35184
+ })();
35185
+ // Internal Imports
35186
+
35187
+
35188
+
35189
+
35190
+
35191
+
35192
+ // D3 Imports
35193
+
35194
+
35195
+ var heatmap_Heatmap = /** @class */ (function (_super) {
35196
+ heatmap_extends(Heatmap, _super);
35197
+ function Heatmap() {
35198
+ var _this = _super !== null && _super.apply(this, arguments) || this;
35199
+ _this.type = 'heatmap';
35200
+ _this.renderType = RenderTypes.SVG;
35201
+ _this.matrix = {};
35202
+ _this.xBandwidth = 0;
35203
+ _this.yBandwidth = 0;
35204
+ _this.translationUnits = {
35205
+ x: 0,
35206
+ y: 0,
35207
+ };
35208
+ // Highlight elements that match the hovered axis item
35209
+ _this.handleAxisOnHover = function (event) {
35210
+ var detail = event.detail;
35211
+ var datum = detail.datum;
35212
+ // Unique ranges and domains
35213
+ var ranges = _this.model.getUniqueRanges();
35214
+ var domains = _this.model.getUniqueDomain();
35215
+ // Labels
35216
+ var domainLabel = _this.services.cartesianScales.getDomainLabel();
35217
+ var rangeLabel = _this.services.cartesianScales.getRangeLabel();
35218
+ // Scales
35219
+ var mainXScale = _this.services.cartesianScales.getMainXScale();
35220
+ var mainYScale = _this.services.cartesianScales.getMainYScale();
35221
+ var label = '', sum = 0, minimum = 0, maximum = 0;
35222
+ // Check to see where datum belongs
35223
+ if (_this.matrix[datum] !== undefined) {
35224
+ label = domainLabel;
35225
+ // Iterate through Object and get sum, min, and max
35226
+ ranges.forEach(function (element) {
35227
+ var value = _this.matrix[datum][element].value || 0;
35228
+ sum += value;
35229
+ minimum = value < minimum ? value : minimum;
35230
+ maximum = value > maximum ? value : maximum;
35231
+ });
35232
+ }
35233
+ else {
35234
+ label = rangeLabel;
35235
+ domains.forEach(function (element) {
35236
+ var value = _this.matrix[element][datum].value || 0;
35237
+ sum += value;
35238
+ minimum = value < minimum ? value : minimum;
35239
+ maximum = value > maximum ? value : maximum;
35240
+ });
35241
+ }
35242
+ if (mainXScale(datum) !== undefined) {
35243
+ _this.parent
35244
+ .select('g.multi-cell.column-highlight')
35245
+ .classed('highlighter-hidden', false)
35246
+ .attr('transform', "translate(" + mainXScale(datum) + ", " + min_min(mainYScale.range()) + ")");
35247
+ }
35248
+ else if (mainYScale(datum) !== undefined) {
35249
+ _this.parent
35250
+ .select('g.multi-cell.row-highlight')
35251
+ .classed('highlighter-hidden', false)
35252
+ .attr('transform', "translate(" + min_min(mainXScale.range()) + "," + mainYScale(datum) + ")");
35253
+ }
35254
+ // Dispatch tooltip show event
35255
+ _this.services.events.dispatchEvent(Events.Tooltip.SHOW, {
35256
+ event: detail.event,
35257
+ hoveredElement: src_select(event.detail.element),
35258
+ items: [
35259
+ {
35260
+ label: label,
35261
+ value: datum,
35262
+ bold: true,
35263
+ },
35264
+ {
35265
+ label: 'Min',
35266
+ value: minimum,
35267
+ },
35268
+ {
35269
+ label: 'Max',
35270
+ value: maximum,
35271
+ },
35272
+ {
35273
+ label: 'Average',
35274
+ value: sum / domains.length,
35275
+ },
35276
+ ],
35277
+ });
35278
+ };
35279
+ // Un-highlight all elements
35280
+ _this.handleAxisMouseOut = function (event) {
35281
+ // Hide column/row
35282
+ _this.parent
35283
+ .selectAll('g.multi-cell')
35284
+ .classed('highlighter-hidden', true);
35285
+ // Dispatch hide tooltip event
35286
+ _this.services.events.dispatchEvent(Events.Tooltip.HIDE, {
35287
+ event: event,
35288
+ });
35289
+ };
35290
+ return _this;
35291
+ }
35292
+ Heatmap.prototype.init = function () {
35293
+ var eventsFragment = this.services.events;
35294
+ // Highlight correct cells on Axis item hovers
35295
+ eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOVER, this.handleAxisOnHover);
35296
+ // Highlight correct cells on Axis item mouseouts
35297
+ eventsFragment.addEventListener(Events.Axis.LABEL_MOUSEOUT, this.handleAxisMouseOut);
35298
+ // Highlight correct cells on Axis item focus
35299
+ eventsFragment.addEventListener(Events.Axis.LABEL_FOCUS, this.handleAxisOnHover);
35300
+ // Highlight correct cells on Axis item blur
35301
+ eventsFragment.addEventListener(Events.Axis.LABEL_BLUR, this.handleAxisMouseOut);
35302
+ };
35303
+ Heatmap.prototype.render = function (animate) {
35304
+ var _this = this;
35305
+ if (animate === void 0) { animate = true; }
35306
+ var svg = this.getComponentContainer({ withinChartClip: true });
35307
+ // Lower the chart so the axes are always visible
35308
+ svg.lower();
35309
+ var cartesianScales = this.services.cartesianScales;
35310
+ this.matrix = this.model.getMatrix();
35311
+ svg.html('');
35312
+ if (tools_Tools.getProperty(this.getOptions(), 'data', 'loading')) {
35313
+ return;
35314
+ }
35315
+ // determine x and y axis scale
35316
+ var mainXScale = cartesianScales.getMainXScale();
35317
+ var mainYScale = cartesianScales.getMainYScale();
35318
+ var domainIdentifier = cartesianScales.getDomainIdentifier();
35319
+ var rangeIdentifier = cartesianScales.getRangeIdentifier();
35320
+ // Get unique axis values & create a matrix
35321
+ var uniqueDomain = this.model.getUniqueDomain();
35322
+ var uniqueRange = this.model.getUniqueRanges();
35323
+ // Get matrix in the form of an array to create a single heatmap group
35324
+ var matrixArray = this.model.getMatrixAsArray();
35325
+ // Get available chart area
35326
+ var xRange = mainXScale.range();
35327
+ var yRange = mainYScale.range();
35328
+ // Determine rectangle dimensions based on the number of unique domain and range
35329
+ this.xBandwidth = Math.abs((xRange[1] - xRange[0]) / uniqueDomain.length);
35330
+ this.yBandwidth = Math.abs((yRange[1] - yRange[0]) / uniqueRange.length);
35331
+ var patternID = this.services.domUtils.generateElementIDString("heatmap-pattern-stripes");
35332
+ // Create a striped pattern for missing data
35333
+ svg.append('defs')
35334
+ .append('pattern')
35335
+ .attr('id', patternID)
35336
+ .attr('width', 3)
35337
+ .attr('height', 3)
35338
+ .attr('patternUnits', 'userSpaceOnUse')
35339
+ .attr('patternTransform', 'rotate(45)')
35340
+ .append('rect')
35341
+ .classed('pattern-fill', true)
35342
+ .attr('width', 0.5)
35343
+ .attr('height', 8);
35344
+ var rectangles = svg
35345
+ .selectAll()
35346
+ .data(matrixArray)
35347
+ .enter()
35348
+ .append('g')
35349
+ .attr('class', function (d) { return "heat-" + d.index; })
35350
+ .classed('cell', true)
35351
+ .attr('transform', function (d) {
35352
+ return "translate(" + mainXScale(d[domainIdentifier]) + ", " + mainYScale(d[rangeIdentifier]) + ")";
35353
+ })
35354
+ .append('rect')
35355
+ .attr('class', function (d) {
35356
+ return _this.model.getColorClassName({
35357
+ value: d.value,
35358
+ originalClassName: "heat-" + d.index,
35359
+ });
35360
+ })
35361
+ .classed('heat', true)
35362
+ .classed('null-state', function (d) {
35363
+ return d.index === -1 || d.value === null ? true : false;
35364
+ })
35365
+ .attr('width', this.xBandwidth)
35366
+ .attr('height', this.yBandwidth)
35367
+ .style('fill', function (d) {
35368
+ // Check if a valid value exists
35369
+ if (d.index === -1 || d.value === null) {
35370
+ return "url(#" + patternID + ")";
35371
+ }
35372
+ return _this.model.getFillColor(Number(d.value));
35373
+ })
35374
+ .attr('aria-label', function (d) { return d.value; });
35375
+ // Cell highlight box
35376
+ this.createOuterBox('g.cell-highlight', this.xBandwidth, this.yBandwidth);
35377
+ // Column highlight box
35378
+ this.createOuterBox('g.multi-cell.column-highlight', this.xBandwidth, Math.abs(yRange[1] - yRange[0]));
35379
+ // Row highlight box
35380
+ this.createOuterBox('g.multi-cell.row-highlight', Math.abs(xRange[1] - xRange[0]), this.yBandwidth);
35381
+ if (this.determineDividerStatus()) {
35382
+ rectangles.style('stroke-width', '1px');
35383
+ this.parent.select('g.cell-highlight').classed('cell-2', true);
35384
+ }
35385
+ this.addEventListener();
35386
+ };
35387
+ /**
35388
+ * Generates a box using lines to create a hover effect
35389
+ * The lines have drop shadow in their respective direction
35390
+ * @param parentTag - tag name
35391
+ * @param xBandwidth - X length
35392
+ * @param yBandwidth - y length
35393
+ */
35394
+ Heatmap.prototype.createOuterBox = function (parentTag, xBandwidth, yBandwidth) {
35395
+ // Create a highlighter in the parent component so the shadow and the lines do not get clipped
35396
+ var highlight = dom_utils_DOMUtils.appendOrSelect(this.parent, parentTag)
35397
+ .classed('shadows', true)
35398
+ .classed('highlighter-hidden', true);
35399
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.top')
35400
+ .attr('x1', -1)
35401
+ .attr('x2', xBandwidth + 1);
35402
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.left')
35403
+ .attr('x1', 0)
35404
+ .attr('y1', -1)
35405
+ .attr('x2', 0)
35406
+ .attr('y2', yBandwidth + 1);
35407
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.down')
35408
+ .attr('x1', -1)
35409
+ .attr('x2', xBandwidth + 1)
35410
+ .attr('y1', yBandwidth)
35411
+ .attr('y2', yBandwidth);
35412
+ dom_utils_DOMUtils.appendOrSelect(highlight, 'line.right')
35413
+ .attr('x1', xBandwidth)
35414
+ .attr('x2', xBandwidth)
35415
+ .attr('y1', -1)
35416
+ .attr('y2', yBandwidth + 1);
35417
+ };
35418
+ Heatmap.prototype.determineDividerStatus = function () {
35419
+ // Add dividers if status is not off, will assume auto or on by default.
35420
+ var dividerStatus = tools_Tools.getProperty(this.getOptions(), 'heatmap', 'divider', 'state');
35421
+ // Determine if cell divider should be displayed
35422
+ if (dividerStatus !== DividerStatus.OFF) {
35423
+ if ((dividerStatus === DividerStatus.AUTO &&
35424
+ heatmap.minCellDividerDimension <=
35425
+ this.xBandwidth &&
35426
+ heatmap.minCellDividerDimension <=
35427
+ this.yBandwidth) ||
35428
+ dividerStatus === DividerStatus.ON) {
35429
+ return true;
35430
+ }
35431
+ }
35432
+ return false;
35433
+ };
35434
+ Heatmap.prototype.addEventListener = function () {
35435
+ var self = this;
35436
+ var cartesianScales = this.services.cartesianScales;
35437
+ var options = this.getOptions();
35438
+ var totalLabel = lodash_es_get(options, 'tooltip.totalLabel');
35439
+ var domainIdentifier = cartesianScales.getDomainIdentifier();
35440
+ var rangeIdentifier = cartesianScales.getRangeIdentifier();
35441
+ var domainLabel = cartesianScales.getDomainLabel();
35442
+ var rangeLabel = cartesianScales.getRangeLabel();
35443
+ this.parent
35444
+ .selectAll('g.cell')
35445
+ .on('mouseover', function (event, datum) {
35446
+ var cell = src_select(this);
35447
+ var hoveredElement = cell.select('rect.heat');
35448
+ var nullState = hoveredElement.classed('null-state');
35449
+ // Dispatch event and tooltip only if value exists
35450
+ if (!nullState) {
35451
+ // Get transformation value of node
35452
+ var transform = tools_Tools.getTranformOffsets(cell.attr('transform'));
35453
+ src_select('g.cell-highlight')
35454
+ .attr('transform', "translate(" + (transform.x + self.translationUnits.x) + ", " + (transform.y + self.translationUnits.y) + ")")
35455
+ .classed('highlighter-hidden', false);
35456
+ // Dispatch mouse over event
35457
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOVER, {
35458
+ event: event,
35459
+ element: hoveredElement,
35460
+ datum: datum,
35461
+ });
35462
+ // Dispatch tooltip show event
35463
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
35464
+ event: event,
35465
+ items: [
35466
+ {
35467
+ label: domainLabel,
35468
+ value: datum[domainIdentifier],
35469
+ },
35470
+ {
35471
+ label: rangeLabel,
35472
+ value: datum[rangeIdentifier],
35473
+ },
35474
+ {
35475
+ label: totalLabel || 'Total',
35476
+ value: datum['value'],
35477
+ color: hoveredElement.style('fill'),
35478
+ },
35479
+ ],
35480
+ });
35481
+ }
35482
+ })
35483
+ .on('mousemove', function (event, datum) {
35484
+ // Dispatch mouse move event
35485
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEMOVE, {
35486
+ event: event,
35487
+ element: src_select(this),
35488
+ datum: datum,
35489
+ });
35490
+ // Dispatch tooltip move event
35491
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
35492
+ event: event,
35493
+ });
35494
+ })
35495
+ .on('click', function (event, datum) {
35496
+ // Dispatch mouse click event
35497
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_CLICK, {
35498
+ event: event,
35499
+ element: src_select(this),
35500
+ datum: datum,
35501
+ });
35502
+ })
35503
+ .on('mouseout', function (event, datum) {
35504
+ var cell = src_select(this);
35505
+ var hoveredElement = cell.select('rect.heat');
35506
+ var nullState = hoveredElement.classed('null-state');
35507
+ src_select('g.cell-highlight').classed('highlighter-hidden', true);
35508
+ // Dispatch event and tooltip only if value exists
35509
+ if (!nullState) {
35510
+ // Dispatch mouse out event
35511
+ self.services.events.dispatchEvent(Events.Heatmap.HEATMAP_MOUSEOUT, {
35512
+ event: event,
35513
+ element: hoveredElement,
35514
+ datum: datum,
35515
+ });
35516
+ // Dispatch hide tooltip event
35517
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
35518
+ event: event,
35519
+ hoveredElement: hoveredElement,
35520
+ });
35521
+ }
35522
+ });
35523
+ };
35524
+ // Remove event listeners
35525
+ Heatmap.prototype.destroy = function () {
35526
+ this.parent
35527
+ .selectAll('rect.heat')
35528
+ .on('mouseover', null)
35529
+ .on('mousemove', null)
35530
+ .on('click', null)
35531
+ .on('mouseout', null);
35532
+ // Remove legend listeners
35533
+ var eventsFragment = this.services.events;
35534
+ eventsFragment.removeEventListener(Events.Legend.ITEM_HOVER, this.handleAxisOnHover);
35535
+ eventsFragment.removeEventListener(Events.Legend.ITEM_MOUSEOUT, this.handleAxisMouseOut);
35536
+ };
35537
+ return Heatmap;
35538
+ }(component_Component));
35539
+
35540
+ //# sourceMappingURL=../../../src/components/graphs/heatmap.js.map
34660
35541
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
34661
35542
  var spacer_extends = (undefined && undefined.__extends) || (function () {
34662
35543
  var extendStatics = function (d, b) {
@@ -34883,187 +35764,6 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
34883
35764
  }(component_Component));
34884
35765
 
34885
35766
  //# sourceMappingURL=../../../src/components/layout/layout.js.map
34886
- // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/identity.js
34887
- /* harmony default export */ var d3_axis_src_identity = (function(x) {
34888
- return x;
34889
- });
34890
-
34891
- // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-axis/src/axis.js
34892
-
34893
-
34894
- var axis_top = 1,
34895
- axis_right = 2,
34896
- bottom = 3,
34897
- axis_left = 4,
34898
- axis_epsilon = 1e-6;
34899
-
34900
- function axis_translateX(x) {
34901
- return "translate(" + x + ",0)";
34902
- }
34903
-
34904
- function axis_translateY(y) {
34905
- return "translate(0," + y + ")";
34906
- }
34907
-
34908
- function axis_number(scale) {
34909
- return d => +scale(d);
34910
- }
34911
-
34912
- function axis_center(scale, offset) {
34913
- offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
34914
- if (scale.round()) offset = Math.round(offset);
34915
- return d => +scale(d) + offset;
34916
- }
34917
-
34918
- function entering() {
34919
- return !this.__axis;
34920
- }
34921
-
34922
- function axis_axis(orient, scale) {
34923
- var tickArguments = [],
34924
- tickValues = null,
34925
- tickFormat = null,
34926
- tickSizeInner = 6,
34927
- tickSizeOuter = 6,
34928
- tickPadding = 3,
34929
- offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5,
34930
- k = orient === axis_top || orient === axis_left ? -1 : 1,
34931
- x = orient === axis_left || orient === axis_right ? "x" : "y",
34932
- transform = orient === axis_top || orient === bottom ? axis_translateX : axis_translateY;
34933
-
34934
- function axis(context) {
34935
- var values = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain()) : tickValues,
34936
- format = tickFormat == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity) : tickFormat,
34937
- spacing = Math.max(tickSizeInner, 0) + tickPadding,
34938
- range = scale.range(),
34939
- range0 = +range[0] + offset,
34940
- range1 = +range[range.length - 1] + offset,
34941
- position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
34942
- selection = context.selection ? context.selection() : context,
34943
- path = selection.selectAll(".domain").data([null]),
34944
- tick = selection.selectAll(".tick").data(values, scale).order(),
34945
- tickExit = tick.exit(),
34946
- tickEnter = tick.enter().append("g").attr("class", "tick"),
34947
- line = tick.select("line"),
34948
- text = tick.select("text");
34949
-
34950
- path = path.merge(path.enter().insert("path", ".tick")
34951
- .attr("class", "domain")
34952
- .attr("stroke", "currentColor"));
34953
-
34954
- tick = tick.merge(tickEnter);
34955
-
34956
- line = line.merge(tickEnter.append("line")
34957
- .attr("stroke", "currentColor")
34958
- .attr(x + "2", k * tickSizeInner));
34959
-
34960
- text = text.merge(tickEnter.append("text")
34961
- .attr("fill", "currentColor")
34962
- .attr(x, k * spacing)
34963
- .attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
34964
-
34965
- if (context !== selection) {
34966
- path = path.transition(context);
34967
- tick = tick.transition(context);
34968
- line = line.transition(context);
34969
- text = text.transition(context);
34970
-
34971
- tickExit = tickExit.transition(context)
34972
- .attr("opacity", axis_epsilon)
34973
- .attr("transform", function(d) { return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform"); });
34974
-
34975
- tickEnter
34976
- .attr("opacity", axis_epsilon)
34977
- .attr("transform", function(d) { var p = this.parentNode.__axis; return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset); });
34978
- }
34979
-
34980
- tickExit.remove();
34981
-
34982
- path
34983
- .attr("d", orient === axis_left || orient === axis_right
34984
- ? (tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1)
34985
- : (tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1));
34986
-
34987
- tick
34988
- .attr("opacity", 1)
34989
- .attr("transform", function(d) { return transform(position(d) + offset); });
34990
-
34991
- line
34992
- .attr(x + "2", k * tickSizeInner);
34993
-
34994
- text
34995
- .attr(x, k * spacing)
34996
- .text(format);
34997
-
34998
- selection.filter(entering)
34999
- .attr("fill", "none")
35000
- .attr("font-size", 10)
35001
- .attr("font-family", "sans-serif")
35002
- .attr("text-anchor", orient === axis_right ? "start" : orient === axis_left ? "end" : "middle");
35003
-
35004
- selection
35005
- .each(function() { this.__axis = position; });
35006
- }
35007
-
35008
- axis.scale = function(_) {
35009
- return arguments.length ? (scale = _, axis) : scale;
35010
- };
35011
-
35012
- axis.ticks = function() {
35013
- return tickArguments = Array.from(arguments), axis;
35014
- };
35015
-
35016
- axis.tickArguments = function(_) {
35017
- return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis) : tickArguments.slice();
35018
- };
35019
-
35020
- axis.tickValues = function(_) {
35021
- return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis) : tickValues && tickValues.slice();
35022
- };
35023
-
35024
- axis.tickFormat = function(_) {
35025
- return arguments.length ? (tickFormat = _, axis) : tickFormat;
35026
- };
35027
-
35028
- axis.tickSize = function(_) {
35029
- return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
35030
- };
35031
-
35032
- axis.tickSizeInner = function(_) {
35033
- return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
35034
- };
35035
-
35036
- axis.tickSizeOuter = function(_) {
35037
- return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
35038
- };
35039
-
35040
- axis.tickPadding = function(_) {
35041
- return arguments.length ? (tickPadding = +_, axis) : tickPadding;
35042
- };
35043
-
35044
- axis.offset = function(_) {
35045
- return arguments.length ? (offset = +_, axis) : offset;
35046
- };
35047
-
35048
- return axis;
35049
- }
35050
-
35051
- function axisTop(scale) {
35052
- return axis_axis(axis_top, scale);
35053
- }
35054
-
35055
- function axisRight(scale) {
35056
- return axis_axis(axis_right, scale);
35057
- }
35058
-
35059
- function axisBottom(scale) {
35060
- return axis_axis(bottom, scale);
35061
- }
35062
-
35063
- function axisLeft(scale) {
35064
- return axis_axis(axis_left, scale);
35065
- }
35066
-
35067
35767
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/axis.js
35068
35768
  var axis_extends = (undefined && undefined.__extends) || (function () {
35069
35769
  var extendStatics = function (d, b) {
@@ -35092,9 +35792,16 @@ var axis_extends = (undefined && undefined.__extends) || (function () {
35092
35792
  var axis_Axis = /** @class */ (function (_super) {
35093
35793
  axis_extends(Axis, _super);
35094
35794
  function Axis(model, services, configs) {
35795
+ var _a;
35095
35796
  var _this = _super.call(this, model, services, configs) || this;
35096
35797
  _this.type = 'axes';
35097
35798
  _this.renderType = RenderTypes.SVG;
35799
+ _this.truncation = (_a = {},
35800
+ _a[AxisPositions.LEFT] = false,
35801
+ _a[AxisPositions.RIGHT] = false,
35802
+ _a[AxisPositions.TOP] = false,
35803
+ _a[AxisPositions.BOTTOM] = false,
35804
+ _a);
35098
35805
  if (configs) {
35099
35806
  _this.configs = configs;
35100
35807
  }
@@ -35522,11 +36229,13 @@ var axis_Axis = /** @class */ (function (_super) {
35522
36229
  .select("g.axis." + axisPosition + " g.ticks g.tick")
35523
36230
  .html();
35524
36231
  container.selectAll('g.ticks g.tick').html(tick_html);
36232
+ var self_1 = this;
35525
36233
  container
35526
36234
  .selectAll('g.tick text')
35527
36235
  .data(axisTickLabels)
35528
36236
  .text(function (d) {
35529
36237
  if (d.length > truncationThreshold) {
36238
+ self_1.truncation[axisPosition] = true;
35530
36239
  return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
35531
36240
  }
35532
36241
  else {
@@ -35561,8 +36270,6 @@ var axis_Axis = /** @class */ (function (_super) {
35561
36270
  var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
35562
36271
  var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
35563
36272
  var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
35564
- var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
35565
- axisOptions.scaleType === ScaleTypes.TIME;
35566
36273
  var self = this;
35567
36274
  container
35568
36275
  .selectAll('g.tick text')
@@ -35643,6 +36350,242 @@ var axis_Axis = /** @class */ (function (_super) {
35643
36350
  }(component_Component));
35644
36351
 
35645
36352
  //# sourceMappingURL=../../../src/components/axes/axis.js.map
36353
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/hover-axis.js
36354
+ var hover_axis_extends = (undefined && undefined.__extends) || (function () {
36355
+ var extendStatics = function (d, b) {
36356
+ extendStatics = Object.setPrototypeOf ||
36357
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
36358
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
36359
+ return extendStatics(d, b);
36360
+ };
36361
+ return function (d, b) {
36362
+ extendStatics(d, b);
36363
+ function __() { this.constructor = d; }
36364
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36365
+ };
36366
+ })();
36367
+ var hover_axis_assign = (undefined && undefined.__assign) || function () {
36368
+ hover_axis_assign = Object.assign || function(t) {
36369
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
36370
+ s = arguments[i];
36371
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
36372
+ t[p] = s[p];
36373
+ }
36374
+ return t;
36375
+ };
36376
+ return hover_axis_assign.apply(this, arguments);
36377
+ };
36378
+ // Internal Imports
36379
+
36380
+
36381
+
36382
+
36383
+
36384
+ // D3 Imports
36385
+
36386
+ var hover_axis_HoverAxis = /** @class */ (function (_super) {
36387
+ hover_axis_extends(HoverAxis, _super);
36388
+ function HoverAxis(model, services, configs) {
36389
+ return _super.call(this, model, services, configs) || this;
36390
+ }
36391
+ HoverAxis.prototype.render = function (animate) {
36392
+ if (animate === void 0) { animate = true; }
36393
+ _super.prototype.render.call(this, animate);
36394
+ // Remove existing event listeners to avoid flashing behavior
36395
+ _super.prototype.destroy.call(this);
36396
+ var axisPosition = this.configs.position;
36397
+ var svg = this.getComponentContainer();
36398
+ var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
36399
+ var self = this;
36400
+ container.selectAll('g.tick').each(function (_, index) {
36401
+ var g = src_select(this);
36402
+ g.classed('tick-hover', true).attr('tabindex', index === 0 ? 0 : -1);
36403
+ var textNode = g.select('text');
36404
+ var _a = dom_utils_DOMUtils.getSVGElementSize(textNode, {
36405
+ useBBox: true,
36406
+ }), width = _a.width, height = _a.height;
36407
+ var rectangle = dom_utils_DOMUtils.appendOrSelect(g, 'rect.axis-holder');
36408
+ var x = 0, y = 0;
36409
+ // Depending on axis position, apply correct translation & rotation to align the rect
36410
+ // with the text
36411
+ switch (axisPosition) {
36412
+ case AxisPositions.LEFT:
36413
+ x = -width + Number(textNode.attr('x'));
36414
+ y = -(height / 2);
36415
+ break;
36416
+ case AxisPositions.RIGHT:
36417
+ x = Math.abs(Number(textNode.attr('x')));
36418
+ y = -(height / 2);
36419
+ break;
36420
+ case AxisPositions.TOP:
36421
+ x = -(width / 2);
36422
+ y = -height + Number(textNode.attr('y')) / 2;
36423
+ if (self.truncation[axisPosition]) {
36424
+ x = 0;
36425
+ rectangle.attr('transform', "rotate(-45)");
36426
+ }
36427
+ break;
36428
+ case AxisPositions.BOTTOM:
36429
+ x = -(width / 2);
36430
+ y = height / 2 - 2;
36431
+ if (self.truncation[axisPosition]) {
36432
+ x = -width;
36433
+ rectangle.attr('transform', "rotate(-45)");
36434
+ }
36435
+ break;
36436
+ }
36437
+ // Translates x position -4 left to keep center after padding
36438
+ // Adds padding on left & right
36439
+ rectangle
36440
+ .attr('x', x - configuration_non_customizable_axis.hover.rectanglePadding)
36441
+ .attr('y', y)
36442
+ .attr('width', width + configuration_non_customizable_axis.hover.rectanglePadding * 2)
36443
+ .attr('height', height)
36444
+ .lower();
36445
+ // Add keyboard event listeners to each group element
36446
+ g.on('keydown', function (event) {
36447
+ // Choose specific arrow key depending on the axis
36448
+ if (axisPosition === AxisPositions.LEFT ||
36449
+ axisPosition === AxisPositions.RIGHT) {
36450
+ if (event.key && event.key === 'ArrowUp') {
36451
+ self.goNext(this, event);
36452
+ }
36453
+ else if (event.key && event.key === 'ArrowDown') {
36454
+ self.goPrevious(this, event);
36455
+ }
36456
+ }
36457
+ else {
36458
+ if (event.key && event.key === 'ArrowLeft') {
36459
+ self.goPrevious(this, event);
36460
+ }
36461
+ else if (event.key && event.key === 'ArrowRight') {
36462
+ self.goNext(this, event);
36463
+ }
36464
+ }
36465
+ });
36466
+ });
36467
+ // Add event listeners to element group
36468
+ this.addEventListeners();
36469
+ };
36470
+ HoverAxis.prototype.addEventListeners = function () {
36471
+ var svg = this.getComponentContainer();
36472
+ var axisPosition = this.configs.position;
36473
+ var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
36474
+ var options = this.getOptions();
36475
+ var axisOptions = tools_Tools.getProperty(options, 'axes', axisPosition);
36476
+ var axisScaleType = tools_Tools.getProperty(axisOptions, 'scaleType');
36477
+ var truncationThreshold = tools_Tools.getProperty(axisOptions, 'truncation', 'threshold');
36478
+ var self = this;
36479
+ container
36480
+ .selectAll('g.tick.tick-hover')
36481
+ .on('mouseover', function (event) {
36482
+ var hoveredElement = src_select(this).select('text');
36483
+ var datum = hoveredElement.datum();
36484
+ // Dispatch mouse event
36485
+ self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
36486
+ event: event,
36487
+ element: hoveredElement,
36488
+ datum: datum,
36489
+ });
36490
+ if (axisScaleType === ScaleTypes.LABELS &&
36491
+ datum.length > truncationThreshold) {
36492
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
36493
+ event: event,
36494
+ element: hoveredElement,
36495
+ datum: datum,
36496
+ });
36497
+ }
36498
+ })
36499
+ .on('mousemove', function (event) {
36500
+ var hoveredElement = src_select(this).select('text');
36501
+ var datum = hoveredElement.datum();
36502
+ // Dispatch mouse event
36503
+ self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
36504
+ event: event,
36505
+ element: hoveredElement,
36506
+ datum: datum,
36507
+ });
36508
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
36509
+ event: event,
36510
+ });
36511
+ })
36512
+ .on('click', function (event) {
36513
+ // Dispatch mouse event
36514
+ self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
36515
+ event: event,
36516
+ element: src_select(this).select('text'),
36517
+ datum: src_select(this).select('text').datum(),
36518
+ });
36519
+ })
36520
+ .on('mouseout', function (event) {
36521
+ // Dispatch mouse event
36522
+ self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
36523
+ event: event,
36524
+ element: src_select(this).select('text'),
36525
+ datum: src_select(this).select('text').datum(),
36526
+ });
36527
+ if (axisScaleType === ScaleTypes.LABELS) {
36528
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
36529
+ }
36530
+ })
36531
+ .on('focus', function (event) {
36532
+ var coordinates = { clientX: 0, clientY: 0 };
36533
+ if (event.target) {
36534
+ // Focus element since we are using arrow keys
36535
+ event.target.focus();
36536
+ var boundingRect = event.target.getBoundingClientRect();
36537
+ coordinates.clientX = boundingRect.x;
36538
+ coordinates.clientY = boundingRect.y;
36539
+ }
36540
+ // Dispatch focus event
36541
+ self.services.events.dispatchEvent(Events.Axis.LABEL_FOCUS, {
36542
+ event: hover_axis_assign(hover_axis_assign({}, event), coordinates),
36543
+ element: src_select(this),
36544
+ datum: src_select(this).select('text').datum(),
36545
+ });
36546
+ })
36547
+ .on('blur', function (event) {
36548
+ // Dispatch blur event
36549
+ self.services.events.dispatchEvent(Events.Axis.LABEL_BLUR, {
36550
+ event: event,
36551
+ element: src_select(this),
36552
+ datum: src_select(this).select('text').datum(),
36553
+ });
36554
+ });
36555
+ };
36556
+ // Focus on the next HTML element sibling
36557
+ HoverAxis.prototype.goNext = function (element, event) {
36558
+ if (element.nextElementSibling &&
36559
+ element.nextElementSibling.tagName !== 'path') {
36560
+ element.nextElementSibling.dispatchEvent(new Event('focus'));
36561
+ }
36562
+ event.preventDefault();
36563
+ };
36564
+ // Focus on the previous HTML element sibling
36565
+ HoverAxis.prototype.goPrevious = function (element, event) {
36566
+ if (element.previousElementSibling &&
36567
+ element.previousElementSibling.tagName !== 'path') {
36568
+ element.previousElementSibling.dispatchEvent(new Event('focus'));
36569
+ }
36570
+ event.preventDefault();
36571
+ };
36572
+ HoverAxis.prototype.destroy = function () {
36573
+ var svg = this.getComponentContainer();
36574
+ var axisPosition = this.configs.position;
36575
+ var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
36576
+ // Remove event listeners
36577
+ container
36578
+ .selectAll('g.tick.tick-hover')
36579
+ .on('mouseover', null)
36580
+ .on('mousemove', null)
36581
+ .on('mouseout', null)
36582
+ .on('focus', null)
36583
+ .on('blur', null);
36584
+ };
36585
+ return HoverAxis;
36586
+ }(axis_Axis));
36587
+
36588
+ //# sourceMappingURL=../../../src/components/axes/hover-axis.js.map
35646
36589
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/axes/two-dimensional-axes.js
35647
36590
  var two_dimensional_axes_extends = (undefined && undefined.__extends) || (function () {
35648
36591
  var extendStatics = function (d, b) {
@@ -35664,6 +36607,7 @@ var two_dimensional_axes_extends = (undefined && undefined.__extends) || (functi
35664
36607
 
35665
36608
 
35666
36609
 
36610
+
35667
36611
  var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
35668
36612
  two_dimensional_axes_extends(TwoDimensionalAxes, _super);
35669
36613
  function TwoDimensionalAxes() {
@@ -35698,11 +36642,14 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
35698
36642
  var axisPosition = AxisPositions[axisPositionKey];
35699
36643
  if (_this.configs.axes[axisPosition] &&
35700
36644
  !_this.children[axisPosition]) {
35701
- var axisComponent = new axis_Axis(_this.model, _this.services, {
36645
+ var configs = {
35702
36646
  position: axisPosition,
35703
36647
  axes: _this.configs.axes,
35704
36648
  margins: _this.margins,
35705
- });
36649
+ };
36650
+ var axisComponent = _this.model.axisFlavor === AxisFlavor.DEFAULT
36651
+ ? new axis_Axis(_this.model, _this.services, configs)
36652
+ : new hover_axis_HoverAxis(_this.model, _this.services, configs);
35706
36653
  // Set model, services & parent for the new axis component
35707
36654
  axisComponent.setModel(_this.model);
35708
36655
  axisComponent.setServices(_this.services);
@@ -35753,6 +36700,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
35753
36700
  break;
35754
36701
  }
35755
36702
  });
36703
+ this.services.events.dispatchEvent(Events.Axis.RENDER_COMPLETE);
35756
36704
  // If the new margins are different than the existing ones
35757
36705
  var isNotEqual = Object.keys(margins).some(function (marginKey) {
35758
36706
  return _this.margins[marginKey] !== margins[marginKey];
@@ -39796,6 +40744,7 @@ var tee = {
39796
40744
 
39797
40745
 
39798
40746
 
40747
+
39799
40748
  // GRAPHS
39800
40749
 
39801
40750
 
@@ -39819,6 +40768,7 @@ var tee = {
39819
40768
 
39820
40769
 
39821
40770
 
40771
+
39822
40772
 
39823
40773
 
39824
40774
  // Layout
@@ -40072,7 +41022,9 @@ var cartesian_charts_spreadArrays = (undefined && undefined.__spreadArrays) || f
40072
41022
  var cartesian_charts_ChartModelCartesian = /** @class */ (function (_super) {
40073
41023
  cartesian_charts_extends(ChartModelCartesian, _super);
40074
41024
  function ChartModelCartesian(services) {
40075
- return _super.call(this, services) || this;
41025
+ var _this = _super.call(this, services) || this;
41026
+ _this.axisFlavor = AxisFlavor.DEFAULT;
41027
+ return _this;
40076
41028
  }
40077
41029
  // get the scales information
40078
41030
  // needed for getTabularArray()
@@ -43000,6 +43952,493 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
43000
43952
  }(chart_Chart));
43001
43953
 
43002
43954
  //# sourceMappingURL=../../src/charts/alluvial.js.map
43955
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-scale/src/quantize.js
43956
+
43957
+
43958
+
43959
+
43960
+ function quantize_quantize() {
43961
+ var x0 = 0,
43962
+ x1 = 1,
43963
+ n = 1,
43964
+ domain = [0.5],
43965
+ range = [0, 1],
43966
+ unknown;
43967
+
43968
+ function scale(x) {
43969
+ return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
43970
+ }
43971
+
43972
+ function rescale() {
43973
+ var i = -1;
43974
+ domain = new Array(n);
43975
+ while (++i < n) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
43976
+ return scale;
43977
+ }
43978
+
43979
+ scale.domain = function(_) {
43980
+ return arguments.length ? ([x0, x1] = _, x0 = +x0, x1 = +x1, rescale()) : [x0, x1];
43981
+ };
43982
+
43983
+ scale.range = function(_) {
43984
+ return arguments.length ? (n = (range = Array.from(_)).length - 1, rescale()) : range.slice();
43985
+ };
43986
+
43987
+ scale.invertExtent = function(y) {
43988
+ var i = range.indexOf(y);
43989
+ return i < 0 ? [NaN, NaN]
43990
+ : i < 1 ? [x0, domain[0]]
43991
+ : i >= n ? [domain[n - 1], x1]
43992
+ : [domain[i - 1], domain[i]];
43993
+ };
43994
+
43995
+ scale.unknown = function(_) {
43996
+ return arguments.length ? (unknown = _, scale) : scale;
43997
+ };
43998
+
43999
+ scale.thresholds = function() {
44000
+ return domain.slice();
44001
+ };
44002
+
44003
+ scale.copy = function() {
44004
+ return quantize_quantize()
44005
+ .domain([x0, x1])
44006
+ .range(range)
44007
+ .unknown(unknown);
44008
+ };
44009
+
44010
+ return initRange.apply(linearish(scale), arguments);
44011
+ }
44012
+
44013
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/model/heatmap.js
44014
+ var model_heatmap_extends = (undefined && undefined.__extends) || (function () {
44015
+ var extendStatics = function (d, b) {
44016
+ extendStatics = Object.setPrototypeOf ||
44017
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44018
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44019
+ return extendStatics(d, b);
44020
+ };
44021
+ return function (d, b) {
44022
+ extendStatics(d, b);
44023
+ function __() { this.constructor = d; }
44024
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44025
+ };
44026
+ })();
44027
+ var heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
44028
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
44029
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
44030
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
44031
+ r[k] = a[j];
44032
+ return r;
44033
+ };
44034
+ // Internal Imports
44035
+
44036
+
44037
+
44038
+ // d3 imports
44039
+
44040
+
44041
+ /** The gauge chart model layer */
44042
+ var heatmap_HeatmapModel = /** @class */ (function (_super) {
44043
+ model_heatmap_extends(HeatmapModel, _super);
44044
+ function HeatmapModel(services) {
44045
+ var _this = _super.call(this, services) || this;
44046
+ _this.axisFlavor = AxisFlavor.HOVERABLE;
44047
+ _this._colorScale = undefined;
44048
+ // List of unique ranges and domains
44049
+ _this._domains = [];
44050
+ _this._ranges = [];
44051
+ _this._matrix = {};
44052
+ // Check which scale types are being used
44053
+ var axis = tools_Tools.getProperty(_this.getOptions(), 'axes');
44054
+ // Need to check options since scale service hasn't been instantiated
44055
+ if ((!!tools_Tools.getProperty(axis, 'left', 'scaleType') &&
44056
+ tools_Tools.getProperty(axis, 'left', 'scaleType') !==
44057
+ ScaleTypes.LABELS) ||
44058
+ (!!tools_Tools.getProperty(axis, 'right', 'scaleType') &&
44059
+ tools_Tools.getProperty(axis, 'right', 'scaleType') !==
44060
+ ScaleTypes.LABELS) ||
44061
+ (!!tools_Tools.getProperty(axis, 'top', 'scaleType') &&
44062
+ tools_Tools.getProperty(axis, 'top', 'scaleType') !==
44063
+ ScaleTypes.LABELS) ||
44064
+ (!!tools_Tools.getProperty(axis, 'bottom', 'scaleType') &&
44065
+ tools_Tools.getProperty(axis, 'bottom', 'scaleType') !==
44066
+ ScaleTypes.LABELS)) {
44067
+ throw Error('Heatmap only supports label scaletypes.');
44068
+ }
44069
+ return _this;
44070
+ }
44071
+ /**
44072
+ * Get min and maximum value of the display data
44073
+ * @returns Array consisting of smallest and largest values in data
44074
+ */
44075
+ HeatmapModel.prototype.getValueDomain = function () {
44076
+ var data = this.getDisplayData().map(function (element) { return element.value; });
44077
+ var limits = src_extent(data);
44078
+ var domain = [];
44079
+ // Round extent values to the nearest multiple of 10
44080
+ // Axis rounds values to multiples of 2, 5, and 10s.
44081
+ limits.forEach(function (number, index) {
44082
+ var value = Number(number);
44083
+ if (index === 0 && value >= 0) {
44084
+ value = 0;
44085
+ }
44086
+ else if (value % 10 === 0 || value === 0) {
44087
+ value;
44088
+ }
44089
+ else if (value < 0) {
44090
+ value = Math.floor(value / 10) * 10;
44091
+ }
44092
+ else {
44093
+ value = Math.ceil(value / 10) * 10;
44094
+ }
44095
+ domain.push(value);
44096
+ });
44097
+ // Ensure the median of the range is 0
44098
+ if (domain[0] < 0 && domain[1] > 0) {
44099
+ if (Math.abs(domain[0]) > domain[1]) {
44100
+ domain[1] = Math.abs(domain[0]);
44101
+ }
44102
+ else {
44103
+ domain[0] = -domain[1];
44104
+ }
44105
+ }
44106
+ return domain;
44107
+ };
44108
+ /**
44109
+ * @override
44110
+ * @param value
44111
+ * @returns
44112
+ */
44113
+ HeatmapModel.prototype.getFillColor = function (value) {
44114
+ return this._colorScale(value);
44115
+ };
44116
+ /**
44117
+ * Generate a list of all unique domains
44118
+ * @returns String[]
44119
+ */
44120
+ HeatmapModel.prototype.getUniqueDomain = function () {
44121
+ if (tools_Tools.isEmpty(this._domains)) {
44122
+ var displayData = this.getDisplayData();
44123
+ var cartesianScales = this.services.cartesianScales;
44124
+ var domainIdentifier_1 = cartesianScales.getDomainIdentifier();
44125
+ var mainXAxisPosition = cartesianScales.getMainXAxisPosition();
44126
+ var customDomain = cartesianScales.getCustomDomainValuesByposition(mainXAxisPosition);
44127
+ // Use user defined domain if specified
44128
+ if (!!customDomain) {
44129
+ return customDomain;
44130
+ }
44131
+ // Get unique axis values & create a matrix
44132
+ this._domains = Array.from(new Set(displayData.map(function (d) {
44133
+ return d[domainIdentifier_1];
44134
+ })));
44135
+ }
44136
+ return this._domains;
44137
+ };
44138
+ /**
44139
+ * Generates a list of all unique ranges
44140
+ * @returns String[]
44141
+ */
44142
+ HeatmapModel.prototype.getUniqueRanges = function () {
44143
+ if (tools_Tools.isEmpty(this._ranges)) {
44144
+ var displayData = this.getDisplayData();
44145
+ var cartesianScales = this.services.cartesianScales;
44146
+ var rangeIdentifier_1 = cartesianScales.getRangeIdentifier();
44147
+ var mainYAxisPosition = cartesianScales.getMainYAxisPosition();
44148
+ var customDomain = cartesianScales.getCustomDomainValuesByposition(mainYAxisPosition);
44149
+ // Use user defined domain if specified
44150
+ if (!!customDomain) {
44151
+ return customDomain;
44152
+ }
44153
+ // Get unique axis values & create a matrix
44154
+ this._ranges = Array.from(new Set(displayData.map(function (d) {
44155
+ return d[rangeIdentifier_1];
44156
+ })));
44157
+ }
44158
+ return this._ranges;
44159
+ };
44160
+ /**
44161
+ * Generates a matrix (If doesn't exist) and returns it
44162
+ * @returns Object
44163
+ */
44164
+ HeatmapModel.prototype.getMatrix = function () {
44165
+ var _this = this;
44166
+ if (tools_Tools.isEmpty(this._matrix)) {
44167
+ var uniqueDomain = this.getUniqueDomain();
44168
+ var uniqueRange = this.getUniqueRanges();
44169
+ var domainIdentifier_2 = this.services.cartesianScales.getDomainIdentifier();
44170
+ var rangeIdentifier_2 = this.services.cartesianScales.getRangeIdentifier();
44171
+ // Create a column
44172
+ var range_1 = {};
44173
+ uniqueRange.forEach(function (ran) {
44174
+ // Initialize matrix to empty state
44175
+ range_1[ran] = {
44176
+ value: null,
44177
+ index: -1,
44178
+ };
44179
+ });
44180
+ // Complete the matrix by cloning the column to all domains
44181
+ uniqueDomain.forEach(function (dom) {
44182
+ _this._matrix[dom] = tools_Tools.clone(range_1);
44183
+ });
44184
+ // Fill in user passed data
44185
+ this.getDisplayData().forEach(function (d, i) {
44186
+ _this._matrix[d[domainIdentifier_2]][d[rangeIdentifier_2]] = {
44187
+ value: d['value'],
44188
+ index: i,
44189
+ };
44190
+ });
44191
+ }
44192
+ return this._matrix;
44193
+ };
44194
+ /**
44195
+ *
44196
+ * @param newData The new raw data to be set
44197
+ */
44198
+ HeatmapModel.prototype.setData = function (newData) {
44199
+ var sanitizedData = this.sanitize(tools_Tools.clone(newData));
44200
+ var dataGroups = this.generateDataGroups(sanitizedData);
44201
+ this.set({
44202
+ data: sanitizedData,
44203
+ dataGroups: dataGroups,
44204
+ });
44205
+ // Set attributes to empty
44206
+ this._domains = [];
44207
+ this._ranges = [];
44208
+ this._matrix = {};
44209
+ return sanitizedData;
44210
+ };
44211
+ /**
44212
+ * Converts Object matrix into a single array
44213
+ * @returns Object[]
44214
+ */
44215
+ HeatmapModel.prototype.getMatrixAsArray = function () {
44216
+ var _this = this;
44217
+ if (tools_Tools.isEmpty(this._matrix)) {
44218
+ this.getMatrix();
44219
+ }
44220
+ var uniqueDomain = this.getUniqueDomain();
44221
+ var uniqueRange = this.getUniqueRanges();
44222
+ var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
44223
+ var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
44224
+ var arr = [];
44225
+ uniqueDomain.forEach(function (domain) {
44226
+ uniqueRange.forEach(function (range) {
44227
+ var element = {
44228
+ value: _this._matrix[domain][range].value,
44229
+ index: _this._matrix[domain][range].index,
44230
+ };
44231
+ element[domainIdentifier] = domain;
44232
+ element[rangeIdentifier] = range;
44233
+ arr.push(element);
44234
+ });
44235
+ });
44236
+ return arr;
44237
+ };
44238
+ /**
44239
+ * Generate tabular data from display data
44240
+ * @returns Array<Object>
44241
+ */
44242
+ HeatmapModel.prototype.getTabularDataArray = function () {
44243
+ var displayData = this.getDisplayData();
44244
+ var _a = this.assignRangeAndDomains(), primaryDomain = _a.primaryDomain, primaryRange = _a.primaryRange, secondaryDomain = _a.secondaryDomain, secondaryRange = _a.secondaryRange;
44245
+ var domainValueFormatter;
44246
+ var result = heatmap_spreadArrays([
44247
+ [primaryDomain.label, primaryRange.label, 'Value']
44248
+ ], displayData.map(function (datum) { return [
44249
+ datum[primaryDomain.identifier] === null
44250
+ ? '&ndash;'
44251
+ : domainValueFormatter
44252
+ ? domainValueFormatter(datum[primaryDomain.identifier])
44253
+ : datum[primaryDomain.identifier],
44254
+ datum[primaryRange.identifier] === null
44255
+ ? '&ndash;'
44256
+ : datum[primaryRange.identifier].toLocaleString(),
44257
+ datum['value'],
44258
+ ]; }));
44259
+ return result;
44260
+ };
44261
+ // Uses quantize scale to return class names
44262
+ HeatmapModel.prototype.getColorClassName = function (configs) {
44263
+ return configs.originalClassName + " " + this._colorScale(configs.value);
44264
+ };
44265
+ HeatmapModel.prototype.setColorClassNames = function () {
44266
+ var options = this.getOptions();
44267
+ var customColors = tools_Tools.getProperty(options, 'color', 'gradient', 'colors');
44268
+ var customColorsEnabled = !tools_Tools.isEmpty(customColors);
44269
+ var colorPairingOption = tools_Tools.getProperty(options, 'color', 'pairing', 'option');
44270
+ // If domain consists of negative and positive values, use diverging palettes
44271
+ var domain = this.getValueDomain();
44272
+ var colorScheme = domain[0] < 0 && domain[1] > 0 ? 'diverge' : 'mono';
44273
+ // Use default color pairing options if not in defined range
44274
+ if (colorPairingOption < 1 &&
44275
+ colorPairingOption > 4 &&
44276
+ colorScheme === 'mono') {
44277
+ colorPairingOption = 1;
44278
+ }
44279
+ else if (colorPairingOption < 1 &&
44280
+ colorPairingOption > 2 &&
44281
+ colorScheme === 'diverge') {
44282
+ colorPairingOption = 1;
44283
+ }
44284
+ // Uses css classes for fill
44285
+ var colorPairing = customColorsEnabled ? customColors : [];
44286
+ if (!customColorsEnabled) {
44287
+ // Add class names to list and the amount based on the color scheme
44288
+ // Carbon charts has 11 colors for a single monochromatic palette & 17 for a divergent palette
44289
+ var colorGroupingLength = colorScheme === 'diverge' ? 17 : 11;
44290
+ for (var i = 1; i < colorGroupingLength + 1; i++) {
44291
+ colorPairing.push("fill-" + colorScheme + "-" + colorPairingOption + "-" + i);
44292
+ }
44293
+ }
44294
+ // Save scale type
44295
+ this._colorScale = quantize_quantize()
44296
+ .domain(this.getValueDomain())
44297
+ .range(colorPairing);
44298
+ };
44299
+ return HeatmapModel;
44300
+ }(cartesian_charts_ChartModelCartesian));
44301
+
44302
+ //# sourceMappingURL=../../src/model/heatmap.js.map
44303
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/heatmap.js
44304
+ var charts_heatmap_extends = (undefined && undefined.__extends) || (function () {
44305
+ var extendStatics = function (d, b) {
44306
+ extendStatics = Object.setPrototypeOf ||
44307
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
44308
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
44309
+ return extendStatics(d, b);
44310
+ };
44311
+ return function (d, b) {
44312
+ extendStatics(d, b);
44313
+ function __() { this.constructor = d; }
44314
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44315
+ };
44316
+ })();
44317
+ var charts_heatmap_spreadArrays = (undefined && undefined.__spreadArrays) || function () {
44318
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
44319
+ for (var r = Array(s), k = 0, i = 0; i < il; i++)
44320
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
44321
+ r[k] = a[j];
44322
+ return r;
44323
+ };
44324
+ // Internal Imports
44325
+
44326
+
44327
+
44328
+
44329
+
44330
+
44331
+ var heatmap_HeatmapChart = /** @class */ (function (_super) {
44332
+ charts_heatmap_extends(HeatmapChart, _super);
44333
+ function HeatmapChart(holder, chartConfigs) {
44334
+ var _this = _super.call(this, holder, chartConfigs) || this;
44335
+ _this.model = new heatmap_HeatmapModel(_this.services);
44336
+ // Merge the default options for this chart
44337
+ // With the user provided options
44338
+ _this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.heatmapChart, chartConfigs.options));
44339
+ // Initialize data, services, components etc.
44340
+ _this.init(holder, chartConfigs);
44341
+ return _this;
44342
+ }
44343
+ // Custom getChartComponents - Implements getChartComponents
44344
+ // Removes zoombar support and additional `features` that are not supported in heatmap
44345
+ HeatmapChart.prototype.getAxisChartComponents = function (graphFrameComponents, configs) {
44346
+ var options = this.model.getOptions();
44347
+ var toolbarEnabled = tools_Tools.getProperty(options, 'toolbar', 'enabled');
44348
+ this.services.cartesianScales.determineAxisDuality();
44349
+ this.services.cartesianScales.findDomainAndRangeAxes(); // need to do this before getMainXAxisPosition()
44350
+ this.services.cartesianScales.determineOrientation();
44351
+ var titleAvailable = !!this.model.getOptions().title;
44352
+ var titleComponent = {
44353
+ id: 'title',
44354
+ components: [new title_Title(this.model, this.services)],
44355
+ growth: LayoutGrowth.STRETCH,
44356
+ };
44357
+ var toolbarComponent = {
44358
+ id: 'toolbar',
44359
+ components: [new toolbar_Toolbar(this.model, this.services)],
44360
+ growth: LayoutGrowth.PREFERRED,
44361
+ };
44362
+ var headerComponent = {
44363
+ id: 'header',
44364
+ components: [
44365
+ new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays([
44366
+ // always add title to keep layout correct
44367
+ titleComponent
44368
+ ], (toolbarEnabled ? [toolbarComponent] : [])), {
44369
+ direction: LayoutDirection.ROW,
44370
+ alignItems: LayoutAlignItems.CENTER,
44371
+ }),
44372
+ ],
44373
+ growth: LayoutGrowth.PREFERRED,
44374
+ };
44375
+ var legendComponent = {
44376
+ id: 'legend',
44377
+ components: [new color_scale_legend_ColorScaleLegend(this.model, this.services)],
44378
+ growth: LayoutGrowth.PREFERRED,
44379
+ renderType: RenderTypes.SVG,
44380
+ };
44381
+ var graphFrameComponent = {
44382
+ id: 'graph-frame',
44383
+ components: graphFrameComponents,
44384
+ growth: LayoutGrowth.STRETCH,
44385
+ renderType: RenderTypes.SVG,
44386
+ };
44387
+ var isLegendEnabled = tools_Tools.getProperty(configs, 'legend', 'enabled') !== false &&
44388
+ this.model.getOptions().legend.enabled !== false;
44389
+ // Decide the position of the legend in reference to the chart
44390
+ var fullFrameComponentDirection = LayoutDirection.COLUMN_REVERSE;
44391
+ var legendSpacerComponent = {
44392
+ id: 'spacer',
44393
+ components: [new spacer_Spacer(this.model, this.services, { size: 15 })],
44394
+ growth: LayoutGrowth.PREFERRED,
44395
+ };
44396
+ var fullFrameComponent = {
44397
+ id: 'full-frame',
44398
+ components: [
44399
+ new layout_LayoutComponent(this.model, this.services, charts_heatmap_spreadArrays((isLegendEnabled ? [legendComponent] : []), (isLegendEnabled ? [legendSpacerComponent] : []), [
44400
+ graphFrameComponent,
44401
+ ]), {
44402
+ direction: fullFrameComponentDirection,
44403
+ }),
44404
+ ],
44405
+ growth: LayoutGrowth.STRETCH,
44406
+ };
44407
+ var topLevelLayoutComponents = [];
44408
+ // header component is required for either title or toolbar
44409
+ if (titleAvailable || toolbarEnabled) {
44410
+ topLevelLayoutComponents.push(headerComponent);
44411
+ var titleSpacerComponent = {
44412
+ id: 'spacer',
44413
+ components: [
44414
+ new spacer_Spacer(this.model, this.services, toolbarEnabled ? { size: 15 } : undefined),
44415
+ ],
44416
+ growth: LayoutGrowth.PREFERRED,
44417
+ };
44418
+ topLevelLayoutComponents.push(titleSpacerComponent);
44419
+ }
44420
+ topLevelLayoutComponents.push(fullFrameComponent);
44421
+ return [
44422
+ new tooltip_axis_AxisChartsTooltip(this.model, this.services),
44423
+ new essentials_modal_Modal(this.model, this.services),
44424
+ new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
44425
+ direction: LayoutDirection.COLUMN,
44426
+ }),
44427
+ ];
44428
+ };
44429
+ HeatmapChart.prototype.getComponents = function () {
44430
+ // Specify what to render inside the graph-frame
44431
+ var graphFrameComponents = [
44432
+ new two_dimensional_axes_TwoDimensionalAxes(this.model, this.services),
44433
+ new heatmap_Heatmap(this.model, this.services),
44434
+ ];
44435
+ var components = this.getAxisChartComponents(graphFrameComponents);
44436
+ return components;
44437
+ };
44438
+ return HeatmapChart;
44439
+ }(axis_chart_AxisChart));
44440
+
44441
+ //# sourceMappingURL=../../src/charts/heatmap.js.map
43003
44442
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
43004
44443
 
43005
44444
 
@@ -43022,6 +44461,7 @@ var alluvial_AlluvialChart = /** @class */ (function (_super) {
43022
44461
 
43023
44462
 
43024
44463
 
44464
+
43025
44465
 
43026
44466
 
43027
44467
  //# sourceMappingURL=../../src/charts/index.js.map
@@ -44233,6 +45673,52 @@ var ccv_alluvial_chart_component = normalizeComponent(
44233
45673
  )
44234
45674
 
44235
45675
  /* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
45676
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"624081f5-vue-loader-template"}!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
45677
+ var ccv_heatmap_chartvue_type_template_id_b6ba687e_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ccv-heatmap-chart"})}
45678
+ var ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns = []
45679
+
45680
+
45681
+ // CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=template&id=b6ba687e&
45682
+
45683
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--12-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/thread-loader/dist/cjs.js!/home/runner/work/carbon-charts/carbon-charts/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
45684
+ //
45685
+ //
45686
+ //
45687
+ //
45688
+
45689
+
45690
+ /* harmony default export */ var ccv_heatmap_chartvue_type_script_lang_js_ = ({
45691
+ name: 'CcvHeatmapChart',
45692
+ extends: ccv_base_chart,
45693
+ mounted: function mounted() {
45694
+ this.coreChart = new heatmap_HeatmapChart(this.$el, {
45695
+ data: this.data,
45696
+ options: this.options
45697
+ });
45698
+ }
45699
+ });
45700
+ // CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue?vue&type=script&lang=js&
45701
+ /* harmony default export */ var src_ccv_heatmap_chartvue_type_script_lang_js_ = (ccv_heatmap_chartvue_type_script_lang_js_);
45702
+ // CONCATENATED MODULE: ./src/ccv-heatmap-chart.vue
45703
+
45704
+
45705
+
45706
+
45707
+
45708
+ /* normalize component */
45709
+
45710
+ var ccv_heatmap_chart_component = normalizeComponent(
45711
+ src_ccv_heatmap_chartvue_type_script_lang_js_,
45712
+ ccv_heatmap_chartvue_type_template_id_b6ba687e_render,
45713
+ ccv_heatmap_chartvue_type_template_id_b6ba687e_staticRenderFns,
45714
+ false,
45715
+ null,
45716
+ null,
45717
+ null
45718
+
45719
+ )
45720
+
45721
+ /* harmony default export */ var ccv_heatmap_chart = (ccv_heatmap_chart_component.exports);
44236
45722
  // CONCATENATED MODULE: ./src/index.js
44237
45723
 
44238
45724
 
@@ -44267,7 +45753,8 @@ var ccv_alluvial_chart_component = normalizeComponent(
44267
45753
 
44268
45754
 
44269
45755
 
44270
- 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];
45756
+
45757
+ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_chart, ccv_grouped_bar_chart, ccv_stacked_bar_chart, ccv_boxplot_chart, ccv_bubble_chart, ccv_bullet_chart, ccv_donut_chart, ccv_gauge_chart, ccv_histogram_chart, ccv_line_chart, ccv_lollipop_chart, ccv_pie_chart, ccv_scatter_chart, ccv_meter_chart, ccv_radar_chart, ccv_combo_chart, ccv_tree_chart, ccv_treemap_chart, ccv_circle_pack_chart, ccv_wordcloud_chart, ccv_alluvial_chart, ccv_heatmap_chart];
44271
45758
  /*
44272
45759
  Allows the module to be used as a Vue plug-in, and has an install()
44273
45760
  method (which is called when the plug-in loads) that registers all the
@@ -44367,6 +45854,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
44367
45854
  /* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
44368
45855
  /* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
44369
45856
  /* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
45857
+ /* concated harmony reexport CcvHeatmapChart */__webpack_require__.d(__webpack_exports__, "CcvHeatmapChart", function() { return ccv_heatmap_chart; });
44370
45858
 
44371
45859
 
44372
45860
  /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);