@rowsncolumns/charts 28.1.8 → 28.1.11

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 +538 -430
  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 +333 -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 +15 -3
  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 +381 -251
  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 +253 -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 +15 -3
  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,52 @@ 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. Index 0 is echarts' virtual root, 1 the
118
+ // top-level categories, 2+ the levels beneath them.
116
119
  var HIERARCHY_LEVEL_STYLES = [
117
120
  {
118
121
  itemStyle: {
119
- gapWidth: 1,
120
- borderColorSaturation: 0.6,
121
- },
122
- upperLabel: { show: false },
123
- },
124
- {
125
- colorSaturation: [0.35, 0.65],
126
- itemStyle: {
127
- gapWidth: 1,
128
- borderColorSaturation: 0.6,
122
+ gapWidth: 2,
123
+ borderColor: "#ffffff",
124
+ borderWidth: 0,
129
125
  },
130
126
  },
131
127
  {
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
+ /** Height of the strip a treemap category name is drawn in (Excel's "Banner"). */
136
+ var TREEMAP_BANNER_HEIGHT = 20;
137
+ /**
138
+ * Excel's treemap `parentLabelLayout`: the top-level category names are
139
+ * drawn in a banner strip (or not at all); the levels between the categories
140
+ * and the leaves are never labelled, so small groups keep their height for
141
+ * the leaf cells (rowsncolumns/spreadsheet#1072). Excel's default
142
+ * `overlapping` writes the name over the group's top-left corner, which an
143
+ * echarts treemap cannot draw (an upper label always reserves its strip and
144
+ * is dropped when the strip is too small for the text), so it draws as a
145
+ * banner.
146
+ */
147
+ var treemapBannerShown = function (layout) { return layout !== "none"; };
148
+ /**
149
+ * Colour a hierarchy like Excel: each top-level node takes the next
150
+ * palette colour and every descendant inherits it (#1072).
151
+ */
152
+ var colorHierarchyNodes = function (nodes, palette) {
153
+ return nodes.map(function (node, index) {
154
+ var color = (0, utils_1.chartPaletteColorAt)(palette, index);
155
+ 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) } : {}))); };
156
+ return paint(node);
157
+ });
158
+ };
159
+ /** Sunburst rings: Excel leaves the centre empty, so even the first level is a ring (#1073). */
160
+ var SUNBURST_RADIUS = ["15%", "80%"];
139
161
  var getHierarchyDepth = function (nodes, depth) {
140
162
  if (depth === void 0) { depth = 1; }
141
163
  var maxDepth = depth;
@@ -172,18 +194,40 @@ var flattenChartDataValues = function (chartData, extractor, hiddenStrategy, ski
172
194
  });
173
195
  return values;
174
196
  };
175
- var buildHierarchyLevels = function (maxDepth) {
197
+ var buildHierarchyLevels = function (maxDepth, options) {
176
198
  if (maxDepth <= 0)
177
199
  return undefined;
178
200
  var levels = [];
179
- for (var i = 0; i < maxDepth; i++) {
201
+ // One entry per depth, the virtual root included, so every level's upper
202
+ // label is explicit: the categories' banner on level 1 only.
203
+ for (var i = 0; i <= maxDepth; i++) {
180
204
  var baseStyle = HIERARCHY_LEVEL_STYLES[Math.min(i, HIERARCHY_LEVEL_STYLES.length - 1)];
181
- levels.push(tslib_1.__assign(tslib_1.__assign({}, baseStyle), { itemStyle: tslib_1.__assign({}, baseStyle.itemStyle) }));
205
+ levels.push(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, baseStyle), { itemStyle: tslib_1.__assign({}, baseStyle.itemStyle) }), (options.treemap
206
+ ? {
207
+ upperLabel: i === 1 && options.banner
208
+ ? {
209
+ show: true,
210
+ height: TREEMAP_BANNER_HEIGHT,
211
+ padding: [0, 0, 0, 4],
212
+ }
213
+ : { show: false },
214
+ }
215
+ : {})));
182
216
  }
183
217
  return levels;
184
218
  };
185
219
  /** Series whose tooltip value is one number on a value axis. */
186
220
  var VALUE_TOOLTIP_SERIES_TYPES = new Set(["bar", "line", "scatter", "funnel"]);
