@rowsncolumns/charts 28.1.7 → 28.1.8

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.
@@ -21,6 +21,8 @@ var error_bars_1 = require("../../utils/error-bars");
21
21
  var category_levels_1 = require("../../utils/category-levels");
22
22
  var gradient_1 = require("../../utils/gradient");
23
23
  var legend_layout_1 = require("../../utils/legend-layout");
24
+ var doughnut_1 = require("../../utils/doughnut");
25
+ var overrides_1 = require("../../utils/overrides");
24
26
  var plotly_title_1 = require("../../utils/plotly-title");
25
27
  var pie_explosion_1 = require("../../utils/pie-explosion");
26
28
  var plotly_click_1 = require("../../utils/plotly-click");
@@ -491,11 +493,11 @@ var BasicChart = function (_a) {
491
493
  * Triggers a chart update
492
494
  */
493
495
  var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
494
- var traces, chartType, position, isBubble, isHierarchy, textColor, bgColor, gridColor, skipHeaders_1, labels, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _a, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _b, categories_1, preparedSeries, sizeValues, sizeScale_1, hasStringX_1, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLayout, hierarchyRows, headerTitle, hierarchyData, seriesName, hierarchyTrace, layoutForHierarchy, labels, seriesEntry, rawValues_1, locations_1, z_1, ramp_1, colorscale, geoScope, regionTrace, surfaceToken, categories, surfaceSeriesInputs, _c, _d, seriesEntry, dataLabel, _e, _f, values, e_2_1, seriesNames, surfaceTrace, surfaceLayout, categories, radarStyle, radarTraces, radarInputs, _g, _h, seriesEntry, label, values, indicators, _loop_1, i, maxR, variant, categories, seriesValues, volumePoints_1, hasVolume, buildVolumeTrace, volumeLayout, priceYAxisDomain, roles, xs_1, candleTrace, lineSeries, stockPalette_1, xs_2, stockTraces, isStacked, isHorizontalBarChart, lineTraceVariant, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, domainData, categoryLevels, multicategoryX, aggregateDomainValues, domainAxisData, secondaryDomainData, categoriesFor, assignCartesianData, themeColorPalette, applyTraceColor, hasSecondaryAxis, hasSecondaryCategoryAxis, valueAxisKey, categoryAxisKey, secondaryValueAxisRef, secondaryCategoryAxisRef, isPareto, isOfPie, ofPieHandled, ofPieExtras, decorateCartesianTrace, domainSources, seriesIndex, _loop_2, _j, _k, series, e_3_1, authoredTitleFmt, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, _l, legendOverrides, showlegend, axisFontSize, primaryValues, leftAxisLabelDepth, leftAxisDepth, rightAxisDepth, bottomAxisTitleStandoff, legendBand, newLayout, dlOpts, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
496
+ var traces, chartType, position, isBubble, isHierarchy, textColor, bgColor, gridColor, skipHeaders_1, labels, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _a, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _b, categories_1, preparedSeries, sizeValues, sizeScale_1, hasStringX_1, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLayout, hierarchyRows, headerTitle, hierarchyData, seriesName, hierarchyTrace, layoutForHierarchy, labels, seriesEntry, rawValues_1, locations_1, z_1, ramp_1, colorscale, geoScope, regionTrace, surfaceToken, categories, surfaceSeriesInputs, _c, _d, seriesEntry, dataLabel, _e, _f, values, e_2_1, seriesNames, surfaceTrace, surfaceLayout, categories, radarStyle, radarTraces, radarInputs, _g, _h, seriesEntry, label, values, radarAxisOptions, indicators, _loop_1, i, radarScale, variant, categories, seriesValues, volumePoints_1, hasVolume, buildVolumeTrace, volumeLayout, priceYAxisDomain, roles, xs_1, candleTrace, lineSeries, stockPalette_1, xs_2, stockTraces, isStacked, isHorizontalBarChart, lineTraceVariant, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, domainData, categoryLevels, multicategoryX, aggregateDomainValues, domainAxisData, secondaryDomainData, categoriesFor, assignCartesianData, themeColorPalette, applyTraceColor, hasSecondaryAxis, hasSecondaryCategoryAxis, valueAxisKey, categoryAxisKey, secondaryValueAxisRef, secondaryCategoryAxisRef, isPareto, isOfPie, ofPieHandled, ofPieExtras, decorateCartesianTrace, domainSources, seriesIndex, _loop_2, _j, _k, series, e_3_1, authoredTitleFmt, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, _l, legendOverrides, showlegend, axisFontSize, primaryValues, leftAxisLabelDepth, leftAxisDepth, rightAxisDepth, bottomAxisTitleStandoff, legendBand, newLayout, dlOpts, doughnutSeriesOrder, doughnutRingSet, traceDataLabels, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
495
497
  var e_2, _m, e_4, _o, e_3, _p, _q, _r;
496
- var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _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;
497
- return tslib_1.__generator(this, function (_76) {
498
- switch (_76.label) {
498
+ var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _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;
499
+ return tslib_1.__generator(this, function (_77) {
500
+ switch (_77.label) {
499
501
  case 0:
500
502
  (0, utils_1.debug)("Updating chart", chart);
501
503
  traces = [];
@@ -520,7 +522,7 @@ var BasicChart = function (_a) {
520
522
  });
521
523
  seriesInputs = [];
522
524
  i = 0;
523
- _76.label = 1;
525
+ _77.label = 1;
524
526
  case 1:
525
527
  if (!(i < spec.series.length)) return [3 /*break*/, 5];
526
528
  seriesEntry = spec.series[i];
@@ -529,13 +531,13 @@ var BasicChart = function (_a) {
529
531
  _a = chart_spec_utils_1.coerceCalculatedLabel;
530
532
  return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_w = chart.position.sheetId) !== null && _w !== void 0 ? _w : sheetId, chart.position.overlayPosition.anchorCell.rowIndex, chart.position.overlayPosition.anchorCell.columnIndex)];
531
533
  case 2:
532
- resolvedLabel = _a.apply(void 0, [_76.sent()]);
533
- _76.label = 3;
534
+ resolvedLabel = _a.apply(void 0, [_77.sent()]);
535
+ _77.label = 3;
534
536
  case 3:
535
537
  xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
536
538
  sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
537
539
  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 } : {})));
