@rowsncolumns/charts 28.1.8 → 28.1.10

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.
Files changed (47) hide show
  1. package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
  2. package/dist/cjs/basic-chart/basic-chart.js +483 -417
  3. package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
  4. package/dist/cjs/basic-chart/helpers.js +2 -0
  5. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  6. package/dist/cjs/plotly/basic-chart/basic-chart.js +315 -184
  7. package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
  8. package/dist/cjs/plotly/basic-chart/helpers.js +2 -0
  9. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  10. package/dist/cjs/utils/bubble.d.ts +34 -1
  11. package/dist/cjs/utils/bubble.d.ts.map +1 -1
  12. package/dist/cjs/utils/bubble.js +39 -13
  13. package/dist/cjs/utils/echarts-overlays.d.ts +46 -0
  14. package/dist/cjs/utils/echarts-overlays.d.ts.map +1 -0
  15. package/dist/cjs/utils/echarts-overlays.js +134 -0
  16. package/dist/cjs/utils/hierarchy.d.ts +23 -1
  17. package/dist/cjs/utils/hierarchy.d.ts.map +1 -1
  18. package/dist/cjs/utils/hierarchy.js +179 -55
  19. package/dist/cjs/utils/overrides.d.ts.map +1 -1
  20. package/dist/cjs/utils/overrides.js +9 -2
  21. package/dist/cjs/utils/trendline.d.ts +7 -1
  22. package/dist/cjs/utils/trendline.d.ts.map +1 -1
  23. package/dist/cjs/utils/trendline.js +82 -18
  24. package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
  25. package/dist/esm/basic-chart/basic-chart.js +320 -239
  26. package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
  27. package/dist/esm/basic-chart/helpers.js +2 -0
  28. package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  29. package/dist/esm/plotly/basic-chart/basic-chart.js +235 -58
  30. package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
  31. package/dist/esm/plotly/basic-chart/helpers.js +2 -0
  32. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  33. package/dist/esm/utils/bubble.d.ts +34 -1
  34. package/dist/esm/utils/bubble.d.ts.map +1 -1
  35. package/dist/esm/utils/bubble.js +35 -11
  36. package/dist/esm/utils/echarts-overlays.d.ts +46 -0
  37. package/dist/esm/utils/echarts-overlays.d.ts.map +1 -0
  38. package/dist/esm/utils/echarts-overlays.js +135 -0
  39. package/dist/esm/utils/hierarchy.d.ts +23 -1
  40. package/dist/esm/utils/hierarchy.d.ts.map +1 -1
  41. package/dist/esm/utils/hierarchy.js +168 -50
  42. package/dist/esm/utils/overrides.d.ts.map +1 -1
  43. package/dist/esm/utils/overrides.js +9 -2
  44. package/dist/esm/utils/trendline.d.ts +7 -1
  45. package/dist/esm/utils/trendline.d.ts.map +1 -1
  46. package/dist/esm/utils/trendline.js +67 -14
  47. package/package.json +3 -3
@@ -22,9 +22,9 @@ var chart_spec_utils_1 = require("../utils/chart-spec-utils");
22
22
  var chart_orientation_1 = require("../utils/chart-orientation");
23
23
  var chart_image_1 = require("../utils/chart-image");
24
24
  var chart_styles_1 = require("../utils/chart-styles");
25
+ var echarts_overlays_1 = require("../utils/echarts-overlays");
25
26
  var empty_cells_1 = require("../utils/empty-cells");
26
27
  var echarts_gl_loader_1 = require("../utils/echarts-gl-loader");
27
- var error_bars_1 = require("../utils/error-bars");
28
28
  var category_levels_1 = require("../utils/category-levels");
29
29
  var gradient_1 = require("../utils/gradient");
30
30
  var hierarchy_1 = require("../utils/hierarchy");
@@ -40,7 +40,6 @@ var stock_1 = require("../utils/stock");
40
40
  var pie_explosion_1 = require("../utils/pie-explosion");
41
41
  var series_click_1 = require("../utils/series-click");
42
42
  var three_d_1 = require("../utils/three-d");
43
- var trendline_1 = require("../utils/trendline");
44
43
  var waterfall_1 = require("../utils/waterfall");
45
44
  var webgl_1 = require("../utils/webgl");
46
45
  var helpers_1 = require("./helpers");
