@carbon/charts-vue 0.32.9 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/charts-vue.umd.js CHANGED
@@ -521,6 +521,16 @@ var AxisPositions;
521
521
  AxisPositions["TOP"] = "top";
522
522
  AxisPositions["BOTTOM"] = "bottom";
523
523
  })(AxisPositions || (AxisPositions = {}));
524
+ /**
525
+ * enum of all possible truncation types
526
+ */
527
+ var TruncationTypes;
528
+ (function (TruncationTypes) {
529
+ TruncationTypes["END_LINE"] = "end_line";
530
+ TruncationTypes["MID_LINE"] = "mid_line";
531
+ TruncationTypes["FRONT_LINE"] = "front_line";
532
+ TruncationTypes["NONE"] = "none";
533
+ })(TruncationTypes || (TruncationTypes = {}));
524
534
  /**
525
535
  * enum of all possible cartesian orientations
526
536
  * to be used for determining the orientation
@@ -559,6 +569,8 @@ var TooltipTypes;
559
569
  TooltipTypes["DATAPOINT"] = "datapoint";
560
570
  TooltipTypes["GRIDLINE"] = "gridline";
561
571
  TooltipTypes["TITLE"] = "title";
572
+ TooltipTypes["LEGEND"] = "legend";
573
+ TooltipTypes["AXISLABEL"] = "axislabel";
562
574
  })(TooltipTypes || (TooltipTypes = {}));
563
575
  /**
564
576
  * enum of all possible legend positions
@@ -6831,7 +6843,7 @@ var tools_Tools;
6831
6843
  function getDimensions(el) {
6832
6844
  return {
6833
6845
  width: parseFloat(el.style.width.replace("px", "") || el.offsetWidth),
6834
- height: parseFloat(el.style.height.replace("px", "") || el.offsetHeight),
6846
+ height: parseFloat(el.style.height.replace("px", "") || el.offsetHeight)
6835
6847
  };
6836
6848
  }
6837
6849
  Tools.getDimensions = getDimensions;
@@ -6861,7 +6873,7 @@ var tools_Tools;
6861
6873
  .split(",");
6862
6874
  return {
6863
6875
  tx: transforms[0],
6864
- ty: transforms[1],
6876
+ ty: transforms[1]
6865
6877
  };
6866
6878
  }
6867
6879
  return null;
@@ -6883,7 +6895,7 @@ var tools_Tools;
6883
6895
  var xyString = match.split(",");
6884
6896
  return {
6885
6897
  x: parseFloat(xyString[0]),
6886
- y: parseFloat(xyString[1]),
6898
+ y: parseFloat(xyString[1])
6887
6899
  };
6888
6900
  }
6889
6901
  Tools.getTranformOffsets = getTranformOffsets;
@@ -6929,6 +6941,31 @@ var tools_Tools;
6929
6941
  : percentage;
6930
6942
  }
6931
6943
  Tools.convertValueToPercentage = convertValueToPercentage;
6944
+ /**
6945
+ * Truncate the labels
6946
+ * @export
6947
+ * @param {any} fullText
6948
+ * @param {any} truncationType
6949
+ * @param {any} numCharacter
6950
+ * @returns Truncated text
6951
+ */
6952
+ function truncateLabel(fullText, truncationType, numCharacter) {
6953
+ if (numCharacter > fullText.length) {
6954
+ return fullText;
6955
+ }
6956
+ if (truncationType === TruncationTypes.MID_LINE) {
6957
+ return (fullText.substr(0, numCharacter / 2) +
6958
+ "..." +
6959
+ fullText.substr(-numCharacter / 2));
6960
+ }
6961
+ else if (truncationType === TruncationTypes.FRONT_LINE) {
6962
+ return "..." + fullText.substr(-numCharacter);
6963
+ }
6964
+ else if (truncationType === TruncationTypes.END_LINE) {
6965
+ return fullText.substr(0, numCharacter) + "...";
6966
+ }
6967
+ }
6968
+ Tools.truncateLabel = truncateLabel;
6932
6969
  /**************************************
6933
6970
  * Object/array related checks *
6934
6971
  *************************************/