538
- _76.label = 4;
540
+ _77.label = 4;
539
541
  case 4:
540
542
  i++;
541
543
  return [3 /*break*/, 1];
@@ -810,11 +812,11 @@ var BasicChart = function (_a) {
810
812
  if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
811
813
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
812
814
  surfaceSeriesInputs = [];
813
- _76.label = 7;
815
+ _77.label = 7;
814
816
  case 7:
815
- _76.trys.push([7, 14, 15, 16]);
817
+ _77.trys.push([7, 14, 15, 16]);
816
818
  _c = tslib_1.__values((_18 = spec.series) !== null && _18 !== void 0 ? _18 : []), _d = _c.next();
817
- _76.label = 8;
819
+ _77.label = 8;
818
820
  case 8:
819
821
  if (!!_d.done) return [3 /*break*/, 13];
820
822
  seriesEntry = _d.value;
@@ -822,22 +824,22 @@ var BasicChart = function (_a) {
822
824
  _f = chart_spec_utils_1.coerceCalculatedLabel;
823
825
  return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_19 = position.sheetId) !== null && _19 !== void 0 ? _19 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
824
826
  case 9:
825
- _e = _f.apply(void 0, [_76.sent()]);
827
+ _e = _f.apply(void 0, [_77.sent()]);
826
828
  return [3 /*break*/, 11];
827
829
  case 10:
828
830
  _e = (_20 = seriesEntry.dataLabel) !== null && _20 !== void 0 ? _20 : "";
829
- _76.label = 11;
831
+ _77.label = 11;
830
832
  case 11:
831
833
  dataLabel = _e;
832
834
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
833
835
  surfaceSeriesInputs.push({ name: dataLabel, values: values });
834
- _76.label = 12;
836
+ _77.label = 12;
835
837
  case 12:
836
838
  _d = _c.next();
837
839
  return [3 /*break*/, 8];
838
840
  case 13: return [3 /*break*/, 16];
839
841
  case 14:
840
- e_2_1 = _76.sent();
842
+ e_2_1 = _77.sent();
841
843
  e_2 = { error: e_2_1 };
842
844
  return [3 /*break*/, 16];
843
845
  case 15:
@@ -911,7 +913,8 @@ var BasicChart = function (_a) {
911
913
  }
912
914
  finally { if (e_4) throw e_4.error; }
913
915
  }