221
+ /** The transparent spacer bars a waterfall stacks its visible bars on. */
222
+ var WATERFALL_PLACEHOLDER_ID = "rnc-waterfall-placeholder";
223
+ /** The invisible funnel that carries the stage names beside the bars. */
224
+ var FUNNEL_NAMES_ID = "rnc-funnel-names";
225
+ /**
226
+ * Layout-only series: they carry no data of their own, so they get no
227
+ * data labels and no tooltip entry (#1070 labelled every waterfall bar
228
+ * with its spacer's height too).
229
+ */
230
+ var DECORATION_SERIES_IDS = new Set([WATERFALL_PLACEHOLDER_ID, FUNNEL_NAMES_ID]);
187
231
  var defaultLegendConfig = {
188
232
  padding: 10,
189
233
  itemWidth: 10,
@@ -368,11 +412,11 @@ var BasicChart = function (_a) {
368
412
  * Triggers a chart update
369
413
  */
370
414
  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) {
415
+ 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, isTreemap, banner, levels, hierarchyLegend, legendShown, categoryLegendSeries, 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;
416
+ 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;
417
+ 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;
418
+ return tslib_1.__generator(this, function (_150) {
419
+ switch (_150.label) {
376
420
  case 0:
377
421
  (0, utils_1.debug)("Updating chart", chart);
378
422
  threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType);
@@ -396,7 +440,7 @@ var BasicChart = function (_a) {
396
440
  // Leaving 3-D (spec edit) — the grid3D option doesn't merge back
397
441
  // into a cartesian one, so re-initialize from a clean slate and
398
442
  // let the normal 2-D flow below do a full structural render.
399
- (_9 = chartRef.current) === null || _9 === void 0 ? void 0 : _9.dispose();
443
+ (_15 = chartRef.current) === null || _15 === void 0 ? void 0 : _15.dispose();
400
444
  chartRef.current = undefined;
401
445
  renderedIn3D.current = false;
402
446
  previousChartType.current = undefined;
@@ -410,7 +454,7 @@ var BasicChart = function (_a) {
410
454
  // doesn't merge back into a cartesian one, so re-initialize from
411
455
  // a clean slate and let the normal flow below do a full
412
456
  // structural render.
413
- (_10 = chartRef.current) === null || _10 === void 0 ? void 0 : _10.dispose();
457
+ (_16 = chartRef.current) === null || _16 === void 0 ? void 0 : _16.dispose();
414
458
  chartRef.current = undefined;
415
459
  renderedAsRegionMap.current = false;
416
460
  previousChartType.current = undefined;
@@ -423,7 +467,7 @@ var BasicChart = function (_a) {
423
467
  geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
424
468
  return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
425
469
  case 1:
426
- geo = _140.sent();
470
+ geo = _150.sent();
427
471
  // Entering the region map from a cartesian render: the previous
428
472
  // grid/axis option doesn't merge into the map one, so start from
429
473
  // a bare instance (theme options are re-applied after setOption).
@@ -438,7 +482,7 @@ var BasicChart = function (_a) {
438
482
  if (!geo) {
439
483
  // Map asset failed to load (or unknown scope) — the loader
440
484
  // 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"] });
485
+ (_17 = chartRef.current) === null || _17 === void 0 ? void 0 : _17.setOption({ series: [] }, { replaceMerge: ["series", "visualMap"] });
442
486
  renderedAsRegionMap.current = true;
443
487
  applyThemeOptions();
444
488
  previousChartType.current = spec.chartType;
@@ -446,7 +490,7 @@ var BasicChart = function (_a) {
446
490
  return [2 /*return*/];
447
491
  }
448
492
  labels = flattenChartDataValues(regionSpec.domains, getDomainValuesFromRange, regionSpec.hiddenDimensionStrategy, false);
449
- seriesEntry = (_12 = regionSpec.series) === null || _12 === void 0 ? void 0 : _12[0];
493
+ seriesEntry = (_18 = regionSpec.series) === null || _18 === void 0 ? void 0 : _18[0];
450
494
  values = seriesEntry
451
495
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, regionSpec.hiddenDimensionStrategy)
452
496
  : [];
@@ -462,7 +506,7 @@ var BasicChart = function (_a) {
462
506
  seriesName = (seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
463
507
  ? seriesEntry.dataLabel
464
508
  : "";
465
- (_13 = chartRef.current) === null || _13 === void 0 ? void 0 : _13.setOption({
509
+ (_19 = chartRef.current) === null || _19 === void 0 ? void 0 : _19.setOption({
466
510
  // The visualMap color scale is the value legend; the series
467
511
  // legend stays hidden unless an authored override turns it on.
468
512
  legend: (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: false }), spec.legend),
@@ -530,54 +574,91 @@ var BasicChart = function (_a) {
530
574
  hierarchyTitleRef.current = explicitChartTitle;
531
575
  skipHeaders_1 = spec.useFirstRowAsHeaders !== false;
532
576
  labelValues = flattenChartDataValues(spec.bubbleLabels, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
533
- perSeriesX = ((_14 = spec.domains) !== null && _14 !== void 0 ? _14 : []).map(function (dom) {
577
+ perSeriesX = ((_20 = spec.domains) !== null && _20 !== void 0 ? _20 : []).map(function (dom) {
534
578
  return flattenChartDataValues([dom], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
535
579
  });
536
- perSeriesSize = ((_15 = spec.bubbleSizes) !== null && _15 !== void 0 ? _15 : []).map(function (sz) {
580
+ perSeriesSize = ((_21 = spec.bubbleSizes) !== null && _21 !== void 0 ? _21 : []).map(function (sz) {
537
581
  return flattenChartDataValues([sz], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
538
582
  });
539
583
  seriesInputs = [];
540
584
  i = 0;
541
- _140.label = 3;
585
+ _150.label = 3;
542
586
  case 3:
543
587
  if (!(i < spec.series.length)) return [3 /*break*/, 7];
544
588
  seriesEntry = spec.series[i];
545
- resolvedLabel = (_16 = seriesEntry.dataLabel) !== null && _16 !== void 0 ? _16 : "";
589
+ resolvedLabel = (_22 = seriesEntry.dataLabel) !== null && _22 !== void 0 ? _22 : "";
546
590
  if (!(resolvedLabel && (0, utils_1.isAFormula)(resolvedLabel))) return [3 /*break*/, 5];
547
591
  _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)];
592
+ return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_23 = position.sheetId) !== null && _23 !== void 0 ? _23 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
549
593
  case 4:
550
- resolvedLabel = _b.apply(void 0, [_140.sent()]);
551
- _140.label = 5;
594
+ resolvedLabel = _b.apply(void 0, [_150.sent()]);
595
+ _150.label = 5;
552
596
  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];
597
+ xValues = (_24 = perSeriesX[i]) !== null && _24 !== void 0 ? _24 : perSeriesX[0];
598
+ sizeValues_1 = (_25 = perSeriesSize[i]) !== null && _25 !== void 0 ? _25 : perSeriesSize[0];
555
599
  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;
600
+ _150.label = 6;
557
601
  case 6:
558
602
  i++;
559
603
  return [3 /*break*/, 3];
560
604
  case 7:
561
- sharedXValues = (_20 = perSeriesX[0]) !== null && _20 !== void 0 ? _20 : [];
562
- sharedSizeValues = (_21 = perSeriesSize[0]) !== null && _21 !== void 0 ? _21 : [];
605
+ sharedXValues = (_26 = perSeriesX[0]) !== null && _26 !== void 0 ? _26 : [];
606
+ sharedSizeValues = (_27 = perSeriesSize[0]) !== null && _27 !== void 0 ? _27 : [];
563
607
  _c = (0, bubble_1.prepareBubbleSeriesData)({
564
608
  xValues: sharedXValues,
565
609
  labelValues: labelValues,
566
610
  sizeValues: sharedSizeValues,
567
611
  series: seriesInputs,
568
612
  }), categories_1 = _c.categories, preparedSeries = _c.series, sizeValues = _c.sizeValues;
569
- sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues);
613
+ sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues, {
614
+ sizeRepresents: spec.sizeRepresents,
615
+ bubbleScale: spec.bubbleScale,
616
+ plotMinSide: Math.min((width !== null && width !== void 0 ? width : 0) * 0.85, (height !== null && height !== void 0 ? height : 0) * 0.75),
617
+ });
618
+ bubblePalette_1 = (0, chart_styles_1.getChartPalette)(spec, [
619
+ theme.themeColors.accent1,
620
+ theme.themeColors.accent2,
621
+ theme.themeColors.accent3,
622
+ theme.themeColors.accent4,
623
+ theme.themeColors.accent5,
624
+ theme.themeColors.accent6,
625
+ ]);
626
+ bubbleItemColor_1 = function (seriesEntry, index) {
627
+ var e_12, _a;
628
+ var _b, _c;
629
+ var base = (_b = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _b !== void 0 ? _b : (0, utils_1.chartPaletteColorAt)(bubblePalette_1, index);
630
+ var overrides = new Map();
631
+ try {
632
+ 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()) {
633
+ var dp = _e.value;
634
+ if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
635
+ overrides.set(dp.idx, dp.color);
636
+ }
637
+ }
638
+ }
639
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
640
+ finally {
641
+ try {
642
+ if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
643
+ }
644
+ finally { if (e_12) throw e_12.error; }
645
+ }
646
+ return overrides.size
647
+ ? 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; }
648
+ : base;
649
+ };
650
+ hasBubbleSecondaryAxis = ((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []).some(function (seriesEntry) { return seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis; });
570
651
  xAxisConfig = categories_1.length > 0
571
652
  ? {
572
653
  type: "category",
573
654
  data: categories_1,
574
- name: (_22 = spec.horizontalAxisTitle) !== null && _22 !== void 0 ? _22 : "",
655
+ name: (_29 = spec.horizontalAxisTitle) !== null && _29 !== void 0 ? _29 : "",
575
656
  nameLocation: "middle",
576
657
  nameGap: 30,
577
658
  }
578
659
  : {
579
660
  type: "value",
580
- name: (_23 = spec.horizontalAxisTitle) !== null && _23 !== void 0 ? _23 : "",
661
+ name: (_30 = spec.horizontalAxisTitle) !== null && _30 !== void 0 ? _30 : "",
581
662
  nameLocation: "middle",
582
663
  nameGap: 30,
583
664
  };
@@ -595,18 +676,92 @@ var BasicChart = function (_a) {
595
676
  var _a;
596
677
  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
678
  };
598
- (_24 = chartRef.current) === null || _24 === void 0 ? void 0 : _24.setOption({
679
+ bubbleSeries = preparedSeries
680
+ .map(function (entry, index) {
681
+ var _a, _b, _c, _d, _e, _f, _g;
682
+ var isScatter = spec.chartType === "scatter";
683
+ var scatterStyle = (_a = spec.scatterStyle) !== null && _a !== void 0 ? _a : (isScatter ? "lineMarker" : undefined);
684
+ var seriesEntry = (_b = spec.series) === null || _b === void 0 ? void 0 : _b[index];
685
+ var seriesColor = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color;
686
+ var perMarker = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.marker;
687
+ var itemColor = bubbleItemColor_1(seriesEntry, index);
688
+ var onSecondary = (seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis) ? { yAxisIndex: 1 } : {};
689
+ if (isScatter) {
690
+ var symbol = perMarker === null || perMarker === void 0 ? void 0 : perMarker.symbol;
691
+ var noMarkers = symbol === "none";
692
+ var wantsLine = scatterStyle === "line" ||
693
+ scatterStyle === "lineMarker" ||
694
+ scatterStyle === "smooth" ||
695
+ scatterStyle === "smoothMarker";
696
+ var wantsMarkers = !noMarkers &&
697
+ (scatterStyle === "marker" ||
698
+ scatterStyle === "lineMarker" ||
699
+ scatterStyle === "smoothMarker" ||
700
+ !scatterStyle);
701
+ var smooth = scatterStyle === "smooth" || scatterStyle === "smoothMarker";
702
+ // Labels hang off the point symbols: a marker-less line keeps
703
+ // an invisible 0-size symbol per point when they show (#1049).
704
+ var labelsWithoutMarkers = !wantsMarkers &&
705
+ Boolean((_c = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesEntry)) === null || _c === void 0 ? void 0 : _c.show);
706
+ // The series colour paints the line; the markers take the
707
+ // per-point overrides when the series has any.
708
+ var markerStyle = seriesColor || typeof itemColor === "function"
709
+ ? { itemStyle: { color: itemColor } }
710
+ : {};
711
+ return wantsLine
712
+ ? 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);
713
+ }
714
+ 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: {
715
+ show: true,
716
+ formatter: function (params) { var _a; return (_a = params.name) !== null && _a !== void 0 ? _a : ""; },
717
+ } }, (seriesColor || typeof itemColor === "function"
718
+ ? { itemStyle: { color: itemColor } }
719
+ : {})), onSecondary);
720
+ })
721
+ .map(function (s, index) {
722
+ var _a;
723
+ var bubbleSeriesLabel = bubbleSeriesLabelFor_1(index);
724
+ return bubbleSeriesLabel
725
+ ? tslib_1.__assign(tslib_1.__assign({}, s), { label: tslib_1.__assign(tslib_1.__assign({}, ((_a = s.label) !== null && _a !== void 0 ? _a : {})), bubbleSeriesLabel) }) : s;
726
+ });
727
+ bubbleOverlays = preparedSeries.flatMap(function (entry, index) {
728
+ var _a, _b;
729
+ var seriesEntry = (_a = spec.series) === null || _a === void 0 ? void 0 : _a[index];
730
+ if (!seriesEntry)
731
+ return [];
732
+ return (0, echarts_overlays_1.buildEchartsOverlaySeries)({
733
+ series: seriesEntry,
734
+ values: entry.points.map(function (point) { return point.value[1]; }),
735
+ xValues: entry.points.map(function (point) { return point.value[0]; }),
736
+ dataLabel: entry.name,
737
+ seriesColor: (_b = seriesEntry.color) !== null && _b !== void 0 ? _b : (0, utils_1.chartPaletteColorAt)(bubblePalette_1, index),
738
+ resolveRange: function (range) {
739
+ return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
740
+ },
741
+ });
742
+ });
743
+ (_31 = chartRef.current) === null || _31 === void 0 ? void 0 : _31.setOption({
599
744
  xAxis: [
600
745
  (0, overrides_1.applyAxisOverrides)(tslib_1.__assign({}, xAxisConfig), spec.categoryAxisOptions),
601
746
  ],
602
- yAxis: [
747
+ yAxis: tslib_1.__spreadArray([
603
748
  (0, overrides_1.applyAxisOverrides)({
604
749
  type: "value",
605
- name: (_25 = spec.verticalAxisTitle) !== null && _25 !== void 0 ? _25 : "",
750
+ name: (_32 = spec.verticalAxisTitle) !== null && _32 !== void 0 ? _32 : "",
606
751
  nameLocation: "middle",
607
752
  nameGap: 45,
608
- }, spec.valueAxisOptions, undefined, locale),
609
- ],
753
+ }, spec.valueAxisOptions, undefined, locale)
754
+ ], tslib_1.__read((hasBubbleSecondaryAxis
755
+ ? [
756
+ (0, overrides_1.applyAxisOverrides)({
757
+ type: "value",
758
+ position: "right",
759
+ nameLocation: "middle",
760
+ nameGap: 45,
761
+ splitLine: { show: false },
762
+ }, spec.secondaryValueAxisOptions, undefined, locale),
763
+ ]
764
+ : [])), false),
610
765
  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
766
  grid: {
612
767
  left: "3%",
@@ -618,57 +773,7 @@ var BasicChart = function (_a) {
618
773
  trigger: "item",
619
774
  formatter: tooltipFormatter,
620
775
  },
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
- }),
776
+ series: tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(bubbleSeries), false), tslib_1.__read(bubbleOverlays), false),
672
777
  }, {
673
778
  replaceMerge: [
674
779
  "series",
@@ -680,7 +785,7 @@ var BasicChart = function (_a) {
680
785
  ],
681
786
  });
682
787
  previousChartType.current = spec.chartType;
683
- previousSeriesCount.current = preparedSeries.length;
788
+ previousSeriesCount.current = bubbleSeries.length + bubbleOverlays.length;
684
789
  return [2 /*return*/];
685
790
  case 8:
686
791
  if (isHierarchy) {
@@ -695,12 +800,42 @@ var BasicChart = function (_a) {
695
800
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
696
801
  });
697
802
  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 : "";
803
+ hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
804
+ theme.themeColors.accent1,
805
+ theme.themeColors.accent2,
806
+ theme.themeColors.accent3,
807
+ theme.themeColors.accent4,
808
+ theme.themeColors.accent5,
809
+ theme.themeColors.accent6,
810
+ ]);
811
+ hierarchyData = colorHierarchyNodes((0, hierarchy_1.buildHierarchyTree)(hierarchyRows), hierarchyPalette);
812
+ rootName = hierarchyData.length === 1 ? (_34 = (_33 = hierarchyData[0]) === null || _33 === void 0 ? void 0 : _33.name) !== null && _34 !== void 0 ? _34 : "" : "";
813
+ drillDown = Boolean(spec.drillDown);
814
+ seriesDisplayName = (_36 = (_35 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _35 !== void 0 ? _35 : rootName) !== null && _36 !== void 0 ? _36 : "";
701
815
  hierarchyDepth = getHierarchyDepth(hierarchyData);
702
- 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);
816
+ isTreemap = spec.chartType === "treemap";
817
+ banner = isTreemap && treemapBannerShown(spec.parentLabelLayout);
818
+ levels = buildHierarchyLevels(hierarchyDepth, {
819
+ treemap: isTreemap,
820
+ banner: banner,
821
+ });
822
+ hierarchyLegend = (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: false }), spec.legend);
823
+ legendShown = hierarchyLegend.show !== false;
824
+ categoryLegendSeries = legendShown
825
+ ? hierarchyData.map(function (node) {
826
+ var _a, _b;
827
+ return ({
828
+ type: "bar",
829
+ id: "rnc-hierarchy-legend-".concat((_a = node.id) !== null && _a !== void 0 ? _a : node.name),
830
+ name: node.name,
831
+ data: [],
832
+ silent: true,
833
+ itemStyle: { color: (_b = node.itemStyle) === null || _b === void 0 ? void 0 : _b.color },
834
+ tooltip: { show: false },
835
+ });
836
+ })
837
+ : [];
838
+ 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
839
  tooltipFormatter = function (params) {
705
840
  var _a;
706
841
  var value = Array.isArray(params.value)
@@ -711,7 +846,7 @@ var BasicChart = function (_a) {
711
846
  hierarchyDataLabels = spec.dataLabels;
712
847
  hierarchySeriesLabel = (0, overrides_1.buildSeriesLabelOption)(hierarchyDataLabels && !hierarchyDataLabels.numberFormatPattern
713
848
  ? 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({
849
+ (_39 = chartRef.current) === null || _39 === void 0 ? void 0 : _39.setOption({
715
850
  xAxis: [
716
851
  {
717
852
  type: "category",
@@ -724,7 +859,7 @@ var BasicChart = function (_a) {
724
859
  show: false,
725
860
  },
726
861
  ],
727
- legend: (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: false }), spec.legend),
862
+ legend: tslib_1.__assign(tslib_1.__assign({}, hierarchyLegend), { data: hierarchyData.map(function (node) { return node.name; }), selectedMode: false }),
728
863
  grid: {
729
864
  left: 0,
730
865
  right: 0,
@@ -735,23 +870,21 @@ var BasicChart = function (_a) {
735
870
  trigger: "item",
736
871
  formatter: tooltipFormatter,
737
872
  },
738
- 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"
746
- ? {
747
- show: true,
748
- padding: [0, 0, 0, 4],
749
- }
750
- : undefined,
751
- levels: levels,
752
- colorMappingBy: "index",
753
- },
754
- ],
873
+ series: tslib_1.__spreadArray([
874
+ tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label: tslib_1.__assign(tslib_1.__assign({ show: true, formatter: "{b}" }, (isTreemap ? { position: "insideBottomLeft" } : {})), (hierarchySeriesLabel !== null && hierarchySeriesLabel !== void 0 ? hierarchySeriesLabel : {})),
875
+ // Only `levels[1]` (the categories) may carry a banner; see
876
+ // buildHierarchyLevels.
877
+ upperLabel: isTreemap ? { show: false } : undefined, levels: levels,
878
+ // Excel has no drill-down on either chart: zooming into a
879
+ // branch on click (and the treemap breadcrumb) is opt-in.
880
+ nodeClick: drillDown
881
+ ? spec.chartType === "treemap"
882
+ ? "zoomToNode"
883
+ : "rootToNode"
884
+ : false }, (isTreemap
885
+ ? { breadcrumb: { show: drillDown } }
886
+ : { radius: tslib_1.__spreadArray([], tslib_1.__read(SUNBURST_RADIUS), false) }))
887
+ ], tslib_1.__read(categoryLegendSeries), false),
755
888
  }, {
756
889
  replaceMerge: [
757
890
  "series",
@@ -763,7 +896,7 @@ var BasicChart = function (_a) {
763
896
  ],
764
897
  });
765
898
  previousChartType.current = spec.chartType;
766
- previousSeriesCount.current = 1;
899
+ previousSeriesCount.current = 1 + categoryLegendSeries.length;
767
900
  return [2 /*return*/];
768
901
  }
769
902
  else {
@@ -775,7 +908,7 @@ var BasicChart = function (_a) {
775
908
  }
776
909
  isContour = (0, three_d_1.isContourSpec)(spec);
777
910
  if (renderedAsContour.current && !isContour) {
778
- (_33 = chartRef.current) === null || _33 === void 0 ? void 0 : _33.dispose();
911
+ (_40 = chartRef.current) === null || _40 === void 0 ? void 0 : _40.dispose();
779
912
  chartRef.current = undefined;
780
913
  renderedAsContour.current = false;
781
914
  previousChartType.current = undefined;
@@ -786,39 +919,39 @@ var BasicChart = function (_a) {
786
919
  if (!isContour) return [3 /*break*/, 19];
787
920
  categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
788
921
  contourSeriesInputs = [];
789
- _140.label = 9;
922
+ _150.label = 9;
790
923
  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;
924
+ _150.trys.push([9, 16, 17, 18]);
925
+ _d = tslib_1.__values((_41 = spec.series) !== null && _41 !== void 0 ? _41 : []), _e = _d.next();
926
+ _150.label = 10;
794
927
  case 10:
795
928
  if (!!_e.done) return [3 /*break*/, 15];
796
929
  seriesEntry = _e.value;
797
930
  if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 12];
798
931
  _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)];
932
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_42 = position.sheetId) !== null && _42 !== void 0 ? _42 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
800
933
  case 11:
801
- _f = _g.apply(void 0, [_140.sent()]);
934
+ _f = _g.apply(void 0, [_150.sent()]);
802
935
  return [3 /*break*/, 13];
803
936
  case 12:
804
- _f = (_36 = seriesEntry.dataLabel) !== null && _36 !== void 0 ? _36 : "";
805
- _140.label = 13;
937
+ _f = (_43 = seriesEntry.dataLabel) !== null && _43 !== void 0 ? _43 : "";
938
+ _150.label = 13;
806
939
  case 13:
807
940
  dataLabel = _f;
808
941
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
809
942
  contourSeriesInputs.push({ name: dataLabel, values: values });
810
- _140.label = 14;
943
+ _150.label = 14;
811
944
  case 14:
812
945
  _e = _d.next();
813
946
  return [3 /*break*/, 10];
814
947
  case 15: return [3 /*break*/, 18];
815
948
  case 16:
816
- e_1_1 = _140.sent();
949
+ e_1_1 = _150.sent();
817
950
  e_1 = { error: e_1_1 };
818
951
  return [3 /*break*/, 18];
819
952
  case 17:
820
953
  try {
821
- if (_e && !_e.done && (_0 = _d.return)) _0.call(_d);
954
+ if (_e && !_e.done && (_4 = _d.return)) _4.call(_d);
822
955
  }
823
956
  finally { if (e_1) throw e_1.error; }
824
957
  return [7 /*endfinally*/];
@@ -838,7 +971,7 @@ var BasicChart = function (_a) {
838
971
  chartRef.current = echarts.init(el.current);
839
972
  bindSeriesSelection(chartRef.current);
840
973
  }
841
- (_37 = chartRef.current) === null || _37 === void 0 ? void 0 : _37.setOption({
974
+ (_44 = chartRef.current) === null || _44 === void 0 ? void 0 : _44.setOption({
842
975
  tooltip: {
843
976
  textStyle: { fontSize: 12 },
844
977
  trigger: "item",
@@ -858,7 +991,7 @@ var BasicChart = function (_a) {
858
991
  type: "category",
859
992
  data: categories_2,
860
993
  splitArea: { show: true },
861
- name: (_38 = spec.horizontalAxisTitle) !== null && _38 !== void 0 ? _38 : "",
994
+ name: (_45 = spec.horizontalAxisTitle) !== null && _45 !== void 0 ? _45 : "",
862
995
  nameLocation: "middle",
863
996
  nameGap: 30,
864
997
  }, spec.categoryAxisOptions),
@@ -868,7 +1001,7 @@ var BasicChart = function (_a) {
868
1001
  type: "category",
869
1002
  data: seriesNames_1,
870
1003
  splitArea: { show: true },
871
- name: (_39 = spec.verticalAxisTitle) !== null && _39 !== void 0 ? _39 : "",
1004
+ name: (_46 = spec.verticalAxisTitle) !== null && _46 !== void 0 ? _46 : "",
872
1005
  nameLocation: "middle",
873
1006
  nameGap: 50,
874
1007
  },
@@ -921,39 +1054,39 @@ var BasicChart = function (_a) {
921
1054
  if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 30];
922
1055
  categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
923
1056
  threeDSeriesInputs = [];
924
- _140.label = 20;
1057
+ _150.label = 20;
925
1058
  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;
1059
+ _150.trys.push([20, 27, 28, 29]);
1060
+ _j = tslib_1.__values((_47 = spec.series) !== null && _47 !== void 0 ? _47 : []), _k = _j.next();
1061
+ _150.label = 21;
929
1062
  case 21:
930
1063
  if (!!_k.done) return [3 /*break*/, 26];
931
1064
  seriesEntry = _k.value;
932
1065
  if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 23];
933
1066
  _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)];
1067
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_48 = position.sheetId) !== null && _48 !== void 0 ? _48 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
935
1068
  case 22:
936
- _l = _m.apply(void 0, [_140.sent()]);
1069
+ _l = _m.apply(void 0, [_150.sent()]);
937
1070
  return [3 /*break*/, 24];
938
1071
  case 23:
939
- _l = (_42 = seriesEntry.dataLabel) !== null && _42 !== void 0 ? _42 : "";
940
- _140.label = 24;
1072
+ _l = (_49 = seriesEntry.dataLabel) !== null && _49 !== void 0 ? _49 : "";
1073
+ _150.label = 24;
941
1074
  case 24:
942
1075
  dataLabel = _l;
943
1076
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
944
1077
  threeDSeriesInputs.push({ name: dataLabel, values: values });
945
- _140.label = 25;
1078
+ _150.label = 25;
946
1079
  case 25:
947
1080
  _k = _j.next();
948
1081
  return [3 /*break*/, 21];
949
1082
  case 26: return [3 /*break*/, 29];
950
1083
  case 27:
951
- e_2_1 = _140.sent();
1084
+ e_2_1 = _150.sent();
952
1085
  e_2 = { error: e_2_1 };
953
1086
  return [3 /*break*/, 29];
954
1087
  case 28:
955
1088
  try {
956
- if (_k && !_k.done && (_1 = _j.return)) _1.call(_j);
1089
+ if (_k && !_k.done && (_5 = _j.return)) _5.call(_j);
957
1090
  }
958
1091
  finally { if (e_2) throw e_2.error; }
959
1092
  return [7 /*endfinally*/];
@@ -1027,7 +1160,7 @@ var BasicChart = function (_a) {
1027
1160
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
1028
1161
  finally {
1029
1162
  try {
1030
- if (threeDSeriesInputs_1_1 && !threeDSeriesInputs_1_1.done && (_2 = threeDSeriesInputs_1.return)) _2.call(threeDSeriesInputs_1);
1163
+ if (threeDSeriesInputs_1_1 && !threeDSeriesInputs_1_1.done && (_6 = threeDSeriesInputs_1.return)) _6.call(threeDSeriesInputs_1);
1031
1164
  }
1032
1165
  finally { if (e_4) throw e_4.error; }
1033
1166
  }
@@ -1117,12 +1250,12 @@ var BasicChart = function (_a) {
1117
1250
  inRange: { color: tslib_1.__spreadArray([], tslib_1.__read(three_d_1.SURFACE_COLOR_RAMP), false) },
1118
1251
  };
1119
1252
  }
1120
- (_43 = chartRef.current) === null || _43 === void 0 ? void 0 : _43.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
1253
+ (_50 = chartRef.current) === null || _50 === void 0 ? void 0 : _50.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
1121
1254
  textStyle: { fontSize: 12 },
1122
1255
  formatter: threeDTooltipFormatter,
1123
1256
  }, legend: threeDRenderKind === "line3D" || stackedBar3D_1
1124
1257
  ? (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: {
1258
+ : { 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
1259
  boxDepth: Math.max(20, Math.min(100, seriesNames_2.length * 20)),
1127
1260
  viewControl: { autoRotate: false },
1128
1261
  } }, (visualMap ? { visualMap: [visualMap] } : {})), { series: threeDSeries }), {
@@ -1153,7 +1286,7 @@ var BasicChart = function (_a) {
1153
1286
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders);
1154
1287
  radarSeriesInputs = [];
1155
1288
  try {
1156
- for (_p = tslib_1.__values((_46 = spec.series) !== null && _46 !== void 0 ? _46 : []), _q = _p.next(); !_q.done; _q = _p.next()) {
1289
+ for (_p = tslib_1.__values((_53 = spec.series) !== null && _53 !== void 0 ? _53 : []), _q = _p.next(); !_q.done; _q = _p.next()) {
1157
1290
  seriesEntry = _q.value;
1158
1291
  label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
1159
1292
  ? seriesEntry.dataLabel
@@ -1165,14 +1298,14 @@ var BasicChart = function (_a) {
1165
1298
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
1166
1299
  finally {
1167
1300
  try {
1168
- if (_q && !_q.done && (_3 = _p.return)) _3.call(_p);
1301
+ if (_q && !_q.done && (_7 = _p.return)) _7.call(_p);
1169
1302
  }
1170
1303
  finally { if (e_5) throw e_5.error; }
1171
1304
  }
1172
- radarAxisOptions = spec.valueAxisOptions;
1173
- indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions);
1305
+ radarAxisOptions_1 = spec.valueAxisOptions;
1306
+ indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions_1);
1174
1307
  radarData = (0, radar_1.buildRadarSeriesData)(radarSeriesInputs, indicators_1.length);
1175
- radarStyle_1 = (_47 = spec.radarStyle) !== null && _47 !== void 0 ? _47 : "standard";
1308
+ radarStyle_1 = (_54 = spec.radarStyle) !== null && _54 !== void 0 ? _54 : "standard";
1176
1309
  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
1310
  radarFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
1178
1311
  radarDataLabels_1 = spec.dataLabels;
@@ -1189,16 +1322,20 @@ var BasicChart = function (_a) {
1189
1322
  });
1190
1323
  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
1324
  };
1192
- (_48 = chartRef.current) === null || _48 === void 0 ? void 0 : _48.setOption({
1325
+ (_55 = chartRef.current) === null || _55 === void 0 ? void 0 : _55.setOption({
1193
1326
  radar: {
1194
- indicator: indicators_1.length
1327
+ // The common scale's tick labels along ONE axis, as Excel draws
1328
+ // them: echarts labels every indicator axis, so each indicator
1329
+ // carries its own `axisLabel.show` (an indicator's own options win
1330
+ // over the radar-level ones in echarts' merge) and only the first
1331
+ // shows (#1066 follow-up); hidden with the spec's value axis.
1332
+ indicator: (indicators_1.length
1195
1333
  ? 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.
1334
+ : [{ name: "", min: 0, max: 1 }]).map(function (indicator, index) { return (tslib_1.__assign(tslib_1.__assign({}, indicator), { axisLabel: {
1335
+ show: index === 0 && (radarAxisOptions_1 === null || radarAxisOptions_1 === void 0 ? void 0 : radarAxisOptions_1.visible) !== false,
1336
+ } })); }),
1200
1337
  axisLabel: {
1201
- show: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
1338
+ show: (radarAxisOptions_1 === null || radarAxisOptions_1 === void 0 ? void 0 : radarAxisOptions_1.visible) !== false,
1202
1339
  formatter: function (value) {
1203
1340
  return (0, axis_number_format_1.formatAxisValue)(radarFormats_1[0], value, locale);
1204
1341
  },
@@ -1241,9 +1378,9 @@ var BasicChart = function (_a) {
1241
1378
  // V-variants additionally get a volume column sub-pane below the
1242
1379
  // price plot.
1243
1380
  if (spec.chartType === "stock") {
1244
- variant_1 = ((_49 = spec.stockVariant) !== null && _49 !== void 0 ? _49 : "HLC");
1381
+ variant_1 = ((_56 = spec.stockVariant) !== null && _56 !== void 0 ? _56 : "HLC");
1245
1382
  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) {
1383
+ seriesValues = ((_57 = spec.series) !== null && _57 !== void 0 ? _57 : []).map(function (seriesEntry) {
1247
1384
  return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
1248
1385
  });
1249
1386
  stockFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
@@ -1261,7 +1398,7 @@ var BasicChart = function (_a) {
1261
1398
  upColor_1 = theme.themeColors.accent1;
1262
1399
  downColor_1 = theme.themeColors.accent2;
1263
1400
  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;
1401
+ hasVolume = ((_58 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _58 !== void 0 ? _58 : 0) > 0;
1265
1402
  stockGrid = hasVolume
1266
1403
  ? [
1267
1404
  { left: "10%", right: "4%", top: "8%", height: "56%" },
@@ -1275,7 +1412,7 @@ var BasicChart = function (_a) {
1275
1412
  axisLine: { show: true },
1276
1413
  axisTick: { show: true },
1277
1414
  splitLine: { show: false },
1278
- name: (_52 = spec.horizontalAxisTitle) !== null && _52 !== void 0 ? _52 : "",
1415
+ name: (_59 = spec.horizontalAxisTitle) !== null && _59 !== void 0 ? _59 : "",
1279
1416
  nameLocation: "middle",
1280
1417
  nameGap: 30,
1281
1418
  }, spec.categoryAxisOptions);
@@ -1317,14 +1454,14 @@ var BasicChart = function (_a) {
1317
1454
  // (no open) fall through to the line-derived rendering below.
1318
1455
  if (variant_1 === "OHLC" || variant_1 === "VOHLC") {
1319
1456
  candleData = (0, stock_1.toCandlestick)(seriesValues, variant_1);
1320
- (_53 = chartRef.current) === null || _53 === void 0 ? void 0 : _53.setOption({
1457
+ (_60 = chartRef.current) === null || _60 === void 0 ? void 0 : _60.setOption({
1321
1458
  xAxis: stockXAxis,
1322
1459
  yAxis: tslib_1.__spreadArray([
1323
1460
  (0, overrides_1.applyAxisOverrides)({
1324
1461
  type: "value",
1325
1462
  show: true,
1326
1463
  scale: true,
1327
- name: (_54 = spec.verticalAxisTitle) !== null && _54 !== void 0 ? _54 : "",
1464
+ name: (_61 = spec.verticalAxisTitle) !== null && _61 !== void 0 ? _61 : "",
1328
1465
  nameLocation: "middle",
1329
1466
  nameGap: 50,
1330
1467
  gridIndex: 0,
@@ -1369,13 +1506,13 @@ var BasicChart = function (_a) {
1369
1506
  theme.themeColors.accent3,
1370
1507
  theme.themeColors.accent4,
1371
1508
  ]);
1372
- (_55 = chartRef.current) === null || _55 === void 0 ? void 0 : _55.setOption({
1509
+ (_62 = chartRef.current) === null || _62 === void 0 ? void 0 : _62.setOption({
1373
1510
  xAxis: stockXAxis,
1374
1511
  yAxis: tslib_1.__spreadArray([
1375
1512
  (0, overrides_1.applyAxisOverrides)({
1376
1513
  type: "value",
1377
1514
  show: true,
1378
- name: (_56 = spec.verticalAxisTitle) !== null && _56 !== void 0 ? _56 : "",
1515
+ name: (_63 = spec.verticalAxisTitle) !== null && _63 !== void 0 ? _63 : "",
1379
1516
  nameLocation: "middle",
1380
1517
  nameGap: 50,
1381
1518
  gridIndex: 0,
@@ -1414,14 +1551,14 @@ var BasicChart = function (_a) {
1414
1551
  ofPieLayout = null;
1415
1552
  isHorizontalBarChart = spec.chartType === "bar";
1416
1553
  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];
1554
+ 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
1555
  rawPrimaryDomainValues = primaryDomainSource
1419
- ? (0, aggregation_1.sanitizeDomainValues)((_60 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _60 !== void 0 ? _60 : [])
1556
+ ? (0, aggregation_1.sanitizeDomainValues)((_67 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _67 !== void 0 ? _67 : [])
1420
1557
  : [];
1421
1558
  aggregateDomainValues = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
1422
1559
  categoryLevels = isCircularChart
1423
1560
  ? undefined
1424
- : (0, category_levels_1.resolveCategoryLevels)((_61 = spec.categoryLevels) === null || _61 === void 0 ? void 0 : _61.map(function (level) {
1561
+ : (0, category_levels_1.resolveCategoryLevels)((_68 = spec.categoryLevels) === null || _68 === void 0 ? void 0 : _68.map(function (level) {
1425
1562
  return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
1426
1563
  }));
1427
1564
  if (categoryLevels) {
@@ -1432,15 +1569,15 @@ var BasicChart = function (_a) {
1432
1569
  axisTick: { show: true },
1433
1570
  splitLine: { show: true },
1434
1571
  name: isHorizontalBarChart
1435
- ? (_62 = spec.verticalAxisTitle) !== null && _62 !== void 0 ? _62 : ""
1436
- : (_63 = spec.horizontalAxisTitle) !== null && _63 !== void 0 ? _63 : "",
1572
+ ? (_69 = spec.verticalAxisTitle) !== null && _69 !== void 0 ? _69 : ""
1573
+ : (_70 = spec.horizontalAxisTitle) !== null && _70 !== void 0 ? _70 : "",
1437
1574
  nameLocation: "middle",
1438
1575
  nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
1439
1576
  })), false));
1440
1577
  }
1441
1578
  // One category axis per domain (Excel): a domain drawn from several
1442
1579
  // ranges lists their categories in sequence on that single axis.
1443
- (categoryLevels ? [] : (_64 = spec.domains) !== null && _64 !== void 0 ? _64 : []).forEach(function (domain, domainIndex) {
1580
+ (categoryLevels ? [] : (_71 = spec.domains) !== null && _71 !== void 0 ? _71 : []).forEach(function (domain, domainIndex) {
1444
1581
  var _a, _b;
1445
1582
  var axisData = domain.sources.flatMap(function (sheetRange, sourceIndex) {
1446
1583
  var _a;
@@ -1476,15 +1613,14 @@ var BasicChart = function (_a) {
1476
1613
  splitLine: { show: true },
1477
1614
  gridIndex: 0,
1478
1615
  name: isHorizontalBarChart
1479
- ? (_65 = spec.verticalAxisTitle) !== null && _65 !== void 0 ? _65 : ""
1480
- : (_66 = spec.horizontalAxisTitle) !== null && _66 !== void 0 ? _66 : "",
1616
+ ? (_72 = spec.verticalAxisTitle) !== null && _72 !== void 0 ? _72 : ""
1617
+ : (_73 = spec.horizontalAxisTitle) !== null && _73 !== void 0 ? _73 : "",
1481
1618
  nameLocation: "middle",
1482
1619
  nameGap: CATEGORY_AXIS_NAME_GAP,
1483
1620
  });
1484
1621
  }
1485
1622
  pushSeriesOverlays = function (series, data, dataLabel) {
1486
- var e_10, _a;
1487
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1623
+ var _a;
1488
1624
  var numericValues = Array.isArray(data)
1489
1625
  ? data.map(function (v) {
1490
1626
  return typeof v === "number"
@@ -1496,135 +1632,21 @@ var BasicChart = function (_a) {
1496
1632
  : [];
1497
1633
  if (numericValues.length === 0)
1498
1634
  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
- }
1635
+ chartSeries.push.apply(chartSeries, tslib_1.__spreadArray([], tslib_1.__read((0, echarts_overlays_1.buildEchartsOverlaySeries)({
1636
+ series: series,
1637
+ values: numericValues,
1638
+ // A horizontal bar keeps its categories on y (#1061).
1639
+ horizontal: isHorizontalBarChart,
1640
+ dataLabel: dataLabel,
1641
+ seriesColor: (_a = series.color) !== null && _a !== void 0 ? _a : theme.themeColors.accent1,
1642
+ resolveRange: function (range) {
1643
+ return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
1644
+ },
1645
+ })), false));
1624
1646
  };
1625
1647
  sideBySideBarCount = isStacked
1626
1648
  ? 1
1627
- : ((_67 = spec.series) !== null && _67 !== void 0 ? _67 : []).reduce(function (count, s) {
1649
+ : ((_74 = spec.series) !== null && _74 !== void 0 ? _74 : []).reduce(function (count, s) {
1628
1650
  var _a;
1629
1651
  var seriesType = (_a = s.seriesChartType) !== null && _a !== void 0 ? _a : spec.chartType;
1630
1652
  return seriesType === "bar" || seriesType === "column"
@@ -1648,29 +1670,29 @@ var BasicChart = function (_a) {
1648
1670
  return (0, utils_1.chartPaletteColorAt)(seriesPalette, index);
1649
1671
  };
1650
1672
  _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) {
1673
+ 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;
1674
+ var e_13, _157, e_14, _158, e_15, _159;
1675
+ return tslib_1.__generator(this, function (_160) {
1676
+ switch (_160.label) {
1655
1677
  case 0:
1656
1678
  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)];
1679
+ _152 = chart_spec_utils_1.coerceCalculatedLabel;
1680
+ return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_76 = position.sheetId) !== null && _76 !== void 0 ? _76 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1659
1681
  case 1:
1660
- _141 = _142.apply(void 0, [_150.sent()]);
1682
+ _151 = _152.apply(void 0, [_160.sent()]);
1661
1683
  return [3 /*break*/, 3];
1662
1684
  case 2:
1663
- _141 = (_70 = series.dataLabel) !== null && _70 !== void 0 ? _70 : "";
1664
- _150.label = 3;
1685
+ _151 = (_77 = series.dataLabel) !== null && _77 !== void 0 ? _77 : "";
1686
+ _160.label = 3;
1665
1687
  case 3:
1666
- dataLabel = _141;
1688
+ dataLabel = _151;
1667
1689
  // Label
1668
1690
  if (dataLabel) {
1669
- (_71 = legend.data) === null || _71 === void 0 ? void 0 : _71.push(dataLabel);
1691
+ (_78 = legend.data) === null || _78 === void 0 ? void 0 : _78.push(dataLabel);
1670
1692
  }
1671
- effectiveChartType = (_72 = series.seriesChartType) !== null && _72 !== void 0 ? _72 : spec.chartType;
1693
+ effectiveChartType = (_79 = series.seriesChartType) !== null && _79 !== void 0 ? _79 : spec.chartType;
1672
1694
  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 : [];
1695
+ 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
1696
  pieDomainLabels = isCircularChart &&
1675
1697
  (domainSources.length > 1 || series.sources.length > 1)
1676
1698
  ? domainSources.flatMap(function (sheetRange) {
@@ -1702,7 +1724,7 @@ var BasicChart = function (_a) {
1702
1724
  seriesEntry = tslib_1.__assign(tslib_1.__assign({ type: seriesEchartsType,
1703
1725
  // Ties the rendered series back to spec.series for click selection
1704
1726
  // 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)
1727
+ 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
1728
  ? { connectNulls: true }
1707
1729
  : {})), seriesStyleAttrs);
1708
1730
  // Plot this series against a secondary value axis. The 2nd
@@ -1727,17 +1749,17 @@ var BasicChart = function (_a) {
1727
1749
  }
1728
1750
  seriesAny = series;
1729
1751
  if (effectiveChartType === "line") {
1730
- markerSymbol = (_78 = seriesAny.marker) === null || _78 === void 0 ? void 0 : _78.symbol;
1752
+ markerSymbol = (_85 = seriesAny.marker) === null || _85 === void 0 ? void 0 : _85.symbol;
1731
1753
  wantsMarkers = markerSymbol === "none"
1732
1754
  ? false
1733
1755
  : Boolean(spec.showMarkers) || !(0, utils_1.isNil)(markerSymbol);
1734
1756
  labelsWithoutMarkers = !wantsMarkers &&
1735
- Boolean((_79 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _79 === void 0 ? void 0 : _79.show);
1757
+ Boolean((_86 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _86 === void 0 ? void 0 : _86.show);
1736
1758
  seriesEntry.showSymbol = wantsMarkers || labelsWithoutMarkers;
1737
1759
  if (wantsMarkers) {
1738
1760
  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;
1761
+ (_87 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _87 !== void 0 ? _87 : "circle";
1762
+ seriesEntry.symbolSize = (_89 = (_88 = seriesAny.marker) === null || _88 === void 0 ? void 0 : _88.size) !== null && _89 !== void 0 ? _89 : 6;
1741
1763
  }
1742
1764
  else {
1743
1765
  if (labelsWithoutMarkers) {
@@ -1752,17 +1774,17 @@ var BasicChart = function (_a) {
1752
1774
  seriesEntry.symbol = "none";
1753
1775
  marked = tslib_1.__spreadArray([], tslib_1.__read(data), false);
1754
1776
  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()) {
1777
+ 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
1778
  i = isolated_1_1.value;
1757
1779
  marked[i] = { value: marked[i], symbol: "circle", symbolSize: 6 };
1758
1780
  }
1759
1781
  }
1760
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
1782
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1761
1783
  finally {
1762
1784
  try {
1763
- if (isolated_1_1 && !isolated_1_1.done && (_147 = isolated_1.return)) _147.call(isolated_1);
1785
+ if (isolated_1_1 && !isolated_1_1.done && (_157 = isolated_1.return)) _157.call(isolated_1);
1764
1786
  }
1765
- finally { if (e_11) throw e_11.error; }
1787
+ finally { if (e_13) throw e_13.error; }
1766
1788
  }
1767
1789
  seriesEntry.data = marked;
1768
1790
  }
@@ -1772,9 +1794,9 @@ var BasicChart = function (_a) {
1772
1794
  gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
1773
1795
  if (gradientArgs && !seriesAny.noFill) {
1774
1796
  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 });
1797
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_90 = seriesEntry.itemStyle) !== null && _90 !== void 0 ? _90 : {})), { color: gradient });
1776
1798
  if (effectiveChartType === "area") {
1777
- seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_84 = seriesEntry.areaStyle) !== null && _84 !== void 0 ? _84 : {})), { color: gradient });
1799
+ seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_91 = seriesEntry.areaStyle) !== null && _91 !== void 0 ? _91 : {})), { color: gradient });
1778
1800
  }
1779
1801
  }
1780
1802
  else if (seriesAny.noFill) {
@@ -1782,58 +1804,58 @@ var BasicChart = function (_a) {
1782
1804
  // with `transparent` so layout is preserved but nothing
1783
1805
  // paints. Legend entries are also suppressed via `name: ""`
1784
1806
  // 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" });
1807
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_92 = seriesEntry.itemStyle) !== null && _92 !== void 0 ? _92 : {})), { color: "transparent", borderColor: "transparent" });
1786
1808
  }
1787
1809
  else if (isBarOrColumn &&
1788
1810
  Array.isArray(seriesAny.dataPointColors) &&
1789
1811
  seriesAny.dataPointColors.length) {
1790
1812
  overrides_2 = new Map();
1791
1813
  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;
1814
+ for (_153 = (e_14 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _154 = _153.next(); !_154.done; _154 = _153.next()) {
1815
+ dp = _154.value;
1794
1816
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1795
1817
  overrides_2.set(dp.idx, dp.color);
1796
1818
  }
1797
1819
  }
1798
1820
  }
1799
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1821
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
1800
1822
  finally {
1801
1823
  try {
1802
- if (_144 && !_144.done && (_148 = _143.return)) _148.call(_143);
1824
+ if (_154 && !_154.done && (_158 = _153.return)) _158.call(_153);
1803
1825
  }
1804
- finally { if (e_12) throw e_12.error; }
1826
+ finally { if (e_14) throw e_14.error; }
1805
1827
  }
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; } });
1828
+ fallback_1 = (_93 = series.color) !== null && _93 !== void 0 ? _93 : paletteColorAt(specSeriesIndex);
1829
+ 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
1830
  }
1809
1831
  else if (isCircularChart &&
1810
1832
  Array.isArray(seriesAny.dataPointColors) &&
1811
1833
  seriesAny.dataPointColors.length) {
1812
1834
  overrides_3 = new Map();
1813
1835
  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;
1836
+ for (_155 = (e_15 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _156 = _155.next(); !_156.done; _156 = _155.next()) {
1837
+ dp = _156.value;
1816
1838
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1817
1839
  overrides_3.set(dp.idx, dp.color);
1818
1840
  }
1819
1841
  }
1820
1842
  }
1821
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
1843
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
1822
1844
  finally {
1823
1845
  try {
1824
- if (_146 && !_146.done && (_149 = _145.return)) _149.call(_145);
1846
+ if (_156 && !_156.done && (_159 = _155.return)) _159.call(_155);
1825
1847
  }
1826
- finally { if (e_13) throw e_13.error; }
1848
+ finally { if (e_15) throw e_15.error; }
1827
1849
  }
1828
- seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_88 = seriesEntry.itemStyle) !== null && _88 !== void 0 ? _88 : {})), { color: function (params) {
1850
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_95 = seriesEntry.itemStyle) !== null && _95 !== void 0 ? _95 : {})), { color: function (params) {
1829
1851
  var _a, _b;
1830
1852
  return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
1831
1853
  } });
1832
1854
  }
1833
1855
  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) {
1856
+ positiveColor_1 = (_96 = series.color) !== null && _96 !== void 0 ? _96 : paletteColorAt(specSeriesIndex);
1857
+ negativeColor_1 = (_97 = series.negativeColor) !== null && _97 !== void 0 ? _97 : "#FF0000";
1858
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_98 = seriesEntry.itemStyle) !== null && _98 !== void 0 ? _98 : {})), { color: function (params) {
1837
1859
  var _a, _b;
1838
1860
  var value = Array.isArray(params.data)
1839
1861
  ? params.data[1]
@@ -1844,10 +1866,10 @@ var BasicChart = function (_a) {
1844
1866
  } });
1845
1867
  }
1846
1868
  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 });
1869
+ seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_99 = seriesEntry.itemStyle) !== null && _99 !== void 0 ? _99 : {})), { color: series.color });
1870
+ seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((_100 = seriesEntry.lineStyle) !== null && _100 !== void 0 ? _100 : {})), { color: series.color });
1849
1871
  if (effectiveChartType === "area") {
1850
- seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_94 = seriesEntry.areaStyle) !== null && _94 !== void 0 ? _94 : {})), { color: series.color });
1872
+ seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_101 = seriesEntry.areaStyle) !== null && _101 !== void 0 ? _101 : {})), { color: series.color });
1851
1873
  }
