@nova-ui/charts 12.0.17-3905 → 12.0.17

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.
@@ -2532,6 +2532,18 @@
2532
2532
  }
2533
2533
  return scales.reduce(callbackFn, {});
2534
2534
  };
2535
+ /**
2536
+ * get values for interaction
2537
+ * @param valueMap map of values by scaleId
2538
+ * @param scaleId preferred scaleId
2539
+ * @returns value from scaleId or first availabel scale
2540
+ */
2541
+ UtilityService.getInteractionValues = function (valueMap, scaleId) {
2542
+ var _a;
2543
+ return valueMap
2544
+ ? (_a = valueMap[scaleId]) !== null && _a !== void 0 ? _a : Object.values(valueMap)[0]
2545
+ : null;
2546
+ };
2535
2547
  return UtilityService;
2536
2548
  }());
2537
2549
 
@@ -4167,7 +4179,7 @@
4167
4179
  var chartValues = {};
4168
4180
  each__default["default"](Object.keys(payload.values), function (scaleKey) {
4169
4181
  var myScaleId = chartSeries.scales[scaleKey].id;
4170
- chartValues[scaleKey] = payload.values[scaleKey][myScaleId];
4182
+ chartValues[scaleKey] = UtilityService.getInteractionValues(payload.values[scaleKey], myScaleId);
4171
4183
  });
4172
4184
  var dataIndex = DATA_POINT_INTERACTION_RESET;
4173
4185
  if (chartSeries.data && chartSeries.data.length > 0) {
@@ -4723,7 +4735,6 @@
4723
4735
  if (seriesProcessor) {
4724
4736
  this.seriesProcessor = seriesProcessor;
4725
4737
  }
4726
- /* eslint-disable-next-line @typescript-eslint/no-use-before-define */
4727
4738
  this.legendInteractionAssist = new LegendInteractionAssist(this);
4728
4739
  this.syncHandlerMap = (_b = {},
4729
4740
  _b[exports.ChartAssistEventType.EmphasizeSeries] = this.emphasizeSeries,
@@ -5884,21 +5895,22 @@
5884
5895
  });
5885
5896
  };
5886
5897
  InteractionLabelPlugin.prototype.handleLabelUpdate = function () {
5887
- var scales = this.chart.getGrid().scales;
5898
+ var grid = this.chart.getGrid();
5899
+ if (!(grid instanceof XYGrid)) {
5900
+ throw new Error(InteractionLabelPlugin.name + " requires XYGrid");
5901
+ }
5902
+ var scales = grid.scales;
5888
5903
  if (!this.areLabelUpdatesEnabled ||
5889
5904
  this.lastInteractionValuesPayload.interactionType !==
5890
5905
  exports.InteractionType.MouseMove ||
5891
5906
  isEmpty__default["default"](scales)) {
5892
5907
  return;
5893
5908
  }
5894
- var grid = this.chart.getGrid();
5895
5909
  var xScale = find__default["default"](scales["x"].index, { id: grid.bottomScaleId });
5896
5910
  if (!xScale) {
5897
5911
  throw new Error("xScale is not defined");
5898
5912
  }
5899
- var xValue = this.lastInteractionValuesPayload.values.x
5900
- ? this.lastInteractionValuesPayload.values.x[xScale.id]
5901
- : null;
5913
+ var xValue = UtilityService.getInteractionValues(this.lastInteractionValuesPayload.values.x, xScale.id);
5902
5914
  this.updateLabel(xScale, isArray__default["default"](xValue) ? xValue.slice(0, xValue.length - 1) : xValue);
5903
5915
  };
5904
5916
  InteractionLabelPlugin.prototype.updateLabel = function (scale, value) {
@@ -6014,20 +6026,21 @@
6014
6026
  });
6015
6027
  };
6016
6028
  InteractionLinePlugin.prototype.handleLineUpdate = function () {
6017
- var scales = this.chart.getGrid().scales;
6029
+ var grid = this.chart.getGrid();
6030
+ if (!(grid instanceof XYGrid)) {
6031
+ throw new Error(InteractionLinePlugin.name + " requires XYGrid");
6032
+ }
6033
+ var scales = grid.scales;
6018
6034
  if (this.lastInteractionValuesPayload.interactionType !==
6019
6035
  exports.InteractionType.MouseMove ||
6020
6036
  isEmpty__default["default"](scales)) {
6021
6037
  return;
6022
6038
  }
6023
- var grid = this.chart.getGrid();
6024
6039
  var xScale = find__default["default"](scales["x"].index, { id: grid.bottomScaleId });
6025
6040
  if (!xScale) {
6026
6041
  throw new Error("xScale is not defined");
6027
6042
  }
6028
- var xValue = this.lastInteractionValuesPayload.values.x
6029
- ? this.lastInteractionValuesPayload.values.x[xScale.id]
6030
- : null;
6043
+ var xValue = UtilityService.getInteractionValues(this.lastInteractionValuesPayload.values.x, xScale.id);
6031
6044
  this.updateLine(this.interactionLineLayer, xScale, xValue);
6032
6045
  };
6033
6046
  InteractionLinePlugin.prototype.updateLine = function (layer, xScale, value) {
@@ -7120,7 +7133,6 @@
7120
7133
  return elementsToFilter.filter(function (element) { return arr.indexOf(element) === -1; });
7121
7134
  };
7122
7135
  XYGrid.prototype.getElementsToHide = function (elementsToFilter, measurement, isBottomAxis) {
7123
- var elementsToDisplay;
7124
7136
  var measureType = isBottomAxis ? "width" : "height";
7125
7137
  var measurementComparison = this.getTextMeasurement(elementsToFilter, measureType) <
7126
7138
  measurement;
@@ -7134,7 +7146,7 @@
7134
7146
  if (shouldNotFilter) {
7135
7147
  return [];
7136
7148
  }
7137
- elementsToDisplay = this.elementsFiltering(elementsToFilter, measurement, measureType);
7149
+ var elementsToDisplay = this.elementsFiltering(elementsToFilter, measurement, measureType);
7138
7150
  return elementsToFilter.filter(function (element) { return elementsToDisplay.indexOf(element) === -1; });
7139
7151
  };
7140
7152
  XYGrid.prototype.elementsFiltering = function (elementsToFilter, parameter, measureType) {