@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.
@@ -512,6 +512,16 @@ var AxisPositions;
512
512
  AxisPositions["TOP"] = "top";
513
513
  AxisPositions["BOTTOM"] = "bottom";
514
514
  })(AxisPositions || (AxisPositions = {}));
515
+ /**
516
+ * enum of all possible truncation types
517
+ */
518
+ var TruncationTypes;
519
+ (function (TruncationTypes) {
520
+ TruncationTypes["END_LINE"] = "end_line";
521
+ TruncationTypes["MID_LINE"] = "mid_line";
522
+ TruncationTypes["FRONT_LINE"] = "front_line";
523
+ TruncationTypes["NONE"] = "none";
524
+ })(TruncationTypes || (TruncationTypes = {}));
515
525
  /**
516
526
  * enum of all possible cartesian orientations
517
527
  * to be used for determining the orientation
@@ -550,6 +560,8 @@ var TooltipTypes;
550
560
  TooltipTypes["DATAPOINT"] = "datapoint";
551
561
  TooltipTypes["GRIDLINE"] = "gridline";
552
562
  TooltipTypes["TITLE"] = "title";
563
+ TooltipTypes["LEGEND"] = "legend";
564
+ TooltipTypes["AXISLABEL"] = "axislabel";
553
565
  })(TooltipTypes || (TooltipTypes = {}));
554
566
  /**
555
567
  * enum of all possible legend positions
@@ -6822,7 +6834,7 @@ var tools_Tools;
6822
6834
  function getDimensions(el) {
6823
6835
  return {
6824
6836
  width: parseFloat(el.style.width.replace("px", "") || el.offsetWidth),
6825
- height: parseFloat(el.style.height.replace("px", "") || el.offsetHeight),
6837
+ height: parseFloat(el.style.height.replace("px", "") || el.offsetHeight)
6826
6838
  };
6827
6839
  }
6828
6840
  Tools.getDimensions = getDimensions;
@@ -6852,7 +6864,7 @@ var tools_Tools;
6852
6864
  .split(",");
6853
6865
  return {
6854
6866
  tx: transforms[0],
6855
- ty: transforms[1],
6867
+ ty: transforms[1]
6856
6868
  };
6857
6869
  }
6858
6870
  return null;
@@ -6874,7 +6886,7 @@ var tools_Tools;
6874
6886
  var xyString = match.split(",");
6875
6887
  return {
6876
6888
  x: parseFloat(xyString[0]),
6877
- y: parseFloat(xyString[1]),
6889
+ y: parseFloat(xyString[1])
6878
6890
  };
6879
6891
  }
6880
6892
  Tools.getTranformOffsets = getTranformOffsets;
@@ -6920,6 +6932,31 @@ var tools_Tools;
6920
6932
  : percentage;
6921
6933
  }
6922
6934
  Tools.convertValueToPercentage = convertValueToPercentage;
6935
+ /**
6936
+ * Truncate the labels
6937
+ * @export
6938
+ * @param {any} fullText
6939
+ * @param {any} truncationType
6940
+ * @param {any} numCharacter
6941
+ * @returns Truncated text
6942
+ */
6943
+ function truncateLabel(fullText, truncationType, numCharacter) {
6944
+ if (numCharacter > fullText.length) {
6945
+ return fullText;
6946
+ }
6947
+ if (truncationType === TruncationTypes.MID_LINE) {
6948
+ return (fullText.substr(0, numCharacter / 2) +
6949
+ "..." +
6950
+ fullText.substr(-numCharacter / 2));
6951
+ }
6952
+ else if (truncationType === TruncationTypes.FRONT_LINE) {
6953
+ return "..." + fullText.substr(-numCharacter);
6954
+ }
6955
+ else if (truncationType === TruncationTypes.END_LINE) {
6956
+ return fullText.substr(0, numCharacter) + "...";
6957
+ }
6958
+ }
6959
+ Tools.truncateLabel = truncateLabel;
6923
6960
  /**************************************
6924
6961
  * Object/array related checks *
6925
6962
  *************************************/