1852
1874
  }
1853
1875
  chartSeries.push(seriesEntry);
@@ -1856,29 +1878,29 @@ var BasicChart = function (_a) {
1856
1878
  }
1857
1879
  });
1858
1880
  };
1859
- _140.label = 31;
1881
+ _150.label = 31;
1860
1882
  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;
1883
+ _150.trys.push([31, 36, 37, 38]);
1884
+ _r = tslib_1.__values(((_75 = spec.series) !== null && _75 !== void 0 ? _75 : []).entries()), _s = _r.next();
1885
+ _150.label = 32;
1864
1886
  case 32:
1865
1887
  if (!!_s.done) return [3 /*break*/, 35];
1866
1888
  _t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
1867
1889
  return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
1868
1890
  case 33:
1869
- _140.sent();
1870
- _140.label = 34;
1891
+ _150.sent();
1892
+ _150.label = 34;
1871
1893
  case 34:
1872
1894
  _s = _r.next();
1873
1895
  return [3 /*break*/, 32];
1874
1896
  case 35: return [3 /*break*/, 38];
1875
1897
  case 36:
1876
- e_3_1 = _140.sent();
1898
+ e_3_1 = _150.sent();
1877
1899
  e_3 = { error: e_3_1 };
1878
1900
  return [3 /*break*/, 38];