@@ -6944,7 +6981,7 @@ var tools_Tools;
6944
6981
  function arrayDifferences(oldArray, newArray) {
6945
6982
  var difference = {
6946
6983
  missing: [],
6947
- added: [],
6984
+ added: []
6948
6985
  };
6949
6986
  oldArray.forEach(function (element) {
6950
6987
  if (newArray.indexOf(element) === -1) {
@@ -7031,7 +7068,7 @@ var tools_Tools;
7031
7068
  y0: verticalCoordinates.x0,
7032
7069
  y1: verticalCoordinates.x1,
7033
7070
  x0: verticalCoordinates.y0,
7034
- x1: verticalCoordinates.y1,
7071
+ x1: verticalCoordinates.y1
7035
7072
  };
7036
7073
  }
7037
7074
  return verticalCoordinates;
@@ -7064,6 +7101,14 @@ var en_US_default = /*#__PURE__*/__webpack_require__.n(en_US);
7064
7101
  * User configurable options *
7065
7102
  *****************************
7066
7103
  */
7104
+ /**
7105
+ * Default truncation configuration
7106
+ */
7107
+ var standardTruncationOptions = {
7108
+ type: TruncationTypes.END_LINE,
7109
+ threshold: 16,
7110
+ numCharacter: 14
7111
+ };
7067
7112
  /**
7068
7113
  * Legend options
7069
7114
  */
@@ -7083,7 +7128,8 @@ var legend = {
7083
7128
  checkbox: {
7084
7129
  radius: 6.5,
7085
7130
  spaceAfter: 4
7086
- }
7131
+ },
7132
+ truncation: standardTruncationOptions
7087
7133
  };
7088
7134
  /**
7089
7135
  * Grid options
@@ -7128,16 +7174,20 @@ var barChartTooltip = tools_Tools.merge({}, axisChartTooltip, {
7128
7174
  // and by TwoDimensionalAxes.
7129
7175
  var configuration_axes = {
7130
7176
  top: {
7131
- includeZero: true
7177
+ includeZero: true,
7178
+ truncation: standardTruncationOptions
7132
7179
  },
7133
7180
  bottom: {
7134
- includeZero: true
7181
+ includeZero: true,
7182
+ truncation: standardTruncationOptions
7135
7183
  },
7136
7184
  left: {
7137
- includeZero: true
7185
+ includeZero: true,
7186
+ truncation: standardTruncationOptions
7138
7187
  },
7139
7188
  right: {
7140
- includeZero: true
7189
+ includeZero: true,
7190
+ truncation: standardTruncationOptions
7141
7191
  }
7142
7192
  };
7143
7193
  var timeScale = {
@@ -7170,7 +7220,8 @@ var configuration_chart = {
7170
7220
  },
7171
7221
  data: {
7172
7222
  groupMapsTo: "group",
7173
- loading: false
7223
+ loading: false,
7224
+ selectedGroups: []
7174
7225
  },
7175
7226
  color: {
7176
7227
  scale: null
@@ -7306,7 +7357,11 @@ var gaugeChart = tools_Tools.merge({}, configuration_chart, {
7306
7357
  numberSpacing: 10,
7307
7358
  deltaFontSize: function (radius) { return radius / 8; },
7308
7359
  valueFontSize: function (radius) { return radius / 2.5; },
7309
- numberFormatter: function (number) { return (number.toFixed(2) % 1 !== 0) ? number.toFixed(2).toLocaleString() : number.toFixed().toLocaleString(); }
7360
+ numberFormatter: function (number) {
7361
+ return number.toFixed(2) % 1 !== 0
7362
+ ? number.toFixed(2).toLocaleString()
7363
+ : number.toFixed().toLocaleString();
7364
+ }
7310
7365
  }
7311
7366
  });
7312
7367
  /**
@@ -7733,7 +7788,7 @@ var getColor = function (obj, shade) { return obj[shade]; };
7733
7788
  magenta: function (shade) { return getColor(magenta, shade); },
7734
7789
  purple: function (shade) { return getColor(purple, shade); },
7735
7790
  red: function (shade) { return getColor(red, shade); },
7736
- teal: function (shade) { return getColor(teal, shade); },
7791
+ teal: function (shade) { return getColor(teal, shade); }
7737
7792
  });
7738
7793
  //# sourceMappingURL=../../src/services/colors.js.map
7739
7794
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/services/colorPalettes.js
@@ -7755,7 +7810,7 @@ var WHITE = [
7755
7810
  services_colors.teal(50),
7756
7811
  services_colors.cyan(90),
7757
7812
  "#8a3800",
7758
- services_colors.purple(50),
7813
+ services_colors.purple(50)
7759
7814
  ];
7760
7815
  var DARK = [
7761
7816
  services_colors.purple(60),
@@ -7771,7 +7826,7 @@ var DARK = [
7771
7826
  services_colors.teal(40),
7772
7827
  services_colors.cyan(20),
7773
7828
  "#ba4e00",
7774
- services_colors.purple(30),
7829
+ services_colors.purple(30)
7775
7830
  ];
7776
7831
  var G10 = WHITE;
7777
7832
  var G90 = DARK;
@@ -12143,11 +12198,10 @@ var model_ChartModel = /** @class */ (function () {
12143
12198
  this.colorScale = {};
12144
12199
  this.services = services;
12145
12200
  }
12146
- ChartModel.prototype.getDisplayData = function () {
12201
+ ChartModel.prototype.getAllDataFromDomain = function () {
12147
12202
  if (!this.get("data")) {
12148
12203
  return null;
12149
12204
  }
12150
- var ACTIVE = legend.items.status.ACTIVE;
12151
12205
  var dataGroups = this.getDataGroups();
12152
12206
  // Remove datasets that have been disabled
12153
12207
  var displayData = tools_Tools.clone(this.get("data"));
@@ -12166,12 +12220,26 @@ var model_ChartModel = /** @class */ (function () {
12166
12220
  else {
12167
12221
  var _a = axesOptions[axis].domain, start_1 = _a[0], end_1 = _a[1];
12168
12222
  // Filter out data outside domain
12169
- displayData = displayData.filter(function (datum) { return datum[mapsTo_1] >= start_1 && datum[mapsTo_1] <= end_1; });
12223
+ displayData = displayData.filter(function (datum) {
12224
+ return datum[mapsTo_1] >= start_1 && datum[mapsTo_1] <= end_1;
12225
+ });
12170
12226
  }
12171
12227
  }
12172
12228
  });
12173
12229
  }
12174
12230
  return displayData.filter(function (datum) {
12231
+ return dataGroups.find(function (group) { return group.name === datum[groupMapsTo]; });
12232
+ });
12233
+ };
12234
+ ChartModel.prototype.getDisplayData = function () {
12235
+ if (!this.get("data")) {
12236
+ return null;
12237
+ }
12238
+ var ACTIVE = legend.items.status.ACTIVE;
12239
+ var dataGroups = this.getDataGroups();
12240
+ var groupMapsTo = this.getOptions().data.groupMapsTo;
12241
+ var allDataFromDomain = this.getAllDataFromDomain();
12242
+ return allDataFromDomain.filter(function (datum) {
12175
12243
  var group = dataGroups.find(function (group) { return group.name === datum[groupMapsTo]; });
12176
12244
  return group.status === ACTIVE;
12177
12245
  });
@@ -12234,6 +12302,20 @@ var model_ChartModel = /** @class */ (function () {
12234
12302
  var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
12235
12303
  var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
12236
12304
  var stackKeys = src_map(displayData, function (datum) { return datum[domainIdentifier]; }).keys();
12305
+ var axisPosition = this.services.cartesianScales.domainAxisPosition;
12306
+ var scaleType = options.axes[axisPosition].scaleType;
12307
+ // Sort keys
12308
+ if (scaleType === ScaleTypes.TIME) {
12309
+ stackKeys.sort(function (a, b) {
12310
+ var dateA = new Date(a);
12311
+ var dateB = new Date(b);
12312
+ return dateA - dateB;
12313
+ });
12314
+ }
12315
+ else if (scaleType === ScaleTypes.LOG ||
12316
+ scaleType === ScaleTypes.LINEAR) {
12317
+ stackKeys.sort(function (a, b) { return a - b; });
12318
+ }
12237
12319
  var dataGroupNames = this.getDataGroupNames();
12238
12320
  return stackKeys.map(function (key) {
12239
12321
  var correspondingValues = { sharedStackKey: key };
@@ -12362,6 +12444,19 @@ var model_ChartModel = /** @class */ (function () {
12362
12444
  group.name === changedLabel ? ACTIVE : DISABLED;
12363
12445
  });
12364
12446
  }
12447
+ // Updates selected groups
12448
+ var updatedActiveItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
12449
+ var options = this.getOptions();
12450
+ var hasUpdatedDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
12451
+ // If there are deactivated items, map the item name into selected groups
12452
+ if (hasUpdatedDeactivatedItems) {
12453
+ options.data.selectedGroups = updatedActiveItems.map(function (activeItem) { return activeItem.name; });
12454
+ }
12455
+ else {
12456
+ // If every item is active, clear array
12457
+ options.data.selectedGroups = [];
12458
+ }
12459
+ ;
12365
12460
  // dispatch legend filtering event with the status of all the dataLabels
12366
12461
  this.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {
12367
12462
  dataGroups: dataGroups
@@ -12489,11 +12584,27 @@ var model_ChartModel = /** @class */ (function () {
12489
12584
  };
12490
12585
  ChartModel.prototype.generateDataGroups = function (data) {
12491
12586
  var groupMapsTo = this.getOptions().data.groupMapsTo;
12492
- var ACTIVE = legend.items.status.ACTIVE;
12587
+ var _a = legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
12588
+ var options = this.getOptions();
12493
12589
  var uniqueDataGroups = src_map(data, function (datum) { return datum[groupMapsTo]; }).keys();
12590
+ // check if selectedGroups can be applied to chart with current data groups
12591
+ if (options.data.selectedGroups.length) {
12592
+ var hasAllSelectedGroups = options.data.selectedGroups
12593
+ .every(function (groupName) { return uniqueDataGroups.includes(groupName); });
12594
+ if (!hasAllSelectedGroups) {
12595
+ options.data.selectedGroups = [];
12596
+ }
12597
+ ;
12598
+ }
12599
+ // Get group status based on items in selected groups
12600
+ var getStatus = function (groupName) {
12601
+ return !options.data.selectedGroups.length || options.data.selectedGroups.includes(groupName)
12602
+ ? ACTIVE
12603
+ : DISABLED;
12604
+ };
12494
12605
  return uniqueDataGroups.map(function (groupName) { return ({
12495
12606
  name: groupName,
12496
- status: ACTIVE
12607
+ status: getStatus(groupName)
12497
12608
  }); });
12498
12609
  };
12499
12610
  /*
@@ -13624,7 +13735,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13624
13735
  }
13625
13736
  var finalDimensions = {
13626
13737
  width: 0,
13627
- height: 0,
13738
+ height: 0
13628
13739
  };
13629
13740
  var validateAndSetDimensions = function (dimensions) {
13630
13741
  if (dimensions) {
@@ -13643,7 +13754,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13643
13754
  };
13644
13755
  var attrDimensions = {
13645
13756
  width: svgSelector.attr("width"),
13646
- height: svgSelector.attr("height"),
13757
+ height: svgSelector.attr("height")
13647
13758
  };
13648
13759
  var bbox, bboxDimensions, boundingRect, boundingRectDimensions;
13649
13760
  // In many versions of Firefox
@@ -13652,7 +13763,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13652
13763
  bbox = svgSelector.node().getBBox();
13653
13764
  bboxDimensions = {
13654
13765
  width: bbox.width,
13655
- height: bbox.height,
13766
+ height: bbox.height
13656
13767
  };
13657
13768
  }
13658
13769
  catch (e) { }
@@ -13660,13 +13771,13 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13660
13771
  boundingRect = svgSelector.node().getBoundingClientRect();
13661
13772
  boundingRectDimensions = {
13662
13773
  width: boundingRect.width,
13663
- height: boundingRect.height,
13774
+ height: boundingRect.height
13664
13775
  };
13665
13776
  }
13666
13777
  catch (e) { }
13667
13778
  var clientDimensions = {
13668
13779
  width: svgSelector.node().clientWidth,
13669
- height: svgSelector.node().clientHeight,
13780
+ height: svgSelector.node().clientHeight
13670
13781
  };
13671
13782
  // If both attribute values are numbers
13672
13783
  // And not percentages or NaN
@@ -13699,7 +13810,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13699
13810
  try {
13700
13811
  var nativeDimensions = {
13701
13812
  width: tools_Tools.getProperty(svgSelector.node(), "width", "baseVal", "value"),
13702
- height: tools_Tools.getProperty(svgSelector.node(), "height", "baseVal", "value"),
13813
+ height: tools_Tools.getProperty(svgSelector.node(), "height", "baseVal", "value")
13703
13814
  };
13704
13815
  validateAndSetDimensions(nativeDimensions);
13705
13816
  }
@@ -13854,7 +13965,7 @@ var events_Events = /** @class */ (function (_super) {
13854
13965
  var newEvent;
13855
13966
  if (eventDetail) {
13856
13967
  newEvent = new CustomEvent(eventType, {
13857
- detail: eventDetail,
13968
+ detail: eventDetail
13858
13969
  });
13859
13970
  }
13860
13971
  else {
@@ -16397,13 +16508,13 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16397
16508
  top: null,
16398
16509
  right: null,
16399
16510
  bottom: null,
16400
- left: null,
16511
+ left: null
16401
16512
  };
16402
16513
  _this.scales = {
16403
16514
  top: null,
16404
16515
  right: null,
16405
16516
  bottom: null,
16406
- left: null,
16517
+ left: null
16407
16518
  };
16408
16519
  return _this;
16409
16520
  }
@@ -16463,7 +16574,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16463
16574
  CartesianScales.prototype.getMainXAxisPosition = function () {
16464
16575
  var possibleXAxisPositions = [
16465
16576
  AxisPositions.BOTTOM,
16466
- AxisPositions.TOP,
16577
+ AxisPositions.TOP
16467
16578
  ];
16468
16579
  return [this.domainAxisPosition, this.rangeAxisPosition].find(function (position) { return possibleXAxisPositions.indexOf(position) > -1; });
16469
16580
  };
@@ -16471,7 +16582,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16471
16582
  CartesianScales.prototype.getMainYAxisPosition = function () {
16472
16583
  var possibleYAxisPositions = [
16473
16584
  AxisPositions.LEFT,
16474
- AxisPositions.RIGHT,
16585
+ AxisPositions.RIGHT
16475
16586
  ];
16476
16587
  return [this.domainAxisPosition, this.rangeAxisPosition].find(function (position) { return possibleYAxisPositions.indexOf(position) > -1; });
16477
16588
  };
@@ -16571,7 +16682,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16571
16682
  var mainHorizontalScaleType = mainHorizontalAxisOptions.scaleType || ScaleTypes.LINEAR;
16572
16683
  var result = {
16573
16684
  domainAxisPosition: null,
16574
- rangeAxisPosition: null,
16685
+ rangeAxisPosition: null
16575
16686
  };
16576
16687
  if (mainHorizontalScaleType === ScaleTypes.LABELS ||
16577
16688
  mainHorizontalScaleType === ScaleTypes.TIME) {
@@ -16677,7 +16788,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16677
16788
  }
16678
16789
  return {
16679
16790
  threshold: highestThreshold,
16680
- scaleValue: domainScale(highestThreshold.value),
16791
+ scaleValue: domainScale(highestThreshold.value)
16681
16792
  };
16682
16793
  };
16683
16794
  CartesianScales.prototype.getHighestRangeThreshold = function () {
@@ -16692,7 +16803,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16692
16803
  var highestThreshold = thresholds.sort(function (a, b) { return b.value - a.value; })[0];
16693
16804
  return {
16694
16805
  threshold: highestThreshold,
16695
- scaleValue: rangeScale(highestThreshold.value),
16806
+ scaleValue: rangeScale(highestThreshold.value)
16696
16807
  };
16697
16808
  };
16698
16809
  return CartesianScales;
@@ -16704,49 +16815,49 @@ function addSpacingToTimeDomain(domain, spaceToAddToEdges) {
16704
16815
  if (differenceInYears(endDate, startDate) > 1) {
16705
16816
  return [
16706
16817
  subYears(startDate, spaceToAddToEdges),
16707
- addYears(endDate, spaceToAddToEdges),
16818
+ addYears(endDate, spaceToAddToEdges)
16708
16819
  ];
16709
16820
  }
16710
16821
  if (differenceInMonths(endDate, startDate) > 1) {
16711
16822
  return [
16712
16823
  subMonths(startDate, spaceToAddToEdges),
16713
- addMonths(endDate, spaceToAddToEdges),
16824
+ addMonths(endDate, spaceToAddToEdges)
16714
16825
  ];
16715
16826
  }
16716
16827
  if (differenceInDays(endDate, startDate) > 1) {
16717
16828
  return [
16718
16829
  subDays(startDate, spaceToAddToEdges),
16719
- addDays(endDate, spaceToAddToEdges),
16830
+ addDays(endDate, spaceToAddToEdges)
16720
16831
  ];
16721
16832
  }
16722
16833
  if (differenceInHours(endDate, startDate) > 1) {
16723
16834
  return [
16724
16835
  subHours(startDate, spaceToAddToEdges),
16725
- addHours(endDate, spaceToAddToEdges),
16836
+ addHours(endDate, spaceToAddToEdges)
16726
16837
  ];
16727
16838
  }
16728
16839
  if (differenceInMinutes(endDate, startDate) > 30) {
16729
16840
  return [
16730
16841
  subMinutes(startDate, spaceToAddToEdges * 30),
16731
- addMinutes(endDate, spaceToAddToEdges * 30),
16842
+ addMinutes(endDate, spaceToAddToEdges * 30)
16732
16843
  ];
16733
16844
  }
16734
16845
  if (differenceInMinutes(endDate, startDate) > 1) {
16735
16846
  return [
16736
16847
  subMinutes(startDate, spaceToAddToEdges),
16737
- addMinutes(endDate, spaceToAddToEdges),
16848
+ addMinutes(endDate, spaceToAddToEdges)
16738
16849
  ];
16739
16850
  }
16740
16851
  if (differenceInSeconds(endDate, startDate) > 15) {
16741
16852
  return [
16742
16853
  subSeconds(startDate, spaceToAddToEdges * 15),
16743
- addSeconds(endDate, spaceToAddToEdges * 15),
16854
+ addSeconds(endDate, spaceToAddToEdges * 15)
16744
16855
  ];
16745
16856
  }
16746
16857
  if (differenceInSeconds(endDate, startDate) > 1) {
16747
16858
  return [
16748
16859
  subSeconds(startDate, spaceToAddToEdges),
16749
- addSeconds(endDate, spaceToAddToEdges),
16860
+ addSeconds(endDate, spaceToAddToEdges)
16750
16861
  ];
16751
16862
  }
16752
16863
  return [startDate, endDate];
@@ -17727,7 +17838,7 @@ var curves_Curves = /** @class */ (function (_super) {
17727
17838
  curveNatural: natural,
17728
17839
  curveStep: curve_step,
17729
17840
  curveStepAfter: stepAfter,
17730
- curveStepBefore: stepBefore,
17841
+ curveStepBefore: stepBefore
17731
17842
  };
17732
17843
  return _this;
17733
17844
  }
@@ -17868,6 +17979,7 @@ var legend_Legend = /** @class */ (function (_super) {
17868
17979
  var _this = this;
17869
17980
  var svg = this.getContainerSVG().attr("role", Roles.GRAPHICS_DOCUMENT);
17870
17981
  var options = this.model.getOptions();
17982
+ var legendOptions = tools_Tools.getProperty(options, "legend");
17871
17983
  var legendItems = svg
17872
17984
  .selectAll("g.legend-item")
17873
17985
  .data(this.model.getDataGroups(), function (dataGroup) { return dataGroup.name; });
@@ -17875,9 +17987,17 @@ var legend_Legend = /** @class */ (function (_super) {
17875
17987
  var addedLegendItems = legendItems
17876
17988
  .enter()
17877
17989
  .append("g")
17878
- .classed("legend-item", true);
17990
+ .classed("legend-item", true)
17991
+ .classed("active", function (d, i) {
17992
+ return d.status === options.legend.items.status.ACTIVE;
17993
+ });
17879
17994
  // Configs
17880
17995
  var checkboxRadius = options.legend.checkbox.radius;
17996
+ // Truncation
17997
+ // get user provided custom values for truncation
17998
+ var truncationType = tools_Tools.getProperty(legendOptions, "truncation", "type");
17999
+ var truncationThreshold = tools_Tools.getProperty(legendOptions, "truncation", "threshold");
18000
+ var truncationNumCharacter = tools_Tools.getProperty(legendOptions, "truncation", "numCharacter");
17881
18001
  addedLegendItems
17882
18002
  .append("rect")
17883
18003
  .classed("checkbox", true)
@@ -17894,11 +18014,23 @@ var legend_Legend = /** @class */ (function (_super) {
17894
18014
  .classed("active", function (d, i) {
17895
18015
  return d.status === options.legend.items.status.ACTIVE;
17896
18016
  });
17897
- addedLegendItems
18017
+ var addedLegendItemsText = addedLegendItems
17898
18018
  .append("text")
17899
- .merge(legendItems.select("text"))
17900
- .html(function (d) { return d.name; })
17901
- .attr("alignment-baseline", "middle");
18019
+ .merge(legendItems.select("text"));
18020
+ // truncate the legend label if it's too long
18021
+ if (truncationType !== TruncationTypes.NONE) {
18022
+ addedLegendItemsText.html(function (d) {
18023
+ if (d.name.length > truncationThreshold) {
18024
+ return tools_Tools.truncateLabel(d.name, truncationType, truncationNumCharacter);
18025
+ }
18026
+ else {
18027
+ return d.name;
18028
+ }
18029
+ });
18030
+ }
18031
+ else {
18032
+ addedLegendItemsText.html(function (d) { return d.name; });
18033
+ }
17902
18034
  this.breakItemsIntoLines(addedLegendItems);
17903
18035
  // Remove old elements as needed.
17904
18036
  legendItems
@@ -17977,11 +18109,19 @@ var legend_Legend = /** @class */ (function (_super) {
17977
18109
  legendItem
17978
18110
  .select("text")
17979
18111
  .attr("x", startingPoint + spaceNeededForCheckbox)
17980
- .attr("y", yOffset + yPosition);
18112
+ .attr("y", yOffset + yPosition + 3);
17981
18113
  lastYPosition = yPosition;
18114
+ // Test if legendItems are placed in the correct direction
18115
+ var testHorizontal = (!legendOrientation ||
18116
+ legendOrientation === LegendOrientations.HORIZONTAL) &&
18117
+ legendItem.select("rect.checkbox").attr("y") === '0';
18118
+ var testVertical = legendOrientation === LegendOrientations.VERTICAL &&
18119
+ legendItem.select("rect.checkbox").attr("x") === '0';
18120
+ var hasCorrectLegendDirection = testHorizontal || testVertical;
17982
18121
  // Render checkbox check icon
17983
18122
  if (hasDeactivatedItems &&
17984
- legendItem.select("g.check").empty()) {
18123
+ legendItem.select("g.check").empty() &&
18124
+ hasCorrectLegendDirection) {
17985
18125
  legendItem.append("g").classed("check", true).html("\n\t\t\t\t\t\t\t<svg focusable=\"false\" preserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 32 32\" aria-hidden=\"true\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\">\n\t\t\t\t\t\t\t\t<path d=\"M13 21.2l-7.1-7.1-1.4 1.4 7.1 7.1L13 24 27.1 9.9l-1.4-1.5z\"></path>\n\t\t\t\t\t\t\t\t<title>Checkmark</title>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t");
17986
18126
  legendItem
17987
18127
  .select("g.check svg")
@@ -18001,10 +18141,12 @@ var legend_Legend = /** @class */ (function (_super) {
18001
18141
  var self = this;
18002
18142
  var svg = this.getContainerSVG();
18003
18143
  var options = this.model.getOptions();
18144
+ var legendOptions = tools_Tools.getProperty(options, "legend");
18145
+ var truncationThreshold = tools_Tools.getProperty(legendOptions, "truncation", "threshold");
18004
18146
  svg.selectAll("g.legend-item")
18005
18147
  .on("mouseover", function () {
18006
18148
  self.services.events.dispatchEvent(Events.Legend.ITEM_HOVER, {
18007
- hoveredElement: src_select(this),
18149
+ hoveredElement: src_select(this)
18008
18150
  });
18009
18151
  // Configs
18010
18152
  var checkboxRadius = options.legend.checkbox.radius;
@@ -18022,17 +18164,28 @@ var legend_Legend = /** @class */ (function (_super) {
18022
18164
  })
18023
18165
  .on("click", function () {
18024
18166
  self.services.events.dispatchEvent(Events.Legend.ITEM_CLICK, {
18025
- clickedElement: src_select(this),
18167
+ clickedElement: src_select(this)
18026
18168
  });
18027
18169
  var clickedItem = src_select(this);
18028
18170
  var clickedItemData = clickedItem.datum();
18029
18171
  self.model.toggleDataLabel(clickedItemData.name);
18172
+ })
18173
+ .on("mousemove", function () {
18174
+ var hoveredItem = src_select(this);
18175
+ var hoveredItemData = hoveredItem.datum();
18176
+ if (hoveredItemData.name.length > truncationThreshold) {
18177
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
18178
+ hoveredElement: hoveredItem,
18179
+ type: TooltipTypes.LEGEND
18180
+ });
18181
+ }
18030
18182
  })
18031
18183
  .on("mouseout", function () {
18032
18184
  var hoveredItem = src_select(this);
18033
18185
  hoveredItem.select("rect.hover-stroke").remove();
18186
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
18034
18187
  self.services.events.dispatchEvent(Events.Legend.ITEM_MOUSEOUT, {
18035
- hoveredElement: hoveredItem,
18188
+ hoveredElement: hoveredItem
18036
18189
  });
18037
18190
  });
18038
18191
  };
@@ -20606,7 +20759,7 @@ var TIME_INTERVALS = [
20606
20759
  ["daily", 24 * 60 * 60 * 1000],
20607
20760
  ["monthly", 30 * 24 * 60 * 60 * 1000],
20608
20761
  ["quarterly", 3 * 30 * 24 * 60 * 60 * 1000],
20609
- ["yearly", 12 * 30 * 24 * 60 * 60 * 1000],
20762
+ ["yearly", 12 * 30 * 24 * 60 * 60 * 1000]
20610
20763
  ];
20611
20764
  // Return true if the tick is a primary tick, false otherwise
20612
20765
  function isTickPrimary(tick, i, interval, showDayName) {
@@ -20676,7 +20829,7 @@ function getTimeformats(timestamp) {
20676
20829
  d: date.getDate(),
20677
20830
  H: date.getHours(),
20678
20831
  m: date.getMinutes(),
20679
- s: date.getSeconds(),
20832
+ s: date.getSeconds() // seconds: 0-59
20680
20833
  };
20681
20834
  }
20682
20835
  // Find the differences between consecutive numbers in an array
@@ -20832,7 +20985,7 @@ var threshold_Threshold = /** @class */ (function (_super) {
20832
20985
  if (scaleType === ScaleTypes.TIME) {
20833
20986
  var isVertical = [
20834
20987
  AxisPositions.LEFT,
20835
- AxisPositions.RIGHT,
20988
+ AxisPositions.RIGHT
20836
20989
  ].includes(axisPosition);
20837
20990
  var mainXScale = this.services.cartesianScales.getMainXScale();
20838
20991
  var mainYScale = this.services.cartesianScales.getMainYScale();
@@ -20863,20 +21016,20 @@ var threshold_Threshold = /** @class */ (function (_super) {
20863
21016
  // Find out whether threshold label should be shown on the left or right side
20864
21017
  var bestPlacementOption = this.positionService.findBestPlacementAt({
20865
21018
  left: mouseRelativePos[0],
20866
- top: mouseRelativePos[1],
21019
+ top: mouseRelativePos[1]
20867
21020
  }, target, [
20868
21021
  PLACEMENTS.RIGHT,
20869
21022
  PLACEMENTS.LEFT,
20870
21023
  PLACEMENTS.TOP,
20871
- PLACEMENTS.BOTTOM,
21024
+ PLACEMENTS.BOTTOM
20872
21025
  ], function () { return ({
20873
21026
  width: holder.offsetWidth,
20874
- height: holder.offsetHeight,
21027
+ height: holder.offsetHeight
20875
21028
  }); });
20876
21029
  // Get coordinates to where label should be positioned
20877
21030
  var pos = this.positionService.findPositionAt({
20878
21031
  left: mouseRelativePos[0],
20879
- top: mouseRelativePos[1],
21032
+ top: mouseRelativePos[1]
20880
21033
  }, target, bestPlacementOption);
20881
21034
  this.positionService.setElement(target, pos);
20882
21035
  };
@@ -20887,13 +21040,13 @@ var threshold_Threshold = /** @class */ (function (_super) {
20887
21040
  .on("mouseover mousemove", function () {
20888
21041
  self.threshold.classed("active", true);
20889
21042
  self.services.events.dispatchEvent(Events.Threshold.SHOW, {
20890
- hoveredElement: src_select(self.threshold),
21043
+ hoveredElement: src_select(self.threshold)
20891
21044
  });
20892
21045
  })
20893
21046
  .on("mouseout", function () {
20894
21047
  self.threshold.classed("active", false);
20895
21048
  self.services.events.dispatchEvent(Events.Threshold.HIDE, {
20896
- hoveredElement: src_select(self.threshold),
21049
+ hoveredElement: src_select(self.threshold)
20897
21050
  });
20898
21051
  });
20899
21052
  };
@@ -20961,12 +21114,12 @@ var title_Title = /** @class */ (function (_super) {
20961
21114
  .on("mouseenter", function () {
20962
21115
  self_1.services.events.dispatchEvent(Events.Tooltip.SHOW, {
20963
21116
  hoveredElement: title,
20964
- type: TooltipTypes.TITLE,
21117
+ type: TooltipTypes.TITLE
20965
21118
  });
20966
21119
  })
20967
21120
  .on("mouseout", function () {
20968
21121
  self_1.services.events.dispatchEvent(Events.Tooltip.HIDE, {
20969
- hoveredElement: title,
21122
+ hoveredElement: title
20970
21123
  });
20971
21124
  });
20972
21125
  }
@@ -21052,17 +21205,19 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21052
21205
  if ((e.detail.type === TooltipTypes.DATAPOINT &&
21053
21206
  tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "datapoint", "enabled")) ||
21054
21207
  (e.detail.type === TooltipTypes.GRIDLINE &&
21055
- tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled"))) {
21208
+ tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled")) ||
21209
+ e.detail.type === TooltipTypes.LEGEND ||
21210
+ e.detail.type === TooltipTypes.AXISLABEL) {
21056
21211
  var data = src_select(on_event.target).datum();
21057
21212
  // Generate default tooltip
21058
21213
  var defaultHTML = void 0;
21059
21214
  if (e.detail.multidata) {
21060
21215
  // multi tooltip
21061
21216
  data = e.detail.multidata;
21062
- defaultHTML = _this.getMultilineTooltipHTML(data);
21217
+ defaultHTML = _this.getMultilineTooltipHTML(data, e.detail.type);
21063
21218
  }
21064
21219
  else {
21065
- defaultHTML = _this.getTooltipHTML(data, TooltipTypes.DATAPOINT);
21220
+ defaultHTML = _this.getTooltipHTML(data, e.detail.type);
21066
21221
  }
21067
21222
  // if there is a provided tooltip HTML function call it
21068
21223
  if (tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "customHTML")) {
@@ -21084,7 +21239,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21084
21239
  _this.tooltip.style("max-width", chartWidth);
21085
21240
  tooltipTextContainer.html(_this.getTooltipHTML(e.detail.hoveredElement, TooltipTypes.TITLE));
21086
21241
  // get the position based on the title positioning (static)
21087
- var position = _this.getTooltipPosition(e.detail.hoveredElement.node());
21242
+ var position = _this.getTooltipPosition(e.detail.hoveredElement.node(), e.detail.type);
21088
21243
  _this.positionTooltip(position);
21089
21244
  }
21090
21245
  // Fade in
@@ -21101,6 +21256,9 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21101
21256
  var title = this.model.getOptions().title;
21102
21257
  return "<div class=\"title-tooltip\"><text>" + title + "</text></div>";
21103
21258
  }
21259
+ else if (type === TooltipTypes.LEGEND) {
21260
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + data.name + "</p></div>";
21261
+ }
21104
21262
  // this cleans up the data item, pie slices have the data within the data.data but other datapoints are self contained within data
21105
21263
  var dataVal = tools_Tools.getProperty(data, "data") ? data.data : data;
21106
21264
  var groupMapsTo = this.model.getOptions().data.groupMapsTo;
@@ -21115,7 +21273,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21115
21273
  var label = dataVal[groupMapsTo];
21116
21274
  return "<div class=\"datapoint-tooltip\">\n\t\t\t\t\t<p class=\"label\">" + label + "</p>\n\t\t\t\t\t<p class=\"value\">" + formattedValue + "</p>\n\t\t\t\t</div>";
21117
21275
  };
21118
- Tooltip.prototype.getMultilineTooltipHTML = function (data) {
21276
+ Tooltip.prototype.getMultilineTooltipHTML = function (data, type) {
21119
21277
  var _this = this;
21120
21278
  // sort them so they are in the same order as the graph
21121
21279
  data.sort(function (a, b) { return b.value - a.value; });
@@ -21142,7 +21300,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21142
21300
  this.tooltip.classed("hidden", true);
21143
21301
  };
21144
21302
  // returns static position based on the element
21145
- Tooltip.prototype.getTooltipPosition = function (hoveredElement) {
21303
+ Tooltip.prototype.getTooltipPosition = function (hoveredElement, type) {
21146
21304
  var holderPosition = src_select(this.services.domUtils.getHolder())
21147
21305
  .node()
21148
21306
  .getBoundingClientRect();
@@ -21153,7 +21311,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21153
21311
  left: elementPosition.left -
21154
21312
  holderPosition.left +
21155
21313
  elementPosition.width / 2,
21156
- top: elementPosition.top - holderPosition.top - verticalOffset,
21314
+ top: elementPosition.top - holderPosition.top - verticalOffset
21157
21315
  };
21158
21316
  return { placement: TooltipPosition.BOTTOM, position: tooltipPos };
21159
21317
  };
@@ -21174,15 +21332,15 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21174
21332
  // Find out whether tooltip should be shown on the left or right side
21175
21333
  var bestPlacementOption = this.positionService.findBestPlacementAt({
21176
21334
  left: mouseRelativePos[0],
21177
- top: mouseRelativePos[1],
21335
+ top: mouseRelativePos[1]
21178
21336
  }, target, [
21179
21337
  PLACEMENTS.RIGHT,
21180
21338
  PLACEMENTS.LEFT,
21181
21339
  PLACEMENTS.TOP,
21182
- PLACEMENTS.BOTTOM,
21340
+ PLACEMENTS.BOTTOM
21183
21341
  ], function () { return ({
21184
21342
  width: holder.offsetWidth,
21185
- height: holder.offsetHeight,
21343
+ height: holder.offsetHeight
21186
21344
  }); });
21187
21345
  var horizontalOffset = this.model.getOptions().tooltip.datapoint.horizontalOffset;
21188
21346
  if (bestPlacementOption === PLACEMENTS.LEFT) {
@@ -21191,7 +21349,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21191
21349
  // Get coordinates to where tooltip should be positioned
21192
21350
  pos = this.positionService.findPositionAt({
21193
21351
  left: mouseRelativePos[0] + horizontalOffset,
21194
- top: mouseRelativePos[1],
21352
+ top: mouseRelativePos[1]
21195
21353
  }, target, bestPlacementOption);
21196
21354
  }
21197
21355
  this.positionService.setElement(target, pos);
@@ -21242,7 +21400,9 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21242
21400
  if ((e.detail.type === TooltipTypes.DATAPOINT &&
21243
21401
  tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "datapoint", "enabled")) ||
21244
21402
  (e.detail.type === TooltipTypes.GRIDLINE &&
21245
- tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled"))) {
21403
+ tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled")) ||
21404
+ e.detail.type === TooltipTypes.LEGEND ||
21405
+ e.detail.type === TooltipTypes.AXISLABEL) {
21246
21406
  var data = e.detail.hoveredElement.datum();
21247
21407
  var hoveredElement = e.detail.hoveredElement.node();
21248
21408
  var defaultHTML = void 0;
@@ -21258,7 +21418,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21258
21418
  else {
21259
21419
  data = e.detail.hoveredElement.datum();
21260
21420
  }
21261
- defaultHTML = _this.getTooltipHTML(data);
21421
+ defaultHTML = _this.getTooltipHTML(data, e.detail.type);
21262
21422
  }
21263
21423
  // if there is a provided tooltip HTML function call it and pass the defaultHTML
21264
21424
  if (tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "customHTML")) {
@@ -21270,9 +21430,15 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21270
21430
  // default tooltip
21271
21431
  tooltipTextContainer.html(defaultHTML);
21272
21432
  }
21273
- var position = _this.getTooltipPosition(hoveredElement, data);
21274
- // Position the tooltip relative to the bars
21275
- _this.positionTooltip(e.detail.multidata ? undefined : position);
21433
+ if (e.detail.type === TooltipTypes.LEGEND ||
21434
+ e.detail.type === TooltipTypes.AXISLABEL) {
21435
+ _this.positionTooltip();
21436
+ }
21437
+ else {
21438
+ var position = _this.getTooltipPosition(hoveredElement, data);
21439
+ // Position the tooltip relative to the bars
21440
+ _this.positionTooltip(e.detail.multidata ? undefined : position);
21441
+ }
21276
21442
  }
21277
21443
  else if (e.detail.type === TooltipTypes.TITLE) {
21278
21444
  // use the chart size to enforce a max width on the tooltip
@@ -21284,7 +21450,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21284
21450
  // use tooltip.ts to get the tooltip html for titles
21285
21451
  tooltipTextContainer.html(_super.prototype.getTooltipHTML.call(_this, e.detail.hoveredElement, TooltipTypes.TITLE));
21286
21452
  // get the position based on the title positioning (static)
21287
- var position = _super.prototype.getTooltipPosition.call(_this, e.detail.hoveredElement.node());
21453
+ var position = _super.prototype.getTooltipPosition.call(_this, e.detail.hoveredElement.node(), e.detail.type);
21288
21454
  _this.positionTooltip(position);
21289
21455
  }
21290
21456
  // Fade in
@@ -21316,7 +21482,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21316
21482
  left: barPosition.left -
21317
21483
  holderPosition.left +
21318
21484
  barPosition.width / 2,
21319
- top: barPosition.bottom - holderPosition.top + verticalOffset,
21485
+ top: barPosition.bottom - holderPosition.top + verticalOffset
21320
21486
  };
21321
21487
  return { placement: TooltipPosition.BOTTOM, position: tooltipPos };
21322
21488
  }
@@ -21326,7 +21492,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21326
21492
  left: barPosition.left -
21327
21493
  holderPosition.left +
21328
21494
  barPosition.width / 2,
21329
- top: barPosition.top - holderPosition.top - verticalOffset,
21495
+ top: barPosition.top - holderPosition.top - verticalOffset
21330
21496
  };
21331
21497
  return { placement: TooltipPosition.TOP, position: tooltipPos };
21332
21498
  }
@@ -21335,7 +21501,13 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21335
21501
  * Returns the html for the bar single point tooltip
21336
21502
  * @param data associated values for the hovered bar
21337
21503
  */
21338
- TooltipBar.prototype.getTooltipHTML = function (data) {
21504
+ TooltipBar.prototype.getTooltipHTML = function (data, type) {
21505
+ if (type === TooltipTypes.LEGEND) {
21506
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + data.name + "</p></div>";
21507
+ }
21508
+ else if (type === TooltipTypes.AXISLABEL) {
21509
+ return "<div class=\"axis-tooltip\"><p class=\"label\">" + data + "</p></div>";
21510
+ }
21339
21511
  var formattedValue = tools_Tools.getProperty(this.model.getOptions(), "tooltip", "valueFormatter")
21340
21512
  ? this.model.getOptions().tooltip.valueFormatter(data.value)
21341
21513
  : data.value.toLocaleString("en");
@@ -21408,6 +21580,9 @@ var tooltip_pie_TooltipPie = /** @class */ (function (_super) {
21408
21580
  var title = this.model.getOptions().title;
21409
21581
  return "<div class=\"title-tooltip\"><text>" + title + "</text></div>";
21410
21582
  }
21583
+ else if (type === TooltipTypes.LEGEND) {
21584
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + d.name + "</p></div>";
21585
+ }
21411
21586
  var dataVal = d.data;
21412
21587
  var groupMapsTo = this.model.getOptions().data.groupMapsTo;
21413
21588
  // format the value if needed
@@ -21449,6 +21624,12 @@ var tooltip_scatter_TooltipScatter = /** @class */ (function (_super) {
21449
21624
  // the main tooltip component handles title styles
21450
21625
  return _super.prototype.getTooltipHTML.call(this, datum, type);
21451
21626
  }
21627
+ else if (type === TooltipTypes.LEGEND) {
21628
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + datum.name + "</p></div>";
21629
+ }
21630
+ else if (type === TooltipTypes.AXISLABEL) {
21631
+ return "<div class=\"axis-tooltip\"><p class=\"label\">" + datum + "</p></div>";
21632
+ }
21452
21633
  var groupMapsTo = this.model.getOptions().data.groupMapsTo;
21453
21634
  var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
21454
21635
  var userProvidedValueFormatter = tools_Tools.getProperty(this.model.getOptions(), "tooltip", "valueFormatter");
@@ -21484,7 +21665,7 @@ var tooltip_radar_TooltipRadar = /** @class */ (function (_super) {
21484
21665
  function TooltipRadar() {
21485
21666
  return _super !== null && _super.apply(this, arguments) || this;
21486
21667
  }
21487
- TooltipRadar.prototype.getMultilineTooltipHTML = function (data) {
21668
+ TooltipRadar.prototype.getMultilineTooltipHTML = function (data, type) {
21488
21669
  var _this = this;
21489
21670
  var options = this.model.getOptions();
21490
21671
  var groupMapsTo = options.data.groupMapsTo;
@@ -21958,11 +22139,13 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
21958
22139
  _this.type = "area-stacked";
21959
22140
  _this.handleLegendOnHover = function (event) {
21960
22141
  var hoveredElement = event.detail.hoveredElement;
22142
+ var options = _this.model.getOptions();
22143
+ var groupMapsTo = options.data.groupMapsTo;
21961
22144
  _this.parent
21962
22145
  .selectAll("path.area")
21963
22146
  .transition(_this.services.transitions.getTransition("legend-hover-area"))
21964
22147
  .attr("opacity", function (d) {
21965
- if (d[0].group !== hoveredElement.datum().name) {
22148
+ if (d[0][groupMapsTo] !== hoveredElement.datum().name) {
21966
22149
  return configuration_area.opacity.unselected;
21967
22150
  }
21968
22151
  return configuration_area.opacity.selected;
@@ -21988,6 +22171,7 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
21988
22171
  var svg = this.getContainerSVG();
21989
22172
  var self = this;
21990
22173
  var options = this.model.getOptions();
22174
+ var groupMapsTo = options.data.groupMapsTo;
21991
22175
  var mainXScale = this.services.cartesianScales.getMainXScale();
21992
22176
  var mainYScale = this.services.cartesianScales.getMainYScale();
21993
22177
  var domainAxisPosition = this.services.cartesianScales.getDomainAxisPosition();
@@ -21996,13 +22180,11 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
21996
22180
  if (!isTimeSeries) {
21997
22181
  return;
21998
22182
  }
21999
- var percentage = Object.keys(options.axes).some(function (axis) {
22000
- return options.axes[axis].percentage;
22001
- });
22183
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
22002
22184
  var stackedData = this.model.getStackedData({ percentage: percentage });
22003
22185
  var areas = svg
22004
22186
  .selectAll("path.area")
22005
- .data(stackedData, function (d) { return d[0].group; });
22187
+ .data(stackedData, function (d) { return d[0][groupMapsTo]; });
22006
22188
  // D3 area generator function
22007
22189
  this.areaGenerator = src_area()
22008
22190
  // @ts-ignore
@@ -22014,8 +22196,8 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
22014
22196
  var enteringAreas = areas.enter().append("path").attr("opacity", 0);
22015
22197
  enteringAreas
22016
22198
  .merge(areas)
22017
- .data(stackedData, function (d) { return d[0].group; })
22018
- .attr("fill", function (d) { return self.model.getFillColor(d[0].group); })
22199
+ .data(stackedData, function (d) { return d[0][groupMapsTo]; })
22200
+ .attr("fill", function (d) { return self.model.getFillColor(d[0][groupMapsTo]); })
22019
22201
  .attr("role", Roles.GRAPHICS_SYMBOL)
22020
22202
  .attr("aria-roledescription", "area")
22021
22203
  .transition(this.services.transitions.getTransition("area-update-enter", animate))
@@ -22182,25 +22364,25 @@ var bar_simple_SimpleBar = /** @class */ (function (_super) {
22182
22364
  // Dispatch mouse event
22183
22365
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {
22184
22366
  element: hoveredElement,
22185
- datum: datum,
22367
+ datum: datum
22186
22368
  });
22187
22369
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22188
22370
  hoveredElement: hoveredElement,
22189
- type: TooltipTypes.DATAPOINT,
22371
+ type: TooltipTypes.DATAPOINT
22190
22372
  });
22191
22373
  })
22192
22374
  .on("mousemove", function (datum) {
22193
22375
  // Dispatch mouse event
22194
22376
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEMOVE, {
22195
22377
  element: src_select(this),
22196
- datum: datum,
22378
+ datum: datum
22197
22379
  });
22198
22380
  })
22199
22381
  .on("click", function (datum) {
22200
22382
  // Dispatch mouse event
22201
22383
  self.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {
22202
22384
  element: src_select(this),
22203
- datum: datum,
22385
+ datum: datum
22204
22386
  });
22205
22387
  })
22206
22388
  .on("mouseout", function (datum) {
@@ -22214,11 +22396,11 @@ var bar_simple_SimpleBar = /** @class */ (function (_super) {
22214
22396
  // Dispatch mouse event
22215
22397
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {
22216
22398
  element: hoveredElement,
22217
- datum: datum,
22399
+ datum: datum
22218
22400
  });
22219
22401
  // Hide tooltip
22220
22402
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22221
- hoveredElement: hoveredElement,
22403
+ hoveredElement: hoveredElement
22222
22404
  });
22223
22405
  });
22224
22406
  };
@@ -22388,26 +22570,26 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
22388
22570
  // Dispatch mouse event
22389
22571
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {
22390
22572
  element: hoveredElement,
22391
- datum: datum,
22573
+ datum: datum
22392
22574
  });
22393
22575
  // Show tooltip
22394
22576
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22395
22577
  hoveredElement: hoveredElement,
22396
- type: TooltipTypes.DATAPOINT,
22578
+ type: TooltipTypes.DATAPOINT
22397
22579
  });
22398
22580
  })
22399
22581
  .on("mousemove", function (datum) {
22400
22582
  // Dispatch mouse event
22401
22583
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEMOVE, {
22402
22584
  element: src_select(this),
22403
- datum: datum,
22585
+ datum: datum
22404
22586
  });
22405
22587
  })
22406
22588
  .on("click", function (datum) {
22407
22589
  // Dispatch mouse event
22408
22590
  self.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {
22409
22591
  element: src_select(this),
22410
- datum: datum,
22592
+ datum: datum
22411
22593
  });
22412
22594
  })
22413
22595
  .on("mouseout", function (datum) {
@@ -22422,11 +22604,11 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
22422
22604
  // Dispatch mouse event
22423
22605
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {
22424
22606
  element: hoveredElement,
22425
- datum: datum,
22607
+ datum: datum
22426
22608
  });
22427
22609
  // Hide tooltip
22428
22610
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22429
- hoveredElement: hoveredElement,
22611
+ hoveredElement: hoveredElement
22430
22612
  });
22431
22613
  });
22432
22614
  };
@@ -22637,7 +22819,7 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
22637
22819
  // Dispatch mouse event
22638
22820
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {
22639
22821
  element: hoveredElement,
22640
- datum: datum,
22822
+ datum: datum
22641
22823
  });
22642
22824
  })
22643
22825
  .on("mousemove", function (datum) {
@@ -22664,14 +22846,14 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
22664
22846
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22665
22847
  hoveredElement: hoveredElement,
22666
22848
  data: matchingDataPoint,
22667
- type: TooltipTypes.DATAPOINT,
22849
+ type: TooltipTypes.DATAPOINT
22668
22850
  });
22669
22851
  })
22670
22852
  .on("click", function (datum) {
22671
22853
  // Dispatch mouse event
22672
22854
  self.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {
22673
22855
  element: src_select(this),
22674
- datum: datum,
22856
+ datum: datum
22675
22857
  });
22676
22858
  })
22677
22859
  .on("mouseout", function (datum) {
@@ -22685,11 +22867,11 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
22685
22867
  // Dispatch mouse event
22686
22868
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {
22687
22869
  element: hoveredElement,
22688
- datum: datum,
22870
+ datum: datum
22689
22871
  });
22690
22872
  // Hide tooltip
22691
22873
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22692
- hoveredElement: hoveredElement,
22874
+ hoveredElement: hoveredElement
22693
22875
  });
22694
22876
  });
22695
22877
  };
@@ -22788,9 +22970,7 @@ var scatter_Scatter = /** @class */ (function (_super) {
22788
22970
  var stacked = this.configs.stacked;
22789
22971
  var scatterData;
22790
22972
  if (stacked) {
22791
- var percentage = Object.keys(options.axes).some(function (axis) {
22792
- return options.axes[axis].percentage;
22793
- });
22973
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
22794
22974
  scatterData = this.model.getStackedData({ percentage: percentage });
22795
22975
  }
22796
22976
  else {
@@ -22920,7 +23100,7 @@ var scatter_Scatter = /** @class */ (function (_super) {
22920
23100
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22921
23101
  hoveredElement: hoveredElement,
22922
23102
  multidata: overlappingData.length > 1 ? overlappingData : null,
22923
- type: TooltipTypes.DATAPOINT,
23103
+ type: TooltipTypes.DATAPOINT
22924
23104
  });
22925
23105
  var eventNameToDispatch = on_event.type === "mouseover"
22926
23106
  ? Events.Scatter.SCATTER_MOUSEOVER
@@ -22928,14 +23108,14 @@ var scatter_Scatter = /** @class */ (function (_super) {
22928
23108
  // Dispatch mouse event
22929
23109
  self.services.events.dispatchEvent(eventNameToDispatch, {
22930
23110
  element: hoveredElement,
22931
- datum: datum,
23111
+ datum: datum
22932
23112
  });
22933
23113
  })
22934
23114
  .on("click", function (datum) {
22935
23115
  // Dispatch mouse event
22936
23116
  self.services.events.dispatchEvent(Events.Scatter.SCATTER_CLICK, {
22937
23117
  element: src_select(this),
22938
- datum: datum,
23118
+ datum: datum
22939
23119
  });
22940
23120
  })
22941
23121
  .on("mouseout", function (datum) {
@@ -22947,11 +23127,11 @@ var scatter_Scatter = /** @class */ (function (_super) {
22947
23127
  // Dispatch mouse event
22948
23128
  self.services.events.dispatchEvent(Events.Scatter.SCATTER_MOUSEOUT, {
22949
23129
  element: hoveredElement,
22950
- datum: datum,
23130
+ datum: datum
22951
23131
  });
22952
23132
  // Hide tooltip
22953
23133
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22954
- hoveredElement: hoveredElement,
23134
+ hoveredElement: hoveredElement
22955
23135
  });
22956
23136
  });
22957
23137
  };
@@ -23129,18 +23309,22 @@ var line_Line = /** @class */ (function (_super) {
23129
23309
  });
23130
23310
  var data = [];
23131
23311
  if (this.configs.stacked) {
23132
- var percentage = Object.keys(options.axes).some(function (axis) {
23133
- return options.axes[axis].percentage;
23134
- });
23312
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
23313
+ var groupMapsTo_1 = options.data.groupMapsTo;
23135
23314
  var stackedData = this.model.getStackedData({ percentage: percentage });
23315
+ var domainIdentifier_1 = this.services.cartesianScales.getDomainIdentifier();
23316
+ var rangeIdentifier_1 = this.services.cartesianScales.getRangeIdentifier();
23136
23317
  data = stackedData.map(function (d) { return ({
23137
- name: d[0].group,
23138
- data: d.map(function (datum) { return ({
23139
- date: datum.data.sharedStackKey,
23140
- group: datum.group,
23141
- value: datum[1],
23142
- }); }),
23143
- hidden: !tools_Tools.some(d, function (datum) { return datum[0] !== datum[1]; }),
23318
+ name: d[0][groupMapsTo_1],
23319
+ data: d.map(function (datum) {
23320
+ var _a;
23321
+ return (_a = {},
23322
+ _a[domainIdentifier_1] = datum.data.sharedStackKey,
23323
+ _a[groupMapsTo_1] = datum[groupMapsTo_1],
23324
+ _a[rangeIdentifier_1] = datum[1],
23325
+ _a);
23326
+ }),
23327
+ hidden: !tools_Tools.some(d, function (datum) { return datum[0] !== datum[1]; })
23144
23328
  }); });
23145
23329
  }
23146
23330
  else {
@@ -23232,14 +23416,12 @@ var scatter_stacked_StackedScatter = /** @class */ (function (_super) {
23232
23416
  var groupMapsTo = options.data.groupMapsTo;
23233
23417
  var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
23234
23418
  var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
23235
- var percentage = Object.keys(options.axes).some(function (axis) {
23236
- return options.axes[axis].percentage;
23237
- });
23419
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
23238
23420
  var stackedData = this.model.getStackedData({ percentage: percentage });
23239
23421
  // Update data on dot groups
23240
23422
  var circleGroups = svg
23241
23423
  .selectAll("g.dots")
23242
- .data(stackedData, function (d) { return d[0].group; });
23424
+ .data(stackedData, function (d) { return d[0][groupMapsTo]; });
23243
23425
  // Remove dot groups that need to be removed
23244
23426
  circleGroups.exit().attr("opacity", 0).remove();
23245
23427
  // Add the dot groups that need to be introduced
@@ -23859,12 +24041,12 @@ var pie_Pie = /** @class */ (function (_super) {
23859
24041
  if (direction === CalloutDirections.RIGHT) {
23860
24042
  d.startPos = {
23861
24043
  x: xPosition,
23862
- y: yPosition + d.textOffsetY,
24044
+ y: yPosition + d.textOffsetY
23863
24045
  };
23864
24046
  // end position for the callout line
23865
24047
  d.endPos = {
23866
24048
  x: xPosition + options.pie.callout.offsetX,
23867
- y: yPosition - options.pie.callout.offsetY + d.textOffsetY,
24049
+ y: yPosition - options.pie.callout.offsetY + d.textOffsetY
23868
24050
  };
23869
24051
  // the intersection point of the vertical and horizontal line
23870
24052
  d.intersectPointX =
@@ -23874,12 +24056,12 @@ var pie_Pie = /** @class */ (function (_super) {
23874
24056
  // start position for the callout line
23875
24057
  d.startPos = {
23876
24058
  x: xPosition,
23877
- y: yPosition + d.textOffsetY,
24059
+ y: yPosition + d.textOffsetY
23878
24060
  };
23879
24061
  // end position for the callout line should be bottom aligned to the title
23880
24062
  d.endPos = {
23881
24063
  x: xPosition - options.pie.callout.offsetX,
23882
- y: yPosition - options.pie.callout.offsetY + d.textOffsetY,
24064
+ y: yPosition - options.pie.callout.offsetY + d.textOffsetY
23883
24065
  };
23884
24066
  // the intersection point of the vertical and horizontal line
23885
24067
  d.intersectPointX =
@@ -23925,7 +24107,7 @@ var pie_Pie = /** @class */ (function (_super) {
23925
24107
  // Dispatch mouse event
23926
24108
  self.services.events.dispatchEvent(Events.Pie.SLICE_MOUSEOVER, {
23927
24109
  element: src_select(this),
23928
- datum: datum,
24110
+ datum: datum
23929
24111
  });
23930
24112
  })
23931
24113
  .on("mousemove", function (datum) {
@@ -23937,19 +24119,19 @@ var pie_Pie = /** @class */ (function (_super) {
23937
24119
  // Dispatch mouse event
23938
24120
  self.services.events.dispatchEvent(Events.Pie.SLICE_MOUSEMOVE, {
23939
24121
  element: hoveredElement,
23940
- datum: datum,
24122
+ datum: datum
23941
24123
  });
23942
24124
  // Show tooltip
23943
24125
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
23944
24126
  hoveredElement: hoveredElement,
23945
- type: TooltipTypes.DATAPOINT,
24127
+ type: TooltipTypes.DATAPOINT
23946
24128
  });
23947
24129
  })
23948
24130
  .on("click", function (datum) {
23949
24131
  // Dispatch mouse event
23950
24132
  self.services.events.dispatchEvent(Events.Pie.SLICE_CLICK, {
23951
24133
  element: src_select(this),
23952
- datum: datum,
24134
+ datum: datum
23953
24135
  });
23954
24136
  })
23955
24137
  .on("mouseout", function (datum) {
@@ -23961,11 +24143,11 @@ var pie_Pie = /** @class */ (function (_super) {
23961
24143
  // Dispatch mouse event
23962
24144
  self.services.events.dispatchEvent(Events.Pie.SLICE_MOUSEOUT, {
23963
24145
  element: hoveredElement,
23964
- datum: datum,
24146
+ datum: datum
23965
24147
  });
23966
24148
  // Hide tooltip
23967
24149
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
23968
- hoveredElement: hoveredElement,
24150
+ hoveredElement: hoveredElement
23969
24151
  });
23970
24152
  });
23971
24153
  };
@@ -23973,7 +24155,7 @@ var pie_Pie = /** @class */ (function (_super) {
23973
24155
  Pie.prototype.computeRadius = function () {
23974
24156
  var options = this.model.getOptions();
23975
24157
  var _a = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
23976
- useAttrs: true,
24158
+ useAttrs: true
23977
24159
  }), width = _a.width, height = _a.height;
23978
24160
  var radius = Math.min(width, height) / 2;
23979
24161
  return radius + options.pie.radiusOffset;
@@ -24178,20 +24360,22 @@ var gauge_Gauge = /** @class */ (function (_super) {
24178
24360
  var deltaFontSize = delta
24179
24361
  ? tools_Tools.getProperty(options, "gauge", "deltaFontSize")
24180
24362
  : function () { return 0; };
24181
- var numberFormatter = tools_Tools.getProperty(options, "gauge", "numberFormatter");
24363
+ // use numberFormatter here only if there is a delta supplied
24364
+ var numberFormatter = delta
24365
+ ? tools_Tools.getProperty(options, "gauge", "numberFormatter")
24366
+ : function () { return null; };
24182
24367
  var arrowSize = tools_Tools.getProperty(options, "gauge", "deltaArrow", "size");
24183
24368
  var numberSpacing = tools_Tools.getProperty(options, "gauge", "numberSpacing");
24184
24369
  var numbersGroup = dom_utils_DOMUtils.appendOrSelect(svg, "g.gauge-numbers");
24185
24370
  // Add the smaller number of the delta
24186
24371
  var deltaGroup = dom_utils_DOMUtils.appendOrSelect(numbersGroup, "g.gauge-delta").attr("transform", "translate(0, " + (deltaFontSize(radius) + numberSpacing) + ")");
24187
- var deltaNumber = deltaGroup
24188
- .selectAll("text.gauge-delta-number")
24189
- .data(delta !== null ? [delta] : []);
24372
+ var deltaNumber = dom_utils_DOMUtils.appendOrSelect(deltaGroup, "text.gauge-delta-number");
24373
+ deltaNumber.data(delta === null ? [] : [delta]);
24190
24374
  deltaNumber
24191
24375
  .enter()
24192
24376
  .append("text")
24377
+ .classed("gauge-delta-number", true)
24193
24378
  .merge(deltaNumber)
24194
- .attr("class", "gauge-delta-number")
24195
24379
  .attr("text-anchor", "middle")
24196
24380
  .style("font-size", deltaFontSize(radius) + "px")
24197
24381
  .text(function (d) { return numberFormatter(d) + "%"; });
@@ -24418,7 +24602,7 @@ var skeleton_Skeleton = /** @class */ (function (_super) {
24418
24602
  var svg = this.parent;
24419
24603
  var parent = svg.node().parentNode;
24420
24604
  var _a = dom_utils_DOMUtils.getSVGElementSize(parent, {
24421
- useAttrs: true,
24605
+ useAttrs: true
24422
24606
  }), width = _a.width, height = _a.height;
24423
24607
  svg.attr("width", width).attr("height", height);
24424
24608
  var isDataEmpty = this.model.isDataEmpty();
@@ -24497,7 +24681,7 @@ var skeleton_Skeleton = /** @class */ (function (_super) {
24497
24681
  var svg = this.parent;
24498
24682
  var parent = svg.node().parentNode;
24499
24683
  var _a = dom_utils_DOMUtils.getSVGElementSize(parent, {
24500
- useAttrs: true,
24684
+ useAttrs: true
24501
24685
  }), width = _a.width, height = _a.height;
24502
24686
  this.backdrop = dom_utils_DOMUtils.appendOrSelect(svg, "svg.chart-skeleton.DAII")
24503
24687
  .attr("width", width)
@@ -24604,7 +24788,7 @@ var skeleton_Skeleton = /** @class */ (function (_super) {
24604
24788
  var stopShimmerClass = "stop-shimmer";
24605
24789
  var container = this.parent.select(".chart-skeleton");
24606
24790
  var width = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
24607
- useAttrs: true,
24791
+ useAttrs: true
24608
24792
  }).width;
24609
24793
  var startPoint = 0;
24610
24794
  var endPoint = width;
@@ -25205,10 +25389,10 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
25205
25389
  // Get parent SVG to render inside of
25206
25390
  var svg = this.parent;
25207
25391
  var _a = dom_utils_DOMUtils.getSVGElementSize(svg, {
25208
- useAttrs: true,
25392
+ useAttrs: true
25209
25393
  }), width = _a.width, height = _a.height;
25210
25394
  var root = hierarchy({
25211
- children: this.children,
25395
+ children: this.children
25212
25396
  }).sum(function (d) { return d.size; });
25213
25397
  // Grab the correct treemap tile function based on direction
25214
25398
  var tileType = this.configs.direction === LayoutDirection.ROW ||
@@ -25254,6 +25438,12 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
25254
25438
  // Calculate preffered children sizes after internal rendering
25255
25439
  var growth = tools_Tools.getProperty(d, "data", "growth", "x");
25256
25440
  var matchingSVGDimensions = dom_utils_DOMUtils.getSVGElementSize(src_select(this), { useBBox: true });
25441
+ if (d.data.id === "legend") {
25442
+ var svgSize = dom_utils_DOMUtils.getSVGElementSize(src_select(this), { useAttrs: true });
25443
+ if (svgSize.height < 40) {
25444
+ matchingSVGDimensions.height = svgSize.height;
25445
+ }
25446
+ }
25257
25447
  if (growth === LayoutGrowth.PREFERRED) {
25258
25448
  var matchingSVGWidth = horizontal
25259
25449
  ? matchingSVGDimensions.width
@@ -25277,7 +25467,7 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
25277
25467
  // Pass children data to the hierarchy layout
25278
25468
  // And calculate sum of sizes
25279
25469
  root = hierarchy({
25280
- children: this.children,
25470
+ children: this.children
25281
25471
  }).sum(function (d) { return d.size; });
25282
25472
  // Compute the position of all elements within the layout
25283
25473
  src_treemap().tile(tileType).size([width, height]).padding(0)(root);
@@ -25552,14 +25742,19 @@ var axis_Axis = /** @class */ (function (_super) {
25552
25742
  var axisPosition = this.configs.position;
25553
25743
  var options = this.model.getOptions();
25554
25744
  var axisOptions = tools_Tools.getProperty(options, "axes", axisPosition);
25745
+ var axisScaleType = tools_Tools.getProperty(axisOptions, "scaleType");
25555
25746
  var numberOfTicksProvided = tools_Tools.getProperty(axisOptions, "ticks", "number");
25747
+ // get user provided custom values for truncation
25748
+ var truncationType = tools_Tools.getProperty(axisOptions, "truncation", "type");
25749
+ var truncationThreshold = tools_Tools.getProperty(axisOptions, "truncation", "threshold");
25750
+ var truncationNumCharacter = tools_Tools.getProperty(axisOptions, "truncation", "numCharacter");
25556
25751
  var isNumberOfTicksProvided = numberOfTicksProvided !== null;
25557
25752
  var isVerticalAxis = axisPosition === AxisPositions.LEFT ||
25558
25753
  axisPosition === AxisPositions.RIGHT;
25559
25754
  var timeScaleOptions = tools_Tools.getProperty(options, "timeScale");
25560
25755
  var svg = this.getContainerSVG();
25561
25756
  var _a = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
25562
- useAttrs: true,
25757
+ useAttrs: true
25563
25758
  }), width = _a.width, height = _a.height;
25564
25759
  var startPosition, endPosition;
25565
25760
  if (axisPosition === AxisPositions.BOTTOM ||
@@ -25617,7 +25812,7 @@ var axis_Axis = /** @class */ (function (_super) {
25617
25812
  var fakeTick = dom_utils_DOMUtils.appendOrSelect(invisibleAxisRef, "g.tick");
25618
25813
  var fakeTickText = dom_utils_DOMUtils.appendOrSelect(fakeTick, "text").text("0");
25619
25814
  var tickHeight = dom_utils_DOMUtils.getSVGElementSize(fakeTickText.node(), {
25620
- useBBox: true,
25815
+ useBBox: true
25621
25816
  }).height;
25622
25817
  fakeTick.remove();
25623
25818
  var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
@@ -25648,13 +25843,15 @@ var axis_Axis = /** @class */ (function (_super) {
25648
25843
  axis.tickValues([]);
25649
25844
  }
25650
25845
  else {
25651
- var tickValues = scale
25652
- .nice(numberOfTicks)
25653
- .ticks(numberOfTicks);
25846
+ var addSpaceOnEdges = tools_Tools.getProperty(options, "timeScale", "addSpaceOnEdges");
25847
+ var tickValues = void 0;
25848
+ if (addSpaceOnEdges) {
25849
+ tickValues = scale.nice(numberOfTicks);
25850
+ }
25851
+ tickValues = scale.ticks(numberOfTicks);
25654
25852
  // Remove labels on the edges
25655
25853
  // If there are more than 2 labels to show
25656
- if (tools_Tools.getProperty(options, "timeScale", "addSpaceOnEdges") &&
25657
- tickValues.length > 2) {
25854
+ if (addSpaceOnEdges && tickValues.length > 2) {
25658
25855
  tickValues.splice(tickValues.length - 1, 1);
25659
25856
  tickValues.splice(0, 1);
25660
25857
  }
@@ -25734,7 +25931,7 @@ var axis_Axis = /** @class */ (function (_super) {
25734
25931
  break;
25735
25932
  case AxisPositions.TOP:
25736
25933
  var titleHeight = dom_utils_DOMUtils.getSVGElementSize(axisTitleRef, {
25737
- useBBox: true,
25934
+ useBBox: true
25738
25935
  }).height;
25739
25936
  axisTitleRef
25740
25937
  .attr("transform", "translate(" + (this.margins.left / 2 + scale.range()[1] / 2) + ", " + titleHeight / 2 + ")")
@@ -25822,6 +26019,45 @@ var axis_Axis = /** @class */ (function (_super) {
25822
26019
  if (this.model.isDataEmpty()) {
25823
26020
  container.attr("opacity", 0);
25824
26021
  }
26022
+ // truncate the label if it's too long
26023
+ // only applies to discrete type
26024
+ if (truncationType !== TruncationTypes.NONE &&
26025
+ axisScaleType === ScaleTypes.LABELS) {
26026
+ var dataGroups = this.model.getDataValuesGroupedByKeys();
26027
+ if (dataGroups.length > 0) {
26028
+ var activeDataGroups = dataGroups.map(function (d) { return d.sharedStackKey; });
26029
+ var tick_html = svg
26030
+ .select("g.axis." + axisPosition + " g.ticks g.tick")
26031
+ .html();
26032
+ container.selectAll("g.ticks g.tick").html(tick_html);
26033
+ container
26034
+ .selectAll("g.tick text")
26035
+ .data(activeDataGroups)
26036
+ .text(function (d) {
26037
+ if (d.length > truncationThreshold) {
26038
+ return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
26039
+ }
26040
+ else {
26041
+ return d;
26042
+ }
26043
+ });
26044
+ this.getInvisibleAxisRef()
26045
+ .selectAll("g.tick text")
26046
+ .data(activeDataGroups)
26047
+ .text(function (d) {
26048
+ if (d.length > truncationThreshold) {
26049
+ return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
26050
+ }
26051
+ else {
26052
+ return d;
26053
+ }
26054
+ });
26055
+ container
26056
+ .selectAll("g.ticks")
26057
+ .html(this.getInvisibleAxisRef().html());
26058
+ container.selectAll("g.tick text").data(activeDataGroups);
26059
+ }
26060
+ }
25825
26061
  // Add event listeners to elements drawn
25826
26062
  this.addEventListeners();
25827
26063
  };
@@ -25829,6 +26065,12 @@ var axis_Axis = /** @class */ (function (_super) {
25829
26065
  var svg = this.getContainerSVG();
25830
26066
  var axisPosition = this.configs.position;
25831
26067
  var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
26068
+ var options = this.model.getOptions();
26069
+ var axisOptions = tools_Tools.getProperty(options, "axes", axisPosition);
26070
+ var axisScaleType = tools_Tools.getProperty(axisOptions, "scaleType");
26071
+ var truncationThreshold = tools_Tools.getProperty(axisOptions, "truncation", "threshold");
26072
+ var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
26073
+ axisOptions.scaleType === ScaleTypes.TIME;
25832
26074
  var self = this;
25833
26075
  container
25834
26076
  .selectAll("g.tick text")
@@ -25836,29 +26078,39 @@ var axis_Axis = /** @class */ (function (_super) {
25836
26078
  // Dispatch mouse event
25837
26079
  self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
25838
26080
  element: src_select(this),
25839
- datum: datum,
26081
+ datum: datum
25840
26082
  });
25841
26083
  })
25842
26084
  .on("mousemove", function (datum) {
25843
26085
  // Dispatch mouse event
25844
26086
  self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
25845
26087
  element: src_select(this),
25846
- datum: datum,
26088
+ datum: datum
25847
26089
  });
26090
+ if (axisScaleType === ScaleTypes.LABELS &&
26091
+ datum.length > truncationThreshold) {
26092
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
26093
+ hoveredElement: src_select(this),
26094
+ type: TooltipTypes.AXISLABEL
26095
+ });
26096
+ }
25848
26097
  })
25849
26098
  .on("click", function (datum) {
25850
26099
  // Dispatch mouse event
25851
26100
  self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
25852
26101
  element: src_select(this),
25853
- datum: datum,
26102
+ datum: datum
25854
26103
  });
25855
26104
  })
25856
26105
  .on("mouseout", function (datum) {
25857
26106
  // Dispatch mouse event
25858
26107
  self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
25859
26108
  element: src_select(this),
25860
- datum: datum,
26109
+ datum: datum
25861
26110
  });
26111
+ if (axisScaleType === ScaleTypes.LABELS) {
26112
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
26113
+ }
25862
26114
  });
25863
26115
  };
25864
26116
  Axis.prototype.getInvisibleAxisRef = function () {
@@ -25931,7 +26183,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
25931
26183
  top: 0,
25932
26184
  right: 0,
25933
26185
  bottom: 0,
25934
- left: 0,
26186
+ left: 0
25935
26187
  };
25936
26188
  return _this;
25937
26189
  }
@@ -25956,7 +26208,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
25956
26208
  var axisComponent = new axis_Axis(_this.model, _this.services, {
25957
26209
  position: axisPosition,
25958
26210
  axes: _this.configs.axes,
25959
- margins: _this.margins,
26211
+ margins: _this.margins
25960
26212
  });
25961
26213
  // Set model, services & parent for the new axis component
25962
26214
  axisComponent.setModel(_this.model);
@@ -25986,7 +26238,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
25986
26238
  }
25987
26239
  else {
25988
26240
  offset = dom_utils_DOMUtils.getSVGElementSize(child.getTitleRef(), {
25989
- useBBox: true,
26241
+ useBBox: true
25990
26242
  }).height;
25991
26243
  }
25992
26244
  switch (axisPosition) {
@@ -26186,7 +26438,7 @@ var grid_Grid = /** @class */ (function (_super) {
26186
26438
  // threshold for when to display a gridline tooltip
26187
26439
  var bounds = {
26188
26440
  min: Number(translations.tx) - threshold,
26189
- max: Number(translations.tx) + threshold,
26441
+ max: Number(translations.tx) + threshold
26190
26442
  };
26191
26443
  return bounds.min <= position[0] && position[0] <= bounds.max;
26192
26444
  });
@@ -26272,7 +26524,7 @@ var ruler_Ruler = /** @class */ (function (_super) {
26272
26524
  var _b = rangeScale.range(), yScaleEnd = _b[0], yScaleStart = _b[1];
26273
26525
  var scaledData = displayData.map(function (d) { return ({
26274
26526
  domainValue: _this.services.cartesianScales.getDomainValue(d),
26275
- originalData: d,
26527
+ originalData: d
26276
26528
  }); });
26277
26529
  /**
26278
26530
  * Find matches, reduce is used instead of filter
@@ -26335,7 +26587,7 @@ var ruler_Ruler = /** @class */ (function (_super) {
26335
26587
  this.services.events.dispatchEvent("show-tooltip", {
26336
26588
  hoveredElement: rulerLine,
26337
26589
  multidata: tooltipData,
26338
- type: TooltipTypes.GRIDLINE,
26590
+ type: TooltipTypes.GRIDLINE
26339
26591
  });
26340
26592
  ruler.attr("opacity", 1);
26341
26593
  // line snaps to matching point
@@ -26453,7 +26705,7 @@ var zero_line_ZeroLine = /** @class */ (function (_super) {
26453
26705
  x0: x0,
26454
26706
  x1: x1,
26455
26707
  y0: yPosition,
26456
- y1: yPosition,
26708
+ y1: yPosition
26457
26709
  }, this.services.cartesianScales.getOrientation());
26458
26710
  var line = dom_utils_DOMUtils.appendOrSelect(svg, "line.domain");
26459
26711
  line.transition(this.services.transitions.getTransition("zero-line-update", animate))
@@ -26714,7 +26966,7 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26714
26966
  var _this = _super.call(this, holder, chartConfigs) || this;
26715
26967
  _this.services = Object.assign(_this.services, {
26716
26968
  cartesianScales: scales_cartesian_CartesianScales,
26717
- curves: curves_Curves,
26969
+ curves: curves_Curves
26718
26970
  });
26719
26971
  return _this;
26720
26972
  }
@@ -26724,24 +26976,24 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26724
26976
  components: [new title_Title(this.model, this.services)],
26725
26977
  growth: {
26726
26978
  x: LayoutGrowth.PREFERRED,
26727
- y: LayoutGrowth.FIXED,
26728
- },
26979
+ y: LayoutGrowth.FIXED
26980
+ }
26729
26981
  };
26730
26982
  var legendComponent = {
26731
26983
  id: "legend",
26732
26984
  components: [new legend_Legend(this.model, this.services)],
26733
26985
  growth: {
26734
26986
  x: LayoutGrowth.PREFERRED,
26735
- y: LayoutGrowth.FIXED,
26736
- },
26987
+ y: LayoutGrowth.FIXED
26988
+ }
26737
26989
  };
26738
26990
  var graphFrameComponent = {
26739
26991
  id: "graph-frame",
26740
26992
  components: graphFrameComponents,
26741
26993
  growth: {
26742
26994
  x: LayoutGrowth.STRETCH,
26743
- y: LayoutGrowth.FIXED,
26744
- },
26995
+ y: LayoutGrowth.FIXED
26996
+ }
26745
26997
  };
26746
26998
  var isLegendEnabled = this.model.getOptions().legend.enabled !== false;
26747
26999
  // Decide the position of the legend in reference to the chart
@@ -26771,23 +27023,23 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26771
27023
  components: [new spacer_Spacer(this.model, this.services)],
26772
27024
  growth: {
26773
27025
  x: LayoutGrowth.PREFERRED,
26774
- y: LayoutGrowth.FIXED,
26775
- },
27026
+ y: LayoutGrowth.FIXED
27027
+ }
26776
27028
  };
26777
27029
  var fullFrameComponent = {
26778
27030
  id: "full-frame",
26779
27031
  components: [
26780
27032
  new layout_LayoutComponent(this.model, this.services, axis_chart_spreadArrays((isLegendEnabled ? [legendComponent] : []), [
26781
27033
  legendSpacerComponent,
26782
- graphFrameComponent,
27034
+ graphFrameComponent
26783
27035
  ]), {
26784
- direction: fullFrameComponentDirection,
26785
- }),
27036
+ direction: fullFrameComponentDirection
27037
+ })
26786
27038
  ],
26787
27039
  growth: {
26788
27040
  x: LayoutGrowth.STRETCH,
26789
- y: LayoutGrowth.FIXED,
26790
- },
27041
+ y: LayoutGrowth.FIXED
27042
+ }
26791
27043
  };
26792
27044
  // Add chart title if it exists
26793
27045
  var topLevelLayoutComponents = [];
@@ -26798,16 +27050,16 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26798
27050
  components: [new spacer_Spacer(this.model, this.services)],
26799
27051
  growth: {
26800
27052
  x: LayoutGrowth.PREFERRED,
26801
- y: LayoutGrowth.FIXED,
26802
- },
27053
+ y: LayoutGrowth.FIXED
27054
+ }
26803
27055
  };
26804
27056
  topLevelLayoutComponents.push(titleSpacerComponent);
26805
27057
  }
26806
27058
  topLevelLayoutComponents.push(fullFrameComponent);
26807
27059
  return [
26808
27060
  new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
26809
- direction: LayoutDirection.COLUMN,
26810
- }),
27061
+ direction: LayoutDirection.COLUMN
27062
+ })
26811
27063
  ];
26812
27064
  };
26813
27065
  return AxisChart;
@@ -26855,8 +27107,8 @@ var area_AreaChart = /** @class */ (function (_super) {
26855
27107
  new area_Area(this.model, this.services),
26856
27108
  new scatter_Scatter(this.model, this.services, {
26857
27109
  fadeInOnChartHolderMouseover: true,
26858
- handleThresholds: true,
26859
- }),
27110
+ handleThresholds: true
27111
+ })
26860
27112
  ];
26861
27113
  var components = this.getAxisChartComponents(graphFrameComponents);
26862
27114
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -26908,8 +27160,8 @@ var area_stacked_StackedAreaChart = /** @class */ (function (_super) {
26908
27160
  new scatter_stacked_StackedScatter(this.model, this.services, {
26909
27161
  fadeInOnChartHolderMouseover: true,
26910
27162
  handleThresholds: true,
26911
- stacked: true,
26912
- }),
27163
+ stacked: true
27164
+ })
26913
27165
  ];
26914
27166
  var components = this.getAxisChartComponents(graphFrameComponents);
26915
27167
  // TODO add tooltip
@@ -26960,8 +27212,8 @@ var bar_simple_SimpleBarChart = /** @class */ (function (_super) {
26960
27212
  new bar_simple_SimpleBar(this.model, this.services),
26961
27213
  new zero_line_ZeroLine(this.model, this.services),
26962
27214
  new skeleton_Skeleton(this.model, this.services, {
26963
- skeleton: Skeletons.VERT_OR_HORIZ,
26964
- }),
27215
+ skeleton: Skeletons.VERT_OR_HORIZ
27216
+ })
26965
27217
  ];
