@gitlab/ui 126.3.3 → 126.3.4

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.
@@ -3,7 +3,7 @@ import { uid, debounceByAnimationFrame } from '../../../../utils/utils';
3
3
  import GlPopover from '../../../base/popover/popover';
4
4
  import { popoverPlacements } from '../../../../utils/constants';
5
5
  import { TOOLTIP_LEFT_OFFSET, TOOLTIP_TOP_OFFSET } from '../../../../utils/charts/constants';
6
- import { getTooltipAxisConfig, getTooltipTitle, getTooltipContent } from '../../../../utils/charts/config';
6
+ import { getTooltipAxisConfig, getTooltipTitle, getTooltipContent, getTooltipParams } from '../../../../utils/charts/config';
7
7
  import TooltipDefaultFormat from './tooltip_default_format/tooltip_default_format';
8
8
  import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.js';
9
9
 
@@ -239,7 +239,7 @@ var script = {
239
239
  const valueAxisName = (_options$valueAxis = options[valueAxis]) === null || _options$valueAxis === void 0 ? void 0 : (_options$valueAxis$ = _options$valueAxis[0]) === null || _options$valueAxis$ === void 0 ? void 0 : _options$valueAxis$.name;
240
240
  this.title = getTooltipTitle(params, titleAxisName, dimensionIndex);
241
241
  this.content = getTooltipContent(params, valueAxisName, metricIndex);
242
- this.params = params;
242
+ this.params = getTooltipParams(params, options);
243
243
  }
244
244
  }
245
245
  }
@@ -1,4 +1,5 @@
1
1
  import merge from 'lodash/merge';
2
+ import groupBy from 'lodash/groupBy';
2
3
  import { yAxis, generateBarSeries, generateLineSeries, gridWithSecondaryYAxis, grid, defaultChartOptions, dataZoomAdjustments, mergeSeriesToOptions } from '../../../utils/charts/config';
3
4
  import { LEGEND_AVERAGE_TEXT, LEGEND_MAX_TEXT, LEGEND_MIN_TEXT, LEGEND_CURRENT_TEXT, LEGEND_LAYOUT_INLINE, LEGEND_LAYOUT_TABLE, CHART_DEFAULT_SERIES_STACK, CHART_DEFAULT_SERIES_SECONDARY_STACK, CHART_TYPE_LINE, HEIGHT_AUTO_CLASSES } from '../../../utils/charts/constants';
4
5
  import { colorFromDefaultPalette } from '../../../utils/charts/theme';
@@ -303,16 +304,26 @@ var script = {
303
304
  params
304
305
  } = _ref5;
305
306
  if (!params) return {};
306
- const tooltipContentEntries = params.seriesData.toSorted((a, b) => b.seriesIndex - a.seriesIndex) // Invert stacking order so it matches chart (see https://github.com/apache/echarts/issues/14700)
307
- .map(_ref6 => {
307
+
308
+ // Group by stack and invert order within so it matches `stacked` presentation (see https://github.com/apache/echarts/issues/14700).
309
+ const seriesDataGroupedByStack = groupBy(params.seriesData, _ref6 => {
310
+ let {
311
+ stack,
312
+ seriesIndex
313
+ } = _ref6;
314
+ return stack !== null && stack !== void 0 ? stack : seriesIndex;
315
+ });
316
+ const sortedSeriesData = Object.values(seriesDataGroupedByStack).flatMap(seriesDataStack => seriesDataStack.toSorted((a, b) => b.seriesIndex - a.seriesIndex));
317
+ const tooltipContentEntries = sortedSeriesData.map(_ref7 => {
308
318
  let {
309
319
  seriesName = '',
310
320
  value,
311
- borderColor
312
- } = _ref6;
321
+ borderColor,
322
+ color
323
+ } = _ref7;
313
324
  return [seriesName, {
314
325
  value,
315
- color: borderColor
326
+ color: borderColor !== null && borderColor !== void 0 ? borderColor : color
316
327
  }];
317
328
  });
318
329
  return Object.fromEntries(tooltipContentEntries);