914
- indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs);
916
+ radarAxisOptions = spec.valueAxisOptions;
917
+ indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
915
918
  _loop_1 = function (i) {
916
919
  var input = radarInputs[i];
917
920
  var seriesColor = (_29 = (_28 = (_27 = spec.series) === null || _27 === void 0 ? void 0 : _27[i]) === null || _28 === void 0 ? void 0 : _28.color) !== null && _29 !== void 0 ? _29 : undefined;
@@ -922,7 +925,7 @@ var BasicChart = function (_a) {
922
925
  for (i = 0; i < radarInputs.length; i++) {
923
926
  _loop_1(i);
924
927
  }
925
- maxR = indicators.reduce(function (m, ind) { return Math.max(m, ind.max); }, 0);
928
+ radarScale = (_30 = indicators[0]) !== null && _30 !== void 0 ? _30 : { min: 0, max: 1 };
926
929
  setPlotData(radarTraces);
927
930
  setLayout({
928
931
  title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) },
@@ -932,8 +935,8 @@ var BasicChart = function (_a) {
932
935
  showlegend: radarTraces.length > 1,
933
936
  polar: {
934
937
  radialaxis: {
935
- visible: true,
936
- range: [0, maxR > 0 ? maxR : 1],
938
+ visible: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
939
+ range: [radarScale.min, radarScale.max],
937
940
  },
938
941
  },
939
942
  margin: { l: 50, r: 50, t: 50, b: 50 },
@@ -946,13 +949,13 @@ var BasicChart = function (_a) {
946
949
  // V-variants additionally get a volume column sub-pane below the
947
950
  // price plot.
948
951
  if (spec.chartType === "stock") {
949
- variant = ((_30 = spec.stockVariant) !== null && _30 !== void 0 ? _30 : "HLC");
952
+ variant = ((_31 = spec.stockVariant) !== null && _31 !== void 0 ? _31 : "HLC");
950
953
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
951
- seriesValues = ((_31 = spec.series) !== null && _31 !== void 0 ? _31 : []).map(function (seriesEntry) {
954
+ seriesValues = ((_32 = spec.series) !== null && _32 !== void 0 ? _32 : []).map(function (seriesEntry) {
952
955
  return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
953
956
  });
954
957
  volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
955
- hasVolume = ((_32 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _32 !== void 0 ? _32 : 0) > 0;
958
+ hasVolume = ((_33 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _33 !== void 0 ? _33 : 0) > 0;
956
959
  buildVolumeTrace = function (xs) {
957
960
  return ({
958
961
  type: "bar",
@@ -985,25 +988,25 @@ var BasicChart = function (_a) {
985
988
  roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
986
989
  xs_1 = categories.length > 0
987
990
  ? categories
988
- : ((_33 = roles.close) !== null && _33 !== void 0 ? _33 : []).map(function (_, i) { return i + 1; });
991
+ : ((_34 = roles.close) !== null && _34 !== void 0 ? _34 : []).map(function (_, i) { return i + 1; });
989
992
  candleTrace = {
990
993
  type: "candlestick",
991
994
  x: xs_1,
992
- open: ((_34 = roles.open) !== null && _34 !== void 0 ? _34 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
993
- high: ((_35 = roles.high) !== null && _35 !== void 0 ? _35 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
994
- low: ((_36 = roles.low) !== null && _36 !== void 0 ? _36 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
995
- close: ((_37 = roles.close) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
995
+ open: ((_35 = roles.open) !== null && _35 !== void 0 ? _35 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
996
+ high: ((_36 = roles.high) !== null && _36 !== void 0 ? _36 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
997
+ low: ((_37 = roles.low) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
998
+ close: ((_38 = roles.close) !== null && _38 !== void 0 ? _38 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
996
999
  increasing: { line: { color: theme.themeColors.accent1 } },
997
1000
  decreasing: { line: { color: theme.themeColors.accent2 } },
998
1001
  };
999
1002
  setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
1000
1003
  setLayout(tslib_1.__assign(tslib_1.__assign({ title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) }, font: { color: textColor }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, xaxis: {
1001
- title: { text: (_38 = spec.horizontalAxisTitle) !== null && _38 !== void 0 ? _38 : "" },
1004
+ title: { text: (_39 = spec.horizontalAxisTitle) !== null && _39 !== void 0 ? _39 : "" },
1002
1005
  automargin: true,
1003
1006
  showgrid: true,
1004
1007
  gridcolor: gridColor,
1005
1008
  rangeslider: { visible: false },
1006
- }, yaxis: tslib_1.__assign({ title: { text: (_39 = spec.verticalAxisTitle) !== null && _39 !== void 0 ? _39 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1009
+ }, yaxis: tslib_1.__assign({ title: { text: (_40 = spec.verticalAxisTitle) !== null && _40 !== void 0 ? _40 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1007
1010
  return [2 /*return*/];
1008
1011
  }
1009
1012
  lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
@@ -1015,7 +1018,7 @@ var BasicChart = function (_a) {
1015
1018
  ]);
1016
1019
  xs_2 = categories.length > 0
1017
1020
  ? categories
1018
- : ((_41 = (_40 = lineSeries[0]) === null || _40 === void 0 ? void 0 : _40.values) !== null && _41 !== void 0 ? _41 : []).map(function (_, i) { return i + 1; });
1021
+ : ((_42 = (_41 = lineSeries[0]) === null || _41 === void 0 ? void 0 : _41.values) !== null && _42 !== void 0 ? _42 : []).map(function (_, i) { return i + 1; });
1019
1022
  stockTraces = lineSeries.map(function (s, i) { return ({
1020
1023
  type: "scatter",
1021
1024
  mode: "lines",
@@ -1026,11 +1029,11 @@ var BasicChart = function (_a) {
1026
1029
  }); });
1027
1030
  setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
1028
1031
  setLayout(tslib_1.__assign(tslib_1.__assign({ title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) }, font: { color: textColor }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: stockTraces.length > 1, xaxis: {
1029
- title: { text: (_42 = spec.horizontalAxisTitle) !== null && _42 !== void 0 ? _42 : "" },
1032
+ title: { text: (_43 = spec.horizontalAxisTitle) !== null && _43 !== void 0 ? _43 : "" },
1030
1033
  automargin: true,
1031
1034
  showgrid: true,
1032
1035
  gridcolor: gridColor,
1033
- }, yaxis: tslib_1.__assign({ title: { text: (_43 = spec.verticalAxisTitle) !== null && _43 !== void 0 ? _43 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1036
+ }, yaxis: tslib_1.__assign({ title: { text: (_44 = spec.verticalAxisTitle) !== null && _44 !== void 0 ? _44 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1034
1037
  return [2 /*return*/];
1035
1038
  }
1036
1039
  isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
@@ -1077,12 +1080,12 @@ var BasicChart = function (_a) {
1077
1080
  return extra;
1078
1081
  };
1079
1082
  shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
1080
- primaryDomainSource = (_46 = (_45 = (_44 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _44 === void 0 ? void 0 : _44[0]) === null || _45 === void 0 ? void 0 : _45.sources) === null || _46 === void 0 ? void 0 : _46[0];
1083
+ primaryDomainSource = (_47 = (_46 = (_45 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _45 === void 0 ? void 0 : _45[0]) === null || _46 === void 0 ? void 0 : _46.sources) === null || _47 === void 0 ? void 0 : _47[0];
1081
1084
  rawPrimaryDomainValues = primaryDomainSource
1082
- ? (0, aggregation_1.sanitizeDomainValues)((_47 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _47 !== void 0 ? _47 : [])
1085
+ ? (0, aggregation_1.sanitizeDomainValues)((_48 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _48 !== void 0 ? _48 : [])
1083
1086
  : [];
1084
1087
  domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
1085
- categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_48 = spec.categoryLevels) === null || _48 === void 0 ? void 0 : _48.map(function (level) {
1088
+ categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_49 = spec.categoryLevels) === null || _49 === void 0 ? void 0 : _49.map(function (level) {
1086
1089
  return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
1087
1090
  }));
1088
1091
  multicategoryX = categoryLevels
@@ -1092,7 +1095,7 @@ var BasicChart = function (_a) {
1092
1095
  domainData = categoryLevels.leaf;
1093
1096
  }
1094
1097
  aggregateDomainValues = domainData;
1095
- domainAxisData = (categoryLevels ? [] : (_49 = spec.domains) !== null && _49 !== void 0 ? _49 : []).map(function (domain, domainIndex) {
1098
+ domainAxisData = (categoryLevels ? [] : (_50 = spec.domains) !== null && _50 !== void 0 ? _50 : []).map(function (domain, domainIndex) {
1096
1099
  return domain.sources.flatMap(function (sheetRange, sourceIndex) {
1097
1100
  var _a;
1098
1101
  if (domainIndex === 0 && sourceIndex === 0) {
@@ -1161,12 +1164,12 @@ var BasicChart = function (_a) {
1161
1164
  if ((isBarOrColumn || isPie) &&
1162
1165
  Array.isArray(options === null || options === void 0 ? void 0 : options.dataPointColors) &&
1163
1166
  (options === null || options === void 0 ? void 0 : options.dataPointColors.length)) {
1164
- var overrides_1 = new Map();
1167
+ var overrides_2 = new Map();
1165
1168
  try {
1166
1169
  for (var _u = tslib_1.__values(options.dataPointColors), _v = _u.next(); !_v.done; _v = _u.next()) {
1167
1170
  var dp = _v.value;
1168
1171
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1169
- overrides_1.set(dp.idx, dp.color);
1172
+ overrides_2.set(dp.idx, dp.color);
1170
1173
  }
1171
1174
  }
1172
1175
  }
@@ -1189,7 +1192,7 @@ var BasicChart = function (_a) {
1189
1192
  : 0;
1190
1193
  target.marker = tslib_1.__assign(tslib_1.__assign({}, ((_j = target.marker) !== null && _j !== void 0 ? _j : {})), { colors: Array.from({ length: labelCount }, function (_, i) {
1191
1194
  var _a, _b;
1192
- return (_b = (_a = overrides_1.get(i)) !== null && _a !== void 0 ? _a : seriesColor) !== null && _b !== void 0 ? _b : existing_1[i % Math.max(1, existing_1.length)];
1195
+ return (_b = (_a = overrides_2.get(i)) !== null && _a !== void 0 ? _a : seriesColor) !== null && _b !== void 0 ? _b : existing_1[i % Math.max(1, existing_1.length)];
1193
1196
  }) });
1194
1197
  return trace;
1195
1198
  }
@@ -1199,7 +1202,7 @@ var BasicChart = function (_a) {
1199
1202
  : Array.isArray(target.x)
1200
1203
  ? target.x
1201
1204
  : [];
1202
- var colors = yArray.map(function (_, i) { var _a; return (_a = overrides_1.get(i)) !== null && _a !== void 0 ? _a : fallback_1; });
1205
+ var colors = yArray.map(function (_, i) { var _a; return (_a = overrides_2.get(i)) !== null && _a !== void 0 ? _a : fallback_1; });
1203
1206
  target.marker = tslib_1.__assign(tslib_1.__assign({}, ((_k = target.marker) !== null && _k !== void 0 ? _k : {})), { color: colors });
1204
1207
  return trace;
1205
1208
  }
@@ -1348,29 +1351,29 @@ var BasicChart = function (_a) {
1348
1351
  finally { if (e_6) throw e_6.error; }
1349
1352
  }
1350
1353
  };
1351
- domainSources = (_52 = (_51 = (_50 = spec.domains) === null || _50 === void 0 ? void 0 : _50[0]) === null || _51 === void 0 ? void 0 : _51.sources) !== null && _52 !== void 0 ? _52 : [];
1354
+ domainSources = (_53 = (_52 = (_51 = spec.domains) === null || _51 === void 0 ? void 0 : _51[0]) === null || _52 === void 0 ? void 0 : _52.sources) !== null && _53 !== void 0 ? _53 : [];
1352
1355
  seriesIndex = 0;
1353
1356
  _loop_2 = function (series) {
1354
- var currentSeriesIndex, dataLabel, _77, _78, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, _79, labels, counts, cumulativePercents, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, trace, rawValues, trace, pieData, _80, main_1, secondary, otherTotal, total, ofPieType, secondScale, halfAngle, paletteAt_1, MAIN_DOMAIN_X, CY, SECONDARY_CX, BAR_LEFT, BAR_RIGHT, plotW, plotH, hasGeometry, r, r2, clampFrac, rx2, ry2, barHalf, shapes, connectorColor, mainCx, px, pyTop, pyBottom, tx, half, line, pieData, trace, _81, x, y, orientation_1, trace, numericValues, _82, x, y, orientation_2, trace;
1355
- return tslib_1.__generator(this, function (_83) {
1356
- switch (_83.label) {
1357
+ var currentSeriesIndex, dataLabel, _78, _79, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, _80, labels, counts, cumulativePercents, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, trace, rawValues, trace, pieData, _81, main_1, secondary, otherTotal, total, ofPieType, secondScale, halfAngle, paletteAt_1, MAIN_DOMAIN_X, CY, SECONDARY_CX, BAR_LEFT, BAR_RIGHT, plotW, plotH, hasGeometry, r, r2, clampFrac, rx2, ry2, barHalf, shapes, connectorColor, mainCx, px, pyTop, pyBottom, tx, half, line, pieData, trace, _82, x, y, orientation_1, trace, numericValues, _83, x, y, orientation_2, trace;
1358
+ return tslib_1.__generator(this, function (_84) {
1359
+ switch (_84.label) {
1357
1360
  case 0:
1358
1361
  currentSeriesIndex = seriesIndex++;
1359
1362
  if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1360
- _78 = chart_spec_utils_1.coerceCalculatedLabel;
1361
- return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_54 = position.sheetId) !== null && _54 !== void 0 ? _54 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1363
+ _79 = chart_spec_utils_1.coerceCalculatedLabel;
1364
+ return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_55 = position.sheetId) !== null && _55 !== void 0 ? _55 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1362
1365
  case 1:
1363
- _77 = _78.apply(void 0, [_83.sent()]);
1366
+ _78 = _79.apply(void 0, [_84.sent()]);
1364
1367
  return [3 /*break*/, 3];
1365
1368
  case 2:
1366
- _77 = (_55 = series.dataLabel) !== null && _55 !== void 0 ? _55 : "";
1367
- _83.label = 3;
1369
+ _78 = (_56 = series.dataLabel) !== null && _56 !== void 0 ? _56 : "";
1370
+ _84.label = 3;
1368
1371
  case 3:
1369
- dataLabel = _77;
1372
+ dataLabel = _78;
1370
1373
  // A series with no ranges draws nothing.
1371
1374
  if (series.sources.length === 0)
1372
1375
  return [2 /*return*/, "continue"];
1373
- effectiveChartType = (_56 = series.seriesChartType) !== null && _56 !== void 0 ? _56 : spec.chartType;
1376
+ effectiveChartType = (_57 = series.seriesChartType) !== null && _57 !== void 0 ? _57 : spec.chartType;
1374
1377
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1375
1378
  pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
1376
1379
  (domainSources.length > 1 || series.sources.length > 1)
@@ -1408,14 +1411,14 @@ var BasicChart = function (_a) {
1408
1411
  : seriesData;
1409
1412
  binCount = spec.binCount;
1410
1413
  if (isPareto) {
1411
- _79 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _79.labels, counts = _79.counts, cumulativePercents = _79.cumulativePercents;
1414
+ _80 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _80.labels, counts = _80.counts, cumulativePercents = _80.cumulativePercents;
1412
1415
  barTrace = {
1413
1416
  type: "bar",
1414
1417
  x: labels,
1415
1418
  y: counts,
1416
1419
  name: dataLabel,
1417
1420
  };
1418
- applyTraceColor(barTrace, (_57 = series.color) !== null && _57 !== void 0 ? _57 : undefined, {
1421
+ applyTraceColor(barTrace, (_58 = series.color) !== null && _58 !== void 0 ? _58 : undefined, {
1419
1422
  noFill: series.noFill,
1420
1423
  dataPointColors: series.dataPointColors,
1421
1424
  seriesIndex: currentSeriesIndex,
@@ -1436,7 +1439,7 @@ var BasicChart = function (_a) {
1436
1439
  trace = tslib_1.__assign({ type: "histogram", x: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }), name: dataLabel }, (typeof binCount === "number" && binCount > 0
1437
1440
  ? { nbinsx: binCount }
1438
1441
  : {}));
1439
- applyTraceColor(trace, (_58 = series.color) !== null && _58 !== void 0 ? _58 : undefined, {
1442
+ applyTraceColor(trace, (_59 = series.color) !== null && _59 !== void 0 ? _59 : undefined, {
1440
1443
  noFill: series.noFill,
1441
1444
  dataPointColors: series.dataPointColors,
1442
1445
  seriesIndex: currentSeriesIndex,
@@ -1486,7 +1489,7 @@ var BasicChart = function (_a) {
1486
1489
  // default and `showOutliers: true` alike).
1487
1490
  boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
1488
1491
  }
1489
- applyTraceColor(trace, (_59 = series.color) !== null && _59 !== void 0 ? _59 : undefined, {
1492
+ applyTraceColor(trace, (_60 = series.color) !== null && _60 !== void 0 ? _60 : undefined, {
1490
1493
  noFill: series.noFill,
1491
1494
  dataPointColors: series.dataPointColors,
1492
1495
  seriesIndex: currentSeriesIndex,
@@ -1498,7 +1501,7 @@ var BasicChart = function (_a) {
1498
1501
  rawValues = "values" in seriesData
1499
1502
  ? seriesData.values
1500
1503
  : seriesData;
1501
- totalIndices_1 = new Set((_60 = spec.totalIndices) !== null && _60 !== void 0 ? _60 : []);
1504
+ totalIndices_1 = new Set((_61 = spec.totalIndices) !== null && _61 !== void 0 ? _61 : []);
1502
1505
  trace = {
1503
1506
  type: "waterfall",
1504
1507
  x: categoriesFor(series),
@@ -1508,7 +1511,7 @@ var BasicChart = function (_a) {
1508
1511
  }),
1509
1512
  name: dataLabel,
1510
1513
  };
1511
- applyTraceColor(trace, (_61 = series.color) !== null && _61 !== void 0 ? _61 : undefined, {
1514
+ applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
1512
1515
  noFill: series.noFill,
1513
1516
  dataPointColors: series.dataPointColors,
1514
1517
  seriesIndex: currentSeriesIndex,
@@ -1526,7 +1529,7 @@ var BasicChart = function (_a) {
1526
1529
  x: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }),
1527
1530
  name: dataLabel,
1528
1531
  };
1529
- applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
1532
+ applyTraceColor(trace, (_63 = series.color) !== null && _63 !== void 0 ? _63 : undefined, {
1530
1533
  noFill: series.noFill,
1531
1534
  dataPointColors: series.dataPointColors,
1532
1535
  seriesIndex: currentSeriesIndex,
@@ -1544,10 +1547,10 @@ var BasicChart = function (_a) {
1544
1547
  return [2 /*return*/, "continue"];
1545
1548
  ofPieHandled = true;
1546
1549
  pieData = seriesData;
1547
- _80 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1550
+ _81 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1548
1551
  splitType: spec.splitType,
1549
1552
  splitPos: spec.splitPos,
1550
- }), main_1 = _80.main, secondary = _80.secondary, otherTotal = _80.otherTotal, total = _80.total;
1553
+ }), main_1 = _81.main, secondary = _81.secondary, otherTotal = _81.otherTotal, total = _81.total;
1551
1554
  ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
1552
1555
  secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
1553
1556
  halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
@@ -1680,7 +1683,7 @@ var BasicChart = function (_a) {
1680
1683
  trace.meta = {
1681
1684
  rncSeriesIndex: currentSeriesIndex,
1682
1685
  };
1683
- applyTraceColor(trace, (_63 = series.color) !== null && _63 !== void 0 ? _63 : undefined, {
1686
+ applyTraceColor(trace, (_64 = series.color) !== null && _64 !== void 0 ? _64 : undefined, {
1684
1687
  noFill: series.noFill,
1685
1688
  dataPointColors: series.dataPointColors,
1686
1689
  seriesIndex: currentSeriesIndex,
@@ -1689,13 +1692,13 @@ var BasicChart = function (_a) {
1689
1692
  traces.push(trace);
1690
1693
  }
1691
1694
  else if ("values" in seriesData && "labels" in seriesData) {
1692
- _81 = assignCartesianData(categoriesFor(series), seriesData.values), x = _81.x, y = _81.y, orientation_1 = _81.orientation;
1695
+ _82 = assignCartesianData(categoriesFor(series), seriesData.values), x = _82.x, y = _82.y, orientation_1 = _82.orientation;
1693
1696
  trace = tslib_1.__assign(tslib_1.__assign({ type: seriesPlotlyType, x: x, y: y, orientation: orientation_1, name: dataLabel, stackgroup: isStacked ? "one" : undefined }, seriesTraceStyle), lineTraceVariant(series, effectiveChartType, seriesData.values));
1694
1697
  // Ties the trace back to spec.series for click selection
1695
1698
  trace.meta = {
1696
1699
  rncSeriesIndex: currentSeriesIndex,
1697
1700
  };
1698
- applyTraceColor(trace, (_64 = series.color) !== null && _64 !== void 0 ? _64 : undefined, {
1701
+ applyTraceColor(trace, (_65 = series.color) !== null && _65 !== void 0 ? _65 : undefined, {
1699
1702
  noFill: series.noFill,
1700
1703
  dataPointColors: series.dataPointColors,
1701
1704
  invertIfNegative: series.invertIfNegative,
@@ -1710,13 +1713,13 @@ var BasicChart = function (_a) {
1710
1713
  }
1711
1714
  else {
1712
1715
  numericValues = seriesData;
1713
- _82 = assignCartesianData(categoriesFor(series), numericValues), x = _82.x, y = _82.y, orientation_2 = _82.orientation;
1716
+ _83 = assignCartesianData(categoriesFor(series), numericValues), x = _83.x, y = _83.y, orientation_2 = _83.orientation;
1714
1717
  trace = tslib_1.__assign(tslib_1.__assign({ type: seriesPlotlyType, x: x, y: y, orientation: orientation_2, name: dataLabel, stackgroup: isStacked ? "one" : undefined }, seriesTraceStyle), lineTraceVariant(series, effectiveChartType, numericValues));
1715
1718
  // Ties the trace back to spec.series for click selection
1716
1719
  trace.meta = {
1717
1720
  rncSeriesIndex: currentSeriesIndex,
1718
1721
  };
1719
- applyTraceColor(trace, (_65 = series.color) !== null && _65 !== void 0 ? _65 : undefined, {
1722
+ applyTraceColor(trace, (_66 = series.color) !== null && _66 !== void 0 ? _66 : undefined, {
1720
1723
  noFill: series.noFill,
1721
1724
  dataPointColors: series.dataPointColors,
1722
1725
  invertIfNegative: series.invertIfNegative,
@@ -1733,24 +1736,24 @@ var BasicChart = function (_a) {
1733
1736
  }
1734
1737
  });
1735
1738
  };
1736
- _76.label = 18;
1739
+ _77.label = 18;
1737
1740
  case 18:
1738
- _76.trys.push([18, 23, 24, 25]);
1739
- _j = tslib_1.__values((_53 = spec.series) !== null && _53 !== void 0 ? _53 : []), _k = _j.next();
1740
- _76.label = 19;
1741
+ _77.trys.push([18, 23, 24, 25]);
1742
+ _j = tslib_1.__values((_54 = spec.series) !== null && _54 !== void 0 ? _54 : []), _k = _j.next();
1743
+ _77.label = 19;
1741
1744
  case 19:
1742
1745
  if (!!_k.done) return [3 /*break*/, 22];
1743
1746
  series = _k.value;
1744
1747
  return [5 /*yield**/, _loop_2(series)];
1745
1748
  case 20:
1746
- _76.sent();
1747
- _76.label = 21;
1749
+ _77.sent();
1750
+ _77.label = 21;
1748
1751
  case 21:
1749
1752
  _k = _j.next();
1750
1753
  return [3 /*break*/, 19];
1751
1754
  case 22: return [3 /*break*/, 25];
1752
1755
  case 23:
1753
- e_3_1 = _76.sent();
1756
+ e_3_1 = _77.sent();
1754
1757
  e_3 = { error: e_3_1 };
1755
1758
  return [3 /*break*/, 25];
1756
1759
  case 24:
@@ -1767,13 +1770,13 @@ var BasicChart = function (_a) {
1767
1770
  ? undefined
1768
1771
  : (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1769
1772
  axisOptions: spec.valueAxisOptions,
1770
- series: ((_66 = spec.series) !== null && _66 !== void 0 ? _66 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1773
+ series: ((_67 = spec.series) !== null && _67 !== void 0 ? _67 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1771
1774
  getFormattingFromRange: getFormattingFromRange,
1772
1775
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1773
1776
  });
1774
1777
  secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1775
1778
  axisOptions: spec.secondaryValueAxisOptions,
1776
- series: ((_67 = spec.series) !== null && _67 !== void 0 ? _67 : []).filter(function (s) { return s.useSecondaryAxis; }),
1779
+ series: ((_68 = spec.series) !== null && _68 !== void 0 ? _68 : []).filter(function (s) { return s.useSecondaryAxis; }),
1777
1780
  getFormattingFromRange: getFormattingFromRange,
1778
1781
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1779
1782
  });
@@ -1821,14 +1824,14 @@ var BasicChart = function (_a) {
1821
1824
  ? VALUE_AXIS_TITLE_STANDOFF
1822
1825
  : legend_layout_1.BAND_GAP;
1823
1826
  legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
1824
- position: (_68 = spec.legend) === null || _68 === void 0 ? void 0 : _68.position,
1827
+ position: (_69 = spec.legend) === null || _69 === void 0 ? void 0 : _69.position,
1825
1828
  visible: showlegend !== false,
1826
1829
  labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
1827
- legendFontSize: (_71 = (_70 = (_69 = spec.legend) === null || _69 === void 0 ? void 0 : _69.textFormat) === null || _70 === void 0 ? void 0 : _70.fontSize) !== null && _71 !== void 0 ? _71 : axisFontSize,
1830
+ legendFontSize: (_72 = (_71 = (_70 = spec.legend) === null || _70 === void 0 ? void 0 : _70.textFormat) === null || _71 === void 0 ? void 0 : _71.fontSize) !== null && _72 !== void 0 ? _72 : axisFontSize,
1828
1831
  width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
1829
1832
  height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
1830
1833
  hasTitle: Boolean(title),
1831
- titleFontSize: (_72 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _72 !== void 0 ? _72 : 16,
1834
+ titleFontSize: (_73 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _73 !== void 0 ? _73 : 16,
1832
1835
  hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
1833
1836
  hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
1834
1837
  leftAxisDepth: leftAxisDepth,
@@ -1840,7 +1843,7 @@ var BasicChart = function (_a) {
1840
1843
  family: "Untitled Sans, apple-system, sans-serif",
1841
1844
  size: 16,
1842
1845
  color: textColor,
1843
- }, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_73 = legendBand.legend) !== null && _73 !== void 0 ? _73 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
1846
+ }, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_74 = legendBand.legend) !== null && _74 !== void 0 ? _74 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
1844
1847
  spec.stackedType
1845
1848
  ? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
1846
1849
  spec.stackedType === "PERCENT_STACKED"
@@ -1853,7 +1856,7 @@ var BasicChart = function (_a) {
1853
1856
  color: textColor,
1854
1857
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
1855
1858
  title: {
1856
- text: (_74 = spec.horizontalAxisTitle) !== null && _74 !== void 0 ? _74 : "",
1859
+ text: (_75 = spec.horizontalAxisTitle) !== null && _75 !== void 0 ? _75 : "",
1857
1860
  font: { color: textColor },
1858
1861
  standoff: bottomAxisTitleStandoff,
1859
1862
  },
@@ -1871,7 +1874,7 @@ var BasicChart = function (_a) {
1871
1874
  isHorizontalBarChart
1872
1875
  ? spec.valueAxisOptions
1873
1876
  : spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
1874
- title: tslib_1.__assign({ text: (_75 = spec.verticalAxisTitle) !== null && _75 !== void 0 ? _75 : "", font: { color: textColor } }, (isHorizontalBarChart
1877
+ title: tslib_1.__assign({ text: (_76 = spec.verticalAxisTitle) !== null && _76 !== void 0 ? _76 : "", font: { color: textColor } }, (isHorizontalBarChart
1875
1878
  ? {}
1876
1879
  : { standoff: VALUE_AXIS_TITLE_STANDOFF })),
1877
1880
  showgrid: !isHorizontalBarChart,
@@ -1907,6 +1910,21 @@ var BasicChart = function (_a) {
1907
1910
  _r) : {})), (ofPieExtras
1908
1911
  ? tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ shapes: ofPieExtras.shapes }, (ofPieExtras.barmode ? { barmode: ofPieExtras.barmode } : {})), (ofPieExtras.xaxis2 ? { xaxis2: ofPieExtras.xaxis2 } : {})), (ofPieExtras.yaxis2 ? { yaxis2: ofPieExtras.yaxis2 } : {})) : {}));
1909
1912
  dlOpts = spec.dataLabels;
1913
+ doughnutSeriesOrder = spec.chartType === "doughnut"
1914
+ ? traces
1915
+ .filter(function (t) { return (t === null || t === void 0 ? void 0 : t.type) === "pie"; })
1916
+ .map(function (t) { var _a; return (_a = t === null || t === void 0 ? void 0 : t.meta) === null || _a === void 0 ? void 0 : _a.rncSeriesIndex; })
1917
+ .filter(function (i) { return typeof i === "number"; })
1918
+ .sort(function (a, b) { return a - b; })
1919
+ : [];
1920
+ doughnutRingSet = spec.chartType === "doughnut"
1921
+ ? (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(spec.doughnutHoleSize), doughnutSeriesOrder.length)
1922
+ : [];
1923
+ traceDataLabels = function (trace) {
1924
+ var _a, _b;
1925
+ var specIndex = (_a = trace === null || trace === void 0 ? void 0 : trace.meta) === null || _a === void 0 ? void 0 : _a.rncSeriesIndex;
1926
+ return (0, overrides_1.resolveSeriesDataLabels)(dlOpts, typeof specIndex === "number" ? (_b = spec.series) === null || _b === void 0 ? void 0 : _b[specIndex] : undefined);
1927
+ };
1910
1928
  doughnutHole = spec.doughnutHoleSize;
1911
1929
  seriesNumberFormats = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
1912
1930
  traceNumberFormat = function (trace) {
@@ -1920,10 +1938,15 @@ var BasicChart = function (_a) {
1920
1938
  };
1921
1939
  piePull = isOfPie ? undefined : (0, pie_explosion_1.explosionToPlotlyPull)((0, pie_explosion_1.resolveExplosion)(spec));
1922
1940
  formattedTraces = traces.map(function (trace) {
1923
- var _a;
1941
+ var _a, _b, _c, _d;
1924
1942
  var pattern = traceNumberFormat(trace);
1925
- var next = applyDataLabelsToTracePlotly(trace, dlOpts, spec.chartType, pattern, locale);
1943
+ var next = applyDataLabelsToTracePlotly(trace, traceDataLabels(trace), spec.chartType, pattern, locale);
1926
1944
  if (next.type === "pie") {
1945
+ // Plotly's pie prints every slice's percentage by default; Excel
1946
+ // draws nothing until data labels are on (#1062).
1947
+ if (!((_a = traceDataLabels(trace)) === null || _a === void 0 ? void 0 : _a.show)) {
1948
+ next = tslib_1.__assign(tslib_1.__assign({}, next), { textinfo: "none" });
1949
+ }
1927
1950
  // Hover values format like the slice's source cell.
1928
1951
  if (pattern && !next.text) {
1929
1952
  var values = Array.isArray(next.values) ? next.values : [];
@@ -1940,7 +1963,7 @@ var BasicChart = function (_a) {
1940
1963
  }
1941
1964
  else if (!next.hovertemplate &&
1942
1965
  (next.type === "bar" || next.type === "scatter") &&
1943
- typeof ((_a = next.meta) === null || _a === void 0 ? void 0 : _a.rncSeriesIndex) === "number") {
1966
+ typeof ((_b = next.meta) === null || _b === void 0 ? void 0 : _b.rncSeriesIndex) === "number") {
1944
1967
  // Hover values read like the series' own cells (Excel's data tip
1945
1968
  // shows the cell text) — the series format alone, not the axis
1946
1969
  // fallback the labels use, since that resolves to the first series
@@ -1962,9 +1985,14 @@ var BasicChart = function (_a) {
1962
1985
  // (doughnutHoleSize); clamp like the echarts renderer and default
1963
1986
  // to 0.5 when unset.
1964
1987
  if (spec.chartType === "doughnut" && next.type === "pie") {
1965
- next = tslib_1.__assign(tslib_1.__assign({}, next), { hole: typeof doughnutHole === "number"
1966
- ? Math.max(0, Math.min(0.9, doughnutHole))
1967
- : 0.5 });
1988
+ var rank = doughnutSeriesOrder.indexOf((_c = next.meta) === null || _c === void 0 ? void 0 : _c.rncSeriesIndex);
1989
+ var ring = (_d = doughnutRingSet[rank]) !== null && _d !== void 0 ? _d : (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(doughnutHole), 1)[0];
1990
+ // Plotly's `hole` is a fraction of the trace's own radius.
1991
+ next = tslib_1.__assign(tslib_1.__assign({}, next), { hole: ring.inner / ring.outer });
1992
+ if (doughnutRingSet.length > 1) {
1993
+ var half = ring.outer / 2;
1994
+ next = tslib_1.__assign(tslib_1.__assign({}, next), { domain: { x: [0.5 - half, 0.5 + half], y: [0.5 - half, 0.5 + half] } });
1995
+ }
1968
1996
  }
1969
1997
  return next;
1970
1998
  });
@@ -1 +1 @@
1
- {"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/plot.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/echarts-gl-loader.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/legend-layout.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
1
+ {"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/plot.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/doughnut.ts","../../utils/echarts-gl-loader.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/legend-layout.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}