26966
27218
  var components = this.getAxisChartComponents(graphFrameComponents);
26967
27219
  components.push(new tooltip_bar_TooltipBar(this.model, this.services));
@@ -27011,8 +27263,8 @@ var bar_grouped_GroupedBarChart = /** @class */ (function (_super) {
27011
27263
  new bar_grouped_GroupedBar(this.model, this.services),
27012
27264
  new zero_line_ZeroLine(this.model, this.services),
27013
27265
  new skeleton_Skeleton(this.model, this.services, {
27014
- skeleton: Skeletons.VERT_OR_HORIZ,
27015
- }),
27266
+ skeleton: Skeletons.VERT_OR_HORIZ
27267
+ })
27016
27268
  ];
27017
27269
  var components = this.getAxisChartComponents(graphFrameComponents);
27018
27270
  components.push(new tooltip_bar_TooltipBar(this.model, this.services));
@@ -27061,8 +27313,8 @@ var bar_stacked_StackedBarChart = /** @class */ (function (_super) {
27061
27313
  new grid_Grid(this.model, this.services),
27062
27314
  new bar_stacked_StackedBar(this.model, this.services),
27063
27315
  new skeleton_Skeleton(this.model, this.services, {
27064
- skeleton: Skeletons.VERT_OR_HORIZ,
27065
- }),
27316
+ skeleton: Skeletons.VERT_OR_HORIZ
27317
+ })
27066
27318
  ];