@@ -6935,7 +6972,7 @@ var tools_Tools;
6935
6972
  function arrayDifferences(oldArray, newArray) {
6936
6973
  var difference = {
6937
6974
  missing: [],
6938
- added: [],
6975
+ added: []
6939
6976
  };
6940
6977
  oldArray.forEach(function (element) {
6941
6978
  if (newArray.indexOf(element) === -1) {
@@ -7022,7 +7059,7 @@ var tools_Tools;
7022
7059
  y0: verticalCoordinates.x0,
7023
7060
  y1: verticalCoordinates.x1,
7024
7061
  x0: verticalCoordinates.y0,
7025
- x1: verticalCoordinates.y1,
7062
+ x1: verticalCoordinates.y1
7026
7063
  };
7027
7064
  }
7028
7065
  return verticalCoordinates;
@@ -7055,6 +7092,14 @@ var en_US_default = /*#__PURE__*/__webpack_require__.n(en_US);
7055
7092
  * User configurable options *
7056
7093
  *****************************
7057
7094
  */
7095
+ /**
7096
+ * Default truncation configuration
7097
+ */
7098
+ var standardTruncationOptions = {
7099
+ type: TruncationTypes.END_LINE,
7100
+ threshold: 16,
7101
+ numCharacter: 14
7102
+ };
7058
7103
  /**
7059
7104
  * Legend options
7060
7105
  */
@@ -7074,7 +7119,8 @@ var legend = {
7074
7119
  checkbox: {
7075
7120
  radius: 6.5,
7076
7121
  spaceAfter: 4
7077
- }
7122
+ },
7123
+ truncation: standardTruncationOptions
7078
7124
  };
7079
7125
  /**
7080
7126
  * Grid options
@@ -7119,16 +7165,20 @@ var barChartTooltip = tools_Tools.merge({}, axisChartTooltip, {
7119
7165
  // and by TwoDimensionalAxes.
7120
7166
  var configuration_axes = {
7121
7167
  top: {
7122
- includeZero: true
7168
+ includeZero: true,
7169
+ truncation: standardTruncationOptions
7123
7170
  },
7124
7171
  bottom: {
7125
- includeZero: true
7172
+ includeZero: true,
7173
+ truncation: standardTruncationOptions
7126
7174
  },
7127
7175
  left: {
7128
- includeZero: true
7176
+ includeZero: true,
7177
+ truncation: standardTruncationOptions
7129
7178
  },
7130
7179
  right: {
7131
- includeZero: true
7180
+ includeZero: true,
7181
+ truncation: standardTruncationOptions
7132
7182
  }
7133
7183
  };
7134
7184
  var timeScale = {
@@ -7161,7 +7211,8 @@ var configuration_chart = {
7161
7211
  },
7162
7212
  data: {
7163
7213
  groupMapsTo: "group",
7164
- loading: false
7214
+ loading: false,
7215
+ selectedGroups: []
7165
7216
  },
7166
7217
  color: {
7167
7218
  scale: null
@@ -7297,7 +7348,11 @@ var gaugeChart = tools_Tools.merge({}, configuration_chart, {
7297
7348
  numberSpacing: 10,
7298
7349
  deltaFontSize: function (radius) { return radius / 8; },
7299
7350
  valueFontSize: function (radius) { return radius / 2.5; },
7300
- numberFormatter: function (number) { return (number.toFixed(2) % 1 !== 0) ? number.toFixed(2).toLocaleString() : number.toFixed().toLocaleString(); }
7351
+ numberFormatter: function (number) {
7352
+ return number.toFixed(2) % 1 !== 0
7353
+ ? number.toFixed(2).toLocaleString()
7354
+ : number.toFixed().toLocaleString();
7355
+ }
7301
7356
  }
7302
7357
  });
7303
7358
  /**
@@ -7724,7 +7779,7 @@ var getColor = function (obj, shade) { return obj[shade]; };
7724
7779
  magenta: function (shade) { return getColor(magenta, shade); },
7725
7780
  purple: function (shade) { return getColor(purple, shade); },
7726
7781
  red: function (shade) { return getColor(red, shade); },
7727
- teal: function (shade) { return getColor(teal, shade); },
7782
+ teal: function (shade) { return getColor(teal, shade); }
7728
7783
  });
7729
7784
  //# sourceMappingURL=../../src/services/colors.js.map
7730
7785
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/services/colorPalettes.js
@@ -7746,7 +7801,7 @@ var WHITE = [
7746
7801
  services_colors.teal(50),
7747
7802
  services_colors.cyan(90),
7748
7803
  "#8a3800",
7749
- services_colors.purple(50),
7804
+ services_colors.purple(50)
7750
7805
  ];
7751
7806
  var DARK = [
7752
7807
  services_colors.purple(60),
@@ -7762,7 +7817,7 @@ var DARK = [
7762
7817
  services_colors.teal(40),
7763
7818
  services_colors.cyan(20),
7764
7819
  "#ba4e00",
7765
- services_colors.purple(30),
7820
+ services_colors.purple(30)
7766
7821
  ];
7767
7822
  var G10 = WHITE;
7768
7823
  var G90 = DARK;
@@ -12134,11 +12189,10 @@ var model_ChartModel = /** @class */ (function () {
12134
12189
  this.colorScale = {};
12135
12190
  this.services = services;
12136
12191
  }
12137
- ChartModel.prototype.getDisplayData = function () {
12192
+ ChartModel.prototype.getAllDataFromDomain = function () {
12138
12193
  if (!this.get("data")) {
12139
12194
  return null;
12140
12195
  }
12141
- var ACTIVE = legend.items.status.ACTIVE;
12142
12196
  var dataGroups = this.getDataGroups();
12143
12197
  // Remove datasets that have been disabled
12144
12198
  var displayData = tools_Tools.clone(this.get("data"));
@@ -12157,12 +12211,26 @@ var model_ChartModel = /** @class */ (function () {
12157
12211
  else {
12158
12212
  var _a = axesOptions[axis].domain, start_1 = _a[0], end_1 = _a[1];
12159
12213
  // Filter out data outside domain
12160
- displayData = displayData.filter(function (datum) { return datum[mapsTo_1] >= start_1 && datum[mapsTo_1] <= end_1; });
12214
+ displayData = displayData.filter(function (datum) {
12215
+ return datum[mapsTo_1] >= start_1 && datum[mapsTo_1] <= end_1;
12216
+ });
12161
12217
  }
12162
12218
  }
12163
12219
  });
12164
12220
  }
12165
12221
  return displayData.filter(function (datum) {
12222
+ return dataGroups.find(function (group) { return group.name === datum[groupMapsTo]; });
12223
+ });
12224
+ };
12225
+ ChartModel.prototype.getDisplayData = function () {
12226
+ if (!this.get("data")) {
12227
+ return null;
12228
+ }
12229
+ var ACTIVE = legend.items.status.ACTIVE;
12230
+ var dataGroups = this.getDataGroups();
12231
+ var groupMapsTo = this.getOptions().data.groupMapsTo;
12232
+ var allDataFromDomain = this.getAllDataFromDomain();
12233
+ return allDataFromDomain.filter(function (datum) {
12166
12234
  var group = dataGroups.find(function (group) { return group.name === datum[groupMapsTo]; });
12167
12235
  return group.status === ACTIVE;
12168
12236
  });
@@ -12225,6 +12293,20 @@ var model_ChartModel = /** @class */ (function () {
12225
12293
  var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
12226
12294
  var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
12227
12295
  var stackKeys = src_map(displayData, function (datum) { return datum[domainIdentifier]; }).keys();
12296
+ var axisPosition = this.services.cartesianScales.domainAxisPosition;
12297
+ var scaleType = options.axes[axisPosition].scaleType;
12298
+ // Sort keys
12299
+ if (scaleType === ScaleTypes.TIME) {
12300
+ stackKeys.sort(function (a, b) {
12301
+ var dateA = new Date(a);
12302
+ var dateB = new Date(b);
12303
+ return dateA - dateB;
12304
+ });
12305
+ }
12306
+ else if (scaleType === ScaleTypes.LOG ||
12307
+ scaleType === ScaleTypes.LINEAR) {
12308
+ stackKeys.sort(function (a, b) { return a - b; });
12309
+ }
12228
12310
  var dataGroupNames = this.getDataGroupNames();
12229
12311
  return stackKeys.map(function (key) {
12230
12312
  var correspondingValues = { sharedStackKey: key };
@@ -12353,6 +12435,19 @@ var model_ChartModel = /** @class */ (function () {
12353
12435
  group.name === changedLabel ? ACTIVE : DISABLED;
12354
12436
  });
12355
12437
  }
12438
+ // Updates selected groups
12439
+ var updatedActiveItems = dataGroups.filter(function (group) { return group.status === ACTIVE; });
12440
+ var options = this.getOptions();
12441
+ var hasUpdatedDeactivatedItems = dataGroups.some(function (group) { return group.status === DISABLED; });
12442
+ // If there are deactivated items, map the item name into selected groups
12443
+ if (hasUpdatedDeactivatedItems) {
12444
+ options.data.selectedGroups = updatedActiveItems.map(function (activeItem) { return activeItem.name; });
12445
+ }
12446
+ else {
12447
+ // If every item is active, clear array
12448
+ options.data.selectedGroups = [];
12449
+ }
12450
+ ;
12356
12451
  // dispatch legend filtering event with the status of all the dataLabels
12357
12452
  this.services.events.dispatchEvent(Events.Legend.ITEMS_UPDATE, {
12358
12453
  dataGroups: dataGroups
@@ -12480,11 +12575,27 @@ var model_ChartModel = /** @class */ (function () {
12480
12575
  };
12481
12576
  ChartModel.prototype.generateDataGroups = function (data) {
12482
12577
  var groupMapsTo = this.getOptions().data.groupMapsTo;
12483
- var ACTIVE = legend.items.status.ACTIVE;
12578
+ var _a = legend.items.status, ACTIVE = _a.ACTIVE, DISABLED = _a.DISABLED;
12579
+ var options = this.getOptions();
12484
12580
  var uniqueDataGroups = src_map(data, function (datum) { return datum[groupMapsTo]; }).keys();
12581
+ // check if selectedGroups can be applied to chart with current data groups
12582
+ if (options.data.selectedGroups.length) {
12583
+ var hasAllSelectedGroups = options.data.selectedGroups
12584
+ .every(function (groupName) { return uniqueDataGroups.includes(groupName); });
12585
+ if (!hasAllSelectedGroups) {
12586
+ options.data.selectedGroups = [];
12587
+ }
12588
+ ;
12589
+ }
12590
+ // Get group status based on items in selected groups
12591
+ var getStatus = function (groupName) {
12592
+ return !options.data.selectedGroups.length || options.data.selectedGroups.includes(groupName)
12593
+ ? ACTIVE
12594
+ : DISABLED;
12595
+ };
12485
12596
  return uniqueDataGroups.map(function (groupName) { return ({
12486
12597
  name: groupName,
12487
- status: ACTIVE
12598
+ status: getStatus(groupName)
12488
12599
  }); });
12489
12600
  };
12490
12601
  /*
@@ -13615,7 +13726,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13615
13726
  }
13616
13727
  var finalDimensions = {
13617
13728
  width: 0,
13618
- height: 0,
13729
+ height: 0
13619
13730
  };
13620
13731
  var validateAndSetDimensions = function (dimensions) {
13621
13732
  if (dimensions) {
@@ -13634,7 +13745,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13634
13745
  };
13635
13746
  var attrDimensions = {
13636
13747
  width: svgSelector.attr("width"),
13637
- height: svgSelector.attr("height"),
13748
+ height: svgSelector.attr("height")
13638
13749
  };
13639
13750
  var bbox, bboxDimensions, boundingRect, boundingRectDimensions;
13640
13751
  // In many versions of Firefox
@@ -13643,7 +13754,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13643
13754
  bbox = svgSelector.node().getBBox();
13644
13755
  bboxDimensions = {
13645
13756
  width: bbox.width,
13646
- height: bbox.height,
13757
+ height: bbox.height
13647
13758
  };
13648
13759
  }
13649
13760
  catch (e) { }
@@ -13651,13 +13762,13 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13651
13762
  boundingRect = svgSelector.node().getBoundingClientRect();
13652
13763
  boundingRectDimensions = {
13653
13764
  width: boundingRect.width,
13654
- height: boundingRect.height,
13765
+ height: boundingRect.height
13655
13766
  };
13656
13767
  }
13657
13768
  catch (e) { }
13658
13769
  var clientDimensions = {
13659
13770
  width: svgSelector.node().clientWidth,
13660
- height: svgSelector.node().clientHeight,
13771
+ height: svgSelector.node().clientHeight
13661
13772
  };
13662
13773
  // If both attribute values are numbers
13663
13774
  // And not percentages or NaN
@@ -13690,7 +13801,7 @@ var dom_utils_DOMUtils = /** @class */ (function (_super) {
13690
13801
  try {
13691
13802
  var nativeDimensions = {
13692
13803
  width: tools_Tools.getProperty(svgSelector.node(), "width", "baseVal", "value"),
13693
- height: tools_Tools.getProperty(svgSelector.node(), "height", "baseVal", "value"),
13804
+ height: tools_Tools.getProperty(svgSelector.node(), "height", "baseVal", "value")
13694
13805
  };
13695
13806
  validateAndSetDimensions(nativeDimensions);
13696
13807
  }
@@ -13845,7 +13956,7 @@ var events_Events = /** @class */ (function (_super) {
13845
13956
  var newEvent;
13846
13957
  if (eventDetail) {
13847
13958
  newEvent = new CustomEvent(eventType, {
13848
- detail: eventDetail,
13959
+ detail: eventDetail
13849
13960
  });
13850
13961
  }
13851
13962
  else {
@@ -16388,13 +16499,13 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16388
16499
  top: null,
16389
16500
  right: null,
16390
16501
  bottom: null,
16391
- left: null,
16502
+ left: null
16392
16503
  };
16393
16504
  _this.scales = {
16394
16505
  top: null,
16395
16506
  right: null,
16396
16507
  bottom: null,
16397
- left: null,
16508
+ left: null
16398
16509
  };
16399
16510
  return _this;
16400
16511
  }
@@ -16454,7 +16565,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16454
16565
  CartesianScales.prototype.getMainXAxisPosition = function () {
16455
16566
  var possibleXAxisPositions = [
16456
16567
  AxisPositions.BOTTOM,
16457
- AxisPositions.TOP,
16568
+ AxisPositions.TOP
16458
16569
  ];
16459
16570
  return [this.domainAxisPosition, this.rangeAxisPosition].find(function (position) { return possibleXAxisPositions.indexOf(position) > -1; });
16460
16571
  };
@@ -16462,7 +16573,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16462
16573
  CartesianScales.prototype.getMainYAxisPosition = function () {
16463
16574
  var possibleYAxisPositions = [
16464
16575
  AxisPositions.LEFT,
16465
- AxisPositions.RIGHT,
16576
+ AxisPositions.RIGHT
16466
16577
  ];
16467
16578
  return [this.domainAxisPosition, this.rangeAxisPosition].find(function (position) { return possibleYAxisPositions.indexOf(position) > -1; });
16468
16579
  };
@@ -16562,7 +16673,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16562
16673
  var mainHorizontalScaleType = mainHorizontalAxisOptions.scaleType || ScaleTypes.LINEAR;
16563
16674
  var result = {
16564
16675
  domainAxisPosition: null,
16565
- rangeAxisPosition: null,
16676
+ rangeAxisPosition: null
16566
16677
  };
16567
16678
  if (mainHorizontalScaleType === ScaleTypes.LABELS ||
16568
16679
  mainHorizontalScaleType === ScaleTypes.TIME) {
@@ -16668,7 +16779,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16668
16779
  }
16669
16780
  return {
16670
16781
  threshold: highestThreshold,
16671
- scaleValue: domainScale(highestThreshold.value),
16782
+ scaleValue: domainScale(highestThreshold.value)
16672
16783
  };
16673
16784
  };
16674
16785
  CartesianScales.prototype.getHighestRangeThreshold = function () {
@@ -16683,7 +16794,7 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
16683
16794
  var highestThreshold = thresholds.sort(function (a, b) { return b.value - a.value; })[0];
16684
16795
  return {
16685
16796
  threshold: highestThreshold,
16686
- scaleValue: rangeScale(highestThreshold.value),
16797
+ scaleValue: rangeScale(highestThreshold.value)
16687
16798
  };
16688
16799
  };
16689
16800
  return CartesianScales;
@@ -16695,49 +16806,49 @@ function addSpacingToTimeDomain(domain, spaceToAddToEdges) {
16695
16806
  if (differenceInYears(endDate, startDate) > 1) {
16696
16807
  return [
16697
16808
  subYears(startDate, spaceToAddToEdges),
16698
- addYears(endDate, spaceToAddToEdges),
16809
+ addYears(endDate, spaceToAddToEdges)
16699
16810
  ];
16700
16811
  }
16701
16812
  if (differenceInMonths(endDate, startDate) > 1) {
16702
16813
  return [
16703
16814
  subMonths(startDate, spaceToAddToEdges),
16704
- addMonths(endDate, spaceToAddToEdges),
16815
+ addMonths(endDate, spaceToAddToEdges)
16705
16816
  ];
16706
16817
  }
16707
16818
  if (differenceInDays(endDate, startDate) > 1) {
16708
16819
  return [
16709
16820
  subDays(startDate, spaceToAddToEdges),
16710
- addDays(endDate, spaceToAddToEdges),
16821
+ addDays(endDate, spaceToAddToEdges)
16711
16822
  ];
16712
16823
  }
16713
16824
  if (differenceInHours(endDate, startDate) > 1) {
16714
16825
  return [
16715
16826
  subHours(startDate, spaceToAddToEdges),
16716
- addHours(endDate, spaceToAddToEdges),
16827
+ addHours(endDate, spaceToAddToEdges)
16717
16828
  ];
16718
16829
  }
16719
16830
  if (differenceInMinutes(endDate, startDate) > 30) {
16720
16831
  return [
16721
16832
  subMinutes(startDate, spaceToAddToEdges * 30),
16722
- addMinutes(endDate, spaceToAddToEdges * 30),
16833
+ addMinutes(endDate, spaceToAddToEdges * 30)
16723
16834
  ];
16724
16835
  }
16725
16836
  if (differenceInMinutes(endDate, startDate) > 1) {
16726
16837
  return [
16727
16838
  subMinutes(startDate, spaceToAddToEdges),
16728
- addMinutes(endDate, spaceToAddToEdges),
16839
+ addMinutes(endDate, spaceToAddToEdges)
16729
16840
  ];
16730
16841
  }
16731
16842
  if (differenceInSeconds(endDate, startDate) > 15) {
16732
16843
  return [
16733
16844
  subSeconds(startDate, spaceToAddToEdges * 15),
16734
- addSeconds(endDate, spaceToAddToEdges * 15),
16845
+ addSeconds(endDate, spaceToAddToEdges * 15)
16735
16846
  ];
16736
16847
  }
16737
16848
  if (differenceInSeconds(endDate, startDate) > 1) {
16738
16849
  return [
16739
16850
  subSeconds(startDate, spaceToAddToEdges),
16740
- addSeconds(endDate, spaceToAddToEdges),
16851
+ addSeconds(endDate, spaceToAddToEdges)
16741
16852
  ];
16742
16853
  }
16743
16854
  return [startDate, endDate];
@@ -17718,7 +17829,7 @@ var curves_Curves = /** @class */ (function (_super) {
17718
17829
  curveNatural: natural,
17719
17830
  curveStep: curve_step,
17720
17831
  curveStepAfter: stepAfter,
17721
- curveStepBefore: stepBefore,
17832
+ curveStepBefore: stepBefore
17722
17833
  };
17723
17834
  return _this;
17724
17835
  }
@@ -17859,6 +17970,7 @@ var legend_Legend = /** @class */ (function (_super) {
17859
17970
  var _this = this;
17860
17971
  var svg = this.getContainerSVG().attr("role", Roles.GRAPHICS_DOCUMENT);
17861
17972
  var options = this.model.getOptions();
17973
+ var legendOptions = tools_Tools.getProperty(options, "legend");
17862
17974
  var legendItems = svg
17863
17975
  .selectAll("g.legend-item")
17864
17976
  .data(this.model.getDataGroups(), function (dataGroup) { return dataGroup.name; });
@@ -17866,9 +17978,17 @@ var legend_Legend = /** @class */ (function (_super) {
17866
17978
  var addedLegendItems = legendItems
17867
17979
  .enter()
17868
17980
  .append("g")
17869
- .classed("legend-item", true);
17981
+ .classed("legend-item", true)
17982
+ .classed("active", function (d, i) {
17983
+ return d.status === options.legend.items.status.ACTIVE;
17984
+ });
17870
17985
  // Configs
17871
17986
  var checkboxRadius = options.legend.checkbox.radius;
17987
+ // Truncation
17988
+ // get user provided custom values for truncation
17989
+ var truncationType = tools_Tools.getProperty(legendOptions, "truncation", "type");
17990
+ var truncationThreshold = tools_Tools.getProperty(legendOptions, "truncation", "threshold");
17991
+ var truncationNumCharacter = tools_Tools.getProperty(legendOptions, "truncation", "numCharacter");
17872
17992
  addedLegendItems
17873
17993
  .append("rect")
17874
17994
  .classed("checkbox", true)
@@ -17885,11 +18005,23 @@ var legend_Legend = /** @class */ (function (_super) {
17885
18005
  .classed("active", function (d, i) {
17886
18006
  return d.status === options.legend.items.status.ACTIVE;
17887
18007
  });
17888
- addedLegendItems
18008
+ var addedLegendItemsText = addedLegendItems
17889
18009
  .append("text")
17890
- .merge(legendItems.select("text"))
17891
- .html(function (d) { return d.name; })
17892
- .attr("alignment-baseline", "middle");
18010
+ .merge(legendItems.select("text"));
18011
+ // truncate the legend label if it's too long
18012
+ if (truncationType !== TruncationTypes.NONE) {
18013
+ addedLegendItemsText.html(function (d) {
18014
+ if (d.name.length > truncationThreshold) {
18015
+ return tools_Tools.truncateLabel(d.name, truncationType, truncationNumCharacter);
18016
+ }
18017
+ else {
18018
+ return d.name;
18019
+ }
18020
+ });
18021
+ }
18022
+ else {
18023
+ addedLegendItemsText.html(function (d) { return d.name; });
18024
+ }
17893
18025
  this.breakItemsIntoLines(addedLegendItems);
17894
18026
  // Remove old elements as needed.
17895
18027
  legendItems
@@ -17968,11 +18100,19 @@ var legend_Legend = /** @class */ (function (_super) {
17968
18100
  legendItem
17969
18101
  .select("text")
17970
18102
  .attr("x", startingPoint + spaceNeededForCheckbox)
17971
- .attr("y", yOffset + yPosition);
18103
+ .attr("y", yOffset + yPosition + 3);
17972
18104
  lastYPosition = yPosition;
18105
+ // Test if legendItems are placed in the correct direction
18106
+ var testHorizontal = (!legendOrientation ||
18107
+ legendOrientation === LegendOrientations.HORIZONTAL) &&
18108
+ legendItem.select("rect.checkbox").attr("y") === '0';
18109
+ var testVertical = legendOrientation === LegendOrientations.VERTICAL &&
18110
+ legendItem.select("rect.checkbox").attr("x") === '0';
18111
+ var hasCorrectLegendDirection = testHorizontal || testVertical;
17973
18112
  // Render checkbox check icon
17974
18113
  if (hasDeactivatedItems &&
17975
- legendItem.select("g.check").empty()) {
18114
+ legendItem.select("g.check").empty() &&
18115
+ hasCorrectLegendDirection) {
17976
18116
  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");
17977
18117
  legendItem
17978
18118
  .select("g.check svg")
@@ -17992,10 +18132,12 @@ var legend_Legend = /** @class */ (function (_super) {
17992
18132
  var self = this;
17993
18133
  var svg = this.getContainerSVG();
17994
18134
  var options = this.model.getOptions();
18135
+ var legendOptions = tools_Tools.getProperty(options, "legend");
18136
+ var truncationThreshold = tools_Tools.getProperty(legendOptions, "truncation", "threshold");
17995
18137
  svg.selectAll("g.legend-item")
17996
18138
  .on("mouseover", function () {
17997
18139
  self.services.events.dispatchEvent(Events.Legend.ITEM_HOVER, {
17998
- hoveredElement: src_select(this),
18140
+ hoveredElement: src_select(this)
17999
18141
  });
18000
18142
  // Configs
18001
18143
  var checkboxRadius = options.legend.checkbox.radius;
@@ -18013,17 +18155,28 @@ var legend_Legend = /** @class */ (function (_super) {
18013
18155
  })
18014
18156
  .on("click", function () {
18015
18157
  self.services.events.dispatchEvent(Events.Legend.ITEM_CLICK, {
18016
- clickedElement: src_select(this),
18158
+ clickedElement: src_select(this)
18017
18159
  });
18018
18160
  var clickedItem = src_select(this);
18019
18161
  var clickedItemData = clickedItem.datum();
18020
18162
  self.model.toggleDataLabel(clickedItemData.name);
18163
+ })
18164
+ .on("mousemove", function () {
18165
+ var hoveredItem = src_select(this);
18166
+ var hoveredItemData = hoveredItem.datum();
18167
+ if (hoveredItemData.name.length > truncationThreshold) {
18168
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
18169
+ hoveredElement: hoveredItem,
18170
+ type: TooltipTypes.LEGEND
18171
+ });
18172
+ }
18021
18173
  })
18022
18174
  .on("mouseout", function () {
18023
18175
  var hoveredItem = src_select(this);
18024
18176
  hoveredItem.select("rect.hover-stroke").remove();
18177
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
18025
18178
  self.services.events.dispatchEvent(Events.Legend.ITEM_MOUSEOUT, {
18026
- hoveredElement: hoveredItem,
18179
+ hoveredElement: hoveredItem
18027
18180
  });
18028
18181
  });
18029
18182
  };
@@ -20597,7 +20750,7 @@ var TIME_INTERVALS = [
20597
20750
  ["daily", 24 * 60 * 60 * 1000],
20598
20751
  ["monthly", 30 * 24 * 60 * 60 * 1000],
20599
20752
  ["quarterly", 3 * 30 * 24 * 60 * 60 * 1000],
20600
- ["yearly", 12 * 30 * 24 * 60 * 60 * 1000],
20753
+ ["yearly", 12 * 30 * 24 * 60 * 60 * 1000]
20601
20754
  ];
20602
20755
  // Return true if the tick is a primary tick, false otherwise
20603
20756
  function isTickPrimary(tick, i, interval, showDayName) {
@@ -20667,7 +20820,7 @@ function getTimeformats(timestamp) {
20667
20820
  d: date.getDate(),
20668
20821
  H: date.getHours(),
20669
20822
  m: date.getMinutes(),
20670
- s: date.getSeconds(),
20823
+ s: date.getSeconds() // seconds: 0-59
20671
20824
  };
20672
20825
  }
20673
20826
  // Find the differences between consecutive numbers in an array
@@ -20823,7 +20976,7 @@ var threshold_Threshold = /** @class */ (function (_super) {
20823
20976
  if (scaleType === ScaleTypes.TIME) {
20824
20977
  var isVertical = [
20825
20978
  AxisPositions.LEFT,
20826
- AxisPositions.RIGHT,
20979
+ AxisPositions.RIGHT
20827
20980
  ].includes(axisPosition);
20828
20981
  var mainXScale = this.services.cartesianScales.getMainXScale();
20829
20982
  var mainYScale = this.services.cartesianScales.getMainYScale();
@@ -20854,20 +21007,20 @@ var threshold_Threshold = /** @class */ (function (_super) {
20854
21007
  // Find out whether threshold label should be shown on the left or right side
20855
21008
  var bestPlacementOption = this.positionService.findBestPlacementAt({
20856
21009
  left: mouseRelativePos[0],
20857
- top: mouseRelativePos[1],
21010
+ top: mouseRelativePos[1]
20858
21011
  }, target, [
20859
21012
  PLACEMENTS.RIGHT,
20860
21013
  PLACEMENTS.LEFT,
20861
21014
  PLACEMENTS.TOP,
20862
- PLACEMENTS.BOTTOM,
21015
+ PLACEMENTS.BOTTOM
20863
21016
  ], function () { return ({
20864
21017
  width: holder.offsetWidth,
20865
- height: holder.offsetHeight,
21018
+ height: holder.offsetHeight
20866
21019
  }); });
20867
21020
  // Get coordinates to where label should be positioned
20868
21021
  var pos = this.positionService.findPositionAt({
20869
21022
  left: mouseRelativePos[0],
20870
- top: mouseRelativePos[1],
21023
+ top: mouseRelativePos[1]
20871
21024
  }, target, bestPlacementOption);
20872
21025
  this.positionService.setElement(target, pos);
20873
21026
  };
@@ -20878,13 +21031,13 @@ var threshold_Threshold = /** @class */ (function (_super) {
20878
21031
  .on("mouseover mousemove", function () {
20879
21032
  self.threshold.classed("active", true);
20880
21033
  self.services.events.dispatchEvent(Events.Threshold.SHOW, {
20881
- hoveredElement: src_select(self.threshold),
21034
+ hoveredElement: src_select(self.threshold)
20882
21035
  });
20883
21036
  })
20884
21037
  .on("mouseout", function () {
20885
21038
  self.threshold.classed("active", false);
20886
21039
  self.services.events.dispatchEvent(Events.Threshold.HIDE, {
20887
- hoveredElement: src_select(self.threshold),
21040
+ hoveredElement: src_select(self.threshold)
20888
21041
  });
20889
21042
  });
20890
21043
  };
@@ -20952,12 +21105,12 @@ var title_Title = /** @class */ (function (_super) {
20952
21105
  .on("mouseenter", function () {
20953
21106
  self_1.services.events.dispatchEvent(Events.Tooltip.SHOW, {
20954
21107
  hoveredElement: title,
20955
- type: TooltipTypes.TITLE,
21108
+ type: TooltipTypes.TITLE
20956
21109
  });
20957
21110
  })
20958
21111
  .on("mouseout", function () {
20959
21112
  self_1.services.events.dispatchEvent(Events.Tooltip.HIDE, {
20960
- hoveredElement: title,
21113
+ hoveredElement: title
20961
21114
  });
20962
21115
  });
20963
21116
  }
@@ -21043,17 +21196,19 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21043
21196
  if ((e.detail.type === TooltipTypes.DATAPOINT &&
21044
21197
  tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "datapoint", "enabled")) ||
21045
21198
  (e.detail.type === TooltipTypes.GRIDLINE &&
21046
- tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled"))) {
21199
+ tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled")) ||
21200
+ e.detail.type === TooltipTypes.LEGEND ||
21201
+ e.detail.type === TooltipTypes.AXISLABEL) {
21047
21202
  var data = src_select(on_event.target).datum();
21048
21203
  // Generate default tooltip
21049
21204
  var defaultHTML = void 0;
21050
21205
  if (e.detail.multidata) {
21051
21206
  // multi tooltip
21052
21207
  data = e.detail.multidata;
21053
- defaultHTML = _this.getMultilineTooltipHTML(data);
21208
+ defaultHTML = _this.getMultilineTooltipHTML(data, e.detail.type);
21054
21209
  }
21055
21210
  else {
21056
- defaultHTML = _this.getTooltipHTML(data, TooltipTypes.DATAPOINT);
21211
+ defaultHTML = _this.getTooltipHTML(data, e.detail.type);
21057
21212
  }
21058
21213
  // if there is a provided tooltip HTML function call it
21059
21214
  if (tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "customHTML")) {
@@ -21075,7 +21230,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21075
21230
  _this.tooltip.style("max-width", chartWidth);
21076
21231
  tooltipTextContainer.html(_this.getTooltipHTML(e.detail.hoveredElement, TooltipTypes.TITLE));
21077
21232
  // get the position based on the title positioning (static)
21078
- var position = _this.getTooltipPosition(e.detail.hoveredElement.node());
21233
+ var position = _this.getTooltipPosition(e.detail.hoveredElement.node(), e.detail.type);
21079
21234
  _this.positionTooltip(position);
21080
21235
  }
21081
21236
  // Fade in
@@ -21092,6 +21247,9 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21092
21247
  var title = this.model.getOptions().title;
21093
21248
  return "<div class=\"title-tooltip\"><text>" + title + "</text></div>";
21094
21249
  }
21250
+ else if (type === TooltipTypes.LEGEND) {
21251
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + data.name + "</p></div>";
21252
+ }
21095
21253
  // this cleans up the data item, pie slices have the data within the data.data but other datapoints are self contained within data
21096
21254
  var dataVal = tools_Tools.getProperty(data, "data") ? data.data : data;
21097
21255
  var groupMapsTo = this.model.getOptions().data.groupMapsTo;
@@ -21106,7 +21264,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21106
21264
  var label = dataVal[groupMapsTo];
21107
21265
  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>";
21108
21266
  };
21109
- Tooltip.prototype.getMultilineTooltipHTML = function (data) {
21267
+ Tooltip.prototype.getMultilineTooltipHTML = function (data, type) {
21110
21268
  var _this = this;
21111
21269
  // sort them so they are in the same order as the graph
21112
21270
  data.sort(function (a, b) { return b.value - a.value; });
@@ -21133,7 +21291,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21133
21291
  this.tooltip.classed("hidden", true);
21134
21292
  };
21135
21293
  // returns static position based on the element
21136
- Tooltip.prototype.getTooltipPosition = function (hoveredElement) {
21294
+ Tooltip.prototype.getTooltipPosition = function (hoveredElement, type) {
21137
21295
  var holderPosition = src_select(this.services.domUtils.getHolder())
21138
21296
  .node()
21139
21297
  .getBoundingClientRect();
@@ -21144,7 +21302,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21144
21302
  left: elementPosition.left -
21145
21303
  holderPosition.left +
21146
21304
  elementPosition.width / 2,
21147
- top: elementPosition.top - holderPosition.top - verticalOffset,
21305
+ top: elementPosition.top - holderPosition.top - verticalOffset
21148
21306
  };
21149
21307
  return { placement: TooltipPosition.BOTTOM, position: tooltipPos };
21150
21308
  };
@@ -21165,15 +21323,15 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21165
21323
  // Find out whether tooltip should be shown on the left or right side
21166
21324
  var bestPlacementOption = this.positionService.findBestPlacementAt({
21167
21325
  left: mouseRelativePos[0],
21168
- top: mouseRelativePos[1],
21326
+ top: mouseRelativePos[1]
21169
21327
  }, target, [
21170
21328
  PLACEMENTS.RIGHT,
21171
21329
  PLACEMENTS.LEFT,
21172
21330
  PLACEMENTS.TOP,
21173
- PLACEMENTS.BOTTOM,
21331
+ PLACEMENTS.BOTTOM
21174
21332
  ], function () { return ({
21175
21333
  width: holder.offsetWidth,
21176
- height: holder.offsetHeight,
21334
+ height: holder.offsetHeight
21177
21335
  }); });
21178
21336
  var horizontalOffset = this.model.getOptions().tooltip.datapoint.horizontalOffset;
21179
21337
  if (bestPlacementOption === PLACEMENTS.LEFT) {
@@ -21182,7 +21340,7 @@ var tooltip_Tooltip = /** @class */ (function (_super) {
21182
21340
  // Get coordinates to where tooltip should be positioned
21183
21341
  pos = this.positionService.findPositionAt({
21184
21342
  left: mouseRelativePos[0] + horizontalOffset,
21185
- top: mouseRelativePos[1],
21343
+ top: mouseRelativePos[1]
21186
21344
  }, target, bestPlacementOption);
21187
21345
  }
21188
21346
  this.positionService.setElement(target, pos);
@@ -21233,7 +21391,9 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21233
21391
  if ((e.detail.type === TooltipTypes.DATAPOINT &&
21234
21392
  tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "datapoint", "enabled")) ||
21235
21393
  (e.detail.type === TooltipTypes.GRIDLINE &&
21236
- tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled"))) {
21394
+ tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "gridline", "enabled")) ||
21395
+ e.detail.type === TooltipTypes.LEGEND ||
21396
+ e.detail.type === TooltipTypes.AXISLABEL) {
21237
21397
  var data = e.detail.hoveredElement.datum();
21238
21398
  var hoveredElement = e.detail.hoveredElement.node();
21239
21399
  var defaultHTML = void 0;
@@ -21249,7 +21409,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21249
21409
  else {
21250
21410
  data = e.detail.hoveredElement.datum();
21251
21411
  }
21252
- defaultHTML = _this.getTooltipHTML(data);
21412
+ defaultHTML = _this.getTooltipHTML(data, e.detail.type);
21253
21413
  }
21254
21414
  // if there is a provided tooltip HTML function call it and pass the defaultHTML
21255
21415
  if (tools_Tools.getProperty(_this.model.getOptions(), "tooltip", "customHTML")) {
@@ -21261,9 +21421,15 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21261
21421
  // default tooltip
21262
21422
  tooltipTextContainer.html(defaultHTML);
21263
21423
  }
21264
- var position = _this.getTooltipPosition(hoveredElement, data);
21265
- // Position the tooltip relative to the bars
21266
- _this.positionTooltip(e.detail.multidata ? undefined : position);
21424
+ if (e.detail.type === TooltipTypes.LEGEND ||
21425
+ e.detail.type === TooltipTypes.AXISLABEL) {
21426
+ _this.positionTooltip();
21427
+ }
21428
+ else {
21429
+ var position = _this.getTooltipPosition(hoveredElement, data);
21430
+ // Position the tooltip relative to the bars
21431
+ _this.positionTooltip(e.detail.multidata ? undefined : position);
21432
+ }
21267
21433
  }
21268
21434
  else if (e.detail.type === TooltipTypes.TITLE) {
21269
21435
  // use the chart size to enforce a max width on the tooltip
@@ -21275,7 +21441,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21275
21441
  // use tooltip.ts to get the tooltip html for titles
21276
21442
  tooltipTextContainer.html(_super.prototype.getTooltipHTML.call(_this, e.detail.hoveredElement, TooltipTypes.TITLE));
21277
21443
  // get the position based on the title positioning (static)
21278
- var position = _super.prototype.getTooltipPosition.call(_this, e.detail.hoveredElement.node());
21444
+ var position = _super.prototype.getTooltipPosition.call(_this, e.detail.hoveredElement.node(), e.detail.type);
21279
21445
  _this.positionTooltip(position);
21280
21446
  }
21281
21447
  // Fade in
@@ -21307,7 +21473,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21307
21473
  left: barPosition.left -
21308
21474
  holderPosition.left +
21309
21475
  barPosition.width / 2,
21310
- top: barPosition.bottom - holderPosition.top + verticalOffset,
21476
+ top: barPosition.bottom - holderPosition.top + verticalOffset
21311
21477
  };
21312
21478
  return { placement: TooltipPosition.BOTTOM, position: tooltipPos };
21313
21479
  }
@@ -21317,7 +21483,7 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21317
21483
  left: barPosition.left -
21318
21484
  holderPosition.left +
21319
21485
  barPosition.width / 2,
21320
- top: barPosition.top - holderPosition.top - verticalOffset,
21486
+ top: barPosition.top - holderPosition.top - verticalOffset
21321
21487
  };
21322
21488
  return { placement: TooltipPosition.TOP, position: tooltipPos };
21323
21489
  }
@@ -21326,7 +21492,13 @@ var tooltip_bar_TooltipBar = /** @class */ (function (_super) {
21326
21492
  * Returns the html for the bar single point tooltip
21327
21493
  * @param data associated values for the hovered bar
21328
21494
  */
21329
- TooltipBar.prototype.getTooltipHTML = function (data) {
21495
+ TooltipBar.prototype.getTooltipHTML = function (data, type) {
21496
+ if (type === TooltipTypes.LEGEND) {
21497
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + data.name + "</p></div>";
21498
+ }
21499
+ else if (type === TooltipTypes.AXISLABEL) {
21500
+ return "<div class=\"axis-tooltip\"><p class=\"label\">" + data + "</p></div>";
21501
+ }
21330
21502
  var formattedValue = tools_Tools.getProperty(this.model.getOptions(), "tooltip", "valueFormatter")
21331
21503
  ? this.model.getOptions().tooltip.valueFormatter(data.value)
21332
21504
  : data.value.toLocaleString("en");
@@ -21399,6 +21571,9 @@ var tooltip_pie_TooltipPie = /** @class */ (function (_super) {
21399
21571
  var title = this.model.getOptions().title;
21400
21572
  return "<div class=\"title-tooltip\"><text>" + title + "</text></div>";
21401
21573
  }
21574
+ else if (type === TooltipTypes.LEGEND) {
21575
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + d.name + "</p></div>";
21576
+ }
21402
21577
  var dataVal = d.data;
21403
21578
  var groupMapsTo = this.model.getOptions().data.groupMapsTo;
21404
21579
  // format the value if needed
@@ -21440,6 +21615,12 @@ var tooltip_scatter_TooltipScatter = /** @class */ (function (_super) {
21440
21615
  // the main tooltip component handles title styles
21441
21616
  return _super.prototype.getTooltipHTML.call(this, datum, type);
21442
21617
  }
21618
+ else if (type === TooltipTypes.LEGEND) {
21619
+ return "<div class=\"legend-tooltip\"><p class=\"label\">" + datum.name + "</p></div>";
21620
+ }
21621
+ else if (type === TooltipTypes.AXISLABEL) {
21622
+ return "<div class=\"axis-tooltip\"><p class=\"label\">" + datum + "</p></div>";
21623
+ }
21443
21624
  var groupMapsTo = this.model.getOptions().data.groupMapsTo;
21444
21625
  var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
21445
21626
  var userProvidedValueFormatter = tools_Tools.getProperty(this.model.getOptions(), "tooltip", "valueFormatter");
@@ -21475,7 +21656,7 @@ var tooltip_radar_TooltipRadar = /** @class */ (function (_super) {
21475
21656
  function TooltipRadar() {
21476
21657
  return _super !== null && _super.apply(this, arguments) || this;
21477
21658
  }
21478
- TooltipRadar.prototype.getMultilineTooltipHTML = function (data) {
21659
+ TooltipRadar.prototype.getMultilineTooltipHTML = function (data, type) {
21479
21660
  var _this = this;
21480
21661
  var options = this.model.getOptions();
21481
21662
  var groupMapsTo = options.data.groupMapsTo;
@@ -21949,11 +22130,13 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
21949
22130
  _this.type = "area-stacked";
21950
22131
  _this.handleLegendOnHover = function (event) {
21951
22132
  var hoveredElement = event.detail.hoveredElement;
22133
+ var options = _this.model.getOptions();
22134
+ var groupMapsTo = options.data.groupMapsTo;
21952
22135
  _this.parent
21953
22136
  .selectAll("path.area")
21954
22137
  .transition(_this.services.transitions.getTransition("legend-hover-area"))
21955
22138
  .attr("opacity", function (d) {
21956
- if (d[0].group !== hoveredElement.datum().name) {
22139
+ if (d[0][groupMapsTo] !== hoveredElement.datum().name) {
21957
22140
  return configuration_area.opacity.unselected;
21958
22141
  }
21959
22142
  return configuration_area.opacity.selected;
@@ -21979,6 +22162,7 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
21979
22162
  var svg = this.getContainerSVG();
21980
22163
  var self = this;
21981
22164
  var options = this.model.getOptions();
22165
+ var groupMapsTo = options.data.groupMapsTo;
21982
22166
  var mainXScale = this.services.cartesianScales.getMainXScale();
21983
22167
  var mainYScale = this.services.cartesianScales.getMainYScale();
21984
22168
  var domainAxisPosition = this.services.cartesianScales.getDomainAxisPosition();
@@ -21987,13 +22171,11 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
21987
22171
  if (!isTimeSeries) {
21988
22172
  return;
21989
22173
  }
21990
- var percentage = Object.keys(options.axes).some(function (axis) {
21991
- return options.axes[axis].percentage;
21992
- });
22174
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
21993
22175
  var stackedData = this.model.getStackedData({ percentage: percentage });
21994
22176
  var areas = svg
21995
22177
  .selectAll("path.area")
21996
- .data(stackedData, function (d) { return d[0].group; });
22178
+ .data(stackedData, function (d) { return d[0][groupMapsTo]; });
21997
22179
  // D3 area generator function
21998
22180
  this.areaGenerator = src_area()
21999
22181
  // @ts-ignore
@@ -22005,8 +22187,8 @@ var area_stacked_StackedArea = /** @class */ (function (_super) {
22005
22187
  var enteringAreas = areas.enter().append("path").attr("opacity", 0);
22006
22188
  enteringAreas
22007
22189
  .merge(areas)
22008
- .data(stackedData, function (d) { return d[0].group; })
22009
- .attr("fill", function (d) { return self.model.getFillColor(d[0].group); })
22190
+ .data(stackedData, function (d) { return d[0][groupMapsTo]; })
22191
+ .attr("fill", function (d) { return self.model.getFillColor(d[0][groupMapsTo]); })
22010
22192
  .attr("role", Roles.GRAPHICS_SYMBOL)
22011
22193
  .attr("aria-roledescription", "area")
22012
22194
  .transition(this.services.transitions.getTransition("area-update-enter", animate))
@@ -22173,25 +22355,25 @@ var bar_simple_SimpleBar = /** @class */ (function (_super) {
22173
22355
  // Dispatch mouse event
22174
22356
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {
22175
22357
  element: hoveredElement,
22176
- datum: datum,
22358
+ datum: datum
22177
22359
  });
22178
22360
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22179
22361
  hoveredElement: hoveredElement,
22180
- type: TooltipTypes.DATAPOINT,
22362
+ type: TooltipTypes.DATAPOINT
22181
22363
  });
22182
22364
  })
22183
22365
  .on("mousemove", function (datum) {
22184
22366
  // Dispatch mouse event
22185
22367
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEMOVE, {
22186
22368
  element: src_select(this),
22187
- datum: datum,
22369
+ datum: datum
22188
22370
  });
22189
22371
  })
22190
22372
  .on("click", function (datum) {
22191
22373
  // Dispatch mouse event
22192
22374
  self.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {
22193
22375
  element: src_select(this),
22194
- datum: datum,
22376
+ datum: datum
22195
22377
  });
22196
22378
  })
22197
22379
  .on("mouseout", function (datum) {
@@ -22205,11 +22387,11 @@ var bar_simple_SimpleBar = /** @class */ (function (_super) {
22205
22387
  // Dispatch mouse event
22206
22388
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {
22207
22389
  element: hoveredElement,
22208
- datum: datum,
22390
+ datum: datum
22209
22391
  });
22210
22392
  // Hide tooltip
22211
22393
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22212
- hoveredElement: hoveredElement,
22394
+ hoveredElement: hoveredElement
22213
22395
  });
22214
22396
  });
22215
22397
  };
@@ -22379,26 +22561,26 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
22379
22561
  // Dispatch mouse event
22380
22562
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {
22381
22563
  element: hoveredElement,
22382
- datum: datum,
22564
+ datum: datum
22383
22565
  });
22384
22566
  // Show tooltip
22385
22567
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22386
22568
  hoveredElement: hoveredElement,
22387
- type: TooltipTypes.DATAPOINT,
22569
+ type: TooltipTypes.DATAPOINT
22388
22570
  });
22389
22571
  })
22390
22572
  .on("mousemove", function (datum) {
22391
22573
  // Dispatch mouse event
22392
22574
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEMOVE, {
22393
22575
  element: src_select(this),
22394
- datum: datum,
22576
+ datum: datum
22395
22577
  });
22396
22578
  })
22397
22579
  .on("click", function (datum) {
22398
22580
  // Dispatch mouse event
22399
22581
  self.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {
22400
22582
  element: src_select(this),
22401
- datum: datum,
22583
+ datum: datum
22402
22584
  });
22403
22585
  })
22404
22586
  .on("mouseout", function (datum) {
@@ -22413,11 +22595,11 @@ var bar_grouped_GroupedBar = /** @class */ (function (_super) {
22413
22595
  // Dispatch mouse event
22414
22596
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {
22415
22597
  element: hoveredElement,
22416
- datum: datum,
22598
+ datum: datum
22417
22599
  });
22418
22600
  // Hide tooltip
22419
22601
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22420
- hoveredElement: hoveredElement,
22602
+ hoveredElement: hoveredElement
22421
22603
  });
22422
22604
  });
22423
22605
  };
@@ -22628,7 +22810,7 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
22628
22810
  // Dispatch mouse event
22629
22811
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOVER, {
22630
22812
  element: hoveredElement,
22631
- datum: datum,
22813
+ datum: datum
22632
22814
  });
22633
22815
  })
22634
22816
  .on("mousemove", function (datum) {
@@ -22655,14 +22837,14 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
22655
22837
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22656
22838
  hoveredElement: hoveredElement,
22657
22839
  data: matchingDataPoint,
22658
- type: TooltipTypes.DATAPOINT,
22840
+ type: TooltipTypes.DATAPOINT
22659
22841
  });
22660
22842
  })
22661
22843
  .on("click", function (datum) {
22662
22844
  // Dispatch mouse event
22663
22845
  self.services.events.dispatchEvent(Events.Bar.BAR_CLICK, {
22664
22846
  element: src_select(this),
22665
- datum: datum,
22847
+ datum: datum
22666
22848
  });
22667
22849
  })
22668
22850
  .on("mouseout", function (datum) {
@@ -22676,11 +22858,11 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
22676
22858
  // Dispatch mouse event
22677
22859
  self.services.events.dispatchEvent(Events.Bar.BAR_MOUSEOUT, {
22678
22860
  element: hoveredElement,
22679
- datum: datum,
22861
+ datum: datum
22680
22862
  });
22681
22863
  // Hide tooltip
22682
22864
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22683
- hoveredElement: hoveredElement,
22865
+ hoveredElement: hoveredElement
22684
22866
  });
22685
22867
  });
22686
22868
  };
@@ -22779,9 +22961,7 @@ var scatter_Scatter = /** @class */ (function (_super) {
22779
22961
  var stacked = this.configs.stacked;
22780
22962
  var scatterData;
22781
22963
  if (stacked) {
22782
- var percentage = Object.keys(options.axes).some(function (axis) {
22783
- return options.axes[axis].percentage;
22784
- });
22964
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
22785
22965
  scatterData = this.model.getStackedData({ percentage: percentage });
22786
22966
  }
22787
22967
  else {
@@ -22911,7 +23091,7 @@ var scatter_Scatter = /** @class */ (function (_super) {
22911
23091
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
22912
23092
  hoveredElement: hoveredElement,
22913
23093
  multidata: overlappingData.length > 1 ? overlappingData : null,
22914
- type: TooltipTypes.DATAPOINT,
23094
+ type: TooltipTypes.DATAPOINT
22915
23095
  });
22916
23096
  var eventNameToDispatch = on_event.type === "mouseover"
22917
23097
  ? Events.Scatter.SCATTER_MOUSEOVER
@@ -22919,14 +23099,14 @@ var scatter_Scatter = /** @class */ (function (_super) {
22919
23099
  // Dispatch mouse event
22920
23100
  self.services.events.dispatchEvent(eventNameToDispatch, {
22921
23101
  element: hoveredElement,
22922
- datum: datum,
23102
+ datum: datum
22923
23103
  });
22924
23104
  })
22925
23105
  .on("click", function (datum) {
22926
23106
  // Dispatch mouse event
22927
23107
  self.services.events.dispatchEvent(Events.Scatter.SCATTER_CLICK, {
22928
23108
  element: src_select(this),
22929
- datum: datum,
23109
+ datum: datum
22930
23110
  });
22931
23111
  })
22932
23112
  .on("mouseout", function (datum) {
@@ -22938,11 +23118,11 @@ var scatter_Scatter = /** @class */ (function (_super) {
22938
23118
  // Dispatch mouse event
22939
23119
  self.services.events.dispatchEvent(Events.Scatter.SCATTER_MOUSEOUT, {
22940
23120
  element: hoveredElement,
22941
- datum: datum,
23121
+ datum: datum
22942
23122
  });
22943
23123
  // Hide tooltip
22944
23124
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
22945
- hoveredElement: hoveredElement,
23125
+ hoveredElement: hoveredElement
22946
23126
  });
22947
23127
  });
22948
23128
  };
@@ -23120,18 +23300,22 @@ var line_Line = /** @class */ (function (_super) {
23120
23300
  });
23121
23301
  var data = [];
23122
23302
  if (this.configs.stacked) {
23123
- var percentage = Object.keys(options.axes).some(function (axis) {
23124
- return options.axes[axis].percentage;
23125
- });
23303
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
23304
+ var groupMapsTo_1 = options.data.groupMapsTo;
23126
23305
  var stackedData = this.model.getStackedData({ percentage: percentage });
23306
+ var domainIdentifier_1 = this.services.cartesianScales.getDomainIdentifier();
23307
+ var rangeIdentifier_1 = this.services.cartesianScales.getRangeIdentifier();
23127
23308
  data = stackedData.map(function (d) { return ({
23128
- name: d[0].group,
23129
- data: d.map(function (datum) { return ({
23130
- date: datum.data.sharedStackKey,
23131
- group: datum.group,
23132
- value: datum[1],
23133
- }); }),
23134
- hidden: !tools_Tools.some(d, function (datum) { return datum[0] !== datum[1]; }),
23309
+ name: d[0][groupMapsTo_1],
23310
+ data: d.map(function (datum) {
23311
+ var _a;
23312
+ return (_a = {},
23313
+ _a[domainIdentifier_1] = datum.data.sharedStackKey,
23314
+ _a[groupMapsTo_1] = datum[groupMapsTo_1],
23315
+ _a[rangeIdentifier_1] = datum[1],
23316
+ _a);
23317
+ }),
23318
+ hidden: !tools_Tools.some(d, function (datum) { return datum[0] !== datum[1]; })
23135
23319
  }); });
23136
23320
  }
23137
23321
  else {
@@ -23223,14 +23407,12 @@ var scatter_stacked_StackedScatter = /** @class */ (function (_super) {
23223
23407
  var groupMapsTo = options.data.groupMapsTo;
23224
23408
  var domainIdentifier = this.services.cartesianScales.getDomainIdentifier();
23225
23409
  var rangeIdentifier = this.services.cartesianScales.getRangeIdentifier();
23226
- var percentage = Object.keys(options.axes).some(function (axis) {
23227
- return options.axes[axis].percentage;
23228
- });
23410
+ var percentage = Object.keys(options.axes).some(function (axis) { return options.axes[axis].percentage; });
23229
23411
  var stackedData = this.model.getStackedData({ percentage: percentage });
23230
23412
  // Update data on dot groups
23231
23413
  var circleGroups = svg
23232
23414
  .selectAll("g.dots")
23233
- .data(stackedData, function (d) { return d[0].group; });
23415
+ .data(stackedData, function (d) { return d[0][groupMapsTo]; });
23234
23416
  // Remove dot groups that need to be removed
23235
23417
  circleGroups.exit().attr("opacity", 0).remove();
23236
23418
  // Add the dot groups that need to be introduced
@@ -23850,12 +24032,12 @@ var pie_Pie = /** @class */ (function (_super) {
23850
24032
  if (direction === CalloutDirections.RIGHT) {
23851
24033
  d.startPos = {
23852
24034
  x: xPosition,
23853
- y: yPosition + d.textOffsetY,
24035
+ y: yPosition + d.textOffsetY
23854
24036
  };
23855
24037
  // end position for the callout line
23856
24038
  d.endPos = {
23857
24039
  x: xPosition + options.pie.callout.offsetX,
23858
- y: yPosition - options.pie.callout.offsetY + d.textOffsetY,
24040
+ y: yPosition - options.pie.callout.offsetY + d.textOffsetY
23859
24041
  };
23860
24042
  // the intersection point of the vertical and horizontal line
23861
24043
  d.intersectPointX =
@@ -23865,12 +24047,12 @@ var pie_Pie = /** @class */ (function (_super) {
23865
24047
  // start position for the callout line
23866
24048
  d.startPos = {
23867
24049
  x: xPosition,
23868
- y: yPosition + d.textOffsetY,
24050
+ y: yPosition + d.textOffsetY
23869
24051
  };
23870
24052
  // end position for the callout line should be bottom aligned to the title
23871
24053
  d.endPos = {
23872
24054
  x: xPosition - options.pie.callout.offsetX,
23873
- y: yPosition - options.pie.callout.offsetY + d.textOffsetY,
24055
+ y: yPosition - options.pie.callout.offsetY + d.textOffsetY
23874
24056
  };
23875
24057
  // the intersection point of the vertical and horizontal line
23876
24058
  d.intersectPointX =
@@ -23916,7 +24098,7 @@ var pie_Pie = /** @class */ (function (_super) {
23916
24098
  // Dispatch mouse event
23917
24099
  self.services.events.dispatchEvent(Events.Pie.SLICE_MOUSEOVER, {
23918
24100
  element: src_select(this),
23919
- datum: datum,
24101
+ datum: datum
23920
24102
  });
23921
24103
  })
23922
24104
  .on("mousemove", function (datum) {
@@ -23928,19 +24110,19 @@ var pie_Pie = /** @class */ (function (_super) {
23928
24110
  // Dispatch mouse event
23929
24111
  self.services.events.dispatchEvent(Events.Pie.SLICE_MOUSEMOVE, {
23930
24112
  element: hoveredElement,
23931
- datum: datum,
24113
+ datum: datum
23932
24114
  });
23933
24115
  // Show tooltip
23934
24116
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
23935
24117
  hoveredElement: hoveredElement,
23936
- type: TooltipTypes.DATAPOINT,
24118
+ type: TooltipTypes.DATAPOINT
23937
24119
  });
23938
24120
  })
23939
24121
  .on("click", function (datum) {
23940
24122
  // Dispatch mouse event
23941
24123
  self.services.events.dispatchEvent(Events.Pie.SLICE_CLICK, {
23942
24124
  element: src_select(this),
23943
- datum: datum,
24125
+ datum: datum
23944
24126
  });
23945
24127
  })
23946
24128
  .on("mouseout", function (datum) {
@@ -23952,11 +24134,11 @@ var pie_Pie = /** @class */ (function (_super) {
23952
24134
  // Dispatch mouse event
23953
24135
  self.services.events.dispatchEvent(Events.Pie.SLICE_MOUSEOUT, {
23954
24136
  element: hoveredElement,
23955
- datum: datum,
24137
+ datum: datum
23956
24138
  });
23957
24139
  // Hide tooltip
23958
24140
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
23959
- hoveredElement: hoveredElement,
24141
+ hoveredElement: hoveredElement
23960
24142
  });
23961
24143
  });
23962
24144
  };
@@ -23964,7 +24146,7 @@ var pie_Pie = /** @class */ (function (_super) {
23964
24146
  Pie.prototype.computeRadius = function () {
23965
24147
  var options = this.model.getOptions();
23966
24148
  var _a = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
23967
- useAttrs: true,
24149
+ useAttrs: true
23968
24150
  }), width = _a.width, height = _a.height;
23969
24151
  var radius = Math.min(width, height) / 2;
23970
24152
  return radius + options.pie.radiusOffset;
@@ -24169,20 +24351,22 @@ var gauge_Gauge = /** @class */ (function (_super) {
24169
24351
  var deltaFontSize = delta
24170
24352
  ? tools_Tools.getProperty(options, "gauge", "deltaFontSize")
24171
24353
  : function () { return 0; };
24172
- var numberFormatter = tools_Tools.getProperty(options, "gauge", "numberFormatter");
24354
+ // use numberFormatter here only if there is a delta supplied
24355
+ var numberFormatter = delta
24356
+ ? tools_Tools.getProperty(options, "gauge", "numberFormatter")
24357
+ : function () { return null; };
24173
24358
  var arrowSize = tools_Tools.getProperty(options, "gauge", "deltaArrow", "size");
24174
24359
  var numberSpacing = tools_Tools.getProperty(options, "gauge", "numberSpacing");
24175
24360
  var numbersGroup = dom_utils_DOMUtils.appendOrSelect(svg, "g.gauge-numbers");
24176
24361
  // Add the smaller number of the delta
24177
24362
  var deltaGroup = dom_utils_DOMUtils.appendOrSelect(numbersGroup, "g.gauge-delta").attr("transform", "translate(0, " + (deltaFontSize(radius) + numberSpacing) + ")");
24178
- var deltaNumber = deltaGroup
24179
- .selectAll("text.gauge-delta-number")
24180
- .data(delta !== null ? [delta] : []);
24363
+ var deltaNumber = dom_utils_DOMUtils.appendOrSelect(deltaGroup, "text.gauge-delta-number");
24364
+ deltaNumber.data(delta === null ? [] : [delta]);
24181
24365
  deltaNumber
24182
24366
  .enter()
24183
24367
  .append("text")
24368
+ .classed("gauge-delta-number", true)
24184
24369
  .merge(deltaNumber)
24185
- .attr("class", "gauge-delta-number")
24186
24370
  .attr("text-anchor", "middle")
24187
24371
  .style("font-size", deltaFontSize(radius) + "px")
24188
24372
  .text(function (d) { return numberFormatter(d) + "%"; });
@@ -24409,7 +24593,7 @@ var skeleton_Skeleton = /** @class */ (function (_super) {
24409
24593
  var svg = this.parent;
24410
24594
  var parent = svg.node().parentNode;
24411
24595
  var _a = dom_utils_DOMUtils.getSVGElementSize(parent, {
24412
- useAttrs: true,
24596
+ useAttrs: true
24413
24597
  }), width = _a.width, height = _a.height;
24414
24598
  svg.attr("width", width).attr("height", height);
24415
24599
  var isDataEmpty = this.model.isDataEmpty();
@@ -24488,7 +24672,7 @@ var skeleton_Skeleton = /** @class */ (function (_super) {
24488
24672
  var svg = this.parent;
24489
24673
  var parent = svg.node().parentNode;
24490
24674
  var _a = dom_utils_DOMUtils.getSVGElementSize(parent, {
24491
- useAttrs: true,
24675
+ useAttrs: true
24492
24676
  }), width = _a.width, height = _a.height;
24493
24677
  this.backdrop = dom_utils_DOMUtils.appendOrSelect(svg, "svg.chart-skeleton.DAII")
24494
24678
  .attr("width", width)
@@ -24595,7 +24779,7 @@ var skeleton_Skeleton = /** @class */ (function (_super) {
24595
24779
  var stopShimmerClass = "stop-shimmer";
24596
24780
  var container = this.parent.select(".chart-skeleton");
24597
24781
  var width = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
24598
- useAttrs: true,
24782
+ useAttrs: true
24599
24783
  }).width;
24600
24784
  var startPoint = 0;
24601
24785
  var endPoint = width;
@@ -25196,10 +25380,10 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
25196
25380
  // Get parent SVG to render inside of
25197
25381
  var svg = this.parent;
25198
25382
  var _a = dom_utils_DOMUtils.getSVGElementSize(svg, {
25199
- useAttrs: true,
25383
+ useAttrs: true
25200
25384
  }), width = _a.width, height = _a.height;
25201
25385
  var root = hierarchy({
25202
- children: this.children,
25386
+ children: this.children
25203
25387
  }).sum(function (d) { return d.size; });
25204
25388
  // Grab the correct treemap tile function based on direction
25205
25389
  var tileType = this.configs.direction === LayoutDirection.ROW ||
@@ -25245,6 +25429,12 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
25245
25429
  // Calculate preffered children sizes after internal rendering
25246
25430
  var growth = tools_Tools.getProperty(d, "data", "growth", "x");
25247
25431
  var matchingSVGDimensions = dom_utils_DOMUtils.getSVGElementSize(src_select(this), { useBBox: true });
25432
+ if (d.data.id === "legend") {
25433
+ var svgSize = dom_utils_DOMUtils.getSVGElementSize(src_select(this), { useAttrs: true });
25434
+ if (svgSize.height < 40) {
25435
+ matchingSVGDimensions.height = svgSize.height;
25436
+ }
25437
+ }
25248
25438
  if (growth === LayoutGrowth.PREFERRED) {
25249
25439
  var matchingSVGWidth = horizontal
25250
25440
  ? matchingSVGDimensions.width
@@ -25268,7 +25458,7 @@ var layout_LayoutComponent = /** @class */ (function (_super) {
25268
25458
  // Pass children data to the hierarchy layout
25269
25459
  // And calculate sum of sizes
25270
25460
  root = hierarchy({
25271
- children: this.children,
25461
+ children: this.children
25272
25462
  }).sum(function (d) { return d.size; });
25273
25463
  // Compute the position of all elements within the layout
25274
25464
  src_treemap().tile(tileType).size([width, height]).padding(0)(root);
@@ -25543,14 +25733,19 @@ var axis_Axis = /** @class */ (function (_super) {
25543
25733
  var axisPosition = this.configs.position;
25544
25734
  var options = this.model.getOptions();
25545
25735
  var axisOptions = tools_Tools.getProperty(options, "axes", axisPosition);
25736
+ var axisScaleType = tools_Tools.getProperty(axisOptions, "scaleType");
25546
25737
  var numberOfTicksProvided = tools_Tools.getProperty(axisOptions, "ticks", "number");
25738
+ // get user provided custom values for truncation
25739
+ var truncationType = tools_Tools.getProperty(axisOptions, "truncation", "type");
25740
+ var truncationThreshold = tools_Tools.getProperty(axisOptions, "truncation", "threshold");
25741
+ var truncationNumCharacter = tools_Tools.getProperty(axisOptions, "truncation", "numCharacter");
25547
25742
  var isNumberOfTicksProvided = numberOfTicksProvided !== null;
25548
25743
  var isVerticalAxis = axisPosition === AxisPositions.LEFT ||
25549
25744
  axisPosition === AxisPositions.RIGHT;
25550
25745
  var timeScaleOptions = tools_Tools.getProperty(options, "timeScale");
25551
25746
  var svg = this.getContainerSVG();
25552
25747
  var _a = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
25553
- useAttrs: true,
25748
+ useAttrs: true
25554
25749
  }), width = _a.width, height = _a.height;
25555
25750
  var startPosition, endPosition;
25556
25751
  if (axisPosition === AxisPositions.BOTTOM ||
@@ -25608,7 +25803,7 @@ var axis_Axis = /** @class */ (function (_super) {
25608
25803
  var fakeTick = dom_utils_DOMUtils.appendOrSelect(invisibleAxisRef, "g.tick");
25609
25804
  var fakeTickText = dom_utils_DOMUtils.appendOrSelect(fakeTick, "text").text("0");
25610
25805
  var tickHeight = dom_utils_DOMUtils.getSVGElementSize(fakeTickText.node(), {
25611
- useBBox: true,
25806
+ useBBox: true
25612
25807
  }).height;
25613
25808
  fakeTick.remove();
25614
25809
  var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
@@ -25639,13 +25834,15 @@ var axis_Axis = /** @class */ (function (_super) {
25639
25834
  axis.tickValues([]);
25640
25835
  }
25641
25836
  else {
25642
- var tickValues = scale
25643
- .nice(numberOfTicks)
25644
- .ticks(numberOfTicks);
25837
+ var addSpaceOnEdges = tools_Tools.getProperty(options, "timeScale", "addSpaceOnEdges");
25838
+ var tickValues = void 0;
25839
+ if (addSpaceOnEdges) {
25840
+ tickValues = scale.nice(numberOfTicks);
25841
+ }
25842
+ tickValues = scale.ticks(numberOfTicks);
25645
25843
  // Remove labels on the edges
25646
25844
  // If there are more than 2 labels to show
25647
- if (tools_Tools.getProperty(options, "timeScale", "addSpaceOnEdges") &&
25648
- tickValues.length > 2) {
25845
+ if (addSpaceOnEdges && tickValues.length > 2) {
25649
25846
  tickValues.splice(tickValues.length - 1, 1);
25650
25847
  tickValues.splice(0, 1);
25651
25848
  }
@@ -25725,7 +25922,7 @@ var axis_Axis = /** @class */ (function (_super) {
25725
25922
  break;
25726
25923
  case AxisPositions.TOP:
25727
25924
  var titleHeight = dom_utils_DOMUtils.getSVGElementSize(axisTitleRef, {
25728
- useBBox: true,
25925
+ useBBox: true
25729
25926
  }).height;
25730
25927
  axisTitleRef
25731
25928
  .attr("transform", "translate(" + (this.margins.left / 2 + scale.range()[1] / 2) + ", " + titleHeight / 2 + ")")
@@ -25813,6 +26010,45 @@ var axis_Axis = /** @class */ (function (_super) {
25813
26010
  if (this.model.isDataEmpty()) {
25814
26011
  container.attr("opacity", 0);
25815
26012
  }
26013
+ // truncate the label if it's too long
26014
+ // only applies to discrete type
26015
+ if (truncationType !== TruncationTypes.NONE &&
26016
+ axisScaleType === ScaleTypes.LABELS) {
26017
+ var dataGroups = this.model.getDataValuesGroupedByKeys();
26018
+ if (dataGroups.length > 0) {
26019
+ var activeDataGroups = dataGroups.map(function (d) { return d.sharedStackKey; });
26020
+ var tick_html = svg
26021
+ .select("g.axis." + axisPosition + " g.ticks g.tick")
26022
+ .html();
26023
+ container.selectAll("g.ticks g.tick").html(tick_html);
26024
+ container
26025
+ .selectAll("g.tick text")
26026
+ .data(activeDataGroups)
26027
+ .text(function (d) {
26028
+ if (d.length > truncationThreshold) {
26029
+ return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
26030
+ }
26031
+ else {
26032
+ return d;
26033
+ }
26034
+ });
26035
+ this.getInvisibleAxisRef()
26036
+ .selectAll("g.tick text")
26037
+ .data(activeDataGroups)
26038
+ .text(function (d) {
26039
+ if (d.length > truncationThreshold) {
26040
+ return tools_Tools.truncateLabel(d, truncationType, truncationNumCharacter);
26041
+ }
26042
+ else {
26043
+ return d;
26044
+ }
26045
+ });
26046
+ container
26047
+ .selectAll("g.ticks")
26048
+ .html(this.getInvisibleAxisRef().html());
26049
+ container.selectAll("g.tick text").data(activeDataGroups);
26050
+ }
26051
+ }
25816
26052
  // Add event listeners to elements drawn
25817
26053
  this.addEventListeners();
25818
26054
  };
@@ -25820,6 +26056,12 @@ var axis_Axis = /** @class */ (function (_super) {
25820
26056
  var svg = this.getContainerSVG();
25821
26057
  var axisPosition = this.configs.position;
25822
26058
  var container = dom_utils_DOMUtils.appendOrSelect(svg, "g.axis." + axisPosition);
26059
+ var options = this.model.getOptions();
26060
+ var axisOptions = tools_Tools.getProperty(options, "axes", axisPosition);
26061
+ var axisScaleType = tools_Tools.getProperty(axisOptions, "scaleType");
26062
+ var truncationThreshold = tools_Tools.getProperty(axisOptions, "truncation", "threshold");
26063
+ var isTimeScaleType = this.scaleType === ScaleTypes.TIME ||
26064
+ axisOptions.scaleType === ScaleTypes.TIME;
25823
26065
  var self = this;
25824
26066
  container
25825
26067
  .selectAll("g.tick text")
@@ -25827,29 +26069,39 @@ var axis_Axis = /** @class */ (function (_super) {
25827
26069
  // Dispatch mouse event
25828
26070
  self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOVER, {
25829
26071
  element: src_select(this),
25830
- datum: datum,
26072
+ datum: datum
25831
26073
  });
25832
26074
  })
25833
26075
  .on("mousemove", function (datum) {
25834
26076
  // Dispatch mouse event
25835
26077
  self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEMOVE, {
25836
26078
  element: src_select(this),
25837
- datum: datum,
26079
+ datum: datum
25838
26080
  });
26081
+ if (axisScaleType === ScaleTypes.LABELS &&
26082
+ datum.length > truncationThreshold) {
26083
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
26084
+ hoveredElement: src_select(this),
26085
+ type: TooltipTypes.AXISLABEL
26086
+ });
26087
+ }
25839
26088
  })
25840
26089
  .on("click", function (datum) {
25841
26090
  // Dispatch mouse event
25842
26091
  self.services.events.dispatchEvent(Events.Axis.LABEL_CLICK, {
25843
26092
  element: src_select(this),
25844
- datum: datum,
26093
+ datum: datum
25845
26094
  });
25846
26095
  })
25847
26096
  .on("mouseout", function (datum) {
25848
26097
  // Dispatch mouse event
25849
26098
  self.services.events.dispatchEvent(Events.Axis.LABEL_MOUSEOUT, {
25850
26099
  element: src_select(this),
25851
- datum: datum,
26100
+ datum: datum
25852
26101
  });
26102
+ if (axisScaleType === ScaleTypes.LABELS) {
26103
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE);
26104
+ }
25853
26105
  });
25854
26106
  };
25855
26107
  Axis.prototype.getInvisibleAxisRef = function () {
@@ -25922,7 +26174,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
25922
26174
  top: 0,
25923
26175
  right: 0,
25924
26176
  bottom: 0,
25925
- left: 0,
26177
+ left: 0
25926
26178
  };
25927
26179
  return _this;
25928
26180
  }
@@ -25947,7 +26199,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
25947
26199
  var axisComponent = new axis_Axis(_this.model, _this.services, {
25948
26200
  position: axisPosition,
25949
26201
  axes: _this.configs.axes,
25950
- margins: _this.margins,
26202
+ margins: _this.margins
25951
26203
  });
25952
26204
  // Set model, services & parent for the new axis component
25953
26205
  axisComponent.setModel(_this.model);
@@ -25977,7 +26229,7 @@ var two_dimensional_axes_TwoDimensionalAxes = /** @class */ (function (_super) {
25977
26229
  }
25978
26230
  else {
25979
26231
  offset = dom_utils_DOMUtils.getSVGElementSize(child.getTitleRef(), {
25980
- useBBox: true,
26232
+ useBBox: true
25981
26233
  }).height;
25982
26234
  }
25983
26235
  switch (axisPosition) {
@@ -26177,7 +26429,7 @@ var grid_Grid = /** @class */ (function (_super) {
26177
26429
  // threshold for when to display a gridline tooltip
26178
26430
  var bounds = {
26179
26431
  min: Number(translations.tx) - threshold,
26180
- max: Number(translations.tx) + threshold,
26432
+ max: Number(translations.tx) + threshold
26181
26433
  };
26182
26434
  return bounds.min <= position[0] && position[0] <= bounds.max;
26183
26435
  });
@@ -26263,7 +26515,7 @@ var ruler_Ruler = /** @class */ (function (_super) {
26263
26515
  var _b = rangeScale.range(), yScaleEnd = _b[0], yScaleStart = _b[1];
26264
26516
  var scaledData = displayData.map(function (d) { return ({
26265
26517
  domainValue: _this.services.cartesianScales.getDomainValue(d),
26266
- originalData: d,
26518
+ originalData: d
26267
26519
  }); });
26268
26520
  /**
26269
26521
  * Find matches, reduce is used instead of filter
@@ -26326,7 +26578,7 @@ var ruler_Ruler = /** @class */ (function (_super) {
26326
26578
  this.services.events.dispatchEvent("show-tooltip", {
26327
26579
  hoveredElement: rulerLine,
26328
26580
  multidata: tooltipData,
26329
- type: TooltipTypes.GRIDLINE,
26581
+ type: TooltipTypes.GRIDLINE
26330
26582
  });
26331
26583
  ruler.attr("opacity", 1);
26332
26584
  // line snaps to matching point
@@ -26444,7 +26696,7 @@ var zero_line_ZeroLine = /** @class */ (function (_super) {
26444
26696
  x0: x0,
26445
26697
  x1: x1,
26446
26698
  y0: yPosition,
26447
- y1: yPosition,
26699
+ y1: yPosition
26448
26700
  }, this.services.cartesianScales.getOrientation());
26449
26701
  var line = dom_utils_DOMUtils.appendOrSelect(svg, "line.domain");
26450
26702
  line.transition(this.services.transitions.getTransition("zero-line-update", animate))
@@ -26705,7 +26957,7 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26705
26957
  var _this = _super.call(this, holder, chartConfigs) || this;
26706
26958
  _this.services = Object.assign(_this.services, {
26707
26959
  cartesianScales: scales_cartesian_CartesianScales,
26708
- curves: curves_Curves,
26960
+ curves: curves_Curves
26709
26961
  });
26710
26962
  return _this;
26711
26963
  }
@@ -26715,24 +26967,24 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26715
26967
  components: [new title_Title(this.model, this.services)],
26716
26968
  growth: {
26717
26969
  x: LayoutGrowth.PREFERRED,
26718
- y: LayoutGrowth.FIXED,
26719
- },
26970
+ y: LayoutGrowth.FIXED
26971
+ }
26720
26972
  };
26721
26973
  var legendComponent = {
26722
26974
  id: "legend",
26723
26975
  components: [new legend_Legend(this.model, this.services)],
26724
26976
  growth: {
26725
26977
  x: LayoutGrowth.PREFERRED,
26726
- y: LayoutGrowth.FIXED,
26727
- },
26978
+ y: LayoutGrowth.FIXED
26979
+ }
26728
26980
  };
26729
26981
  var graphFrameComponent = {
26730
26982
  id: "graph-frame",
26731
26983
  components: graphFrameComponents,
26732
26984
  growth: {
26733
26985
  x: LayoutGrowth.STRETCH,
26734
- y: LayoutGrowth.FIXED,
26735
- },
26986
+ y: LayoutGrowth.FIXED
26987
+ }
26736
26988
  };
26737
26989
  var isLegendEnabled = this.model.getOptions().legend.enabled !== false;
26738
26990
  // Decide the position of the legend in reference to the chart
@@ -26762,23 +27014,23 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26762
27014
  components: [new spacer_Spacer(this.model, this.services)],
26763
27015
  growth: {
26764
27016
  x: LayoutGrowth.PREFERRED,
26765
- y: LayoutGrowth.FIXED,
26766
- },
27017
+ y: LayoutGrowth.FIXED
27018
+ }
26767
27019
  };
26768
27020
  var fullFrameComponent = {
26769
27021
  id: "full-frame",
26770
27022
  components: [
26771
27023
  new layout_LayoutComponent(this.model, this.services, axis_chart_spreadArrays((isLegendEnabled ? [legendComponent] : []), [
26772
27024
  legendSpacerComponent,
26773
- graphFrameComponent,
27025
+ graphFrameComponent
26774
27026
  ]), {
26775
- direction: fullFrameComponentDirection,
26776
- }),
27027
+ direction: fullFrameComponentDirection
27028
+ })
26777
27029
  ],
26778
27030
  growth: {
26779
27031
  x: LayoutGrowth.STRETCH,
26780
- y: LayoutGrowth.FIXED,
26781
- },
27032
+ y: LayoutGrowth.FIXED
27033
+ }
26782
27034
  };
26783
27035
  // Add chart title if it exists
26784
27036
  var topLevelLayoutComponents = [];
@@ -26789,16 +27041,16 @@ var axis_chart_AxisChart = /** @class */ (function (_super) {
26789
27041
  components: [new spacer_Spacer(this.model, this.services)],
26790
27042
  growth: {
26791
27043
  x: LayoutGrowth.PREFERRED,
26792
- y: LayoutGrowth.FIXED,
26793
- },
27044
+ y: LayoutGrowth.FIXED
27045
+ }
26794
27046
  };
26795
27047
  topLevelLayoutComponents.push(titleSpacerComponent);
26796
27048
  }
26797
27049
  topLevelLayoutComponents.push(fullFrameComponent);
26798
27050
  return [
26799
27051
  new layout_LayoutComponent(this.model, this.services, topLevelLayoutComponents, {
26800
- direction: LayoutDirection.COLUMN,
26801
- }),
27052
+ direction: LayoutDirection.COLUMN
27053
+ })
26802
27054
  ];
26803
27055
  };
26804
27056
  return AxisChart;
@@ -26846,8 +27098,8 @@ var area_AreaChart = /** @class */ (function (_super) {
26846
27098
  new area_Area(this.model, this.services),
26847
27099
  new scatter_Scatter(this.model, this.services, {
26848
27100
  fadeInOnChartHolderMouseover: true,
26849
- handleThresholds: true,
26850
- }),
27101
+ handleThresholds: true
27102
+ })
26851
27103
  ];
26852
27104
  var components = this.getAxisChartComponents(graphFrameComponents);
26853
27105
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -26899,8 +27151,8 @@ var area_stacked_StackedAreaChart = /** @class */ (function (_super) {
26899
27151
  new scatter_stacked_StackedScatter(this.model, this.services, {
26900
27152
  fadeInOnChartHolderMouseover: true,
26901
27153
  handleThresholds: true,
26902
- stacked: true,
26903
- }),
27154
+ stacked: true
27155
+ })
26904
27156
  ];
26905
27157
  var components = this.getAxisChartComponents(graphFrameComponents);
26906
27158
  // TODO add tooltip
@@ -26951,8 +27203,8 @@ var bar_simple_SimpleBarChart = /** @class */ (function (_super) {
26951
27203
  new bar_simple_SimpleBar(this.model, this.services),
26952
27204
  new zero_line_ZeroLine(this.model, this.services),
26953
27205
  new skeleton_Skeleton(this.model, this.services, {
26954
- skeleton: Skeletons.VERT_OR_HORIZ,
26955
- }),
27206
+ skeleton: Skeletons.VERT_OR_HORIZ
27207
+ })
26956
27208
  ];
26957
27209
  var components = this.getAxisChartComponents(graphFrameComponents);
26958
27210
  components.push(new tooltip_bar_TooltipBar(this.model, this.services));
@@ -27002,8 +27254,8 @@ var bar_grouped_GroupedBarChart = /** @class */ (function (_super) {
27002
27254
  new bar_grouped_GroupedBar(this.model, this.services),
27003
27255
  new zero_line_ZeroLine(this.model, this.services),
27004
27256
  new skeleton_Skeleton(this.model, this.services, {
27005
- skeleton: Skeletons.VERT_OR_HORIZ,
27006
- }),
27257
+ skeleton: Skeletons.VERT_OR_HORIZ
27258
+ })
27007
27259
  ];
27008
27260
  var components = this.getAxisChartComponents(graphFrameComponents);
27009
27261
  components.push(new tooltip_bar_TooltipBar(this.model, this.services));
@@ -27052,8 +27304,8 @@ var bar_stacked_StackedBarChart = /** @class */ (function (_super) {
27052
27304
  new grid_Grid(this.model, this.services),
27053
27305
  new bar_stacked_StackedBar(this.model, this.services),
27054
27306
  new skeleton_Skeleton(this.model, this.services, {
27055
- skeleton: Skeletons.VERT_OR_HORIZ,
27056
- }),
27307
+ skeleton: Skeletons.VERT_OR_HORIZ
27308
+ })
27057
27309
  ];
27058
27310
  var components = this.getAxisChartComponents(graphFrameComponents);
27059
27311
  components.push(new tooltip_bar_TooltipBar(this.model, this.services));
@@ -27103,8 +27355,8 @@ var bubble_BubbleChart = /** @class */ (function (_super) {
27103
27355
  new ruler_Ruler(this.model, this.services),
27104
27356
  new bubble_Bubble(this.model, this.services),
27105
27357
  new skeleton_Skeleton(this.model, this.services, {
27106
- skeleton: Skeletons.GRID,
27107
- }),
27358
+ skeleton: Skeletons.GRID
27359
+ })
27108
27360
  ];
27109
27361
  var components = this.getAxisChartComponents(graphFrameComponents);
27110
27362
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -27155,8 +27407,8 @@ var line_LineChart = /** @class */ (function (_super) {
27155
27407
  new line_Line(this.model, this.services),
27156
27408
  new scatter_Scatter(this.model, this.services, { handleThresholds: true }),
27157
27409
  new skeleton_Skeleton(this.model, this.services, {
27158
- skeleton: Skeletons.GRID,
27159
- }),
27410
+ skeleton: Skeletons.GRID
27411
+ })
27160
27412
  ];
27161
27413
  var components = this.getAxisChartComponents(graphFrameComponents);
27162
27414
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -27206,8 +27458,8 @@ var scatter_ScatterChart = /** @class */ (function (_super) {
27206
27458
  new ruler_Ruler(this.model, this.services),
27207
27459
  new scatter_Scatter(this.model, this.services),
27208
27460
  new skeleton_Skeleton(this.model, this.services, {
27209
- skeleton: Skeletons.GRID,
27210
- }),
27461
+ skeleton: Skeletons.GRID
27462
+ })
27211
27463
  ];
27212
27464
  var components = this.getAxisChartComponents(graphFrameComponents);
27213
27465
  components.push(new tooltip_scatter_TooltipScatter(this.model, this.services));
@@ -27308,8 +27560,8 @@ var pie_PieChart = /** @class */ (function (_super) {
27308
27560
  var graphFrameComponents = [
27309
27561
  new pie_Pie(this.model, this.services),
27310
27562
  new skeleton_Skeleton(this.model, this.services, {
27311
- skeleton: Skeletons.PIE,
27312
- }),
27563
+ skeleton: Skeletons.PIE
27564
+ })
27313
27565
  ];
27314
27566
  // get the base chart components and export with tooltip
27315
27567
  var components = this.getChartComponents(graphFrameComponents);
@@ -27357,8 +27609,8 @@ var donut_DonutChart = /** @class */ (function (_super) {
27357
27609
  var graphFrameComponents = [
27358
27610
  new donut_Donut(this.model, this.services),
27359
27611
  new skeleton_Skeleton(this.model, this.services, {
27360
- skeleton: Skeletons.DONUT,
27361
- }),
27612
+ skeleton: Skeletons.DONUT
27613
+ })
27362
27614
  ];
27363
27615
  var components = this.getChartComponents(graphFrameComponents);
27364
27616
  components.push(new tooltip_pie_TooltipPie(this.model, this.services));
@@ -27375,50 +27627,50 @@ function radialLabelPlacement(angleRadians) {
27375
27627
  if (isInRange(angle, [0, 10]) || isInRange(angle, [350, 0])) {
27376
27628
  return {
27377
27629
  textAnchor: TextAnchor.START,
27378
- dominantBaseline: DominantBaseline.MIDDLE,
27630
+ dominantBaseline: DominantBaseline.MIDDLE
27379
27631
  };
27380
27632
  }
27381
27633
  else if (isInRange(angle, [10, 80])) {
27382
27634
  return {
27383
27635
  textAnchor: TextAnchor.START,
27384
- dominantBaseline: DominantBaseline.HANGING,
27636
+ dominantBaseline: DominantBaseline.HANGING
27385
27637
  };
27386
27638
  }
27387
27639
  else if (isInRange(angle, [80, 100])) {
27388
27640
  return {
27389
27641
  textAnchor: TextAnchor.MIDDLE,
27390
- dominantBaseline: DominantBaseline.HANGING,
27642
+ dominantBaseline: DominantBaseline.HANGING
27391
27643
  };
27392
27644
  }
27393
27645
  else if (isInRange(angle, [100, 170])) {
27394
27646
  return {
27395
27647
  textAnchor: TextAnchor.END,
27396
- dominantBaseline: DominantBaseline.HANGING,
27648
+ dominantBaseline: DominantBaseline.HANGING
27397
27649
  };
27398
27650
  }
27399
27651
  else if (isInRange(angle, [170, 190])) {
27400
27652
  return {
27401
27653
  textAnchor: TextAnchor.END,
27402
- dominantBaseline: DominantBaseline.MIDDLE,
27654
+ dominantBaseline: DominantBaseline.MIDDLE
27403
27655
  };
27404
27656
  }
27405
27657
  else if (isInRange(angle, [190, 260])) {
27406
27658
  return {
27407
27659
  textAnchor: TextAnchor.END,
27408
- dominantBaseline: DominantBaseline.BASELINE,
27660
+ dominantBaseline: DominantBaseline.BASELINE
27409
27661
  };
27410
27662
  }
27411
27663
  else if (isInRange(angle, [260, 280])) {
27412
27664
  return {
27413
27665
  textAnchor: TextAnchor.MIDDLE,
27414
- dominantBaseline: DominantBaseline.BASELINE,
27666
+ dominantBaseline: DominantBaseline.BASELINE
27415
27667
  };
27416
27668
  }
27417
27669
  else {
27418
27670
  // 280 - 350
27419
27671
  return {
27420
27672
  textAnchor: TextAnchor.START,
27421
- dominantBaseline: DominantBaseline.BASELINE,
27673
+ dominantBaseline: DominantBaseline.BASELINE
27422
27674
  };
27423
27675
  }
27424
27676
  }
@@ -27619,7 +27871,7 @@ var radar_Radar = /** @class */ (function (_super) {
27619
27871
  if (animate === void 0) { animate = true; }
27620
27872
  this.svg = this.getContainerSVG();
27621
27873
  var _a = dom_utils_DOMUtils.getSVGElementSize(this.parent, {
27622
- useAttrs: true,
27874
+ useAttrs: true
27623
27875
  }), width = _a.width, height = _a.height;
27624
27876
  var data = this.model.getData();
27625
27877
  var displayData = this.model.getDisplayData();
@@ -27648,7 +27900,7 @@ var radar_Radar = /** @class */ (function (_super) {
27648
27900
  var yScale = linear_linear()
27649
27901
  .domain([
27650
27902
  0,
27651
- src_max(this.displayDataNormalized.map(function (d) { return d[value]; })),
27903
+ src_max(this.displayDataNormalized.map(function (d) { return d[value]; }))
27652
27904
  ])
27653
27905
  .range([minRange, radius])
27654
27906
  .nice(yTicksNumber);
@@ -27681,7 +27933,7 @@ var radar_Radar = /** @class */ (function (_super) {
27681
27933
  // center coordinates
27682
27934
  var c = {
27683
27935
  x: leftPadding + xLabelPadding,
27684
- y: height / 2,
27936
+ y: height / 2
27685
27937
  };
27686
27938
  /////////////////////////////
27687
27939
  // Drawing the radar
@@ -27983,7 +28235,7 @@ var radar_Radar = /** @class */ (function (_super) {
27983
28235
  // Dispatch mouse event
27984
28236
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEOVER, {
27985
28237
  element: src_select(this),
27986
- datum: datum,
28238
+ datum: datum
27987
28239
  });
27988
28240
  })
27989
28241
  .on("mousemove", function (datum) {
@@ -28000,7 +28252,7 @@ var radar_Radar = /** @class */ (function (_super) {
28000
28252
  // Dispatch mouse event
28001
28253
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEMOVE, {
28002
28254
  element: hoveredElement,
28003
- datum: datum,
28255
+ datum: datum
28004
28256
  });
28005
28257
  // get the items that should be highlighted
28006
28258
  var itemsToHighlight = self.displayDataNormalized.filter(function (d) { return d[angle] === datum; });
@@ -28008,14 +28260,14 @@ var radar_Radar = /** @class */ (function (_super) {
28008
28260
  self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
28009
28261
  hoveredElement: hoveredElement,
28010
28262
  multidata: itemsToHighlight,
28011
- type: TooltipTypes.GRIDLINE,
28263
+ type: TooltipTypes.GRIDLINE
28012
28264
  });
28013
28265
  })
28014
28266
  .on("click", function (datum) {
28015
28267
  // Dispatch mouse event
28016
28268
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_CLICK, {
28017
28269
  element: src_select(this),
28018
- datum: datum,
28270
+ datum: datum
28019
28271
  });
28020
28272
  })
28021
28273
  .on("mouseout", function (datum) {
@@ -28030,14 +28282,14 @@ var radar_Radar = /** @class */ (function (_super) {
28030
28282
  // Dispatch mouse event
28031
28283
  self.services.events.dispatchEvent(Events.Radar.X_AXIS_MOUSEOUT, {
28032
28284
  element: hoveredElement,
28033
- datum: datum,
28285
+ datum: datum
28034
28286
  });
28035
28287
  // Hide tooltip
28036
28288
  self.services.events.dispatchEvent("hide-tooltip", {
28037
- hoveredElement: hoveredElement,
28289
+ hoveredElement: hoveredElement
28038
28290
  });
28039
28291
  self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
28040
- hoveredElement: hoveredElement,
28292
+ hoveredElement: hoveredElement
28041
28293
  });
28042
28294
  });
28043
28295
  };
@@ -28130,6 +28382,7 @@ var gauge_GaugeChart = /** @class */ (function (_super) {
28130
28382
  // Specify what to render inside the graph-frame
28131
28383
  var graphFrameComponents = [new gauge_Gauge(this.model, this.services)];
28132
28384
  var components = this.getChartComponents(graphFrameComponents);
28385
+ components.push(new tooltip_Tooltip(this.model, this.services));
28133
28386
  return components;
28134
28387
  };
28135
28388
  return GaugeChart;