1879
1901
  case 37:
1880
1902
  try {
1881
- if (_s && !_s.done && (_4 = _r.return)) _4.call(_r);
1903
+ if (_s && !_s.done && (_8 = _r.return)) _8.call(_r);
1882
1904
  }
1883
1905
  finally { if (e_3) throw e_3.error; }
1884
1906
  return [7 /*endfinally*/];
@@ -1891,7 +1913,7 @@ var BasicChart = function (_a) {
1891
1913
  }
1892
1914
  if (isOfPie) {
1893
1915
  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];
1916
+ seriesEntry = (_102 = spec.series) === null || _102 === void 0 ? void 0 : _102[0];
1895
1917
  rawValues = seriesEntry
1896
1918
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
1897
1919
  : [];
@@ -1938,7 +1960,7 @@ var BasicChart = function (_a) {
1938
1960
  };
1939
1961
  chartSeries.push({
1940
1962
  type: "pie",
1941
- name: (_96 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _96 !== void 0 ? _96 : "",
1963
+ name: (_103 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _103 !== void 0 ? _103 : "",
1942
1964
  center: ["".concat(MAIN_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
1943
1965
  radius: [0, "".concat(MAIN_RADIUS_PCT_1, "%")],
1944
1966
  // Rotate the pie so the "Other" slice's angular midpoint faces
@@ -1956,7 +1978,7 @@ var BasicChart = function (_a) {
1956
1978
  if (ofPieType_1 === "pie") {
1957
1979
  chartSeries.push({
1958
1980
  type: "pie",
1959
- name: (_97 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _97 !== void 0 ? _97 : "",
1981
+ name: (_104 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _104 !== void 0 ? _104 : "",
1960
1982
  center: ["".concat(SECONDARY_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
1961
1983
  radius: [0, "".concat(secondaryRadiusPct_1, "%")],
1962
1984
  data: secondary.map(function (s, i) { return ({
@@ -2051,16 +2073,16 @@ var BasicChart = function (_a) {
2051
2073
  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
2074
  }
2053
2075
  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];
2076
+ 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
2077
  rawDomainValues = primaryDomainSource_1
2056
- ? (0, aggregation_1.sanitizeDomainValues)((_101 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _101 !== void 0 ? _101 : [])
2078
+ ? (0, aggregation_1.sanitizeDomainValues)((_108 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _108 !== void 0 ? _108 : [])
2057
2079
  : [];
2058
2080
  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];
2081
+ seriesEntry = (_109 = spec.series) === null || _109 === void 0 ? void 0 : _109[0];
2060
2082
  rawValues_1 = seriesEntry
2061
2083
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
2062
2084
  : [];
2063
- totalIndices = new Set((_103 = spec.totalIndices) !== null && _103 !== void 0 ? _103 : []);
2085
+ totalIndices = new Set((_110 = spec.totalIndices) !== null && _110 !== void 0 ? _110 : []);
2064
2086
  steps = (0, waterfall_1.computeWaterfall)(rawValues_1, labels, totalIndices);
2065
2087
  chartDomains.length = 0;
2066
2088
  chartDomains.push({
@@ -2070,40 +2092,68 @@ var BasicChart = function (_a) {
2070
2092
  axisLine: { show: true },
2071
2093
  axisTick: { show: true },
2072
2094
  splitLine: { show: false },
2073
- name: (_104 = spec.horizontalAxisTitle) !== null && _104 !== void 0 ? _104 : "",
2095
+ name: (_111 = spec.horizontalAxisTitle) !== null && _111 !== void 0 ? _111 : "",
2074
2096
  nameLocation: "middle",
2075
2097
  nameGap: 30,
2076
2098
  });
2077
2099
  chartSeries.length = 0;
2100
+ // The spacer bars are layout only: no labels, no tooltip entry.
2078
2101
  chartSeries.push({
2079
2102
  type: "bar",
2103
+ id: WATERFALL_PLACEHOLDER_ID,
2080
2104
  stack: "waterfall",
2081
2105
  itemStyle: { color: "transparent" },
2082
2106
  emphasis: { itemStyle: { color: "transparent" } },
2083
2107
  data: steps.map(function (s) { return s.placeholder; }),
2084
2108
  silent: true,
2109
+ label: { show: false },
2110
+ tooltip: { show: false },
2085
2111
  });
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;
2112
+ accent_1 = (_112 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _112 !== void 0 ? _112 : theme.themeColors.accent1;
2113
+ 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;
2114
+ totalColor_1 = (_115 = theme.themeColors.accent3) !== null && _115 !== void 0 ? _115 : accent_1;
2115
+ pointColors_1 = new Map();
2116
+ try {
2117
+ 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()) {
2118
+ dp = _w.value;
2119
+ if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
2120
+ pointColors_1.set(dp.idx, dp.color);
2121
+ }
2122
+ }
2123
+ }
2124
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
2125
+ finally {
2126
+ try {
2127
+ if (_w && !_w.done && (_9 = _v.return)) _9.call(_v);
2128
+ }
2129
+ finally { if (e_6) throw e_6.error; }
2130
+ }
2089
2131
  connectors = steps.slice(0, -1).map(function (s, i) { return [
2090
2132
  { coord: [i, s.cumulative] },
2091
2133
  { coord: [i + 1, s.cumulative] },
2092
2134
  ]; });
2093
2135
  chartSeries.push({
2094
2136
  type: "bar",
2137
+ id: (0, series_click_1.chartSeriesId)(0, 0),
2095
2138
  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
- }); }),
2139
+ name: (_117 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _117 !== void 0 ? _117 : "",
2140
+ // A bar's height is the step's magnitude; the signed source value
2141
+ // rides along as `originalValue` so labels and tooltips read
2142
+ // "-90" for a decrease, like Excel.
2143
+ data: steps.map(function (s, i) {
2144
+ var _a;
2145
+ return ({
2146
+ value: s.value,
2147
+ originalValue: rawValues_1[i],
2148
+ itemStyle: {
2149
+ color: (_a = pointColors_1.get(i)) !== null && _a !== void 0 ? _a : (s.isTotal
2150
+ ? totalColor_1
2151
+ : rawValues_1[i] < 0
2152
+ ? decreaseColor_1
2153
+ : accent_1),
2154
+ },
2155
+ });
2156
+ }),
2107
2157
  markLine: {
2108
2158
  silent: true,
2109
2159
  symbol: "none",
@@ -2120,29 +2170,68 @@ var BasicChart = function (_a) {
2120
2170
  legend.data = [];
2121
2171
  }
2122
2172
  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];
2173
+ 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
2174
  rawDomainValues = primaryDomainSource_2
2125
- ? (0, aggregation_1.sanitizeDomainValues)((_113 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _113 !== void 0 ? _113 : [])
2175
+ ? (0, aggregation_1.sanitizeDomainValues)((_121 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _121 !== void 0 ? _121 : [])
2126
2176
  : [];
2127
2177
  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];
2178
+ seriesEntry = (_122 = spec.series) === null || _122 === void 0 ? void 0 : _122[0];
2129
2179
  rawValues = seriesEntry
2130
2180
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : 0); })
2131
2181
  : [];
2132
2182
  chartDomains.length = 0;
2133
2183
  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" },
2184
+ funnelPalette = (0, chart_styles_1.getChartPalette)(spec, [
2185
+ theme.themeColors.accent1,
2186
+ theme.themeColors.accent2,
2187
+ theme.themeColors.accent3,
2188
+ theme.themeColors.accent4,
2189
+ theme.themeColors.accent5,
2190
+ theme.themeColors.accent6,
2191
+ ]);
2192
+ funnelColor_1 = (_123 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _123 !== void 0 ? _123 : (0, utils_1.chartPaletteColorAt)(funnelPalette, 0);
2193
+ stageColors_1 = new Map();
2194
+ try {
2195
+ 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()) {
2196
+ dp = _y.value;
2197
+ if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
2198
+ stageColors_1.set(dp.idx, dp.color);
2199
+ }
2200
+ }
2201
+ }
2202
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
2203
+ finally {
2204
+ try {
2205
+ if (_y && !_y.done && (_10 = _x.return)) _10.call(_x);
2206
+ }
2207
+ finally { if (e_7) throw e_7.error; }
2208
+ }
2209
+ funnelData = rawValues.map(function (value, i) {
2210
+ var _a;
2211
+ return ({
2212
+ name: (_a = labels_1[i]) !== null && _a !== void 0 ? _a : String(i),
2213
+ value: value,
2214
+ });
2145
2215
  });
2216
+ funnelLayout = {
2217
+ sort: "none",
2218
+ left: "22%",
2219
+ right: "10%",
2220
+ top: 60,
2221
+ bottom: 20,
2222
+ };
2223
+ 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: {
2224
+ color: function (params) { var _a; return (_a = stageColors_1.get(params.dataIndex)) !== null && _a !== void 0 ? _a : funnelColor_1; },
2225
+ }, label: {
2226
+ show: true,
2227
+ position: "inside",
2228
+ formatter: function (params) {
2229
+ return (0, axis_number_format_1.formatAxisValue)(undefined, params.value, locale);
2230
+ },
2231
+ } }));
2232
+ // The stage names sit to the left of the bars, where Excel's
2233
+ // category axis puts them: an invisible twin funnel carries them.
2234
+ 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
2235
  legend.data = [];
2147
2236
  }
2148
2237
  else if (spec.chartType === "boxplot") {
@@ -2154,8 +2243,8 @@ var BasicChart = function (_a) {
2154
2243
  outlierPoints = [];
2155
2244
  meanPoints = [];
2156
2245
  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;
2246
+ for (_z = tslib_1.__values((_126 = spec.series) !== null && _126 !== void 0 ? _126 : []), _0 = _z.next(); !_0.done; _0 = _z.next()) {
2247
+ seriesEntry = _0.value;
2159
2248
  label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
2160
2249
  ? seriesEntry.dataLabel
2161
2250
  : "";
@@ -2169,17 +2258,17 @@ var BasicChart = function (_a) {
2169
2258
  boxLabels.push(label);
2170
2259
  if (showOutliers === true) {
2171
2260
  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;
2261
+ for (_1 = (e_9 = void 0, tslib_1.__values(summary.outliers)), _2 = _1.next(); !_2.done; _2 = _1.next()) {
2262
+ outlier = _2.value;
2174
2263
  outlierPoints.push([boxIndex, outlier]);
2175
2264
  }
2176
2265
  }
2177
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2266
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
2178
2267
  finally {
2179
2268
  try {
2180
- if (_y && !_y.done && (_6 = _x.return)) _6.call(_x);
2269
+ if (_2 && !_2.done && (_12 = _1.return)) _12.call(_1);
2181
2270
  }
2182
- finally { if (e_7) throw e_7.error; }
2271
+ finally { if (e_9) throw e_9.error; }
2183
2272
  }
2184
2273
  }
2185
2274
  if (showMeanMarker) {
@@ -2188,12 +2277,12 @@ var BasicChart = function (_a) {
2188
2277
  }
2189
2278
  }
2190
2279
  }
2191
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2280
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
2192
2281
  finally {
2193
2282
  try {
2194
- if (_w && !_w.done && (_5 = _v.return)) _5.call(_v);
2283
+ if (_0 && !_0.done && (_11 = _z.return)) _11.call(_z);
2195
2284
  }
2196
- finally { if (e_6) throw e_6.error; }
2285
+ finally { if (e_8) throw e_8.error; }
2197
2286
  }
2198
2287
  chartDomains.length = 0;
2199
2288
  chartDomains.push({
@@ -2203,7 +2292,7 @@ var BasicChart = function (_a) {
2203
2292
  axisLine: { show: true },
2204
2293
  axisTick: { show: true },
2205
2294
  splitLine: { show: false },
2206
- name: (_117 = spec.horizontalAxisTitle) !== null && _117 !== void 0 ? _117 : "",
2295
+ name: (_127 = spec.horizontalAxisTitle) !== null && _127 !== void 0 ? _127 : "",
2207
2296
  nameLocation: "middle",
2208
2297
  nameGap: 30,
2209
2298
  });
@@ -2213,7 +2302,7 @@ var BasicChart = function (_a) {
2213
2302
  name: "",
2214
2303
  data: boxStats,
2215
2304
  };
2216
- boxColor = (_119 = (_118 = spec.series) === null || _118 === void 0 ? void 0 : _118[0]) === null || _119 === void 0 ? void 0 : _119.color;
2305
+ boxColor = (_129 = (_128 = spec.series) === null || _128 === void 0 ? void 0 : _128[0]) === null || _129 === void 0 ? void 0 : _129.color;
2217
2306
  if (boxColor) {
2218
2307
  boxSeries.itemStyle = { color: boxColor, borderColor: boxColor };
2219
2308
  }
@@ -2228,7 +2317,7 @@ var BasicChart = function (_a) {
2228
2317
  }
2229
2318
  else if (spec.chartType === "histogram") {
2230
2319
  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;
2320
+ _3 = (0, histogram_1.binHistogram)(rawValues, spec.binCount), labels = _3.labels, counts = _3.counts;
2232
2321
  isPareto_1 = (0, histogram_1.isParetoSpec)(spec);
2233
2322
  cumulativePercents = [];
2234
2323
  if (isPareto_1) {
@@ -2245,18 +2334,18 @@ var BasicChart = function (_a) {
2245
2334
  axisLine: { show: true },
2246
2335
  axisTick: { show: true },
2247
2336
  splitLine: { show: false },
2248
- name: (_120 = spec.horizontalAxisTitle) !== null && _120 !== void 0 ? _120 : "",
2337
+ name: (_130 = spec.horizontalAxisTitle) !== null && _130 !== void 0 ? _130 : "",
2249
2338
  nameLocation: "middle",
2250
2339
  nameGap: 30,
2251
2340
  });
2252
2341
  chartSeries.length = 0;
2253
2342
  histogramSeries = {
2254
2343
  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 : "",
2344
+ 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
2345
  data: counts,
2257
2346
  barCategoryGap: "1%",
2258
2347
  };
2259
- histogramColor = (_125 = (_124 = spec.series) === null || _124 === void 0 ? void 0 : _124[0]) === null || _125 === void 0 ? void 0 : _125.color;
2348
+ histogramColor = (_135 = (_134 = spec.series) === null || _134 === void 0 ? void 0 : _134[0]) === null || _135 === void 0 ? void 0 : _135.color;
2260
2349
  if (histogramColor) {
2261
2350
  histogramSeries.itemStyle = { color: histogramColor };
2262
2351
  }
@@ -2293,20 +2382,20 @@ var BasicChart = function (_a) {
2293
2382
  isPareto = spec.chartType === "histogram" && (0, histogram_1.isParetoSpec)(spec);
2294
2383
  hasSecondaryAxis = !isCircularChart &&
2295
2384
  !isHorizontalBarChart &&
2296
- (((_126 = spec.series) !== null && _126 !== void 0 ? _126 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
2385
+ (((_136 = spec.series) !== null && _136 !== void 0 ? _136 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
2297
2386
  isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
2298
2387
  (spec.chartType === "bar" || spec.chartType === "column");
2299
2388
  primaryAxisNumberFormat = isPercentStackedBars
2300
2389
  ? undefined
2301
2390
  : (0, axis_number_format_1.resolveValueAxisNumberFormat)({
2302
2391
  axisOptions: spec.valueAxisOptions,
2303
- series: ((_127 = spec.series) !== null && _127 !== void 0 ? _127 : []).filter(function (s) { return !s.useSecondaryAxis; }),
2392
+ series: ((_137 = spec.series) !== null && _137 !== void 0 ? _137 : []).filter(function (s) { return !s.useSecondaryAxis; }),
2304
2393
  getFormattingFromRange: getFormattingFromRange,
2305
2394
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
2306
2395
  });
2307
2396
  secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
2308
2397
  axisOptions: spec.secondaryValueAxisOptions,
2309
- series: ((_128 = spec.series) !== null && _128 !== void 0 ? _128 : []).filter(function (s) { return s.useSecondaryAxis; }),
2398
+ series: ((_138 = spec.series) !== null && _138 !== void 0 ? _138 : []).filter(function (s) { return s.useSecondaryAxis; }),
2310
2399
  getFormattingFromRange: getFormattingFromRange,
2311
2400
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
2312
2401
  });
@@ -2335,17 +2424,17 @@ var BasicChart = function (_a) {
2335
2424
  finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
2336
2425
  bottomAxisNameGap = isHorizontalBarChart
2337
2426
  ? 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);
2427
+ : Number((_140 = (_139 = chartDomains[0]) === null || _139 === void 0 ? void 0 : _139.nameGap) !== null && _140 !== void 0 ? _140 : CATEGORY_AXIS_NAME_GAP);
2339
2428
  legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
2340
- position: (_131 = spec.legend) === null || _131 === void 0 ? void 0 : _131.position,
2429
+ position: (_141 = spec.legend) === null || _141 === void 0 ? void 0 : _141.position,
2341
2430
  visible: finalLegend.show !== false,
2342
2431
  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,
2432
+ 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
2433
  legendItemWidth: defaultLegendConfig.itemWidth,
2345
2434
  width: width !== null && width !== void 0 ? width : 0,
2346
2435
  height: height !== null && height !== void 0 ? height : 0,
2347
2436
  hasTitle: Boolean(title),
2348
- titleFontSize: (_138 = (_137 = spec.titleTextFormat) === null || _137 === void 0 ? void 0 : _137.fontSize) !== null && _138 !== void 0 ? _138 : 16,
2437
+ titleFontSize: (_148 = (_147 = spec.titleTextFormat) === null || _147 === void 0 ? void 0 : _147.fontSize) !== null && _148 !== void 0 ? _148 : 16,
2349
2438
  hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
2350
2439
  bottomAxisNameGap: bottomAxisNameGap,
2351
2440
  hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
@@ -2418,12 +2507,12 @@ var BasicChart = function (_a) {
2418
2507
  }
2419
2508
  }
2420
2509
  }
2421
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2510
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2422
2511
  finally {
2423
2512
  try {
2424
- if (barSeries_1_1 && !barSeries_1_1.done && (_7 = barSeries_1.return)) _7.call(barSeries_1);
2513
+ if (barSeries_1_1 && !barSeries_1_1.done && (_13 = barSeries_1.return)) _13.call(barSeries_1);
2425
2514
  }
2426
- finally { if (e_8) throw e_8.error; }
2515
+ finally { if (e_10) throw e_10.error; }
2427
2516
  }
2428
2517
  try {
2429
2518
  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 +2529,20 @@ var BasicChart = function (_a) {
2440
2529
  });
2441
2530
  }
2442
2531
  }
2443
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2532
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2444
2533
  finally {
2445
2534
  try {
2446
- if (barSeries_2_1 && !barSeries_2_1.done && (_8 = barSeries_2.return)) _8.call(barSeries_2);
2535
+ if (barSeries_2_1 && !barSeries_2_1.done && (_14 = barSeries_2.return)) _14.call(barSeries_2);
2447
2536
  }
2448
- finally { if (e_9) throw e_9.error; }
2537
+ finally { if (e_11) throw e_11.error; }
2449
2538
  }
2450
2539
  }
2451
2540
  seriesWithLabels = chartSeries.map(function (s) {
2452
2541
  var _a, _b, _c, _d, _e, _f, _g, _h;
2453
2542
  var next = tslib_1.__assign({}, s);
2543
+ if (DECORATION_SERIES_IDS.has(s === null || s === void 0 ? void 0 : s.id)) {
2544
+ return next;
2545
+ }
2454
2546
  var seriesLabelOption = seriesLabelOptionFor(s);
2455
2547
  if (seriesLabelOption) {
2456
2548
  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 +2558,24 @@ var BasicChart = function (_a) {
2466
2558
  var seriesTooltipValueFormatter = VALUE_TOOLTIP_SERIES_TYPES.has(s === null || s === void 0 ? void 0 : s.type)
2467
2559
  ? (0, axis_number_format_1.valueAxisLabelFormatter)(seriesNumberFormatFor(s), locale)
2468
2560
  : 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 });
2561
+ // A data item carrying `originalValue` (a waterfall step's signed
2562
+ // source value, a percent-stacked bar's raw amount) reads as that
2563
+ // value in the tooltip, like its data label.
2564
+ var originalValueAt = function (dataIndex) {
2565
+ var item = Array.isArray(s === null || s === void 0 ? void 0 : s.data) ? s.data[dataIndex] : undefined;
2566
+ return item !== null && typeof item === "object"
2567
+ ? item.originalValue
2568
+ : undefined;
2569
+ };
2570
+ var carriesOriginalValues = VALUE_TOOLTIP_SERIES_TYPES.has(s === null || s === void 0 ? void 0 : s.type) &&
2571
+ Array.isArray(s === null || s === void 0 ? void 0 : s.data) &&
2572
+ s.data.some(function (item) {
2573
+ return item !== null && typeof item === "object" && "originalValue" in item;
2574
+ });
2575
+ if ((seriesTooltipValueFormatter || carriesOriginalValues) &&
2576
+ ((_d = s === null || s === void 0 ? void 0 : s.tooltip) === null || _d === void 0 ? void 0 : _d.show) !== false) {
2577
+ var formatValue_1 = seriesTooltipValueFormatter !== null && seriesTooltipValueFormatter !== void 0 ? seriesTooltipValueFormatter : (function (value) { return (0, axis_number_format_1.formatAxisValue)(undefined, value, locale); });
2578
+ 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
2579
  }
2472
2580
  if (next.type === "pie") {
2473
2581
  var pieNumberFormat = seriesNumberFormatFor(s);
@@ -2496,7 +2604,7 @@ var BasicChart = function (_a) {
2496
2604
  return next;
2497
2605
  });
2498
2606
  // Update charts
2499
- (_139 = chartRef.current) === null || _139 === void 0 ? void 0 : _139.setOption({
2607
+ (_149 = chartRef.current) === null || _149 === void 0 ? void 0 : _149.setOption({
2500
2608
  xAxis: (function () {
2501
2609
  var _a, _b;
2502
2610
  if (isOfPie) {