27067
27319
  var components = this.getAxisChartComponents(graphFrameComponents);
27068
27320
  components.push(new tooltip_bar_TooltipBar(this.model, this.services));
@@ -27112,8 +27364,8 @@ var bubble_BubbleChart = /** @class */ (function (_super) {
27112
27364
  new ruler_Ruler(this.model, this.services),
27113
27365
  new bubble_Bubble(this.model, this.services),
27114
27366
  new skeleton_Skeleton(this.model, this.services, {
27115
- skeleton: Skeletons.GRID,
27116
- }),
27367
+ skeleton: Skeletons.GRID
27368
+ })
27117
27369
  ];
27118
27370
  var components = this.getAxisChartComponents(graphFrameComponents);
27119
27371
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -27164,8 +27416,8 @@ var line_LineChart = /** @class */ (function (_super) {
27164
27416
  new line_Line(this.model, this.services),
27165
27417
  new scatter_Scatter(this.model, this.services, { handleThresholds: true }),
27166
27418
  new skeleton_Skeleton(this.model, this.services, {
27167
- skeleton: Skeletons.GRID,
27168
- }),
27419
+ skeleton: Skeletons.GRID
27420
+ })
27169
27421
  ];
27170
27422
  var components = this.getAxisChartComponents(graphFrameComponents);