@@ -113,29 +112,39 @@ var isBubbleChartSpec = function (spec) {
113
112
  var isHierarchyChartSpec = function (spec) {
114
113
  return HIERARCHY_CHART_TYPES.has(spec.chartType);
115
114
  };
115
+ // Every level keeps the colour its node was given (one solid colour per
116
+ // top-level category, like Excel — no per-level saturation ramp); thin
117
+ // white gaps separate the cells.
116
118
  var HIERARCHY_LEVEL_STYLES = [
117
119
  {
118
120
  itemStyle: {
119
- gapWidth: 1,
120
- borderColorSaturation: 0.6,
121
+ gapWidth: 2,
122
+ borderColor: "#ffffff",
123
+ borderWidth: 0,
121
124
  },
122
125
  upperLabel: { show: false },
123
126
  },
124
127
  {
125
- colorSaturation: [0.35, 0.65],
126
- itemStyle: {
127
- gapWidth: 1,
128
- borderColorSaturation: 0.6,
129
- },
130
- },
131
- {
132
- colorSaturation: [0.45, 0.75],
133
128
  itemStyle: {
134
129
  gapWidth: 1,
135
- borderColorSaturation: 0.6,
130
+ borderColor: "#ffffff",
131
+ borderWidth: 1,
136
132
  },
137
133
  },
138
134
  ];
135
+ /**
136
+ * Colour a hierarchy like Excel: each top-level node takes the next
137
+ * palette colour and every descendant inherits it (#1072).
138
+ */
139
+ var colorHierarchyNodes = function (nodes, palette) {
140
+ return nodes.map(function (node, index) {
141
+ var color = (0, utils_1.chartPaletteColorAt)(palette, index);
142
+ var paint = function (n) { return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, n), { itemStyle: { color: color } }), (n.children ? { children: n.children.map(paint) } : {}))); };
143
+ return paint(node);
144
+ });
145
+ };
146
+ /** Sunburst rings: Excel leaves the centre empty, so even the first level is a ring (#1073). */
147
+ var SUNBURST_RADIUS = ["15%", "80%"];
139
148
  var getHierarchyDepth = function (nodes, depth) {
140
149
  if (depth === void 0) { depth = 1; }
141
150
  var maxDepth = depth;
@@ -184,6 +193,16 @@ var buildHierarchyLevels = function (maxDepth) {
184
193
  };
185
194
  /** Series whose tooltip value is one number on a value axis. */
186
195
  var VALUE_TOOLTIP_SERIES_TYPES = new Set(["bar", "line", "scatter", "funnel"]);
196
+ /** The transparent spacer bars a waterfall stacks its visible bars on. */
197
+ var WATERFALL_PLACEHOLDER_ID = "rnc-waterfall-placeholder";
198
+ /** The invisible funnel that carries the stage names beside the bars. */
199
+ var FUNNEL_NAMES_ID = "rnc-funnel-names";
200
+ /**
201
+ * Layout-only series: they carry no data of their own, so they get no
202
+ * data labels and no tooltip entry (#1070 labelled every waterfall bar
203
+ * with its spacer's height too).
204
+ */
205
+ var DECORATION_SERIES_IDS = new Set([WATERFALL_PLACEHOLDER_ID, FUNNEL_NAMES_ID]);
187
206
  var defaultLegendConfig = {
188
207
  padding: 10,
189
208
  itemWidth: 10,
@@ -368,11 +387,11 @@ var BasicChart = function (_a) {
368
387
  * Triggers a chart update
369
388
  */
370
389
  var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
371
- var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, xAxisConfig, tooltipFormatter, bubbleSeriesLabelFor_1, hierarchyRows, headerTitle, hierarchyData, rootName, seriesDisplayName, hierarchyDepth, levels, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchySeriesLabel, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, values, e_1_1, seriesNames_1, contourPoints, _h, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _j, _k, seriesEntry, dataLabel, _l, _m, values, e_2_1, seriesNames_2, threeDPalette_1, seriesColorAt_1, categoryAxisLabel, seriesAxisLabel, stackedBar3D_1, threeDFormats_1, threeDTooltipFormatter, threeDSeries, visualMap, xAxis3D, yAxis3D, categoryCount, categoryTotals_1, threeDSeriesInputs_1, threeDSeriesInputs_1_1, entry, isPercent_1, surfacePoints, _o, zMin, zMax, skipHeaders, categories, radarSeriesInputs, _p, _q, seriesEntry, label, values, radarAxisOptions, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, variant_1, categories, seriesValues, stockFormats_1, stockRoleIndex_1, stockFormatFor_1, stockDataLabels_1, stockSeriesLabelFor_1, upColor_1, downColor_1, volumePoints, hasVolume, stockGrid, baseStockXAxis, stockXAxis, volumeYAxis, volumeSeries, stockAxisPointer, candleData, lineSeries, stockColors_1, isStacked, isCircularChart, isOfPie, ofPieLayout, isHorizontalBarChart, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, aggregateDomainValues, categoryLevels, pushSeriesOverlays, sideBySideBarCount, specBarGap, specBarCategoryGap, seriesPalette, paletteColorAt, _loop_1, _r, _s, _t, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _u, main_1, secondary, otherTotal, total, ofPieType_1, secondScale, halfAngle_1, hasSecondary, MAIN_CX_1, CY_1, MAIN_RADIUS_PCT_1, SECONDARY_CX_1, secondaryRadiusPct_1, BAR_LEFT_1, BAR_RIGHT, barHalfFrac_1, ofPiePalette_1, paletteAt_1, connectorColor_1, primaryDomainSource_1, rawDomainValues, labels, seriesEntry, rawValues_1, totalIndices, steps, accent_1, decreaseColor_1, totalColor_1, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, quartileMethod, showOutliers, showMeanMarker, boxStats, boxLabels, outlierPoints, meanPoints, _v, _w, seriesEntry, label, rawValues, summary, boxIndex, lo, hi, _x, _y, outlier, boxSeries, boxColor, rawValues, _z, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, chartDataLabels, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, doughnutSeriesOrder, doughnutRingSet, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels;
372
- var e_1, _0, e_2, _1, e_4, _2, e_5, _3, e_3, _4, e_6, _5, e_7, _6, e_8, _7, e_9, _8;
373
- var _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, _135, _136, _137, _138, _139;
374
- return tslib_1.__generator(this, function (_140) {
375
- switch (_140.label) {
390
+ var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, bubblePalette_1, bubbleItemColor_1, hasBubbleSecondaryAxis, xAxisConfig, tooltipFormatter, bubbleSeriesLabelFor_1, bubbleSeries, bubbleOverlays, hierarchyRows, headerTitle, hierarchyPalette, hierarchyData, rootName, drillDown, seriesDisplayName, hierarchyDepth, levels, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchySeriesLabel, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, values, e_1_1, seriesNames_1, contourPoints, _h, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _j, _k, seriesEntry, dataLabel, _l, _m, values, e_2_1, seriesNames_2, threeDPalette_1, seriesColorAt_1, categoryAxisLabel, seriesAxisLabel, stackedBar3D_1, threeDFormats_1, threeDTooltipFormatter, threeDSeries, visualMap, xAxis3D, yAxis3D, categoryCount, categoryTotals_1, threeDSeriesInputs_1, threeDSeriesInputs_1_1, entry, isPercent_1, surfacePoints, _o, zMin, zMax, skipHeaders, categories, radarSeriesInputs, _p, _q, seriesEntry, label, values, radarAxisOptions_1, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, variant_1, categories, seriesValues, stockFormats_1, stockRoleIndex_1, stockFormatFor_1, stockDataLabels_1, stockSeriesLabelFor_1, upColor_1, downColor_1, volumePoints, hasVolume, stockGrid, baseStockXAxis, stockXAxis, volumeYAxis, volumeSeries, stockAxisPointer, candleData, lineSeries, stockColors_1, isStacked, isCircularChart, isOfPie, ofPieLayout, isHorizontalBarChart, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, aggregateDomainValues, categoryLevels, pushSeriesOverlays, sideBySideBarCount, specBarGap, specBarCategoryGap, seriesPalette, paletteColorAt, _loop_1, _r, _s, _t, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _u, main_1, secondary, otherTotal, total, ofPieType_1, secondScale, halfAngle_1, hasSecondary, MAIN_CX_1, CY_1, MAIN_RADIUS_PCT_1, SECONDARY_CX_1, secondaryRadiusPct_1, BAR_LEFT_1, BAR_RIGHT, barHalfFrac_1, ofPiePalette_1, paletteAt_1, connectorColor_1, primaryDomainSource_1, rawDomainValues, labels, seriesEntry, rawValues_1, totalIndices, steps, accent_1, decreaseColor_1, totalColor_1, pointColors_1, _v, _w, dp, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, funnelPalette, funnelColor_1, stageColors_1, _x, _y, dp, funnelData, funnelLayout, quartileMethod, showOutliers, showMeanMarker, boxStats, boxLabels, outlierPoints, meanPoints, _z, _0, seriesEntry, label, rawValues, summary, boxIndex, lo, hi, _1, _2, outlier, boxSeries, boxColor, rawValues, _3, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, chartDataLabels, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, doughnutSeriesOrder, doughnutRingSet, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels;
391
+ var e_1, _4, e_2, _5, e_4, _6, e_5, _7, e_3, _8, e_6, _9, e_7, _10, e_8, _11, e_9, _12, e_10, _13, e_11, _14;
392
+ var _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, _135, _136, _137, _138, _139, _140, _141, _142, _143, _144, _145, _146, _147, _148, _149;
393
+ return tslib_1.__generator(this, function (_150) {
394
+ switch (_150.label) {
376
395
  case 0:
377
396
  (0, utils_1.debug)("Updating chart", chart);
378
397
  threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType);
@@ -396,7 +415,7 @@ var BasicChart = function (_a) {
396
415
  // Leaving 3-D (spec edit) — the grid3D option doesn't merge back
397
416
  // into a cartesian one, so re-initialize from a clean slate and
398
417
  // let the normal 2-D flow below do a full structural render.
399
- (_9 = chartRef.current) === null || _9 === void 0 ? void 0 : _9.dispose();
418
+ (_15 = chartRef.current) === null || _15 === void 0 ? void 0 : _15.dispose();
400
419
  chartRef.current = undefined;
401
420
  renderedIn3D.current = false;
402
421
  previousChartType.current = undefined;
@@ -410,7 +429,7 @@ var BasicChart = function (_a) {
410
429
  // doesn't merge back into a cartesian one, so re-initialize from
411
430
  // a clean slate and let the normal flow below do a full
412
431
  // structural render.
413
- (_10 = chartRef.current) === null || _10 === void 0 ? void 0 : _10.dispose();
432
+ (_16 = chartRef.current) === null || _16 === void 0 ? void 0 : _16.dispose();
414
433
  chartRef.current = undefined;
415
434
  renderedAsRegionMap.current = false;
416
435
  previousChartType.current = undefined;
@@ -423,7 +442,7 @@ var BasicChart = function (_a) {
423
442
  geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
424
443
  return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
425
444
  case 1:
426
- geo = _140.sent();
445
+ geo = _150.sent();
427
446
  // Entering the region map from a cartesian render: the previous
428
447
  // grid/axis option doesn't merge into the map one, so start from
429
448
  // a bare instance (theme options are re-applied after setOption).
@@ -438,7 +457,7 @@ var BasicChart = function (_a) {
438
457
  if (!geo) {
439
458
  // Map asset failed to load (or unknown scope) — the loader
440
459
  // already warned once; render an empty chart, never crash.
441
- (_11 = chartRef.current) === null || _11 === void 0 ? void 0 : _11.setOption({ series: [] }, { replaceMerge: ["series", "visualMap"] });
460
+ (_17 = chartRef.current) === null || _17 === void 0 ? void 0 : _17.setOption({ series: [] }, { replaceMerge: ["series", "visualMap"] });
442
461
  renderedAsRegionMap.current = true;
443
462
  applyThemeOptions();
444
463
  previousChartType.current = spec.chartType;
@@ -446,7 +465,7 @@ var BasicChart = function (_a) {
446
465
  return [2 /*return*/];
447
466
  }
448
467
  labels = flattenChartDataValues(regionSpec.domains, getDomainValuesFromRange, regionSpec.hiddenDimensionStrategy, false);
449
- seriesEntry = (_12 = regionSpec.series) === null || _12 === void 0 ? void 0 : _12[0];
468
+ seriesEntry = (_18 = regionSpec.series) === null || _18 === void 0 ? void 0 : _18[0];
450
469
  values = seriesEntry
451
470
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, regionSpec.hiddenDimensionStrategy)
452
471
  : [];
@@ -462,7 +481,7 @@ var BasicChart = function (_a) {
462
481
  seriesName = (seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
463
482
  ? seriesEntry.dataLabel
464
483
  : "";
465
- (_13 = chartRef.current) === null || _13 === void 0 ? void 0 : _13.setOption({
484
+ (_19 = chartRef.current) === null || _19 === void 0 ? void 0 : _19.setOption({
466
485
  // The visualMap color scale is the value legend; the series
467
486
  // legend stays hidden unless an authored override turns it on.
468
487
  legend: (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: false }), spec.legend),
@@ -530,54 +549,91 @@ var BasicChart = function (_a) {
530
549
  hierarchyTitleRef.current = explicitChartTitle;
531
550
  skipHeaders_1 = spec.useFirstRowAsHeaders !== false;
532
551
  labelValues = flattenChartDataValues(spec.bubbleLabels, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
533
- perSeriesX = ((_14 = spec.domains) !== null && _14 !== void 0 ? _14 : []).map(function (dom) {
552
+ perSeriesX = ((_20 = spec.domains) !== null && _20 !== void 0 ? _20 : []).map(function (dom) {
534
553
  return flattenChartDataValues([dom], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
535
554
  });
536
- perSeriesSize = ((_15 = spec.bubbleSizes) !== null && _15 !== void 0 ? _15 : []).map(function (sz) {
555
+ perSeriesSize = ((_21 = spec.bubbleSizes) !== null && _21 !== void 0 ? _21 : []).map(function (sz) {
537
556
  return flattenChartDataValues([sz], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
538
557
  });
539
558
  seriesInputs = [];
540
559
  i = 0;
541
- _140.label = 3;
560
+ _150.label = 3;
542
561
  case 3:
543
562
  if (!(i < spec.series.length)) return [3 /*break*/, 7];
544
563
  seriesEntry = spec.series[i];
545
- resolvedLabel = (_16 = seriesEntry.dataLabel) !== null && _16 !== void 0 ? _16 : "";
564
+ resolvedLabel = (_22 = seriesEntry.dataLabel) !== null && _22 !== void 0 ? _22 : "";
546
565
  if (!(resolvedLabel && (0, utils_1.isAFormula)(resolvedLabel))) return [3 /*break*/, 5];
547
566
  _b = chart_spec_utils_1.coerceCalculatedLabel;
548
- return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_17 = position.sheetId) !== null && _17 !== void 0 ? _17 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
567
+ return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_23 = position.sheetId) !== null && _23 !== void 0 ? _23 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
549
568
  case 4:
550
- resolvedLabel = _b.apply(void 0, [_140.sent()]);
551
- _140.label = 5;
569
+ resolvedLabel = _b.apply(void 0, [_150.sent()]);
570
+ _150.label = 5;
552
571
  case 5:
553
- xValues = (_18 = perSeriesX[i]) !== null && _18 !== void 0 ? _18 : perSeriesX[0];
554
- sizeValues_1 = (_19 = perSeriesSize[i]) !== null && _19 !== void 0 ? _19 : perSeriesSize[0];
572
+ xValues = (_24 = perSeriesX[i]) !== null && _24 !== void 0 ? _24 : perSeriesX[0];
573
+ sizeValues_1 = (_25 = perSeriesSize[i]) !== null && _25 !== void 0 ? _25 : perSeriesSize[0];
555
574
  seriesInputs.push(tslib_1.__assign(tslib_1.__assign({ name: resolvedLabel, values: flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1) }, (xValues ? { xValues: xValues } : {})), (sizeValues_1 ? { sizeValues: sizeValues_1 } : {})));
556
- _140.label = 6;
575
+ _150.label = 6;
557
576
  case 6:
558
577
  i++;
559
578
  return [3 /*break*/, 3];
560
579
  case 7:
561
- sharedXValues = (_20 = perSeriesX[0]) !== null && _20 !== void 0 ? _20 : [];
562
- sharedSizeValues = (_21 = perSeriesSize[0]) !== null && _21 !== void 0 ? _21 : [];
580
+ sharedXValues = (_26 = perSeriesX[0]) !== null && _26 !== void 0 ? _26 : [];
581
+ sharedSizeValues = (_27 = perSeriesSize[0]) !== null && _27 !== void 0 ? _27 : [];
563
582
  _c = (0, bubble_1.prepareBubbleSeriesData)({
564
583
  xValues: sharedXValues,
565
584
  labelValues: labelValues,
566
585
  sizeValues: sharedSizeValues,
567
586
  series: seriesInputs,
568
587
  }), categories_1 = _c.categories, preparedSeries = _c.series, sizeValues = _c.sizeValues;
569
- sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues);
588
+ sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues, {
589
+ sizeRepresents: spec.sizeRepresents,
590
+ bubbleScale: spec.bubbleScale,
591
+ plotMinSide: Math.min((width !== null && width !== void 0 ? width : 0) * 0.85, (height !== null && height !== void 0 ? height : 0) * 0.75),
592
+ });
593
+ bubblePalette_1 = (0, chart_styles_1.getChartPalette)(spec, [
594
+ theme.themeColors.accent1,
595
+ theme.themeColors.accent2,
596
+ theme.themeColors.accent3,
597
+ theme.themeColors.accent4,
598
+ theme.themeColors.accent5,
599
+ theme.themeColors.accent6,
600
+ ]);
601
+ bubbleItemColor_1 = function (seriesEntry, index) {
602
+ var e_12, _a;
603
+ var _b, _c;
604
+ var base = (_b = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _b !== void 0 ? _b : (0, utils_1.chartPaletteColorAt)(bubblePalette_1, index);
605
+ var overrides = new Map();
606
+ try {
607
+ for (var _d = tslib_1.__values((_c = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _c !== void 0 ? _c : []), _e = _d.next(); !_e.done; _e = _d.next()) {
608
+ var dp = _e.value;
609
+ if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
610
+ overrides.set(dp.idx, dp.color);
611
+ }
612
+ }
613
+ }
614
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
615
+ finally {
616
+ try {
617
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
618
+ }
619
+ finally { if (e_12) throw e_12.error; }
620
+ }
621
+ return overrides.size
622
+ ? function (params) { var _a, _b; return (_b = overrides.get((_a = params === null || params === void 0 ? void 0 : params.data) === null || _a === void 0 ? void 0 : _a.index)) !== null && _b !== void 0 ? _b : base; }
623
+ : base;
624
+ };
625
+ hasBubbleSecondaryAxis = ((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []).some(function (seriesEntry) { return seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis; });
570
626
  xAxisConfig = categories_1.length > 0
571
627
  ? {
572
628
  type: "category",
573
629
  data: categories_1,
574
- name: (_22 = spec.horizontalAxisTitle) !== null && _22 !== void 0 ? _22 : "",
630
+ name: (_29 = spec.horizontalAxisTitle) !== null && _29 !== void 0 ? _29 : "",
575
631
  nameLocation: "middle",
576
632
  nameGap: 30,
577
633
  }
578
634
  : {
579
635
  type: "value",
580
- name: (_23 = spec.horizontalAxisTitle) !== null && _23 !== void 0 ? _23 : "",
636
+ name: (_30 = spec.horizontalAxisTitle) !== null && _30 !== void 0 ? _30 : "",
581
637
  nameLocation: "middle",
582
638
  nameGap: 30,
583
639
  };
@@ -595,18 +651,92 @@ var BasicChart = function (_a) {
595
651
  var _a;
596
652
  return (0, overrides_1.buildSeriesLabelOption)((0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, (_a = spec.series) === null || _a === void 0 ? void 0 : _a[index]), undefined, locale);
597
653
  };
598
- (_24 = chartRef.current) === null || _24 === void 0 ? void 0 : _24.setOption({
654
+ bubbleSeries = preparedSeries
655
+ .map(function (entry, index) {
656
+ var _a, _b, _c, _d, _e, _f, _g;
657
+ var isScatter = spec.chartType === "scatter";
658
+ var scatterStyle = (_a = spec.scatterStyle) !== null && _a !== void 0 ? _a : (isScatter ? "lineMarker" : undefined);
659
+ var seriesEntry = (_b = spec.series) === null || _b === void 0 ? void 0 : _b[index];
660
+ var seriesColor = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color;
661
+ var perMarker = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.marker;
662
+ var itemColor = bubbleItemColor_1(seriesEntry, index);
663
+ var onSecondary = (seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis) ? { yAxisIndex: 1 } : {};
664
+ if (isScatter) {
665
+ var symbol = perMarker === null || perMarker === void 0 ? void 0 : perMarker.symbol;
666
+ var noMarkers = symbol === "none";
667
+ var wantsLine = scatterStyle === "line" ||
668
+ scatterStyle === "lineMarker" ||
669
+ scatterStyle === "smooth" ||
670
+ scatterStyle === "smoothMarker";
671
+ var wantsMarkers = !noMarkers &&
672
+ (scatterStyle === "marker" ||
673
+ scatterStyle === "lineMarker" ||
674
+ scatterStyle === "smoothMarker" ||
675
+ !scatterStyle);
676
+ var smooth = scatterStyle === "smooth" || scatterStyle === "smoothMarker";
677
+ // Labels hang off the point symbols: a marker-less line keeps
678
+ // an invisible 0-size symbol per point when they show (#1049).
679
+ var labelsWithoutMarkers = !wantsMarkers &&
680
+ Boolean((_c = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesEntry)) === null || _c === void 0 ? void 0 : _c.show);
681
+ // The series colour paints the line; the markers take the
682
+ // per-point overrides when the series has any.
683
+ var markerStyle = seriesColor || typeof itemColor === "function"
684
+ ? { itemStyle: { color: itemColor } }
685
+ : {};
686
+ return wantsLine
687
+ ? tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "line", name: entry.name, data: entry.points, showSymbol: wantsMarkers || labelsWithoutMarkers, smooth: smooth, symbol: (_d = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _d !== void 0 ? _d : "circle", symbolSize: labelsWithoutMarkers ? 0 : (_e = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _e !== void 0 ? _e : 6 }, markerStyle), (seriesColor ? { lineStyle: { color: seriesColor } } : {})), onSecondary) : tslib_1.__assign(tslib_1.__assign({ type: "scatter", name: entry.name, data: entry.points, symbol: (_f = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _f !== void 0 ? _f : "circle", symbolSize: (_g = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _g !== void 0 ? _g : 6 }, markerStyle), onSecondary);
688
+ }
689
+ return tslib_1.__assign(tslib_1.__assign({ type: chartType, name: entry.name, data: entry.points, symbolSize: function (data) { var _a; return sizeScale_1((_a = data === null || data === void 0 ? void 0 : data[2]) !== null && _a !== void 0 ? _a : 0); }, label: {
690
+ show: true,
691
+ formatter: function (params) { var _a; return (_a = params.name) !== null && _a !== void 0 ? _a : ""; },
692
+ } }, (seriesColor || typeof itemColor === "function"
693
+ ? { itemStyle: { color: itemColor } }
694
+ : {})), onSecondary);
695
+ })
696
+ .map(function (s, index) {
697
+ var _a;
698
+ var bubbleSeriesLabel = bubbleSeriesLabelFor_1(index);
699
+ return bubbleSeriesLabel
700
+ ? tslib_1.__assign(tslib_1.__assign({}, s), { label: tslib_1.__assign(tslib_1.__assign({}, ((_a = s.label) !== null && _a !== void 0 ? _a : {})), bubbleSeriesLabel) }) : s;
701
+ });
702
+ bubbleOverlays = preparedSeries.flatMap(function (entry, index) {
703
+ var _a, _b;
704
+ var seriesEntry = (_a = spec.series) === null || _a === void 0 ? void 0 : _a[index];
705
+ if (!seriesEntry)
706
+ return [];
707
+ return (0, echarts_overlays_1.buildEchartsOverlaySeries)({
708
+ series: seriesEntry,
709
+ values: entry.points.map(function (point) { return point.value[1]; }),
710
+ xValues: entry.points.map(function (point) { return point.value[0]; }),
711
+ dataLabel: entry.name,
712
+ seriesColor: (_b = seriesEntry.color) !== null && _b !== void 0 ? _b : (0, utils_1.chartPaletteColorAt)(bubblePalette_1, index),
713
+ resolveRange: function (range) {
714
+ return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
715
+ },
716
+ });
717
+ });
718
+ (_31 = chartRef.current) === null || _31 === void 0 ? void 0 : _31.setOption({
599
719
  xAxis: [
600
720
  (0, overrides_1.applyAxisOverrides)(tslib_1.__assign({}, xAxisConfig), spec.categoryAxisOptions),
601
721
  ],
602
- yAxis: [
722
+ yAxis: tslib_1.__spreadArray([
603
723
  (0, overrides_1.applyAxisOverrides)({
604
724
  type: "value",
605
- name: (_25 = spec.verticalAxisTitle) !== null && _25 !== void 0 ? _25 : "",
725
+ name: (_32 = spec.verticalAxisTitle) !== null && _32 !== void 0 ? _32 : "",
606
726
  nameLocation: "middle",
607
727
  nameGap: 45,
608
- }, spec.valueAxisOptions, undefined, locale),
609
- ],
728
+ }, spec.valueAxisOptions, undefined, locale)
729
+ ], tslib_1.__read((hasBubbleSecondaryAxis
730
+ ? [
731
+ (0, overrides_1.applyAxisOverrides)({
732
+ type: "value",
733
+ position: "right",
734
+ nameLocation: "middle",
735
+ nameGap: 45,
736
+ splitLine: { show: false },
737
+ }, spec.secondaryValueAxisOptions, undefined, locale),
738
+ ]
739
+ : [])), false),
610
740
  legend: (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, legend), { show: preparedSeries.length > 1, data: preparedSeries.map(function (entry) { return entry.name; }) }), spec.legend),
611
741
  grid: {
612
742
  left: "3%",
@@ -618,57 +748,7 @@ var BasicChart = function (_a) {
618
748
  trigger: "item",
619
749
  formatter: tooltipFormatter,
620
750
  },
621
- // Scatter vs bubble — scatter uses small fixed markers
622
- // (optionally connected with a line per scatterStyle); bubble
623
- // applies a size scale on the 3rd dimension. Pre-fix scatter
624
- // routed through the bubble code, producing Y-scaled giant
625
- // circles instead of Excel's small dots.
626
- series: preparedSeries.map(function (entry, index) {
627
- var _a, _b, _c, _d, _e, _f, _g;
628
- var isScatter = spec.chartType === "scatter";
629
- var scatterStyle = (_a = spec.scatterStyle) !== null && _a !== void 0 ? _a : (isScatter ? "lineMarker" : undefined);
630
- var seriesEntry = (_b = spec.series) === null || _b === void 0 ? void 0 : _b[index];
631
- var seriesColor = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color;
632
- var perMarker = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.marker;
633
- if (isScatter) {
634
- var symbol = perMarker === null || perMarker === void 0 ? void 0 : perMarker.symbol;
635
- var noMarkers = symbol === "none";
636
- var wantsLine = scatterStyle === "line" ||
637
- scatterStyle === "lineMarker" ||
638
- scatterStyle === "smooth" ||
639
- scatterStyle === "smoothMarker";
640
- var wantsMarkers = !noMarkers &&
641
- (scatterStyle === "marker" ||
642
- scatterStyle === "lineMarker" ||
643
- scatterStyle === "smoothMarker" ||
644
- !scatterStyle);
645
- var smooth = scatterStyle === "smooth" || scatterStyle === "smoothMarker";
646
- // Labels hang off the point symbols: a marker-less line keeps
647
- // an invisible 0-size symbol per point when they show (#1049).
648
- var labelsWithoutMarkers = !wantsMarkers &&
649
- Boolean((_c = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesEntry)) === null || _c === void 0 ? void 0 : _c.show);
650
- return wantsLine
651
- ? tslib_1.__assign({ type: "line", name: entry.name, data: entry.points, showSymbol: wantsMarkers || labelsWithoutMarkers, smooth: smooth, symbol: (_d = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _d !== void 0 ? _d : "circle", symbolSize: labelsWithoutMarkers
652
- ? 0
653
- : (_e = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _e !== void 0 ? _e : 6 }, (seriesColor
654
- ? {
655
- itemStyle: { color: seriesColor },
656
- lineStyle: { color: seriesColor },
657
- }
658
- : {})) : tslib_1.__assign({ type: "scatter", name: entry.name, data: entry.points, symbol: (_f = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _f !== void 0 ? _f : "circle", symbolSize: (_g = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _g !== void 0 ? _g : 6 }, (seriesColor
659
- ? { itemStyle: { color: seriesColor } }
660
- : {}));
661
- }
662
- return tslib_1.__assign({ type: chartType, name: entry.name, data: entry.points, symbolSize: function (data) { var _a; return sizeScale_1((_a = data === null || data === void 0 ? void 0 : data[2]) !== null && _a !== void 0 ? _a : 0); }, label: {
663
- show: true,
664
- formatter: function (params) { var _a; return (_a = params.name) !== null && _a !== void 0 ? _a : ""; },
665
- } }, (seriesColor ? { itemStyle: { color: seriesColor } } : {}));
666
- }).map(function (s, index) {
667
- var _a;
668
- var bubbleSeriesLabel = bubbleSeriesLabelFor_1(index);
669
- return bubbleSeriesLabel
670
- ? tslib_1.__assign(tslib_1.__assign({}, s), { label: tslib_1.__assign(tslib_1.__assign({}, ((_a = s.label) !== null && _a !== void 0 ? _a : {})), bubbleSeriesLabel) }) : s;
671
- }),
751
+ series: tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(bubbleSeries), false), tslib_1.__read(bubbleOverlays), false),
672
752
  }, {
673
753
  replaceMerge: [
674
754
  "series",
@@ -680,7 +760,7 @@ var BasicChart = function (_a) {
680
760
  ],
681
761
  });
682
762
  previousChartType.current = spec.chartType;
683
- previousSeriesCount.current = preparedSeries.length;
763
+ previousSeriesCount.current = bubbleSeries.length + bubbleOverlays.length;
684
764
  return [2 /*return*/];
685
765
  case 8:
686
766
  if (isHierarchy) {
@@ -695,12 +775,21 @@ var BasicChart = function (_a) {
695
775
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
696
776
  });
697
777
  hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
698
- hierarchyData = (0, hierarchy_1.buildHierarchyTree)(hierarchyRows);
699
- rootName = hierarchyData.length === 1 ? (_27 = (_26 = hierarchyData[0]) === null || _26 === void 0 ? void 0 : _26.name) !== null && _27 !== void 0 ? _27 : "" : "";
700
- seriesDisplayName = (_29 = (_28 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _28 !== void 0 ? _28 : rootName) !== null && _29 !== void 0 ? _29 : "";
778
+ hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
779
+ theme.themeColors.accent1,
780
+ theme.themeColors.accent2,
781
+ theme.themeColors.accent3,
782
+ theme.themeColors.accent4,
783
+ theme.themeColors.accent5,
784
+ theme.themeColors.accent6,
785
+ ]);
786
+ hierarchyData = colorHierarchyNodes((0, hierarchy_1.buildHierarchyTree)(hierarchyRows), hierarchyPalette);
787
+ rootName = hierarchyData.length === 1 ? (_34 = (_33 = hierarchyData[0]) === null || _33 === void 0 ? void 0 : _33.name) !== null && _34 !== void 0 ? _34 : "" : "";
788
+ drillDown = Boolean(spec.drillDown);
789
+ seriesDisplayName = (_36 = (_35 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _35 !== void 0 ? _35 : rootName) !== null && _36 !== void 0 ? _36 : "";
701
790
  hierarchyDepth = getHierarchyDepth(hierarchyData);
702
791
  levels = buildHierarchyLevels(hierarchyDepth);
703
- sizeNumberFormat_1 = (0, axis_number_format_1.resolveSourceNumberFormat)((_31 = (_30 = spec.sizeData) === null || _30 === void 0 ? void 0 : _30[0]) === null || _31 === void 0 ? void 0 : _31.sources, getFormattingFromRange, spec.hiddenDimensionStrategy);
792
+ sizeNumberFormat_1 = (0, axis_number_format_1.resolveSourceNumberFormat)((_38 = (_37 = spec.sizeData) === null || _37 === void 0 ? void 0 : _37[0]) === null || _38 === void 0 ? void 0 : _38.sources, getFormattingFromRange, spec.hiddenDimensionStrategy);
704
793
  tooltipFormatter = function (params) {
705
794
  var _a;
706
795
  var value = Array.isArray(params.value)
@@ -711,7 +800,7 @@ var BasicChart = function (_a) {
711
800
  hierarchyDataLabels = spec.dataLabels;
712
801
  hierarchySeriesLabel = (0, overrides_1.buildSeriesLabelOption)(hierarchyDataLabels && !hierarchyDataLabels.numberFormatPattern
713
802
  ? tslib_1.__assign(tslib_1.__assign({}, hierarchyDataLabels), { numberFormatPattern: sizeNumberFormat_1 }) : hierarchyDataLabels, undefined, locale);
714
- (_32 = chartRef.current) === null || _32 === void 0 ? void 0 : _32.setOption({
803
+ (_39 = chartRef.current) === null || _39 === void 0 ? void 0 : _39.setOption({
715
804
  xAxis: [
716
805
  {
717
806
  type: "category",
@@ -736,21 +825,23 @@ var BasicChart = function (_a) {
736
825
  formatter: tooltipFormatter,
737
826
  },
738
827
  series: [
739
- {
740
- type: chartType,
741
- name: seriesDisplayName,
742
- rootName: rootName || seriesDisplayName || "",
743
- data: hierarchyData,
744
- label: tslib_1.__assign({ show: true, formatter: "{b}" }, (hierarchySeriesLabel !== null && hierarchySeriesLabel !== void 0 ? hierarchySeriesLabel : {})),
745
- upperLabel: spec.chartType === "treemap"
828
+ tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label: tslib_1.__assign(tslib_1.__assign({ show: true, formatter: "{b}" }, (spec.chartType === "treemap"
829
+ ? { position: "insideBottomLeft" }
830
+ : {})), (hierarchySeriesLabel !== null && hierarchySeriesLabel !== void 0 ? hierarchySeriesLabel : {})), upperLabel: spec.chartType === "treemap"
746
831
  ? {
747
832
  show: true,
748
833
  padding: [0, 0, 0, 4],
749
834
  }
750
- : undefined,
751
- levels: levels,
752
- colorMappingBy: "index",
753
- },
835
+ : undefined, levels: levels,
836
+ // Excel has no drill-down on either chart: zooming into a
837
+ // branch on click (and the treemap breadcrumb) is opt-in.
838
+ nodeClick: drillDown
839
+ ? spec.chartType === "treemap"
840
+ ? "zoomToNode"
841
+ : "rootToNode"
842
+ : false }, (spec.chartType === "treemap"
843
+ ? { breadcrumb: { show: drillDown } }
844
+ : { radius: tslib_1.__spreadArray([], tslib_1.__read(SUNBURST_RADIUS), false) })),
754
845
  ],
755
846
  }, {
756
847
  replaceMerge: [
@@ -775,7 +866,7 @@ var BasicChart = function (_a) {
775
866
  }
776
867
  isContour = (0, three_d_1.isContourSpec)(spec);
777
868
  if (renderedAsContour.current && !isContour) {
778
- (_33 = chartRef.current) === null || _33 === void 0 ? void 0 : _33.dispose();
869
+ (_40 = chartRef.current) === null || _40 === void 0 ? void 0 : _40.dispose();
779
870
  chartRef.current = undefined;
780
871
  renderedAsContour.current = false;
781
872
  previousChartType.current = undefined;
@@ -786,39 +877,39 @@ var BasicChart = function (_a) {
786
877
  if (!isContour) return [3 /*break*/, 19];
787
878
  categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
788
879
  contourSeriesInputs = [];
789
- _140.label = 9;
880
+ _150.label = 9;
790
881
  case 9:
791
- _140.trys.push([9, 16, 17, 18]);
792
- _d = tslib_1.__values((_34 = spec.series) !== null && _34 !== void 0 ? _34 : []), _e = _d.next();
793
- _140.label = 10;
882
+ _150.trys.push([9, 16, 17, 18]);
883
+ _d = tslib_1.__values((_41 = spec.series) !== null && _41 !== void 0 ? _41 : []), _e = _d.next();
884
+ _150.label = 10;
794
885
  case 10:
795
886
  if (!!_e.done) return [3 /*break*/, 15];
796
887
  seriesEntry = _e.value;
797
888
  if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 12];
798
889
  _g = chart_spec_utils_1.coerceCalculatedLabel;
799
- return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_35 = position.sheetId) !== null && _35 !== void 0 ? _35 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
890
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_42 = position.sheetId) !== null && _42 !== void 0 ? _42 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
800
891
  case 11:
801
- _f = _g.apply(void 0, [_140.sent()]);
892
+ _f = _g.apply(void 0, [_150.sent()]);
802
893
  return [3 /*break*/, 13];
803
894
  case 12:
804
- _f = (_36 = seriesEntry.dataLabel) !== null && _36 !== void 0 ? _36 : "";
805
- _140.label = 13;
895
+ _f = (_43 = seriesEntry.dataLabel) !== null && _43 !== void 0 ? _43 : "";
896
+ _150.label = 13;
806
897
  case 13:
807
898
  dataLabel = _f;
808
899
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
809
900
  contourSeriesInputs.push({ name: dataLabel, values: values });
810
- _140.label = 14;
901
+ _150.label = 14;
811
902
  case 14:
812
903
  _e = _d.next();
813
904
  return [3 /*break*/, 10];
814
905
  case 15: return [3 /*break*/, 18];
815
906
  case 16:
816
- e_1_1 = _140.sent();
907
+ e_1_1 = _150.sent();
817
908
  e_1 = { error: e_1_1 };
818
909
  return [3 /*break*/, 18];
819
910
  case 17:
820
911
  try {
821
- if (_e && !_e.done && (_0 = _d.return)) _0.call(_d);
912
+ if (_e && !_e.done && (_4 = _d.return)) _4.call(_d);
822
913
  }
823
914
  finally { if (e_1) throw e_1.error; }
824
915
  return [7 /*endfinally*/];
@@ -838,7 +929,7 @@ var BasicChart = function (_a) {
838
929
  chartRef.current = echarts.init(el.current);
839
930
  bindSeriesSelection(chartRef.current);
840
931
  }
841
- (_37 = chartRef.current) === null || _37 === void 0 ? void 0 : _37.setOption({
932
+ (_44 = chartRef.current) === null || _44 === void 0 ? void 0 : _44.setOption({
842
933
  tooltip: {
843
934
  textStyle: { fontSize: 12 },
844
935
  trigger: "item",
@@ -858,7 +949,7 @@ var BasicChart = function (_a) {
858
949
  type: "category",
859
950
  data: categories_2,
860
951
  splitArea: { show: true },
861
- name: (_38 = spec.horizontalAxisTitle) !== null && _38 !== void 0 ? _38 : "",
952
+ name: (_45 = spec.horizontalAxisTitle) !== null && _45 !== void 0 ? _45 : "",
862
953
  nameLocation: "middle",
863
954
  nameGap: 30,
864
955
  }, spec.categoryAxisOptions),
@@ -868,7 +959,7 @@ var BasicChart = function (_a) {
868
959
  type: "category",
869
960
  data: seriesNames_1,
870
961
  splitArea: { show: true },
871
- name: (_39 = spec.verticalAxisTitle) !== null && _39 !== void 0 ? _39 : "",
962
+ name: (_46 = spec.verticalAxisTitle) !== null && _46 !== void 0 ? _46 : "",
872
963
  nameLocation: "middle",
873
964
  nameGap: 50,
874
965
  },
@@ -921,39 +1012,39 @@ var BasicChart = function (_a) {
921
1012
  if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 30];
922
1013
  categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
923
1014
  threeDSeriesInputs = [];
924
- _140.label = 20;
1015
+ _150.label = 20;
925
1016
  case 20:
926
- _140.trys.push([20, 27, 28, 29]);
927
- _j = tslib_1.__values((_40 = spec.series) !== null && _40 !== void 0 ? _40 : []), _k = _j.next();
928
- _140.label = 21;
1017
+ _150.trys.push([20, 27, 28, 29]);
1018
+ _j = tslib_1.__values((_47 = spec.series) !== null && _47 !== void 0 ? _47 : []), _k = _j.next();
1019
+ _150.label = 21;
929
1020
  case 21:
930
1021
  if (!!_k.done) return [3 /*break*/, 26];
931
1022
  seriesEntry = _k.value;
932
1023
  if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 23];
933
1024
  _m = chart_spec_utils_1.coerceCalculatedLabel;
934
- return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_41 = position.sheetId) !== null && _41 !== void 0 ? _41 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1025
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_48 = position.sheetId) !== null && _48 !== void 0 ? _48 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
935
1026
  case 22:
936
- _l = _m.apply(void 0, [_140.sent()]);
1027
+ _l = _m.apply(void 0, [_150.sent()]);
937
1028
  return [3 /*break*/, 24];
938
1029
  case 23:
939
- _l = (_42 = seriesEntry.dataLabel) !== null && _42 !== void 0 ? _42 : "";
940
- _140.label = 24;
1030
+ _l = (_49 = seriesEntry.dataLabel) !== null && _49 !== void 0 ? _49 : "";
1031
+ _150.label = 24;
941
1032
  case 24:
942
1033
  dataLabel = _l;
943
1034
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
944
1035
  threeDSeriesInputs.push({ name: dataLabel, values: values });
945
- _140.label = 25;
1036
+ _150.label = 25;
946
1037
  case 25:
947
1038
  _k = _j.next();
948
1039
  return [3 /*break*/, 21];
949
1040
  case 26: return [3 /*break*/, 29];
950
1041
  case 27:
951
- e_2_1 = _140.sent();
1042
+ e_2_1 = _150.sent();
952
1043
  e_2 = { error: e_2_1 };
953
1044
  return [3 /*break*/, 29];
954
1045
  case 28:
955
1046
  try {
956
- if (_k && !_k.done && (_1 = _j.return)) _1.call(_j);
1047
+ if (_k && !_k.done && (_5 = _j.return)) _5.call(_j);
957
1048
  }
958
1049
  finally { if (e_2) throw e_2.error; }
959
1050
  return [7 /*endfinally*/];
@@ -1027,7 +1118,7 @@ var BasicChart = function (_a) {
1027
1118
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
1028
1119
  finally {
1029
1120
  try {
1030
- if (threeDSeriesInputs_1_1 && !threeDSeriesInputs_1_1.done && (_2 = threeDSeriesInputs_1.return)) _2.call(threeDSeriesInputs_1);
1121
+ if (threeDSeriesInputs_1_1 && !threeDSeriesInputs_1_1.done && (_6 = threeDSeriesInputs_1.return)) _6.call(threeDSeriesInputs_1);
1031
1122
  }
1032
1123
  finally { if (e_4) throw e_4.error; }
1033
1124
  }
@@ -1117,12 +1208,12 @@ var BasicChart = function (_a) {
1117
1208
  inRange: { color: tslib_1.__spreadArray([], tslib_1.__read(three_d_1.SURFACE_COLOR_RAMP), false) },
1118
1209
  };
1119
1210
  }
1120
- (_43 = chartRef.current) === null || _43 === void 0 ? void 0 : _43.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
1211
+ (_50 = chartRef.current) === null || _50 === void 0 ? void 0 : _50.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
1121
1212
  textStyle: { fontSize: 12 },
1122
1213
  formatter: threeDTooltipFormatter,
1123
1214
  }, legend: threeDRenderKind === "line3D" || stackedBar3D_1
1124
1215
  ? (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: seriesNames_2.length > 1, data: seriesNames_2 }), spec.legend)
1125
- : { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (_44 = spec.horizontalAxisTitle) !== null && _44 !== void 0 ? _44 : "" }), yAxis3D: tslib_1.__assign(tslib_1.__assign({}, yAxis3D), { name: "" }), zAxis3D: { type: "value", name: (_45 = spec.verticalAxisTitle) !== null && _45 !== void 0 ? _45 : "" }, grid3D: {
1216
+ : { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (_51 = spec.horizontalAxisTitle) !== null && _51 !== void 0 ? _51 : "" }), yAxis3D: tslib_1.__assign(tslib_1.__assign({}, yAxis3D), { name: "" }), zAxis3D: { type: "value", name: (_52 = spec.verticalAxisTitle) !== null && _52 !== void 0 ? _52 : "" }, grid3D: {
1126
1217
  boxDepth: Math.max(20, Math.min(100, seriesNames_2.length * 20)),
1127
1218
  viewControl: { autoRotate: false },
1128
1219
  } }, (visualMap ? { visualMap: [visualMap] } : {})), { series: threeDSeries }), {
@@ -1153,7 +1244,7 @@ var BasicChart = function (_a) {
1153
1244
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders);
1154
1245
  radarSeriesInputs = [];
1155
1246
  try {
1156
- for (_p = tslib_1.__values((_46 = spec.series) !== null && _46 !== void 0 ? _46 : []), _q = _p.next(); !_q.done; _q = _p.next()) {
1247
+ for (_p = tslib_1.__values((_53 = spec.series) !== null && _53 !== void 0 ? _53 : []), _q = _p.next(); !_q.done; _q = _p.next()) {
1157
1248
  seriesEntry = _q.value;
1158
1249
  label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
1159
1250
  ? seriesEntry.dataLabel
@@ -1165,14 +1256,14 @@ var BasicChart = function (_a) {
1165
1256
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
1166
1257
  finally {
1167
1258
  try {
1168
- if (_q && !_q.done && (_3 = _p.return)) _3.call(_p);
1259
+ if (_q && !_q.done && (_7 = _p.return)) _7.call(_p);
1169
1260
  }
1170
1261
  finally { if (e_5) throw e_5.error; }
1171
1262
  }
1172
- radarAxisOptions = spec.valueAxisOptions;
1173
- indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions);
1263
+ radarAxisOptions_1 = spec.valueAxisOptions;
1264
+ indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions_1);
1174
1265
  radarData = (0, radar_1.buildRadarSeriesData)(radarSeriesInputs, indicators_1.length);
1175
- radarStyle_1 = (_47 = spec.radarStyle) !== null && _47 !== void 0 ? _47 : "standard";
1266
+ radarStyle_1 = (_54 = spec.radarStyle) !== null && _54 !== void 0 ? _54 : "standard";
1176
1267
  radarColors_1 = radarSeriesInputs.map(function (_, i) { var _a, _b; return (_b = (_a = spec.series) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.color; });
1177
1268
  radarFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
1178
1269
  radarDataLabels_1 = spec.dataLabels;
@@ -1189,16 +1280,20 @@ var BasicChart = function (_a) {
1189
1280
  });
1190
1281
  return tslib_1.__spreadArray([(_b = params === null || params === void 0 ? void 0 : params.name) !== null && _b !== void 0 ? _b : ""], tslib_1.__read(lines), false).filter(Boolean).join("<br/>");
1191
1282
  };
1192
- (_48 = chartRef.current) === null || _48 === void 0 ? void 0 : _48.setOption({
1283
+ (_55 = chartRef.current) === null || _55 === void 0 ? void 0 : _55.setOption({
1193
1284
  radar: {
1194
- indicator: indicators_1.length
1285
+ // The common scale's tick labels along ONE axis, as Excel draws
1286
+ // them: echarts labels every indicator axis, so each indicator
1287
+ // carries its own `axisLabel.show` (an indicator's own options win
1288
+ // over the radar-level ones in echarts' merge) and only the first
1289
+ // shows (#1066 follow-up); hidden with the spec's value axis.
1290
+ indicator: (indicators_1.length
1195
1291
  ? indicators_1
1196
- : [{ name: "", min: 0, max: 1 }],
1197
- // The common scale's tick labels along one axis, as Excel draws
1198
- // them (echarts labels the first indicator axis only); hidden
1199
- // with the spec's value axis.
1292
+ : [{ name: "", min: 0, max: 1 }]).map(function (indicator, index) { return (tslib_1.__assign(tslib_1.__assign({}, indicator), { axisLabel: {
1293
+ show: index === 0 && (radarAxisOptions_1 === null || radarAxisOptions_1 === void 0 ? void 0 : radarAxisOptions_1.visible) !== false,
1294
+ } })); }),
1200
1295
  axisLabel: {
1201
- show: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
1296
+ show: (radarAxisOptions_1 === null || radarAxisOptions_1 === void 0 ? void 0 : radarAxisOptions_1.visible) !== false,
1202
1297
  formatter: function (value) {
1203
1298
  return (0, axis_number_format_1.formatAxisValue)(radarFormats_1[0], value, locale);
1204
1299
  },
@@ -1241,9 +1336,9 @@ var BasicChart = function (_a) {
1241
1336
  // V-variants additionally get a volume column sub-pane below the
1242
1337
  // price plot.
1243
1338
  if (spec.chartType === "stock") {
1244
- variant_1 = ((_49 = spec.stockVariant) !== null && _49 !== void 0 ? _49 : "HLC");
1339
+ variant_1 = ((_56 = spec.stockVariant) !== null && _56 !== void 0 ? _56 : "HLC");
1245
1340
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1246
- seriesValues = ((_50 = spec.series) !== null && _50 !== void 0 ? _50 : []).map(function (seriesEntry) {
1341
+ seriesValues = ((_57 = spec.series) !== null && _57 !== void 0 ? _57 : []).map(function (seriesEntry) {
1247
1342
  return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
1248
1343
  });
1249
1344
  stockFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
@@ -1261,7 +1356,7 @@ var BasicChart = function (_a) {
1261
1356
  upColor_1 = theme.themeColors.accent1;
1262
1357
  downColor_1 = theme.themeColors.accent2;
1263
1358
  volumePoints = (0, stock_1.toVolumeSeries)(seriesValues, variant_1);
1264
- hasVolume = ((_51 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _51 !== void 0 ? _51 : 0) > 0;
1359
+ hasVolume = ((_58 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _58 !== void 0 ? _58 : 0) > 0;
1265
1360
  stockGrid = hasVolume
1266
1361
  ? [
1267
1362
  { left: "10%", right: "4%", top: "8%", height: "56%" },
@@ -1275,7 +1370,7 @@ var BasicChart = function (_a) {
1275
1370
  axisLine: { show: true },
1276
1371
  axisTick: { show: true },
1277
1372
  splitLine: { show: false },
1278
- name: (_52 = spec.horizontalAxisTitle) !== null && _52 !== void 0 ? _52 : "",
1373
+ name: (_59 = spec.horizontalAxisTitle) !== null && _59 !== void 0 ? _59 : "",
1279
1374
  nameLocation: "middle",
1280
1375
  nameGap: 30,
1281
1376
  }, spec.categoryAxisOptions);
@@ -1317,14 +1412,14 @@ var BasicChart = function (_a) {
1317
1412
  // (no open) fall through to the line-derived rendering below.
1318
1413
  if (variant_1 === "OHLC" || variant_1 === "VOHLC") {
1319
1414
  candleData = (0, stock_1.toCandlestick)(seriesValues, variant_1);
1320
- (_53 = chartRef.current) === null || _53 === void 0 ? void 0 : _53.setOption({
1415
+ (_60 = chartRef.current) === null || _60 === void 0 ? void 0 : _60.setOption({
1321
1416
  xAxis: stockXAxis,
1322
1417
  yAxis: tslib_1.__spreadArray([
1323
1418
  (0, overrides_1.applyAxisOverrides)({
1324
1419
  type: "value",
1325
1420
  show: true,
1326
1421
  scale: true,
1327
- name: (_54 = spec.verticalAxisTitle) !== null && _54 !== void 0 ? _54 : "",
1422
+ name: (_61 = spec.verticalAxisTitle) !== null && _61 !== void 0 ? _61 : "",
1328
1423
  nameLocation: "middle",
1329
1424
  nameGap: 50,
1330
1425
  gridIndex: 0,
@@ -1369,13 +1464,13 @@ var BasicChart = function (_a) {
1369
1464
  theme.themeColors.accent3,
1370
1465
  theme.themeColors.accent4,
1371
1466
  ]);
1372
- (_55 = chartRef.current) === null || _55 === void 0 ? void 0 : _55.setOption({
1467
+ (_62 = chartRef.current) === null || _62 === void 0 ? void 0 : _62.setOption({
1373
1468
  xAxis: stockXAxis,
1374
1469
  yAxis: tslib_1.__spreadArray([
1375
1470
  (0, overrides_1.applyAxisOverrides)({
1376
1471
  type: "value",
1377
1472
  show: true,
1378
- name: (_56 = spec.verticalAxisTitle) !== null && _56 !== void 0 ? _56 : "",
1473
+ name: (_63 = spec.verticalAxisTitle) !== null && _63 !== void 0 ? _63 : "",
1379
1474
  nameLocation: "middle",
1380
1475
  nameGap: 50,
1381
1476
  gridIndex: 0,
@@ -1414,14 +1509,14 @@ var BasicChart = function (_a) {
1414
1509
  ofPieLayout = null;
1415
1510
  isHorizontalBarChart = spec.chartType === "bar";
1416
1511
  shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
1417
- primaryDomainSource = (_59 = (_58 = (_57 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _57 === void 0 ? void 0 : _57[0]) === null || _58 === void 0 ? void 0 : _58.sources) === null || _59 === void 0 ? void 0 : _59[0];
1512
+ primaryDomainSource = (_66 = (_65 = (_64 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _64 === void 0 ? void 0 : _64[0]) === null || _65 === void 0 ? void 0 : _65.sources) === null || _66 === void 0 ? void 0 : _66[0];
1418
1513
  rawPrimaryDomainValues = primaryDomainSource
1419
- ? (0, aggregation_1.sanitizeDomainValues)((_60 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _60 !== void 0 ? _60 : [])
1514
+ ? (0, aggregation_1.sanitizeDomainValues)((_67 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _67 !== void 0 ? _67 : [])
1420
1515
  : [];
1421
1516
  aggregateDomainValues = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
1422
1517
  categoryLevels = isCircularChart
1423
1518
  ? undefined
1424
- : (0, category_levels_1.resolveCategoryLevels)((_61 = spec.categoryLevels) === null || _61 === void 0 ? void 0 : _61.map(function (level) {
1519
+ : (0, category_levels_1.resolveCategoryLevels)((_68 = spec.categoryLevels) === null || _68 === void 0 ? void 0 : _68.map(function (level) {
1425
1520
  return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
1426
1521
  }));
1427
1522
  if (categoryLevels) {
@@ -1432,15 +1527,15 @@ var BasicChart = function (_a) {
1432
1527
  axisTick: { show: true },
1433
1528
  splitLine: { show: true },
1434
1529
  name: isHorizontalBarChart
1435
- ? (_62 = spec.verticalAxisTitle) !== null && _62 !== void 0 ? _62 : ""
1436
- : (_63 = spec.horizontalAxisTitle) !== null && _63 !== void 0 ? _63 : "",
1530
+ ? (_69 = spec.verticalAxisTitle) !== null && _69 !== void 0 ? _69 : ""
1531
+ : (_70 = spec.horizontalAxisTitle) !== null && _70 !== void 0 ? _70 : "",
1437
1532
  nameLocation: "middle",
1438
1533
  nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
1439
1534
  })), false));
1440
1535
  }
1441
1536
  // One category axis per domain (Excel): a domain drawn from several
1442
1537
  // ranges lists their categories in sequence on that single axis.
1443
- (categoryLevels ? [] : (_64 = spec.domains) !== null && _64 !== void 0 ? _64 : []).forEach(function (domain, domainIndex) {
1538
+ (categoryLevels ? [] : (_71 = spec.domains) !== null && _71 !== void 0 ? _71 : []).forEach(function (domain, domainIndex) {
1444
1539
  var _a, _b;
1445
1540
  var axisData = domain.sources.flatMap(function (sheetRange, sourceIndex) {
1446
1541
  var _a;
@@ -1476,15 +1571,14 @@ var BasicChart = function (_a) {
1476
1571
  splitLine: { show: true },
1477
1572
  gridIndex: 0,
1478
1573
  name: isHorizontalBarChart
1479
- ? (_65 = spec.verticalAxisTitle) !== null && _65 !== void 0 ? _65 : ""
1480
- : (_66 = spec.horizontalAxisTitle) !== null && _66 !== void 0 ? _66 : "",
1574
+ ? (_72 = spec.verticalAxisTitle) !== null && _72 !== void 0 ? _72 : ""
1575
+ : (_73 = spec.horizontalAxisTitle) !== null && _73 !== void 0 ? _73 : "",
1481
1576
  nameLocation: "middle",
1482
1577
  nameGap: CATEGORY_AXIS_NAME_GAP,
1483
1578
  });
1484
1579
  }
1485
1580
  pushSeriesOverlays = function (series, data, dataLabel) {
1486
- var e_10, _a;
1487
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1581
+ var _a;
1488
1582
  var numericValues = Array.isArray(data)
1489
1583
  ? data.map(function (v) {
1490
1584
  return typeof v === "number"
@@ -1496,135 +1590,21 @@ var BasicChart = function (_a) {
1496
1590
  : [];
1497
1591
  if (numericValues.length === 0)
1498
1592
  return;
1499
- var seriesColor = (_b = series.color) !== null && _b !== void 0 ? _b : theme.themeColors.accent1;
1500
- var useSecondary = series.useSecondaryAxis ? { yAxisIndex: 1 } : {};
1501
- try {
1502
- // Trendlines — one overlay line series per spec.
1503
- for (var _m = tslib_1.__values((_c = series.trendlines) !== null && _c !== void 0 ? _c : []), _o = _m.next(); !_o.done; _o = _m.next()) {
1504
- var tl = _o.value;
1505
- var result = (0, trendline_1.computeTrendline)(numericValues, {
1506
- type: tl.type,
1507
- order: tl.order,
1508
- period: tl.period,
1509
- forecastForward: tl.forecastForward,
1510
- forecastBackward: tl.forecastBackward,
1511
- });
1512
- if (!result || result.points.length < 2)
1513
- continue;
1514
- var tlName = (_d = tl.name) !== null && _d !== void 0 ? _d : "".concat(dataLabel ? dataLabel + " " : "").concat((_e = tl.type) !== null && _e !== void 0 ? _e : "linear", " trend");
1515
- chartSeries.push(tslib_1.__assign({ type: "line", name: tlName,
1516
- // Index x lets the trendline overlay the category axis even
1517
- // when forecasting extends beyond the data range.
1518
- data: result.points.map(function (p) { return [p.x, p.y]; }), showSymbol: false, smooth: tl.type === "poly", lineStyle: {
1519
- color: (_f = tl.color) !== null && _f !== void 0 ? _f : seriesColor,
1520
- type: "dashed",
1521
- width: 2,
1522
- }, itemStyle: { color: (_g = tl.color) !== null && _g !== void 0 ? _g : seriesColor }, tooltip: { show: false }, z: 5 }, useSecondary));
1523
- }
1524
- }
1525
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
1526
- finally {
1527
- try {
1528
- if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
1529
- }
1530
- finally { if (e_10) throw e_10.error; }
1531
- }
1532
- // Error bars — drawn as a custom series of vertical/horizontal
1533
- // whiskers. valueType "custom" reads per-point magnitudes from the
1534
- // spec's plus/minus ranges, resolved through the same extractor
1535
- // the series values use.
1536
- var magnitudes = (0, error_bars_1.computeErrorBars)(numericValues, (0, error_bars_1.resolveCustomErrorBarValues)(series.errorBars, function (range) {
1537
- return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
1538
- }));
1539
- if (magnitudes) {
1540
- var direction_1 = (_j = (_h = series.errorBars) === null || _h === void 0 ? void 0 : _h.direction) !== null && _j !== void 0 ? _j : "y";
1541
- var noEndCap_1 = (_l = (_k = series.errorBars) === null || _k === void 0 ? void 0 : _k.noEndCap) !== null && _l !== void 0 ? _l : false;
1542
- var errorData = numericValues.map(function (v, i) {
1543
- var _a, _b;
1544
- return [
1545
- i,
1546
- typeof v === "number" ? v : 0,
1547
- (_a = magnitudes.plus[i]) !== null && _a !== void 0 ? _a : 0,
1548
- (_b = magnitudes.minus[i]) !== null && _b !== void 0 ? _b : 0,
1549
- ];
1550
- });
1551
- chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "custom", name: "".concat(dataLabel ? dataLabel + " " : "", "error"), data: errorData, z: 6, tooltip: { show: false } }, useSecondary), { renderItem: function (_params, api) {
1552
- var value = api.value(1);
1553
- var plus = api.value(2);
1554
- var minus = api.value(3);
1555
- var capHalf = 5;
1556
- if (direction_1 === "x") {
1557
- var center_1 = api.coord([value, api.value(0)]);
1558
- var hi_1 = api.coord([value + plus, api.value(0)]);
1559
- var lo_1 = api.coord([value - minus, api.value(0)]);
1560
- var children_1 = [
1561
- {
1562
- type: "line",
1563
- shape: { x1: lo_1[0], y1: center_1[1], x2: hi_1[0], y2: center_1[1] },
1564
- style: { stroke: seriesColor, lineWidth: 1 },
1565
- },
1566
- ];
1567
- if (!noEndCap_1) {
1568
- children_1.push({
1569
- type: "line",
1570
- shape: {
1571
- x1: hi_1[0],
1572
- y1: center_1[1] - capHalf,
1573
- x2: hi_1[0],
1574
- y2: center_1[1] + capHalf,
1575
- },
1576
- style: { stroke: seriesColor, lineWidth: 1 },
1577
- }, {
1578
- type: "line",
1579
- shape: {
1580
- x1: lo_1[0],
1581
- y1: center_1[1] - capHalf,
1582
- x2: lo_1[0],
1583
- y2: center_1[1] + capHalf,
1584
- },
1585
- style: { stroke: seriesColor, lineWidth: 1 },
1586
- });
1587
- }
1588
- return { type: "group", children: children_1 };
1589
- }
1590
- var center = api.coord([api.value(0), value]);
1591
- var hi = api.coord([api.value(0), value + plus]);
1592
- var lo = api.coord([api.value(0), value - minus]);
1593
- var children = [
1594
- {
1595
- type: "line",
1596
- shape: { x1: center[0], y1: lo[1], x2: center[0], y2: hi[1] },
1597
- style: { stroke: seriesColor, lineWidth: 1 },
1598
- },
1599
- ];
1600
- if (!noEndCap_1) {
1601
- children.push({
1602
- type: "line",
1603
- shape: {
1604
- x1: center[0] - capHalf,
1605
- y1: hi[1],
1606
- x2: center[0] + capHalf,
1607
- y2: hi[1],
1608
- },
1609
- style: { stroke: seriesColor, lineWidth: 1 },
1610
- }, {
1611
- type: "line",
1612
- shape: {
1613
- x1: center[0] - capHalf,
1614
- y1: lo[1],
1615
- x2: center[0] + capHalf,
1616
- y2: lo[1],
1617
- },
1618
- style: { stroke: seriesColor, lineWidth: 1 },
1619
- });
1620
- }
1621
- return { type: "group", children: children };
1622
- } }));
1623
- }
1593
+ chartSeries.push.apply(chartSeries, tslib_1.__spreadArray([], tslib_1.__read((0, echarts_overlays_1.buildEchartsOverlaySeries)({
1594
+ series: series,
1595
+ values: numericValues,
1596
+ // A horizontal bar keeps its categories on y (#1061).
1597
+ horizontal: isHorizontalBarChart,
1598
+ dataLabel: dataLabel,
1599
+ seriesColor: (_a = series.color) !== null && _a !== void 0 ? _a : theme.themeColors.accent1,
1600
+ resolveRange: function (range) {
1601
+ return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
1602
+ },
1603
+ })), false));
1624
1604
  };
1625
1605
  sideBySideBarCount = isStacked
1626
1606
  ? 1
1627
- : ((_67 = spec.series) !== null && _67 !== void 0 ? _67 : []).reduce(function (count, s) {
1607
+ : ((_74 = spec.series) !== null && _74 !== void 0 ? _74 : []).reduce(function (count, s) {
1628
1608
  var _a;
1629
1609
  var seriesType = (_a = s.seriesChartType) !== null && _a !== void 0 ? _a : spec.chartType;
1630
1610
  return seriesType === "bar" || seriesType === "column"
@@ -1648,29 +1628,29 @@ var BasicChart = function (_a) {
1648
1628
  return (0, utils_1.chartPaletteColorAt)(seriesPalette, index);
1649
1629
  };
1650
1630
  _loop_1 = function (specSeriesIndex, series) {
1651
- var dataLabel, _141, _142, effectiveChartType, lineLike, domainSources, pieDomainLabels, piePointOffset, data, seriesEchartsType, seriesStyleAttrs, seriesEntry, isBarOrColumn, seriesAny, markerSymbol, wantsMarkers, labelsWithoutMarkers, isolated, marked, isolated_1, isolated_1_1, i, gradientArgs, gradient, overrides_2, _143, _144, dp, fallback_1, overrides_3, _145, _146, dp, positiveColor_1, negativeColor_1;
1652
- var e_11, _147, e_12, _148, e_13, _149;
1653
- return tslib_1.__generator(this, function (_150) {
1654
- switch (_150.label) {
1631
+ var dataLabel, _151, _152, effectiveChartType, lineLike, domainSources, pieDomainLabels, piePointOffset, data, seriesEchartsType, seriesStyleAttrs, seriesEntry, isBarOrColumn, seriesAny, markerSymbol, wantsMarkers, labelsWithoutMarkers, isolated, marked, isolated_1, isolated_1_1, i, gradientArgs, gradient, overrides_2, _153, _154, dp, fallback_1, overrides_3, _155, _156, dp, positiveColor_1, negativeColor_1;
1632
+ var e_13, _157, e_14, _158, e_15, _159;
1633
+ return tslib_1.__generator(this, function (_160) {
1634
+ switch (_160.label) {
1655
1635
  case 0:
1656
1636
  if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1657
- _142 = chart_spec_utils_1.coerceCalculatedLabel;
1658
- return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_69 = position.sheetId) !== null && _69 !== void 0 ? _69 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1637
+ _152 = chart_spec_utils_1.coerceCalculatedLabel;
1638
+ return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_76 = position.sheetId) !== null && _76 !== void 0 ? _76 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1659
1639
  case 1:
1660
- _141 = _142.apply(void 0, [_150.sent()]);
1640
+ _151 = _152.apply(void 0, [_160.sent()]);
1661
1641
  return [3 /*break*/, 3];
1662
1642
  case 2:
1663
- _141 = (_70 = series.dataLabel) !== null && _70 !== void 0 ? _70 : "";
1664
- _150.label = 3;
1643
+ _151 = (_77 = series.dataLabel) !== null && _77 !== void 0 ? _77 : "";
1644
+ _160.label = 3;
1665
1645
  case 3:
1666
- dataLabel = _141;
1646
+ dataLabel = _151;
1667
1647
  // Label
1668
1648
  if (dataLabel) {
1669
- (_71 = legend.data) === null || _71 === void 0 ? void 0 : _71.push(dataLabel);
1649
+ (_78 = legend.data) === null || _78 === void 0 ? void 0 : _78.push(dataLabel);
1670
1650
  }
1671
- effectiveChartType = (_72 = series.seriesChartType) !== null && _72 !== void 0 ? _72 : spec.chartType;
1651
+ effectiveChartType = (_79 = series.seriesChartType) !== null && _79 !== void 0 ? _79 : spec.chartType;
1672
1652
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1673
- domainSources = (_75 = (_74 = (_73 = spec.domains) === null || _73 === void 0 ? void 0 : _73[0]) === null || _74 === void 0 ? void 0 : _74.sources) !== null && _75 !== void 0 ? _75 : [];
1653
+ domainSources = (_82 = (_81 = (_80 = spec.domains) === null || _80 === void 0 ? void 0 : _80[0]) === null || _81 === void 0 ? void 0 : _81.sources) !== null && _82 !== void 0 ? _82 : [];
1674
1654
  pieDomainLabels = isCircularChart &&
1675
1655
  (domainSources.length > 1 || series.sources.length > 1)
1676
1656
  ? domainSources.flatMap(function (sheetRange) {
@@ -1702,7 +1682,7 @@ var BasicChart = function (_a) {
1702
1682
  seriesEntry = tslib_1.__assign(tslib_1.__assign({ type: seriesEchartsType,
1703
1683
  // Ties the rendered series back to spec.series for click selection
1704
1684
  // One rendered series per spec series (source index 0).
1705
- id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (_76 = spec.smooth) !== null && _76 !== void 0 ? _76 : undefined, radius: (_77 = spec.radius) !== null && _77 !== void 0 ? _77 : (isCircularChart ? [0, "75%"] : undefined) }, ((0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike)
1685
+ id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (_83 = spec.smooth) !== null && _83 !== void 0 ? _83 : undefined, radius: (_84 = spec.radius) !== null && _84 !== void 0 ? _84 : (isCircularChart ? [0, "75%"] : undefined) }, ((0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike)
1706
1686
  ? { connectNulls: true }
1707
1687
  : {})), seriesStyleAttrs);
1708
1688
  // Plot this series against a secondary value axis. The 2nd
@@ -1727,17 +1707,17 @@ var BasicChart = function (_a) {
1727
1707
  }
1728
1708
  seriesAny = series;
1729
1709
  if (effectiveChartType === "line") {
1730
- markerSymbol = (_78 = seriesAny.marker) === null || _78 === void 0 ? void 0 : _78.symbol;
1710
+ markerSymbol = (_85 = seriesAny.marker) === null || _85 === void 0 ? void 0 : _85.symbol;
1731
1711
  wantsMarkers = markerSymbol === "none"
1732
1712
  ? false
1733
1713
  : Boolean(spec.showMarkers) || !(0, utils_1.isNil)(markerSymbol);
1734
1714
  labelsWithoutMarkers = !wantsMarkers &&
1735
- Boolean((_79 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _79 === void 0 ? void 0 : _79.show);
1715
+ Boolean((_86 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _86 === void 0 ? void 0 : _86.show);
1736
1716
  seriesEntry.showSymbol = wantsMarkers || labelsWithoutMarkers;
1737
1717
  if (wantsMarkers) {
1738
1718
  seriesEntry.symbol =
1739
- (_80 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _80 !== void 0 ? _80 : "circle";
1740
- seriesEntry.symbolSize = (_82 = (_81 = seriesAny.marker) === null || _81 === void 0 ? void 0 : _81.size) !== null && _82 !== void 0 ? _82 : 6;
1719
+ (_87 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _87 !== void 0 ? _87 : "circle";
1720
+ seriesEntry.symbolSize = (_89 = (_88 = seriesAny.marker) === null || _88 === void 0 ? void 0 : _88.size) !== null && _89 !== void 0 ? _89 : 6;
1741
1721
  }
1742
1722
  else {
1743
1723
  if (labelsWithoutMarkers) {
@@ -1752,17 +1732,17 @@ var BasicChart = function (_a) {
1752
1732
  seriesEntry.symbol = "none";
1753
1733
  marked = tslib_1.__spreadArray([], tslib_1.__read(data), false);
1754
1734
  try {
1755
- for (isolated_1 = (e_11 = void 0, tslib_1.__values(isolated)), isolated_1_1 = isolated_1.next(); !isolated_1_1.done; isolated_1_1 = isolated_1.next()) {
1735
+ for (isolated_1 = (e_13 = void 0, tslib_1.__values(isolated)), isolated_1_1 = isolated_1.next(); !isolated_1_1.done; isolated_1_1 = isolated_1.next()) {
1756
1736
  i = isolated_1_1.value;
1757
1737
  marked[i] = { value: marked[i], symbol: "circle", symbolSize: 6 };
1758
1738
  }
1759
1739
  }
1760
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
1740
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1761
1741
  finally {
1762
1742
  try {
1763
- if (isolated_1_1 && !isolated_1_1.done && (_147 = isolated_1.return)) _147.call(isolated_1);
1743
+ if (isolated_1_1 && !isolated_1_1.done && (_157 = isolated_1.return)) _157.call(isolated_1);
1764
1744
  }
1765
- finally { if (e_11) throw e_11.error; }
1745
+ finally { if (e_13) throw e_13.error; }
1766
1746
  }
1767
1747
  seriesEntry.data = marked;
1768
1748
  }
@@ -1772,9 +1752,9 @@ var BasicChart = function (_a) {
1772
1752
  gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
1773
1753
  if (gradientArgs && !seriesAny.noFill) {
1774
1754
  gradient = new echarts.graphic.LinearGradient(gradientArgs.x, gradientArgs.y, gradientArgs.x2, gradientArgs.y2, gradientArgs.colorStops);
1775
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_83 = seriesEntry.itemStyle) !== null && _83 !== void 0 ? _83 : {})), { color: gradient });
1755
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_90 = seriesEntry.itemStyle) !== null && _90 !== void 0 ? _90 : {})), { color: gradient });
1776
1756
  if (effectiveChartType === "area") {
1777
- seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_84 = seriesEntry.areaStyle) !== null && _84 !== void 0 ? _84 : {})), { color: gradient });
1757
+ seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_91 = seriesEntry.areaStyle) !== null && _91 !== void 0 ? _91 : {})), { color: gradient });
1778
1758
  }
1779
1759
  }
1780
1760
  else if (seriesAny.noFill) {
@@ -1782,58 +1762,58 @@ var BasicChart = function (_a) {
1782
1762
  // with `transparent` so layout is preserved but nothing
1783
1763
  // paints. Legend entries are also suppressed via `name: ""`
1784
1764
  // since the series carries no semantic information.
1785
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_85 = seriesEntry.itemStyle) !== null && _85 !== void 0 ? _85 : {})), { color: "transparent", borderColor: "transparent" });
1765
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_92 = seriesEntry.itemStyle) !== null && _92 !== void 0 ? _92 : {})), { color: "transparent", borderColor: "transparent" });
1786
1766
  }
1787
1767
  else if (isBarOrColumn &&
1788
1768
  Array.isArray(seriesAny.dataPointColors) &&
1789
1769
  seriesAny.dataPointColors.length) {
1790
1770
  overrides_2 = new Map();
1791
1771
  try {
1792
- for (_143 = (e_12 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _144 = _143.next(); !_144.done; _144 = _143.next()) {
1793
- dp = _144.value;
1772
+ for (_153 = (e_14 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _154 = _153.next(); !_154.done; _154 = _153.next()) {
1773
+ dp = _154.value;
1794
1774
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1795
1775
  overrides_2.set(dp.idx, dp.color);
1796
1776
  }
1797
1777
  }
1798
1778
  }
1799
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1779
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
1800
1780
  finally {
1801
1781
  try {
1802
- if (_144 && !_144.done && (_148 = _143.return)) _148.call(_143);
1782
+ if (_154 && !_154.done && (_158 = _153.return)) _158.call(_153);
1803
1783
  }
1804
- finally { if (e_12) throw e_12.error; }
1784
+ finally { if (e_14) throw e_14.error; }
1805
1785
  }
1806
- fallback_1 = (_86 = series.color) !== null && _86 !== void 0 ? _86 : paletteColorAt(specSeriesIndex);
1807
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_87 = seriesEntry.itemStyle) !== null && _87 !== void 0 ? _87 : {})), { color: function (params) { var _a; return (_a = overrides_2.get(params.dataIndex)) !== null && _a !== void 0 ? _a : fallback_1; } });
1786
+ fallback_1 = (_93 = series.color) !== null && _93 !== void 0 ? _93 : paletteColorAt(specSeriesIndex);
1787
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_94 = seriesEntry.itemStyle) !== null && _94 !== void 0 ? _94 : {})), { color: function (params) { var _a; return (_a = overrides_2.get(params.dataIndex)) !== null && _a !== void 0 ? _a : fallback_1; } });
1808
1788
  }
1809
1789
  else if (isCircularChart &&
1810
1790
  Array.isArray(seriesAny.dataPointColors) &&
1811
1791
  seriesAny.dataPointColors.length) {
1812
1792
  overrides_3 = new Map();
1813
1793
  try {
1814
- for (_145 = (e_13 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _146 = _145.next(); !_146.done; _146 = _145.next()) {
1815
- dp = _146.value;
1794
+ for (_155 = (e_15 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _156 = _155.next(); !_156.done; _156 = _155.next()) {
1795
+ dp = _156.value;
1816
1796
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1817
1797
  overrides_3.set(dp.idx, dp.color);
1818
1798
  }
1819
1799
  }
1820
1800
  }
1821
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
1801
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
1822
1802
  finally {
1823
1803
  try {
1824
- if (_146 && !_146.done && (_149 = _145.return)) _149.call(_145);
1804
+ if (_156 && !_156.done && (_159 = _155.return)) _159.call(_155);
1825
1805
  }
1826
- finally { if (e_13) throw e_13.error; }
1806
+ finally { if (e_15) throw e_15.error; }
1827
1807
  }
1828
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_88 = seriesEntry.itemStyle) !== null && _88 !== void 0 ? _88 : {})), { color: function (params) {
1808
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_95 = seriesEntry.itemStyle) !== null && _95 !== void 0 ? _95 : {})), { color: function (params) {
1829
1809
  var _a, _b;
1830
1810
  return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
1831
1811
  } });
1832
1812
  }
1833
1813
  else if (isBarOrColumn && series.invertIfNegative) {
1834
- positiveColor_1 = (_89 = series.color) !== null && _89 !== void 0 ? _89 : paletteColorAt(specSeriesIndex);
1835
- negativeColor_1 = (_90 = series.negativeColor) !== null && _90 !== void 0 ? _90 : "#FF0000";
1836
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_91 = seriesEntry.itemStyle) !== null && _91 !== void 0 ? _91 : {})), { color: function (params) {
1814
+ positiveColor_1 = (_96 = series.color) !== null && _96 !== void 0 ? _96 : paletteColorAt(specSeriesIndex);
1815
+ negativeColor_1 = (_97 = series.negativeColor) !== null && _97 !== void 0 ? _97 : "#FF0000";
1816
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_98 = seriesEntry.itemStyle) !== null && _98 !== void 0 ? _98 : {})), { color: function (params) {
1837
1817
  var _a, _b;
1838
1818
  var value = Array.isArray(params.data)
1839
1819
  ? params.data[1]
@@ -1844,10 +1824,10 @@ var BasicChart = function (_a) {
1844
1824
  } });
1845
1825
  }
1846
1826
  else if (series.color) {
1847
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_92 = seriesEntry.itemStyle) !== null && _92 !== void 0 ? _92 : {})), { color: series.color });
1848
- seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((_93 = seriesEntry.lineStyle) !== null && _93 !== void 0 ? _93 : {})), { color: series.color });
1827
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_99 = seriesEntry.itemStyle) !== null && _99 !== void 0 ? _99 : {})), { color: series.color });
1828
+ seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((_100 = seriesEntry.lineStyle) !== null && _100 !== void 0 ? _100 : {})), { color: series.color });
1849
1829
  if (effectiveChartType === "area") {
1850
- seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_94 = seriesEntry.areaStyle) !== null && _94 !== void 0 ? _94 : {})), { color: series.color });
1830
+ seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_101 = seriesEntry.areaStyle) !== null && _101 !== void 0 ? _101 : {})), { color: series.color });
1851
1831
  }
1852
1832
  }
1853
1833
  chartSeries.push(seriesEntry);
@@ -1856,29 +1836,29 @@ var BasicChart = function (_a) {
1856
1836
  }
1857
1837
  });
1858
1838
  };
1859
- _140.label = 31;
1839
+ _150.label = 31;
1860
1840
  case 31:
1861
- _140.trys.push([31, 36, 37, 38]);
1862
- _r = tslib_1.__values(((_68 = spec.series) !== null && _68 !== void 0 ? _68 : []).entries()), _s = _r.next();
1863
- _140.label = 32;
1841
+ _150.trys.push([31, 36, 37, 38]);
1842
+ _r = tslib_1.__values(((_75 = spec.series) !== null && _75 !== void 0 ? _75 : []).entries()), _s = _r.next();
1843
+ _150.label = 32;
1864
1844
  case 32:
1865
1845
  if (!!_s.done) return [3 /*break*/, 35];
1866
1846
  _t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
1867
1847
  return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
1868
1848
  case 33:
1869
- _140.sent();
1870
- _140.label = 34;
1849
+ _150.sent();
1850
+ _150.label = 34;
1871
1851
  case 34:
1872
1852
  _s = _r.next();
1873
1853
  return [3 /*break*/, 32];
1874
1854
  case 35: return [3 /*break*/, 38];
1875
1855
  case 36:
1876
- e_3_1 = _140.sent();
1856
+ e_3_1 = _150.sent();
1877
1857
  e_3 = { error: e_3_1 };
1878
1858
  return [3 /*break*/, 38];
1879
1859
  case 37:
1880
1860
  try {
1881
- if (_s && !_s.done && (_4 = _r.return)) _4.call(_r);
1861
+ if (_s && !_s.done && (_8 = _r.return)) _8.call(_r);
1882
1862
  }
1883
1863
  finally { if (e_3) throw e_3.error; }
1884
1864
  return [7 /*endfinally*/];
@@ -1891,7 +1871,7 @@ var BasicChart = function (_a) {
1891
1871
  }
1892
1872
  if (isOfPie) {
1893
1873
  labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1894
- seriesEntry = (_95 = spec.series) === null || _95 === void 0 ? void 0 : _95[0];
1874
+ seriesEntry = (_102 = spec.series) === null || _102 === void 0 ? void 0 : _102[0];
1895
1875
  rawValues = seriesEntry
1896
1876
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
1897
1877
  : [];
@@ -1938,7 +1918,7 @@ var BasicChart = function (_a) {
1938
1918
  };
1939
1919
  chartSeries.push({
1940
1920
  type: "pie",
1941
- name: (_96 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _96 !== void 0 ? _96 : "",
1921
+ name: (_103 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _103 !== void 0 ? _103 : "",
1942
1922
  center: ["".concat(MAIN_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
1943
1923
  radius: [0, "".concat(MAIN_RADIUS_PCT_1, "%")],
1944
1924
  // Rotate the pie so the "Other" slice's angular midpoint faces
@@ -1956,7 +1936,7 @@ var BasicChart = function (_a) {
1956
1936
  if (ofPieType_1 === "pie") {
1957
1937
  chartSeries.push({
1958
1938
  type: "pie",
1959
- name: (_97 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _97 !== void 0 ? _97 : "",
1939
+ name: (_104 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _104 !== void 0 ? _104 : "",
1960
1940
  center: ["".concat(SECONDARY_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
1961
1941
  radius: [0, "".concat(secondaryRadiusPct_1, "%")],
1962
1942
  data: secondary.map(function (s, i) { return ({
@@ -2051,16 +2031,16 @@ var BasicChart = function (_a) {
2051
2031
  legend.data = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(main_1.map(function (s) { return s.label; })), false), tslib_1.__read(secondary.map(function (s) { return s.label; })), false);
2052
2032
  }
2053
2033
  else if (spec.chartType === "waterfall") {
2054
- primaryDomainSource_1 = (_100 = (_99 = (_98 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _98 === void 0 ? void 0 : _98[0]) === null || _99 === void 0 ? void 0 : _99.sources) === null || _100 === void 0 ? void 0 : _100[0];
2034
+ primaryDomainSource_1 = (_107 = (_106 = (_105 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _105 === void 0 ? void 0 : _105[0]) === null || _106 === void 0 ? void 0 : _106.sources) === null || _107 === void 0 ? void 0 : _107[0];
2055
2035
  rawDomainValues = primaryDomainSource_1
2056
- ? (0, aggregation_1.sanitizeDomainValues)((_101 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _101 !== void 0 ? _101 : [])
2036
+ ? (0, aggregation_1.sanitizeDomainValues)((_108 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _108 !== void 0 ? _108 : [])
2057
2037
  : [];
2058
2038
  labels = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
2059
- seriesEntry = (_102 = spec.series) === null || _102 === void 0 ? void 0 : _102[0];
2039
+ seriesEntry = (_109 = spec.series) === null || _109 === void 0 ? void 0 : _109[0];
2060
2040
  rawValues_1 = seriesEntry
2061
2041
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
2062
2042
  : [];
2063
- totalIndices = new Set((_103 = spec.totalIndices) !== null && _103 !== void 0 ? _103 : []);
2043
+ totalIndices = new Set((_110 = spec.totalIndices) !== null && _110 !== void 0 ? _110 : []);
2064
2044
  steps = (0, waterfall_1.computeWaterfall)(rawValues_1, labels, totalIndices);
2065
2045
  chartDomains.length = 0;
2066
2046
  chartDomains.push({
@@ -2070,40 +2050,68 @@ var BasicChart = function (_a) {
2070
2050
  axisLine: { show: true },
2071
2051
  axisTick: { show: true },
2072
2052
  splitLine: { show: false },
2073
- name: (_104 = spec.horizontalAxisTitle) !== null && _104 !== void 0 ? _104 : "",
2053
+ name: (_111 = spec.horizontalAxisTitle) !== null && _111 !== void 0 ? _111 : "",
2074
2054
  nameLocation: "middle",
2075
2055
  nameGap: 30,
2076
2056
  });
2077
2057
  chartSeries.length = 0;
2058
+ // The spacer bars are layout only: no labels, no tooltip entry.
2078
2059
  chartSeries.push({
2079
2060
  type: "bar",
2061
+ id: WATERFALL_PLACEHOLDER_ID,
2080
2062
  stack: "waterfall",
2081
2063
  itemStyle: { color: "transparent" },
2082
2064
  emphasis: { itemStyle: { color: "transparent" } },
2083
2065
  data: steps.map(function (s) { return s.placeholder; }),
2084
2066
  silent: true,
2067
+ label: { show: false },
2068
+ tooltip: { show: false },
2085
2069
  });
2086
- accent_1 = (_105 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _105 !== void 0 ? _105 : theme.themeColors.accent1;
2087
- decreaseColor_1 = (_107 = (_106 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.negativeColor) !== null && _106 !== void 0 ? _106 : theme.themeColors.accent2) !== null && _107 !== void 0 ? _107 : accent_1;
2088
- totalColor_1 = (_108 = theme.themeColors.accent3) !== null && _108 !== void 0 ? _108 : accent_1;
2070
+ accent_1 = (_112 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _112 !== void 0 ? _112 : theme.themeColors.accent1;
2071
+ decreaseColor_1 = (_114 = (_113 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.negativeColor) !== null && _113 !== void 0 ? _113 : theme.themeColors.accent2) !== null && _114 !== void 0 ? _114 : accent_1;
2072
+ totalColor_1 = (_115 = theme.themeColors.accent3) !== null && _115 !== void 0 ? _115 : accent_1;
2073
+ pointColors_1 = new Map();
2074
+ try {
2075
+ for (_v = tslib_1.__values((_116 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _116 !== void 0 ? _116 : []), _w = _v.next(); !_w.done; _w = _v.next()) {
2076
+ dp = _w.value;
2077
+ if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
2078
+ pointColors_1.set(dp.idx, dp.color);
2079
+ }
2080
+ }
2081
+ }
2082
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
2083
+ finally {
2084
+ try {
2085
+ if (_w && !_w.done && (_9 = _v.return)) _9.call(_v);
2086
+ }
2087
+ finally { if (e_6) throw e_6.error; }
2088
+ }
2089
2089
  connectors = steps.slice(0, -1).map(function (s, i) { return [
2090
2090
  { coord: [i, s.cumulative] },
2091
2091
  { coord: [i + 1, s.cumulative] },
2092
2092
  ]; });
2093
2093
  chartSeries.push({
2094
2094
  type: "bar",
2095
+ id: (0, series_click_1.chartSeriesId)(0, 0),
2095
2096
  stack: "waterfall",
2096
- name: (_109 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _109 !== void 0 ? _109 : "",
2097
- data: steps.map(function (s, i) { return ({
2098
- value: s.value,
2099
- itemStyle: {
2100
- color: s.isTotal
2101
- ? totalColor_1
2102
- : rawValues_1[i] < 0
2103
- ? decreaseColor_1
2104
- : accent_1,
2105
- },
2106
- }); }),
2097
+ name: (_117 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _117 !== void 0 ? _117 : "",
2098
+ // A bar's height is the step's magnitude; the signed source value
2099
+ // rides along as `originalValue` so labels and tooltips read
2100
+ // "-90" for a decrease, like Excel.
2101
+ data: steps.map(function (s, i) {
2102
+ var _a;
2103
+ return ({
2104
+ value: s.value,
2105
+ originalValue: rawValues_1[i],
2106
+ itemStyle: {
2107
+ color: (_a = pointColors_1.get(i)) !== null && _a !== void 0 ? _a : (s.isTotal
2108
+ ? totalColor_1
2109
+ : rawValues_1[i] < 0
2110
+ ? decreaseColor_1
2111
+ : accent_1),
2112
+ },
2113
+ });
2114
+ }),
2107
2115
  markLine: {
2108
2116
  silent: true,
2109
2117
  symbol: "none",
@@ -2120,29 +2128,68 @@ var BasicChart = function (_a) {
2120
2128
  legend.data = [];
2121
2129
  }
2122
2130
  else if (spec.chartType === "funnel") {
2123
- primaryDomainSource_2 = (_112 = (_111 = (_110 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _110 === void 0 ? void 0 : _110[0]) === null || _111 === void 0 ? void 0 : _111.sources) === null || _112 === void 0 ? void 0 : _112[0];
2131
+ primaryDomainSource_2 = (_120 = (_119 = (_118 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _118 === void 0 ? void 0 : _118[0]) === null || _119 === void 0 ? void 0 : _119.sources) === null || _120 === void 0 ? void 0 : _120[0];
2124
2132
  rawDomainValues = primaryDomainSource_2
2125
- ? (0, aggregation_1.sanitizeDomainValues)((_113 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _113 !== void 0 ? _113 : [])
2133
+ ? (0, aggregation_1.sanitizeDomainValues)((_121 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _121 !== void 0 ? _121 : [])
2126
2134
  : [];
2127
2135
  labels_1 = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
2128
- seriesEntry = (_114 = spec.series) === null || _114 === void 0 ? void 0 : _114[0];
2136
+ seriesEntry = (_122 = spec.series) === null || _122 === void 0 ? void 0 : _122[0];
2129
2137
  rawValues = seriesEntry
2130
2138
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : 0); })
2131
2139
  : [];
2132
2140
  chartDomains.length = 0;
2133
2141
  chartSeries.length = 0;
2134
- chartSeries.push({
2135
- type: "funnel",
2136
- name: (_115 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _115 !== void 0 ? _115 : "",
2137
- data: rawValues.map(function (value, i) {
2138
- var _a;
2139
- return ({
2140
- name: (_a = labels_1[i]) !== null && _a !== void 0 ? _a : String(i),
2141
- value: value,
2142
- });
2143
- }),
2144
- label: { show: true, position: "inside" },
2142
+ funnelPalette = (0, chart_styles_1.getChartPalette)(spec, [
2143
+ theme.themeColors.accent1,
2144
+ theme.themeColors.accent2,
2145
+ theme.themeColors.accent3,
2146
+ theme.themeColors.accent4,
2147
+ theme.themeColors.accent5,
2148
+ theme.themeColors.accent6,
2149
+ ]);
2150
+ funnelColor_1 = (_123 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _123 !== void 0 ? _123 : (0, utils_1.chartPaletteColorAt)(funnelPalette, 0);
2151
+ stageColors_1 = new Map();
2152
+ try {
2153
+ for (_x = tslib_1.__values((_124 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _124 !== void 0 ? _124 : []), _y = _x.next(); !_y.done; _y = _x.next()) {
2154
+ dp = _y.value;
2155
+ if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
2156
+ stageColors_1.set(dp.idx, dp.color);
2157
+ }
2158
+ }
2159
+ }
2160
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2161
+ finally {
2162
+ try {
2163
+ if (_y && !_y.done && (_10 = _x.return)) _10.call(_x);
2164
+ }
2165
+ finally { if (e_7) throw e_7.error; }
2166
+ }
2167
+ funnelData = rawValues.map(function (value, i) {
2168
+ var _a;
2169
+ return ({
2170
+ name: (_a = labels_1[i]) !== null && _a !== void 0 ? _a : String(i),
2171
+ value: value,
2172
+ });
2145
2173
  });
2174
+ funnelLayout = {
2175
+ sort: "none",
2176
+ left: "22%",
2177
+ right: "10%",
2178
+ top: 60,
2179
+ bottom: 20,
2180
+ };
2181
+ chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: (0, series_click_1.chartSeriesId)(0, 0), name: (_125 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _125 !== void 0 ? _125 : "", data: funnelData }, funnelLayout), { itemStyle: {
2182
+ color: function (params) { var _a; return (_a = stageColors_1.get(params.dataIndex)) !== null && _a !== void 0 ? _a : funnelColor_1; },
2183
+ }, label: {
2184
+ show: true,
2185
+ position: "inside",
2186
+ formatter: function (params) {
2187
+ return (0, axis_number_format_1.formatAxisValue)(undefined, params.value, locale);
2188
+ },
2189
+ } }));
2190
+ // The stage names sit to the left of the bars, where Excel's
2191
+ // category axis puts them: an invisible twin funnel carries them.
2192
+ chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: FUNNEL_NAMES_ID, data: funnelData }, funnelLayout), { silent: true, itemStyle: { color: "transparent", borderWidth: 0 }, emphasis: { disabled: true }, tooltip: { show: false }, label: { show: true, position: "left", formatter: "{b}" }, labelLine: { show: false }, z: 1 }));
2146
2193
  legend.data = [];
2147
2194
  }
2148
2195
  else if (spec.chartType === "boxplot") {
@@ -2154,8 +2201,8 @@ var BasicChart = function (_a) {
2154
2201
  outlierPoints = [];
2155
2202
  meanPoints = [];
2156
2203
  try {
2157
- for (_v = tslib_1.__values((_116 = spec.series) !== null && _116 !== void 0 ? _116 : []), _w = _v.next(); !_w.done; _w = _v.next()) {
2158
- seriesEntry = _w.value;
2204
+ for (_z = tslib_1.__values((_126 = spec.series) !== null && _126 !== void 0 ? _126 : []), _0 = _z.next(); !_0.done; _0 = _z.next()) {
2205
+ seriesEntry = _0.value;
2159
2206
  label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
2160
2207
  ? seriesEntry.dataLabel
2161
2208
  : "";
@@ -2169,17 +2216,17 @@ var BasicChart = function (_a) {
2169
2216
  boxLabels.push(label);
2170
2217
  if (showOutliers === true) {
2171
2218
  try {
2172
- for (_x = (e_7 = void 0, tslib_1.__values(summary.outliers)), _y = _x.next(); !_y.done; _y = _x.next()) {
2173
- outlier = _y.value;
2219
+ for (_1 = (e_9 = void 0, tslib_1.__values(summary.outliers)), _2 = _1.next(); !_2.done; _2 = _1.next()) {
2220
+ outlier = _2.value;
2174
2221
  outlierPoints.push([boxIndex, outlier]);
2175
2222
  }
2176
2223
  }
2177
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2224
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2178
2225
  finally {
2179
2226
  try {
2180
- if (_y && !_y.done && (_6 = _x.return)) _6.call(_x);
2227
+ if (_2 && !_2.done && (_12 = _1.return)) _12.call(_1);
2181
2228
  }
2182
- finally { if (e_7) throw e_7.error; }
2229
+ finally { if (e_9) throw e_9.error; }
2183
2230
  }
2184
2231
  }
2185
2232
  if (showMeanMarker) {
@@ -2188,12 +2235,12 @@ var BasicChart = function (_a) {
2188
2235
  }
2189
2236
  }
2190
2237
  }
2191
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2238
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2192
2239
  finally {
2193
2240
  try {
2194
- if (_w && !_w.done && (_5 = _v.return)) _5.call(_v);
2241
+ if (_0 && !_0.done && (_11 = _z.return)) _11.call(_z);
2195
2242
  }
2196
- finally { if (e_6) throw e_6.error; }
2243
+ finally { if (e_8) throw e_8.error; }
2197
2244
  }
2198
2245
  chartDomains.length = 0;
2199
2246
  chartDomains.push({
@@ -2203,7 +2250,7 @@ var BasicChart = function (_a) {
2203
2250
  axisLine: { show: true },
2204
2251
  axisTick: { show: true },
2205
2252
  splitLine: { show: false },
2206
- name: (_117 = spec.horizontalAxisTitle) !== null && _117 !== void 0 ? _117 : "",
2253
+ name: (_127 = spec.horizontalAxisTitle) !== null && _127 !== void 0 ? _127 : "",
2207
2254
  nameLocation: "middle",
2208
2255
  nameGap: 30,
2209
2256
  });
@@ -2213,7 +2260,7 @@ var BasicChart = function (_a) {
2213
2260
  name: "",
2214
2261
  data: boxStats,
2215
2262
  };
2216
- boxColor = (_119 = (_118 = spec.series) === null || _118 === void 0 ? void 0 : _118[0]) === null || _119 === void 0 ? void 0 : _119.color;
2263
+ boxColor = (_129 = (_128 = spec.series) === null || _128 === void 0 ? void 0 : _128[0]) === null || _129 === void 0 ? void 0 : _129.color;
2217
2264
  if (boxColor) {
2218
2265
  boxSeries.itemStyle = { color: boxColor, borderColor: boxColor };
2219
2266
  }
@@ -2228,7 +2275,7 @@ var BasicChart = function (_a) {
2228
2275
  }
2229
2276
  else if (spec.chartType === "histogram") {
2230
2277
  rawValues = flattenChartDataValues(spec.series, getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
2231
- _z = (0, histogram_1.binHistogram)(rawValues, spec.binCount), labels = _z.labels, counts = _z.counts;
2278
+ _3 = (0, histogram_1.binHistogram)(rawValues, spec.binCount), labels = _3.labels, counts = _3.counts;
2232
2279
  isPareto_1 = (0, histogram_1.isParetoSpec)(spec);
2233
2280
  cumulativePercents = [];
2234
2281
  if (isPareto_1) {
@@ -2245,18 +2292,18 @@ var BasicChart = function (_a) {
2245
2292
  axisLine: { show: true },
2246
2293
  axisTick: { show: true },
2247
2294
  splitLine: { show: false },
2248
- name: (_120 = spec.horizontalAxisTitle) !== null && _120 !== void 0 ? _120 : "",
2295
+ name: (_130 = spec.horizontalAxisTitle) !== null && _130 !== void 0 ? _130 : "",
2249
2296
  nameLocation: "middle",
2250
2297
  nameGap: 30,
2251
2298
  });
2252
2299
  chartSeries.length = 0;
2253
2300
  histogramSeries = {
2254
2301
  type: "bar",
2255
- name: (_123 = (_122 = (_121 = spec.series) === null || _121 === void 0 ? void 0 : _121[0]) === null || _122 === void 0 ? void 0 : _122.dataLabel) !== null && _123 !== void 0 ? _123 : "",
2302
+ name: (_133 = (_132 = (_131 = spec.series) === null || _131 === void 0 ? void 0 : _131[0]) === null || _132 === void 0 ? void 0 : _132.dataLabel) !== null && _133 !== void 0 ? _133 : "",
2256
2303
  data: counts,
2257
2304
  barCategoryGap: "1%",
2258
2305
  };
2259
- histogramColor = (_125 = (_124 = spec.series) === null || _124 === void 0 ? void 0 : _124[0]) === null || _125 === void 0 ? void 0 : _125.color;
2306
+ histogramColor = (_135 = (_134 = spec.series) === null || _134 === void 0 ? void 0 : _134[0]) === null || _135 === void 0 ? void 0 : _135.color;
2260
2307
  if (histogramColor) {
2261
2308
  histogramSeries.itemStyle = { color: histogramColor };
2262
2309
  }
@@ -2293,20 +2340,20 @@ var BasicChart = function (_a) {
2293
2340
  isPareto = spec.chartType === "histogram" && (0, histogram_1.isParetoSpec)(spec);
2294
2341
  hasSecondaryAxis = !isCircularChart &&
2295
2342
  !isHorizontalBarChart &&
2296
- (((_126 = spec.series) !== null && _126 !== void 0 ? _126 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
2343
+ (((_136 = spec.series) !== null && _136 !== void 0 ? _136 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
2297
2344
  isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
2298
2345
  (spec.chartType === "bar" || spec.chartType === "column");
2299
2346
  primaryAxisNumberFormat = isPercentStackedBars
2300
2347
  ? undefined
2301
2348
  : (0, axis_number_format_1.resolveValueAxisNumberFormat)({
2302
2349
  axisOptions: spec.valueAxisOptions,
2303
- series: ((_127 = spec.series) !== null && _127 !== void 0 ? _127 : []).filter(function (s) { return !s.useSecondaryAxis; }),
2350
+ series: ((_137 = spec.series) !== null && _137 !== void 0 ? _137 : []).filter(function (s) { return !s.useSecondaryAxis; }),
2304
2351
  getFormattingFromRange: getFormattingFromRange,
2305
2352
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
2306
2353
  });
2307
2354
  secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
2308
2355
  axisOptions: spec.secondaryValueAxisOptions,
2309
- series: ((_128 = spec.series) !== null && _128 !== void 0 ? _128 : []).filter(function (s) { return s.useSecondaryAxis; }),
2356
+ series: ((_138 = spec.series) !== null && _138 !== void 0 ? _138 : []).filter(function (s) { return s.useSecondaryAxis; }),
2310
2357
  getFormattingFromRange: getFormattingFromRange,
2311
2358
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
2312
2359
  });
@@ -2335,17 +2382,17 @@ var BasicChart = function (_a) {
2335
2382
  finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
2336
2383
  bottomAxisNameGap = isHorizontalBarChart
2337
2384
  ? valueAxisBase.nameGap
2338
- : Number((_130 = (_129 = chartDomains[0]) === null || _129 === void 0 ? void 0 : _129.nameGap) !== null && _130 !== void 0 ? _130 : CATEGORY_AXIS_NAME_GAP);
2385
+ : Number((_140 = (_139 = chartDomains[0]) === null || _139 === void 0 ? void 0 : _139.nameGap) !== null && _140 !== void 0 ? _140 : CATEGORY_AXIS_NAME_GAP);
2339
2386
  legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
2340
- position: (_131 = spec.legend) === null || _131 === void 0 ? void 0 : _131.position,
2387
+ position: (_141 = spec.legend) === null || _141 === void 0 ? void 0 : _141.position,
2341
2388
  visible: finalLegend.show !== false,
2342
2389
  labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
2343
- legendFontSize: (_136 = (_133 = (_132 = finalLegend.textStyle) === null || _132 === void 0 ? void 0 : _132.fontSize) !== null && _133 !== void 0 ? _133 : (_135 = (_134 = spec.legend) === null || _134 === void 0 ? void 0 : _134.textFormat) === null || _135 === void 0 ? void 0 : _135.fontSize) !== null && _136 !== void 0 ? _136 : 12,
2390
+ legendFontSize: (_146 = (_143 = (_142 = finalLegend.textStyle) === null || _142 === void 0 ? void 0 : _142.fontSize) !== null && _143 !== void 0 ? _143 : (_145 = (_144 = spec.legend) === null || _144 === void 0 ? void 0 : _144.textFormat) === null || _145 === void 0 ? void 0 : _145.fontSize) !== null && _146 !== void 0 ? _146 : 12,
2344
2391
  legendItemWidth: defaultLegendConfig.itemWidth,
2345
2392
  width: width !== null && width !== void 0 ? width : 0,
2346
2393
  height: height !== null && height !== void 0 ? height : 0,
2347
2394
  hasTitle: Boolean(title),
2348
- titleFontSize: (_138 = (_137 = spec.titleTextFormat) === null || _137 === void 0 ? void 0 : _137.fontSize) !== null && _138 !== void 0 ? _138 : 16,
2395
+ titleFontSize: (_148 = (_147 = spec.titleTextFormat) === null || _147 === void 0 ? void 0 : _147.fontSize) !== null && _148 !== void 0 ? _148 : 16,
2349
2396
  hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
2350
2397
  bottomAxisNameGap: bottomAxisNameGap,
2351
2398
  hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
@@ -2418,12 +2465,12 @@ var BasicChart = function (_a) {
2418
2465
  }
2419
2466
  }
2420
2467
  }
2421
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2468
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2422
2469
  finally {
2423
2470
  try {
2424
- if (barSeries_1_1 && !barSeries_1_1.done && (_7 = barSeries_1.return)) _7.call(barSeries_1);
2471
+ if (barSeries_1_1 && !barSeries_1_1.done && (_13 = barSeries_1.return)) _13.call(barSeries_1);
2425
2472
  }
2426
- finally { if (e_8) throw e_8.error; }
2473
+ finally { if (e_10) throw e_10.error; }
2427
2474
  }
2428
2475
  try {
2429
2476
  for (barSeries_2 = tslib_1.__values(barSeries), barSeries_2_1 = barSeries_2.next(); !barSeries_2_1.done; barSeries_2_1 = barSeries_2.next()) {
@@ -2440,17 +2487,20 @@ var BasicChart = function (_a) {
2440
2487
  });
2441
2488
  }
2442
2489
  }
2443
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2490
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2444
2491
  finally {
2445
2492
  try {
2446
- if (barSeries_2_1 && !barSeries_2_1.done && (_8 = barSeries_2.return)) _8.call(barSeries_2);
2493
+ if (barSeries_2_1 && !barSeries_2_1.done && (_14 = barSeries_2.return)) _14.call(barSeries_2);
2447
2494
  }
2448
- finally { if (e_9) throw e_9.error; }
2495
+ finally { if (e_11) throw e_11.error; }
2449
2496
  }
2450
2497
  }
2451
2498
  seriesWithLabels = chartSeries.map(function (s) {
2452
2499
  var _a, _b, _c, _d, _e, _f, _g, _h;
2453
2500
  var next = tslib_1.__assign({}, s);
2501
+ if (DECORATION_SERIES_IDS.has(s === null || s === void 0 ? void 0 : s.id)) {
2502
+ return next;
2503
+ }
2454
2504
  var seriesLabelOption = seriesLabelOptionFor(s);
2455
2505
  if (seriesLabelOption) {
2456
2506
  next.label = tslib_1.__assign(tslib_1.__assign({}, ((_a = s === null || s === void 0 ? void 0 : s.label) !== null && _a !== void 0 ? _a : {})), seriesLabelOption);
@@ -2466,8 +2516,24 @@ var BasicChart = function (_a) {
2466
2516
  var seriesTooltipValueFormatter = VALUE_TOOLTIP_SERIES_TYPES.has(s === null || s === void 0 ? void 0 : s.type)
2467
2517
  ? (0, axis_number_format_1.valueAxisLabelFormatter)(seriesNumberFormatFor(s), locale)
2468
2518
  : undefined;
2469
- if (seriesTooltipValueFormatter && ((_d = s === null || s === void 0 ? void 0 : s.tooltip) === null || _d === void 0 ? void 0 : _d.show) !== false) {
2470
- next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((_e = s === null || s === void 0 ? void 0 : s.tooltip) !== null && _e !== void 0 ? _e : {})), { valueFormatter: seriesTooltipValueFormatter });
2519
+ // A data item carrying `originalValue` (a waterfall step's signed
2520
+ // source value, a percent-stacked bar's raw amount) reads as that
2521
+ // value in the tooltip, like its data label.
2522
+ var originalValueAt = function (dataIndex) {
2523
+ var item = Array.isArray(s === null || s === void 0 ? void 0 : s.data) ? s.data[dataIndex] : undefined;
2524
+ return item !== null && typeof item === "object"
2525
+ ? item.originalValue
2526
+ : undefined;
2527
+ };
2528
+ var carriesOriginalValues = VALUE_TOOLTIP_SERIES_TYPES.has(s === null || s === void 0 ? void 0 : s.type) &&
2529
+ Array.isArray(s === null || s === void 0 ? void 0 : s.data) &&
2530
+ s.data.some(function (item) {
2531
+ return item !== null && typeof item === "object" && "originalValue" in item;
2532
+ });
2533
+ if ((seriesTooltipValueFormatter || carriesOriginalValues) &&
2534
+ ((_d = s === null || s === void 0 ? void 0 : s.tooltip) === null || _d === void 0 ? void 0 : _d.show) !== false) {
2535
+ var formatValue_1 = seriesTooltipValueFormatter !== null && seriesTooltipValueFormatter !== void 0 ? seriesTooltipValueFormatter : (function (value) { return (0, axis_number_format_1.formatAxisValue)(undefined, value, locale); });
2536
+ next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((_e = s === null || s === void 0 ? void 0 : s.tooltip) !== null && _e !== void 0 ? _e : {})), { valueFormatter: function (value, dataIndex) { var _a; return formatValue_1((_a = originalValueAt(dataIndex)) !== null && _a !== void 0 ? _a : value); } });
2471
2537
  }
2472
2538
  if (next.type === "pie") {
2473
2539
  var pieNumberFormat = seriesNumberFormatFor(s);
@@ -2496,7 +2562,7 @@ var BasicChart = function (_a) {
2496
2562
  return next;
2497
2563
  });
2498
2564
  // Update charts
2499
- (_139 = chartRef.current) === null || _139 === void 0 ? void 0 : _139.setOption({
2565
+ (_149 = chartRef.current) === null || _149 === void 0 ? void 0 : _149.setOption({
2500
2566
  xAxis: (function () {
2501
2567
  var _a, _b;
2502
2568
  if (isOfPie) {