27171
27423
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -27215,8 +27467,8 @@ var scatter_ScatterChart = /** @class */ (function (_super) {
27215
27467
  new ruler_Ruler(this.model, this.services),
27216
27468
  new scatter_Scatter(this.model, this.services),
27217
27469
  new skeleton_Skeleton(this.model, this.services, {
27218
- skeleton: Skeletons.GRID,
27219
- }),
27470
+ skeleton: Skeletons.GRID
27471
+ })
27220
27472
  ];
27221
27473
  var components = this.getAxisChartComponents(graphFrameComponents);
27222
27474
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -27317,8 +27569,8 @@ var pie_PieChart = /** @class */ (function (_super) {
27317
27569
  var graphFrameComponents = [
27318
27570
  new pie_Pie(this.model, this.services),
27319
27571
  new skeleton_Skeleton(this.model, this.services, {
27320
- skeleton: Skeletons.PIE,
27321
- }),
27572
+ skeleton: Skeletons.PIE
27573
+ })
27322
27574
  ];
27323
27575
  // get the base chart components and export with tooltip
27324
27576
  var components = this.getChartComponents(graphFrameComponents);
@@ -27366,8 +27618,8 @@ var donut_DonutChart = /** @class */ (function (_super) {
27366
27618
  var graphFrameComponents = [
27367
27619
  new donut_Donut(this.model, this.services),
27368
27620
  new skeleton_Skeleton(this.model, this.services, {
27369
- skeleton: Skeletons.DONUT,
27370
- }),
27621
+ skeleton: Skeletons.DONUT
27622
+ })
27371
27623
  ];
27372
27624
  var components = this.getChartComponents(graphFrameComponents);
27373
27625
  components.push(new tooltip_pie_TooltipPie(this.model, this.services));
@@ -27384,50 +27636,50 @@ function radialLabelPlacement(angleRadians) {
27384
27636
  if (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {
27385
27637
  return {
27386
27638
  textAnchor: TextAnchor.START,
27387
- dominantBaseline: DominantBaseline.MIDDLE,
27639
+ dominantBaseline: DominantBaseline.MIDDLE
27388
27640
  };
27389
27641
  }
27390
27642
  else if (isInRange(angle, [10, 80])) {
27391
27643
  return {
27392
27644
  textAnchor: TextAnchor.START,
27393
- dominantBaseline: DominantBaseline.HANGING,
27645
+ dominantBaseline: DominantBaseline.HANGING
27394
27646
  };
27395
27647
  }
27396
27648
  else if (isInRange(angle, [80, 100])) {
27397
27649
  return {
27398
27650
  textAnchor: TextAnchor.MIDDLE,
27399
- dominantBaseline: DominantBaseline.HANGING,
27651
+ dominantBaseline: DominantBaseline.HANGING
27400
27652
  };
27401
27653
  }
27402
27654
  else if (isInRange(angle, [100, 170])) {
27403
27655
  return {
27404
27656
  textAnchor: TextAnchor.END,
27405
- dominantBaseline: DominantBaseline.HANGING,
27657
+ dominantBaseline: DominantBaseline.HANGING
27406
27658
  };
27407
27659
  }
27408
27660
  else if (isInRange(angle, [170, 190])) {
27409
27661
  return {
27410
27662
  textAnchor: TextAnchor.END,
27411
- dominantBaseline: DominantBaseline.MIDDLE,
27663
+ dominantBaseline: DominantBaseline.MIDDLE
27412
27664
  };
27413
27665
  }
27414
27666
  else if (isInRange(angle, [190, 260])) {
27415
27667
  return {
27416
27668
  textAnchor: TextAnchor.END,
27417
- dominantBaseline: DominantBaseline.BASELINE,
27669
+ dominantBaseline: DominantBaseline.BASELINE
27418
27670
  };
27419
27671
  }
27420
27672
  else if (isInRange(angle, [260, 280])) {
27421
27673
  return {
27422
27674
  textAnchor: TextAnchor.MIDDLE,
27423
- dominantBaseline: DominantBaseline.BASELINE,
27675
+ dominantBaseline: DominantBaseline.BASELINE
27424
27676
  };
27425
27677
  }
27426
27678
  else {
27427
27679
  // 280 - 350
27428
27680
  return {
27429
27681
  textAnchor: TextAnchor.START,
27430
- dominantBaseline: DominantBaseline.BASELINE,
27682
+ dominantBaseline: DominantBaseline.BASELINE
27431
27683
  };
27432
27684
  }
27433
27685
  }
@@ -27628,7 +27880,7 @@ var radar_Radar = /** @class */ (function (_super) {
27628
27880
  if (animate === void 0) { animate = true; }
27629
27881
  this.svg = this.getContainerSVG();
27630
27882
  var _a = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
27631
- useAttrs: true,
27883
+ useAttrs: true
27632
27884
  }), width = _a.width, height = _a.height;
27633
27885
  var data = this.model.getData();
27634
27886
  var displayData = this.model.getDisplayData();
@@ -27657,7 +27909,7 @@ var radar_Radar = /** @class */ (function (_super) {
27657
27909
  var yScale = linear_linear()
27658
27910
  .domain([
27659
27911
  0,
27660
- src_max(this.displayDataNormalized.map(function (d) { return d[value]; })),
27912
+ src_max(this.displayDataNormalized.map(function (d) { return d[value]; }))
27661
27913
  ])
27662
27914
  .range([minRange, radius])
27663
27915
  .nice(yTicksNumber);
@@ -27690,7 +27942,7 @@ var radar_Radar = /** @class */ (function (_super) {
27690
27942
  // center coordinates
27691
27943
  var c = {
27692
27944
  x: leftPadding + xLabelPadding,
27693
- y: height / 2,
27945
+ y: height / 2
27694
27946
  };
27695
27947
  /////////////////////////////
27696
27948
  // Drawing the radar
@@ -27992,7 +28244,7 @@ var radar_Radar = /** @class */ (function (_super) {
27992
28244
  // Dispatch mouse event
27993
28245
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEOVER, {
27994
28246
  element: src_select(this),
27995
- datum: datum,
28247
+ datum: datum
27996
28248
  });
27997
28249
  })
27998
28250
  .on("mousemove", function (datum) {
@@ -28009,7 +28261,7 @@ var radar_Radar = /** @class */ (function (_super) {
28009
28261
  // Dispatch mouse event
28010
28262
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEMOVE, {
28011
28263
  element: hoveredElement,
28012
- datum: datum,
28264
+ datum: datum
28013
28265
  });
28014
28266
  // get the items that should be highlighted
28015
28267
  var itemsToHighlight = self.displayDataNormalized.filter(function (d) { return d[angle] === datum; });
@@ -28017,14 +28269,14 @@ var radar_Radar = /** @class */ (function (_super) {
28017
28269
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
28018
28270
  hoveredElement: hoveredElement,
28019
28271
  multidata: itemsToHighlight,
28020
- type: TooltipTypes.GRIDLINE,
28272
+ type: TooltipTypes.GRIDLINE
28021
28273
  });
28022
28274
  })
28023
28275
  .on("click", function (datum) {
28024
28276
  // Dispatch mouse event
28025
28277
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_CLICK, {
28026
28278
  element: src_select(this),
28027
- datum: datum,
28279
+ datum: datum
28028
28280
  });
28029
28281
  })
28030
28282
  .on("mouseout", function (datum) {
@@ -28039,14 +28291,14 @@ var radar_Radar = /** @class */ (function (_super) {
28039
28291
  // Dispatch mouse event
28040
28292
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEOUT, {
28041
28293
  element: hoveredElement,
28042
- datum: datum,
28294
+ datum: datum
28043
28295
  });
28044
28296
  // Hide tooltip
28045
28297
  self.services.events.dispatchEvent("hide-tooltip", {
28046
- hoveredElement: hoveredElement,
28298
+ hoveredElement: hoveredElement
28047
28299
  });
28048
28300
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
28049
- hoveredElement: hoveredElement,
28301
+ hoveredElement: hoveredElement
28050
28302
  });
28051
28303
  });
28052
28304
  };
@@ -28139,6 +28391,7 @@ var gauge_GaugeChart = /** @class */ (function (_super) {
28139
28391
  // Specify what to render inside the graph-frame
28140
28392
  var graphFrameComponents = [new gauge_Gauge(this.model, this.services)];
28141
28393
  var components = this.getChartComponents(graphFrameComponents);
28394
+ components.push(new tooltip_Tooltip(this.model, this.services));
28142
28395
  return components;
28143
28396
  };
28144
28397
  return GaugeChart;