@rowsncolumns/charts 28.1.13 → 28.1.15

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 (99) hide show
  1. package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
  2. package/dist/cjs/basic-chart/basic-chart.js +308 -270
  3. package/dist/cjs/components/editors/chart-editor-capabilities.d.ts +48 -0
  4. package/dist/cjs/components/editors/chart-editor-capabilities.d.ts.map +1 -0
  5. package/dist/cjs/components/editors/chart-editor-capabilities.js +62 -0
  6. package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
  7. package/dist/cjs/components/editors/chart-editor.js +200 -534
  8. package/dist/cjs/components/editors/fields/axis-options-fields.d.ts +16 -0
  9. package/dist/cjs/components/editors/fields/axis-options-fields.d.ts.map +1 -0
  10. package/dist/cjs/components/editors/fields/axis-options-fields.js +31 -0
  11. package/dist/cjs/components/editors/fields/chart-type-options.d.ts +25 -0
  12. package/dist/cjs/components/editors/fields/chart-type-options.d.ts.map +1 -0
  13. package/dist/cjs/components/editors/fields/chart-type-options.js +170 -0
  14. package/dist/cjs/components/editors/fields/data-labels-fields.d.ts +15 -0
  15. package/dist/cjs/components/editors/fields/data-labels-fields.d.ts.map +1 -0
  16. package/dist/cjs/components/editors/fields/data-labels-fields.js +57 -0
  17. package/dist/cjs/components/editors/fields/primitives.d.ts +54 -0
  18. package/dist/cjs/components/editors/fields/primitives.d.ts.map +1 -0
  19. package/dist/cjs/components/editors/fields/primitives.js +52 -0
  20. package/dist/cjs/components/editors/fields/series-format-fields.d.ts +17 -0
  21. package/dist/cjs/components/editors/fields/series-format-fields.d.ts.map +1 -0
  22. package/dist/cjs/components/editors/fields/series-format-fields.js +165 -0
  23. package/dist/cjs/components/editors/fields/series-name-field.d.ts +16 -0
  24. package/dist/cjs/components/editors/fields/series-name-field.d.ts.map +1 -0
  25. package/dist/cjs/components/editors/fields/series-name-field.js +36 -0
  26. package/dist/cjs/components/editors/fields/text-format-fields.d.ts +20 -0
  27. package/dist/cjs/components/editors/fields/text-format-fields.d.ts.map +1 -0
  28. package/dist/cjs/components/editors/fields/text-format-fields.js +46 -0
  29. package/dist/cjs/config.d.ts.map +1 -1
  30. package/dist/cjs/config.js +3 -0
  31. package/dist/cjs/interface/create-chart.d.ts +3 -2
  32. package/dist/cjs/interface/create-chart.d.ts.map +1 -1
  33. package/dist/cjs/interface/create-chart.js +7 -0
  34. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  35. package/dist/cjs/plotly/basic-chart/basic-chart.js +255 -218
  36. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  37. package/dist/cjs/utils/chart-orientation.d.ts.map +1 -1
  38. package/dist/cjs/utils/chart-orientation.js +24 -12
  39. package/dist/cjs/utils/chart-spec-utils.d.ts.map +1 -1
  40. package/dist/cjs/utils/chart-spec-utils.js +120 -21
  41. package/dist/cjs/utils/echarts-overlays.d.ts +2 -0
  42. package/dist/cjs/utils/echarts-overlays.d.ts.map +1 -1
  43. package/dist/cjs/utils/echarts-overlays.js +25 -12
  44. package/dist/cjs/utils/series-name.d.ts +12 -0
  45. package/dist/cjs/utils/series-name.d.ts.map +1 -0
  46. package/dist/cjs/utils/series-name.js +26 -0
  47. package/dist/cjs/utils/trendline.d.ts +9 -0
  48. package/dist/cjs/utils/trendline.d.ts.map +1 -1
  49. package/dist/cjs/utils/trendline.js +16 -1
  50. package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
  51. package/dist/esm/basic-chart/basic-chart.js +73 -37
  52. package/dist/esm/components/editors/chart-editor-capabilities.d.ts +48 -0
  53. package/dist/esm/components/editors/chart-editor-capabilities.d.ts.map +1 -0
  54. package/dist/esm/components/editors/chart-editor-capabilities.js +58 -0
  55. package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
  56. package/dist/esm/components/editors/chart-editor.js +166 -448
  57. package/dist/esm/components/editors/fields/axis-options-fields.d.ts +16 -0
  58. package/dist/esm/components/editors/fields/axis-options-fields.d.ts.map +1 -0
  59. package/dist/esm/components/editors/fields/axis-options-fields.js +22 -0
  60. package/dist/esm/components/editors/fields/chart-type-options.d.ts +25 -0
  61. package/dist/esm/components/editors/fields/chart-type-options.d.ts.map +1 -0
  62. package/dist/esm/components/editors/fields/chart-type-options.js +151 -0
  63. package/dist/esm/components/editors/fields/data-labels-fields.d.ts +15 -0
  64. package/dist/esm/components/editors/fields/data-labels-fields.d.ts.map +1 -0
  65. package/dist/esm/components/editors/fields/data-labels-fields.js +47 -0
  66. package/dist/esm/components/editors/fields/primitives.d.ts +54 -0
  67. package/dist/esm/components/editors/fields/primitives.d.ts.map +1 -0
  68. package/dist/esm/components/editors/fields/primitives.js +26 -0
  69. package/dist/esm/components/editors/fields/series-format-fields.d.ts +17 -0
  70. package/dist/esm/components/editors/fields/series-format-fields.d.ts.map +1 -0
  71. package/dist/esm/components/editors/fields/series-format-fields.js +143 -0
  72. package/dist/esm/components/editors/fields/series-name-field.d.ts +16 -0
  73. package/dist/esm/components/editors/fields/series-name-field.d.ts.map +1 -0
  74. package/dist/esm/components/editors/fields/series-name-field.js +31 -0
  75. package/dist/esm/components/editors/fields/text-format-fields.d.ts +20 -0
  76. package/dist/esm/components/editors/fields/text-format-fields.d.ts.map +1 -0
  77. package/dist/esm/components/editors/fields/text-format-fields.js +34 -0
  78. package/dist/esm/config.d.ts.map +1 -1
  79. package/dist/esm/config.js +3 -0
  80. package/dist/esm/interface/create-chart.d.ts +3 -2
  81. package/dist/esm/interface/create-chart.d.ts.map +1 -1
  82. package/dist/esm/interface/create-chart.js +8 -1
  83. package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  84. package/dist/esm/plotly/basic-chart/basic-chart.js +52 -30
  85. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  86. package/dist/esm/utils/chart-orientation.d.ts.map +1 -1
  87. package/dist/esm/utils/chart-orientation.js +20 -0
  88. package/dist/esm/utils/chart-spec-utils.d.ts.map +1 -1
  89. package/dist/esm/utils/chart-spec-utils.js +95 -8
  90. package/dist/esm/utils/echarts-overlays.d.ts +2 -0
  91. package/dist/esm/utils/echarts-overlays.d.ts.map +1 -1
  92. package/dist/esm/utils/echarts-overlays.js +15 -1
  93. package/dist/esm/utils/series-name.d.ts +12 -0
  94. package/dist/esm/utils/series-name.d.ts.map +1 -0
  95. package/dist/esm/utils/series-name.js +24 -0
  96. package/dist/esm/utils/trendline.d.ts +9 -0
  97. package/dist/esm/utils/trendline.d.ts.map +1 -1
  98. package/dist/esm/utils/trendline.js +14 -0
  99. package/package.json +3 -3
@@ -11,28 +11,29 @@ var react_1 = tslib_1.__importStar(require("react"));
11
11
  var aggregation_1 = require("../../utils/aggregation");
12
12
  var axis_number_format_1 = require("../../utils/axis-number-format");
13
13
  var bubble_1 = require("../../utils/bubble");
14
- var chart_orientation_1 = require("../../utils/chart-orientation");
14
+ var category_levels_1 = require("../../utils/category-levels");
15
15
  var chart_image_1 = require("../../utils/chart-image");
16
- var chart_styles_1 = require("../../utils/chart-styles");
16
+ var chart_orientation_1 = require("../../utils/chart-orientation");
17
17
  var chart_spec_utils_1 = require("../../utils/chart-spec-utils");
18
+ var chart_styles_1 = require("../../utils/chart-styles");
19
+ var doughnut_1 = require("../../utils/doughnut");
18
20
  var empty_cells_1 = require("../../utils/empty-cells");
19
21
  var error_bars_1 = require("../../utils/error-bars");
20
- var category_levels_1 = require("../../utils/category-levels");
21
22
  var gradient_1 = require("../../utils/gradient");
23
+ var hierarchy_1 = require("../../utils/hierarchy");
24
+ var histogram_1 = require("../../utils/histogram");
22
25
  var legend_layout_1 = require("../../utils/legend-layout");
23
- var doughnut_1 = require("../../utils/doughnut");
26
+ var of_pie_1 = require("../../utils/of-pie");
24
27
  var overrides_1 = require("../../utils/overrides");
25
- var plotly_title_1 = require("../../utils/plotly-title");
26
28
  var pie_explosion_1 = require("../../utils/pie-explosion");
27
29
  var plotly_click_1 = require("../../utils/plotly-click");
28
30
  var plotly_surface_1 = require("../../utils/plotly-surface");
29
- var three_d_1 = require("../../utils/three-d");
30
- var hierarchy_1 = require("../../utils/hierarchy");
31
- var histogram_1 = require("../../utils/histogram");
32
- var of_pie_1 = require("../../utils/of-pie");
31
+ var plotly_title_1 = require("../../utils/plotly-title");
33
32
  var radar_1 = require("../../utils/radar");
34
33
  var region_map_1 = require("../../utils/region-map");
34
+ var series_name_1 = require("../../utils/series-name");
35
35
  var stock_1 = require("../../utils/stock");
36
+ var three_d_1 = require("../../utils/three-d");
36
37
  var trendline_1 = require("../../utils/trendline");
37
38
  var plot_1 = require("../plot");
38
39
  var helpers_1 = require("./helpers");
@@ -506,11 +507,11 @@ var BasicChart = function (_a) {
506
507
  * Triggers a chart update
507
508
  */
508
509
  var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
509
- 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, hasBubbleSecondaryAxis, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLegendOverrides, bubbleBand, bubbleLayout, hierarchyRows, headerTitle, hierarchyData_1, seriesName, hierarchyPalette, nodeColors, isSunburst, SUNBURST_ROOT_ID_1, rootTotal, 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, radarLegendOverrides, radarBand, 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;
510
- var e_2, _m, e_4, _o, e_3, _p, _q, _r;
511
- 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, _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;
512
- return tslib_1.__generator(this, function (_105) {
513
- switch (_105.label) {
510
+ var traces, chartType, position, isBubble, isHierarchy, textColor, bgColor, gridColor, skipHeaders_1, labels, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, linkedLabel, resolvedLabel, _a, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _b, categories_1, preparedSeries, sizeValues, sizeScale_1, hasStringX_1, hasBubbleSecondaryAxis, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLegendOverrides, bubbleBand, bubbleLayout, hierarchyRows, headerTitle, hierarchyData_1, seriesName, hierarchyPalette, nodeColors, isSunburst, SUNBURST_ROOT_ID_1, rootTotal, hierarchyTrace, layoutForHierarchy, labels, seriesEntry, rawValues_1, locations_1, z_1, ramp_1, colorscale, geoScope, regionTrace, surfaceToken, categories, surfaceSeriesInputs, _c, _d, seriesEntry, dataLabel, _e, _f, _g, values, e_2_1, seriesNames, surfaceTrace, surfaceLayout, categories, radarStyle, radarTraces, radarInputs, _h, _j, seriesEntry, label, values, radarAxisOptions, indicators, _loop_1, i, radarScale, radarLegendOverrides, radarBand, 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, _k, _l, series, e_3_1, authoredTitleFmt, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, _m, legendOverrides, showlegend, axisFontSize, primaryValues, leftAxisLabelDepth, leftAxisDepth, rightAxisDepth, bottomAxisTitleStandoff, legendBand, newLayout, dlOpts, doughnutSeriesOrder, doughnutRingSet, traceDataLabels, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
511
+ var e_2, _o, e_4, _p, e_3, _q, _r, _s;
512
+ var _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, _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;
513
+ return tslib_1.__generator(this, function (_109) {
514
+ switch (_109.label) {
514
515
  case 0:
515
516
  (0, utils_1.debug)("Updating chart", chart);
516
517
  traces = [];
@@ -522,41 +523,42 @@ var BasicChart = function (_a) {
522
523
  theme: 1,
523
524
  tint: isDarkMode ? 1 : 0,
524
525
  }, theme);
525
- bgColor = (_s = spec.backgroundColor) !== null && _s !== void 0 ? _s : (0, spreadsheet_1.getStringifiedColor)({ theme: 0, tint: isDarkMode ? -1 : 1 }, theme);
526
+ bgColor = (_t = spec.backgroundColor) !== null && _t !== void 0 ? _t : (0, spreadsheet_1.getStringifiedColor)({ theme: 0, tint: isDarkMode ? -1 : 1 }, theme);
526
527
  gridColor = isDarkMode ? "rgba(255,255,255,0.3)" : "#CCCCCC";
527
528
  if (!isBubble) return [3 /*break*/, 6];
528
529
  skipHeaders_1 = spec.useFirstRowAsHeaders !== false;
529
530
  labels = flattenChartDataValues(spec.bubbleLabels, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1).map(bubble_1.toLabelString);
530
- perSeriesX = ((_t = spec.domains) !== null && _t !== void 0 ? _t : []).map(function (dom) {
531
+ perSeriesX = ((_u = spec.domains) !== null && _u !== void 0 ? _u : []).map(function (dom) {
531
532
  return flattenChartDataValues([dom], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
532
533
  });
533
- perSeriesSize = ((_u = spec.bubbleSizes) !== null && _u !== void 0 ? _u : []).map(function (sz) {
534
+ perSeriesSize = ((_v = spec.bubbleSizes) !== null && _v !== void 0 ? _v : []).map(function (sz) {
534
535
  return flattenChartDataValues([sz], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
535
536
  });
536
537
  seriesInputs = [];
537
538
  i = 0;
538
- _105.label = 1;
539
+ _109.label = 1;
539
540
  case 1:
540
541
  if (!(i < spec.series.length)) return [3 /*break*/, 5];
541
542
  seriesEntry = spec.series[i];
542
- resolvedLabel = (_v = seriesEntry.dataLabel) !== null && _v !== void 0 ? _v : "";
543
- if (!(resolvedLabel && (0, utils_1.isAFormula)(resolvedLabel))) return [3 /*break*/, 3];
543
+ linkedLabel = (0, series_name_1.linkedSeriesName)(seriesEntry, getDomainValuesFromRange);
544
+ resolvedLabel = (_w = linkedLabel !== null && linkedLabel !== void 0 ? linkedLabel : seriesEntry.dataLabel) !== null && _w !== void 0 ? _w : "";
545
+ if (!(linkedLabel === undefined && resolvedLabel && (0, utils_1.isAFormula)(resolvedLabel))) return [3 /*break*/, 3];
544
546
  _a = chart_spec_utils_1.coerceCalculatedLabel;
545
- 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)];
547
+ return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_x = chart.position.sheetId) !== null && _x !== void 0 ? _x : sheetId, chart.position.overlayPosition.anchorCell.rowIndex, chart.position.overlayPosition.anchorCell.columnIndex)];
546
548
  case 2:
547
- resolvedLabel = _a.apply(void 0, [_105.sent()]);
548
- _105.label = 3;
549
+ resolvedLabel = _a.apply(void 0, [_109.sent()]);
550
+ _109.label = 3;
549
551
  case 3:
550
- xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
551
- sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
552
+ xValues = (_y = perSeriesX[i]) !== null && _y !== void 0 ? _y : perSeriesX[0];
553
+ sizeValues_1 = (_z = perSeriesSize[i]) !== null && _z !== void 0 ? _z : perSeriesSize[0];
552
554
  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 } : {})));
553
- _105.label = 4;
555
+ _109.label = 4;
554
556
  case 4:
555
557
  i++;
556
558
  return [3 /*break*/, 1];
557
559
  case 5:
558
- sharedXValues = (_z = perSeriesX[0]) !== null && _z !== void 0 ? _z : [];
559
- sharedSizeValues = (_0 = perSeriesSize[0]) !== null && _0 !== void 0 ? _0 : [];
560
+ sharedXValues = (_0 = perSeriesX[0]) !== null && _0 !== void 0 ? _0 : [];
561
+ sharedSizeValues = (_1 = perSeriesSize[0]) !== null && _1 !== void 0 ? _1 : [];
560
562
  _b = (0, bubble_1.prepareBubbleSeriesData)({
561
563
  xValues: sharedXValues,
562
564
  labelValues: labels,
@@ -569,7 +571,7 @@ var BasicChart = function (_a) {
569
571
  plotMinSide: Math.min((width !== null && width !== void 0 ? width : 0) - 80, (height !== null && height !== void 0 ? height : 0) - 100),
570
572
  });
571
573
  hasStringX_1 = categories_1.length > 0;
572
- hasBubbleSecondaryAxis = ((_1 = spec.series) !== null && _1 !== void 0 ? _1 : []).some(function (seriesEntry) { return seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis; });
574
+ hasBubbleSecondaryAxis = ((_2 = spec.series) !== null && _2 !== void 0 ? _2 : []).some(function (seriesEntry) { return seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis; });
573
575
  palette_1 = (0, chart_styles_1.getChartPalette)(spec, [
574
576
  theme.themeColors.accent1,
575
577
  theme.themeColors.accent2,
@@ -579,7 +581,7 @@ var BasicChart = function (_a) {
579
581
  theme.themeColors.accent6,
580
582
  ]);
581
583
  isScatter_1 = spec.chartType === "scatter";
582
- scatterStyle_1 = (_2 = spec.scatterStyle) !== null && _2 !== void 0 ? _2 : (isScatter_1 ? "lineMarker" : undefined);
584
+ scatterStyle_1 = (_3 = spec.scatterStyle) !== null && _3 !== void 0 ? _3 : (isScatter_1 ? "lineMarker" : undefined);
583
585
  plotlyModeForScatterStyle_1 = function (style) {
584
586
  switch (style) {
585
587
  case "line":
@@ -603,7 +605,7 @@ var BasicChart = function (_a) {
603
605
  traces_1 = [];
604
606
  preparedSeries.forEach(function (entry, index) {
605
607
  var e_5, _a, e_6, _b;
606
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
608
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
607
609
  var xValues = entry.points.map(function (point) {
608
610
  var _a, _b;
609
611
  return hasStringX_1
@@ -619,8 +621,8 @@ var BasicChart = function (_a) {
619
621
  // (`BubbleSeriesPoint.index` — points without a Y are skipped).
620
622
  var pointColorOverrides = new Map();
621
623
  try {
622
- for (var _r = tslib_1.__values((_e = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.dataPointColors) !== null && _e !== void 0 ? _e : []), _s = _r.next(); !_s.done; _s = _r.next()) {
623
- var dp = _s.value;
624
+ for (var _s = tslib_1.__values((_e = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.dataPointColors) !== null && _e !== void 0 ? _e : []), _t = _s.next(); !_t.done; _t = _s.next()) {
625
+ var dp = _t.value;
624
626
  if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
625
627
  pointColorOverrides.set(dp.idx, dp.color);
626
628
  }
@@ -629,7 +631,7 @@ var BasicChart = function (_a) {
629
631
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
630
632
  finally {
631
633
  try {
632
- if (_s && !_s.done && (_a = _r.return)) _a.call(_r);
634
+ if (_t && !_t.done && (_a = _s.return)) _a.call(_s);
633
635
  }
634
636
  finally { if (e_5) throw e_5.error; }
635
637
  }
@@ -700,36 +702,49 @@ var BasicChart = function (_a) {
700
702
  // Trendlines on the real (x, y) points — a regression of Y on X,
701
703
  // not on the point index — and native error bars (#1067).
702
704
  var numericX = entry.points.map(function (point) { return point.value[0]; });
705
+ var _loop_3 = function (tl) {
706
+ var result = (0, trendline_1.computeTrendline)(yValues, {
707
+ type: tl.type,
708
+ order: tl.order,
709
+ period: tl.period,
710
+ forecastForward: tl.forecastForward,
711
+ forecastBackward: tl.forecastBackward,
712
+ }, numericX);
713
+ if (!result || result.points.length < 2)
714
+ return "continue";
715
+ var tlName = (_k = tl.name) !== null && _k !== void 0 ? _k : "".concat(entry.name ? entry.name + " " : "").concat((_l = tl.type) !== null && _l !== void 0 ? _l : "linear", " trend");
716
+ var label = (0, trendline_1.trendlineLabel)(tl, result);
717
+ traces_1.push(tslib_1.__assign(tslib_1.__assign({ type: "scatter", mode: label ? "lines+text" : "lines", name: tlName, x: result.points.map(function (p) {
718
+ var _a;
719
+ return hasStringX_1
720
+ ? (_a = categories_1[Math.round(p.x)]) !== null && _a !== void 0 ? _a : p.x
721
+ : p.x;
722
+ }), y: result.points.map(function (p) { return p.y; }), line: { color: (_m = tl.color) !== null && _m !== void 0 ? _m : seriesColor, dash: "dash", width: 2 }, hoverinfo: "skip" }, (label
723
+ ? {
724
+ // Excel prints the equation / R² at the line's end.
725
+ text: result.points.map(function (_, i) {
726
+ return i === result.points.length - 1 ? label.replace("\n", "<br>") : "";
727
+ }),
728
+ textposition: "top left",
729
+ textfont: { color: (_o = tl.color) !== null && _o !== void 0 ? _o : seriesColor, size: 11 },
730
+ }
731
+ : {})), onSecondary));
732
+ };
703
733
  try {
704
- for (var _t = tslib_1.__values((_j = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.trendlines) !== null && _j !== void 0 ? _j : []), _u = _t.next(); !_u.done; _u = _t.next()) {
705
- var tl = _u.value;
706
- var result = (0, trendline_1.computeTrendline)(yValues, {
707
- type: tl.type,
708
- order: tl.order,
709
- period: tl.period,
710
- forecastForward: tl.forecastForward,
711
- forecastBackward: tl.forecastBackward,
712
- }, numericX);
713
- if (!result || result.points.length < 2)
714
- continue;
715
- var tlName = (_k = tl.name) !== null && _k !== void 0 ? _k : "".concat(entry.name ? entry.name + " " : "").concat((_l = tl.type) !== null && _l !== void 0 ? _l : "linear", " trend");
716
- traces_1.push(tslib_1.__assign({ type: "scatter", mode: "lines", name: tlName, x: result.points.map(function (p) {
717
- var _a;
718
- return hasStringX_1
719
- ? (_a = categories_1[Math.round(p.x)]) !== null && _a !== void 0 ? _a : p.x
720
- : p.x;
721
- }), y: result.points.map(function (p) { return p.y; }), line: { color: (_m = tl.color) !== null && _m !== void 0 ? _m : seriesColor, dash: "dash", width: 2 }, hoverinfo: "skip" }, onSecondary));
734
+ for (var _u = tslib_1.__values((_j = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.trendlines) !== null && _j !== void 0 ? _j : []), _v = _u.next(); !_v.done; _v = _u.next()) {
735
+ var tl = _v.value;
736
+ _loop_3(tl);
722
737
  }
723
738
  }
724
739
  catch (e_6_1) { e_6 = { error: e_6_1 }; }
725
740
  finally {
726
741
  try {
727
- if (_u && !_u.done && (_b = _t.return)) _b.call(_t);
742
+ if (_v && !_v.done && (_b = _u.return)) _b.call(_u);
728
743
  }
729
744
  finally { if (e_6) throw e_6.error; }
730
745
  }
731
746
  if (seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.errorBars) {
732
- var direction = (_o = seriesSpec.errorBars.direction) !== null && _o !== void 0 ? _o : "y";
747
+ var direction = (_p = seriesSpec.errorBars.direction) !== null && _p !== void 0 ? _p : "y";
733
748
  // An X error bar sizes from the X values (a percentage or
734
749
  // deviation of X).
735
750
  var magnitudes_1 = (0, error_bars_1.computeErrorBars)(direction === "x" ? numericX : yValues, (0, error_bars_1.resolveCustomErrorBarValues)(seriesSpec.errorBars, function (range) {
@@ -738,7 +753,7 @@ var BasicChart = function (_a) {
738
753
  if (magnitudes_1) {
739
754
  var symmetric = magnitudes_1.plus.every(function (plus, i) { return plus === magnitudes_1.minus[i]; });
740
755
  var errorConfig = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "data", symmetric: symmetric, array: magnitudes_1.plus }, (symmetric ? {} : { arrayminus: magnitudes_1.minus })), { color: seriesColor }), (seriesSpec.errorBars.noEndCap ? { width: 0 } : {}));
741
- var target = traces_1[traces_1.length - 1 - ((_q = (_p = seriesSpec.trendlines) === null || _p === void 0 ? void 0 : _p.length) !== null && _q !== void 0 ? _q : 0)];
756
+ var target = traces_1[traces_1.length - 1 - ((_r = (_q = seriesSpec.trendlines) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : 0)];
742
757
  if (target) {
743
758
  target[direction === "x" ? "error_x" : "error_y"] = errorConfig;
744
759
  }
@@ -746,22 +761,22 @@ var BasicChart = function (_a) {
746
761
  }
747
762
  });
748
763
  titleFmt = spec.titleTextFormat;
749
- xAxisFmt = (_3 = spec.categoryAxisOptions) === null || _3 === void 0 ? void 0 : _3.textFormat;
750
- yAxisFmt = (_4 = spec.valueAxisOptions) === null || _4 === void 0 ? void 0 : _4.textFormat;
751
- legendFmt = (_5 = spec.legend) === null || _5 === void 0 ? void 0 : _5.textFormat;
764
+ xAxisFmt = (_4 = spec.categoryAxisOptions) === null || _4 === void 0 ? void 0 : _4.textFormat;
765
+ yAxisFmt = (_5 = spec.valueAxisOptions) === null || _5 === void 0 ? void 0 : _5.textFormat;
766
+ legendFmt = (_6 = spec.legend) === null || _6 === void 0 ? void 0 : _6.textFormat;
752
767
  bubbleLegendOverrides = applyLegendOverridesPlotly({
753
- font: tslib_1.__assign(tslib_1.__assign({ color: (_6 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.color) !== null && _6 !== void 0 ? _6 : textColor }, ((legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontFamily) ? { family: legendFmt.fontFamily } : {})), ((legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontSize) ? { size: legendFmt.fontSize } : {})),
768
+ font: tslib_1.__assign(tslib_1.__assign({ color: (_7 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.color) !== null && _7 !== void 0 ? _7 : textColor }, ((legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontFamily) ? { family: legendFmt.fontFamily } : {})), ((legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontSize) ? { size: legendFmt.fontSize } : {})),
754
769
  }, spec.legend);
755
770
  bubbleBand = (0, legend_layout_1.reservePlotlyLegendBand)({
756
- position: (_7 = spec.legend) === null || _7 === void 0 ? void 0 : _7.position,
757
- visible: ((_8 = bubbleLegendOverrides.showlegend) !== null && _8 !== void 0 ? _8 : preparedSeries.length > 1) !==
771
+ position: (_8 = spec.legend) === null || _8 === void 0 ? void 0 : _8.position,
772
+ visible: ((_9 = bubbleLegendOverrides.showlegend) !== null && _9 !== void 0 ? _9 : preparedSeries.length > 1) !==
758
773
  false,
759
774
  labels: preparedSeries.map(function (entry) { return entry.name; }),
760
- legendFontSize: (_9 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontSize) !== null && _9 !== void 0 ? _9 : 12,
775
+ legendFontSize: (_10 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontSize) !== null && _10 !== void 0 ? _10 : 12,
761
776
  width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
762
777
  height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
763
778
  hasTitle: Boolean(title),
764
- titleFontSize: (_10 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _10 !== void 0 ? _10 : 16,
779
+ titleFontSize: (_11 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _11 !== void 0 ? _11 : 16,
765
780
  hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
766
781
  hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
767
782
  leftAxisDepth: 60,
@@ -771,9 +786,9 @@ var BasicChart = function (_a) {
771
786
  bubbleLayout = tslib_1.__assign(tslib_1.__assign({ title: {
772
787
  text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
773
788
  font: {
774
- family: (_11 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontFamily) !== null && _11 !== void 0 ? _11 : "Untitled Sans, apple-system, sans-serif",
775
- size: (_12 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _12 !== void 0 ? _12 : 16,
776
- color: (_13 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.color) !== null && _13 !== void 0 ? _13 : textColor,
789
+ family: (_12 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontFamily) !== null && _12 !== void 0 ? _12 : "Untitled Sans, apple-system, sans-serif",
790
+ size: (_13 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _13 !== void 0 ? _13 : 16,
791
+ color: (_14 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.color) !== null && _14 !== void 0 ? _14 : textColor,
777
792
  },
778
793
  x: 0.02,
779
794
  xanchor: "left",
@@ -783,19 +798,19 @@ var BasicChart = function (_a) {
783
798
  // renderer).
784
799
  xaxis: applyAxisOverridesPlotly({
785
800
  title: {
786
- text: (_14 = spec.horizontalAxisTitle) !== null && _14 !== void 0 ? _14 : "",
787
- font: { color: (_15 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _15 !== void 0 ? _15 : textColor },
801
+ text: (_15 = spec.horizontalAxisTitle) !== null && _15 !== void 0 ? _15 : "",
802
+ font: { color: (_16 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _16 !== void 0 ? _16 : textColor },
788
803
  },
789
804
  gridcolor: gridColor,
790
- tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_16 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _16 !== void 0 ? _16 : textColor }, ((xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.fontFamily) ? { family: xAxisFmt.fontFamily } : {})), ((xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.fontSize) ? { size: xAxisFmt.fontSize } : {})),
805
+ tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_17 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _17 !== void 0 ? _17 : textColor }, ((xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.fontFamily) ? { family: xAxisFmt.fontFamily } : {})), ((xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.fontSize) ? { size: xAxisFmt.fontSize } : {})),
791
806
  type: hasStringX_1 ? "category" : "linear",
792
807
  }, spec.categoryAxisOptions), yaxis: applyAxisOverridesPlotly({
793
808
  title: {
794
- text: (_17 = spec.verticalAxisTitle) !== null && _17 !== void 0 ? _17 : "",
795
- font: { color: (_18 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _18 !== void 0 ? _18 : textColor },
809
+ text: (_18 = spec.verticalAxisTitle) !== null && _18 !== void 0 ? _18 : "",
810
+ font: { color: (_19 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _19 !== void 0 ? _19 : textColor },
796
811
  },
797
812
  gridcolor: gridColor,
798
- tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_19 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _19 !== void 0 ? _19 : textColor }, ((yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.fontFamily) ? { family: yAxisFmt.fontFamily } : {})), ((yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.fontSize) ? { size: yAxisFmt.fontSize } : {})),
813
+ tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_20 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _20 !== void 0 ? _20 : textColor }, ((yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.fontFamily) ? { family: yAxisFmt.fontFamily } : {})), ((yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.fontSize) ? { size: yAxisFmt.fontSize } : {})),
799
814
  }, spec.valueAxisOptions) }, (hasBubbleSecondaryAxis
800
815
  ? {
801
816
  yaxis2: applyAxisOverridesPlotly({
@@ -803,10 +818,10 @@ var BasicChart = function (_a) {
803
818
  side: "right",
804
819
  showgrid: false,
805
820
  automargin: true,
806
- tickfont: { color: (_20 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _20 !== void 0 ? _20 : textColor },
821
+ tickfont: { color: (_21 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _21 !== void 0 ? _21 : textColor },
807
822
  }, spec.secondaryValueAxisOptions),
808
823
  }
809
- : {})), { legend: tslib_1.__assign(tslib_1.__assign({}, bubbleLegendOverrides.legend), ((_21 = bubbleBand.legend) !== null && _21 !== void 0 ? _21 : {})), paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: (_22 = bubbleLegendOverrides.showlegend) !== null && _22 !== void 0 ? _22 : preparedSeries.length > 1,
824
+ : {})), { legend: tslib_1.__assign(tslib_1.__assign({}, bubbleLegendOverrides.legend), ((_22 = bubbleBand.legend) !== null && _22 !== void 0 ? _22 : {})), paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: (_23 = bubbleLegendOverrides.showlegend) !== null && _23 !== void 0 ? _23 : preparedSeries.length > 1,
810
825
  // The plot shrinks to leave the legend its own band (#1089).
811
826
  margin: bubbleBand.margin });
812
827
  setPlotData(traces_1);
@@ -827,8 +842,8 @@ var BasicChart = function (_a) {
827
842
  hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
828
843
  hierarchyData_1 = (0, hierarchy_1.toPlotlyHierarchy)(hierarchyRows);
829
844
  seriesName = hierarchyData_1.labels.length === 1
830
- ? (_23 = hierarchyData_1.labels[0]) !== null && _23 !== void 0 ? _23 : ""
831
- : (_24 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _24 !== void 0 ? _24 : "";
845
+ ? (_24 = hierarchyData_1.labels[0]) !== null && _24 !== void 0 ? _24 : ""
846
+ : (_25 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _25 !== void 0 ? _25 : "";
832
847
  hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
833
848
  theme.themeColors.accent1,
834
849
  theme.themeColors.accent2,
@@ -844,7 +859,7 @@ var BasicChart = function (_a) {
844
859
  hierarchyTrace = tslib_1.__assign({ type: chartType, labels: isSunburst ? tslib_1.__spreadArray([""], tslib_1.__read(hierarchyData_1.labels), false) : hierarchyData_1.labels, ids: isSunburst ? tslib_1.__spreadArray([SUNBURST_ROOT_ID_1], tslib_1.__read(hierarchyData_1.ids), false) : hierarchyData_1.ids, parents: isSunburst
845
860
  ? tslib_1.__spreadArray([""], tslib_1.__read(hierarchyData_1.parents.map(function (parent) { return parent || SUNBURST_ROOT_ID_1; })), false) : hierarchyData_1.parents, values: isSunburst ? tslib_1.__spreadArray([rootTotal], tslib_1.__read(hierarchyData_1.values), false) : hierarchyData_1.values, marker: tslib_1.__assign({ colors: isSunburst ? tslib_1.__spreadArray(["rgba(0,0,0,0)"], tslib_1.__read(nodeColors), false) : nodeColors }, (isSunburst ? { line: { width: 1 } } : {})), name: seriesName,
846
861
  // `dataLabels: { show: false }` turns the labels off (#1086).
847
- textinfo: ((_25 = spec.dataLabels) === null || _25 === void 0 ? void 0 : _25.show) === false ? "none" : "label+value", branchvalues: "total" }, (isSunburst || ((_26 = spec.dataLabels) === null || _26 === void 0 ? void 0 : _26.show) === false
862
+ textinfo: ((_26 = spec.dataLabels) === null || _26 === void 0 ? void 0 : _26.show) === false ? "none" : "label+value", branchvalues: "total" }, (isSunburst || ((_27 = spec.dataLabels) === null || _27 === void 0 ? void 0 : _27.show) === false
848
863
  ? {}
849
864
  : {
850
865
  textposition: "bottom left",
@@ -902,7 +917,7 @@ var BasicChart = function (_a) {
902
917
  // country-name matching and silently skips labels it can't place.
903
918
  if ((0, region_map_1.isRegionMapSpec)(spec)) {
904
919
  labels = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : "").trim(); });
905
- seriesEntry = (_27 = spec.series) === null || _27 === void 0 ? void 0 : _27[0];
920
+ seriesEntry = (_28 = spec.series) === null || _28 === void 0 ? void 0 : _28[0];
906
921
  rawValues_1 = seriesEntry
907
922
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
908
923
  : [];
@@ -964,46 +979,53 @@ var BasicChart = function (_a) {
964
979
  return [2 /*return*/];
965
980
  }
966
981
  surfaceToken = (0, three_d_1.normalize3DSourceType)(spec.sourceChartType);
967
- if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
982
+ if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 19];
968
983
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
969
984
  surfaceSeriesInputs = [];
970
- _105.label = 7;
985
+ _109.label = 7;
971
986
  case 7:
972
- _105.trys.push([7, 14, 15, 16]);
973
- _c = tslib_1.__values((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []), _d = _c.next();
974
- _105.label = 8;
987
+ _109.trys.push([7, 16, 17, 18]);
988
+ _c = tslib_1.__values((_29 = spec.series) !== null && _29 !== void 0 ? _29 : []), _d = _c.next();
989
+ _109.label = 8;
975
990
  case 8:
976
- if (!!_d.done) return [3 /*break*/, 13];
991
+ if (!!_d.done) return [3 /*break*/, 15];
977
992
  seriesEntry = _d.value;
978
- if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 10];
979
- _f = chart_spec_utils_1.coerceCalculatedLabel;
980
- return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_29 = position.sheetId) !== null && _29 !== void 0 ? _29 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
993
+ if (!((_30 = (0, series_name_1.linkedSeriesName)(seriesEntry, getDomainValuesFromRange)) !== null && _30 !== void 0)) return [3 /*break*/, 9];
994
+ _e = _30;
995
+ return [3 /*break*/, 13];
981
996
  case 9:
982
- _e = _f.apply(void 0, [_105.sent()]);
983
- return [3 /*break*/, 11];
997
+ if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 11];
998
+ _g = chart_spec_utils_1.coerceCalculatedLabel;
999
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_31 = position.sheetId) !== null && _31 !== void 0 ? _31 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
984
1000
  case 10:
985
- _e = (_30 = seriesEntry.dataLabel) !== null && _30 !== void 0 ? _30 : "";
986
- _105.label = 11;
1001
+ _f = _g.apply(void 0, [_109.sent()]);
1002
+ return [3 /*break*/, 12];
987
1003
  case 11:
1004
+ _f = (_32 = seriesEntry.dataLabel) !== null && _32 !== void 0 ? _32 : "";
1005
+ _109.label = 12;
1006
+ case 12:
1007
+ _e = (_f);
1008
+ _109.label = 13;
1009
+ case 13:
988
1010
  dataLabel = _e;
989
1011
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
990
1012
  surfaceSeriesInputs.push({ name: dataLabel, values: values });
991
- _105.label = 12;
992
- case 12:
1013
+ _109.label = 14;
1014
+ case 14:
993
1015
  _d = _c.next();
994
1016
  return [3 /*break*/, 8];
995
- case 13: return [3 /*break*/, 16];
996
- case 14:
997
- e_2_1 = _105.sent();
1017
+ case 15: return [3 /*break*/, 18];
1018
+ case 16:
1019
+ e_2_1 = _109.sent();
998
1020
  e_2 = { error: e_2_1 };
999
- return [3 /*break*/, 16];
1000
- case 15:
1021
+ return [3 /*break*/, 18];
1022
+ case 17:
1001
1023
  try {
1002
- if (_d && !_d.done && (_m = _c.return)) _m.call(_c);
1024
+ if (_d && !_d.done && (_o = _c.return)) _o.call(_c);
1003
1025
  }
1004
1026
  finally { if (e_2) throw e_2.error; }
1005
1027
  return [7 /*endfinally*/];
1006
- case 16:
1028
+ case 18:
1007
1029
  seriesNames = surfaceSeriesInputs.map(function (entry, index) { return entry.name || "Series ".concat(index + 1); });
1008
1030
  surfaceTrace = (0, plotly_surface_1.buildPlotlySurfaceTrace)(surfaceToken, surfaceSeriesInputs, categories, seriesNames, (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy));
1009
1031
  surfaceLayout = tslib_1.__assign({ title: {
@@ -1022,41 +1044,41 @@ var BasicChart = function (_a) {
1022
1044
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, margin: { l: 60, r: 20, t: 50, b: 50 } }, (surfaceToken === "SURFACE"
1023
1045
  ? {
1024
1046
  xaxis: {
1025
- title: { text: (_31 = spec.horizontalAxisTitle) !== null && _31 !== void 0 ? _31 : "" },
1047
+ title: { text: (_33 = spec.horizontalAxisTitle) !== null && _33 !== void 0 ? _33 : "" },
1026
1048
  automargin: true,
1027
1049
  color: textColor,
1028
1050
  },
1029
1051
  yaxis: {
1030
- title: { text: (_32 = spec.verticalAxisTitle) !== null && _32 !== void 0 ? _32 : "" },
1052
+ title: { text: (_34 = spec.verticalAxisTitle) !== null && _34 !== void 0 ? _34 : "" },
1031
1053
  automargin: true,
1032
1054
  color: textColor,
1033
1055
  },
1034
1056
  }
1035
1057
  : {
1036
1058
  scene: {
1037
- xaxis: { title: { text: (_33 = spec.horizontalAxisTitle) !== null && _33 !== void 0 ? _33 : "" } },
1059
+ xaxis: { title: { text: (_35 = spec.horizontalAxisTitle) !== null && _35 !== void 0 ? _35 : "" } },
1038
1060
  yaxis: { title: { text: "" } },
1039
- zaxis: { title: { text: (_34 = spec.verticalAxisTitle) !== null && _34 !== void 0 ? _34 : "" } },
1061
+ zaxis: { title: { text: (_36 = spec.verticalAxisTitle) !== null && _36 !== void 0 ? _36 : "" } },
1040
1062
  },
1041
1063
  }));
1042
1064
  setPlotData([surfaceTrace]);
1043
1065
  setLayout(surfaceLayout);
1044
1066
  return [2 /*return*/];
1045
- case 17:
1067
+ case 19:
1046
1068
  // ---------------------------- Radar ----------------------------
1047
1069
  // Plotly renders radar via `scatterpolar` traces: r = the values,
1048
1070
  // theta = the category names (closed by appending the first point).
1049
1071
  if (spec.chartType === "radar") {
1050
1072
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1051
- radarStyle = (_35 = spec.radarStyle) !== null && _35 !== void 0 ? _35 : "standard";
1073
+ radarStyle = (_37 = spec.radarStyle) !== null && _37 !== void 0 ? _37 : "standard";
1052
1074
  radarTraces = [];
1053
1075
  radarInputs = [];
1054
1076
  try {
1055
- for (_g = tslib_1.__values((_36 = spec.series) !== null && _36 !== void 0 ? _36 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
1056
- seriesEntry = _h.value;
1057
- label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
1077
+ for (_h = tslib_1.__values((_38 = spec.series) !== null && _38 !== void 0 ? _38 : []), _j = _h.next(); !_j.done; _j = _h.next()) {
1078
+ seriesEntry = _j.value;
1079
+ label = (_39 = (0, series_name_1.linkedSeriesName)(seriesEntry, getDomainValuesFromRange)) !== null && _39 !== void 0 ? _39 : (seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
1058
1080
  ? seriesEntry.dataLabel
1059
- : "";
1081
+ : "");
1060
1082
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
1061
1083
  radarInputs.push({ name: label, values: values });
1062
1084
  }
@@ -1064,7 +1086,7 @@ var BasicChart = function (_a) {
1064
1086
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
1065
1087
  finally {
1066
1088
  try {
1067
- if (_h && !_h.done && (_o = _g.return)) _o.call(_g);
1089
+ if (_j && !_j.done && (_p = _h.return)) _p.call(_h);
1068
1090
  }
1069
1091
  finally { if (e_4) throw e_4.error; }
1070
1092
  }
@@ -1072,7 +1094,7 @@ var BasicChart = function (_a) {
1072
1094
  indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
1073
1095
  _loop_1 = function (i) {
1074
1096
  var input = radarInputs[i];
1075
- var seriesColor = (_39 = (_38 = (_37 = spec.series) === null || _37 === void 0 ? void 0 : _37[i]) === null || _38 === void 0 ? void 0 : _38.color) !== null && _39 !== void 0 ? _39 : undefined;
1097
+ var seriesColor = (_42 = (_41 = (_40 = spec.series) === null || _40 === void 0 ? void 0 : _40[i]) === null || _41 === void 0 ? void 0 : _41.color) !== null && _42 !== void 0 ? _42 : undefined;
1076
1098
  var r = indicators.map(function (_, idx) { var _a; return (_a = input.values[idx]) !== null && _a !== void 0 ? _a : 0; });
1077
1099
  var theta = indicators.map(function (ind) { return ind.name; });
1078
1100
  radarTraces.push(tslib_1.__assign(tslib_1.__assign({ type: "scatterpolar", r: r.length ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(r), false), [r[0]], false) : r, theta: theta.length ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(theta), false), [theta[0]], false) : theta, name: input.name, mode: radarStyle === "standard" ? "lines" : "lines+markers" }, (radarStyle === "filled" ? { fill: "toself" } : {})), (seriesColor ? { line: { color: seriesColor } } : {})));
@@ -1080,17 +1102,17 @@ var BasicChart = function (_a) {
1080
1102
  for (i = 0; i < radarInputs.length; i++) {
1081
1103
  _loop_1(i);
1082
1104
  }
1083
- radarScale = (_40 = indicators[0]) !== null && _40 !== void 0 ? _40 : { min: 0, max: 1 };
1105
+ radarScale = (_43 = indicators[0]) !== null && _43 !== void 0 ? _43 : { min: 0, max: 1 };
1084
1106
  radarLegendOverrides = applyLegendOverridesPlotly({ font: { color: textColor } }, spec.legend);
1085
1107
  radarBand = (0, legend_layout_1.reservePlotlyLegendBand)({
1086
- position: (_41 = spec.legend) === null || _41 === void 0 ? void 0 : _41.position,
1087
- visible: ((_42 = radarLegendOverrides.showlegend) !== null && _42 !== void 0 ? _42 : radarTraces.length > 1) !== false,
1108
+ position: (_44 = spec.legend) === null || _44 === void 0 ? void 0 : _44.position,
1109
+ visible: ((_45 = radarLegendOverrides.showlegend) !== null && _45 !== void 0 ? _45 : radarTraces.length > 1) !== false,
1088
1110
  labels: radarInputs.map(function (input) { return input.name; }),
1089
- legendFontSize: (_45 = (_44 = (_43 = spec.legend) === null || _43 === void 0 ? void 0 : _43.textFormat) === null || _44 === void 0 ? void 0 : _44.fontSize) !== null && _45 !== void 0 ? _45 : 12,
1111
+ legendFontSize: (_48 = (_47 = (_46 = spec.legend) === null || _46 === void 0 ? void 0 : _46.textFormat) === null || _47 === void 0 ? void 0 : _47.fontSize) !== null && _48 !== void 0 ? _48 : 12,
1090
1112
  width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
1091
1113
  height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
1092
1114
  hasTitle: Boolean(title),
1093
- titleFontSize: (_47 = (_46 = spec.titleTextFormat) === null || _46 === void 0 ? void 0 : _46.fontSize) !== null && _47 !== void 0 ? _47 : 16,
1115
+ titleFontSize: (_50 = (_49 = spec.titleTextFormat) === null || _49 === void 0 ? void 0 : _49.fontSize) !== null && _50 !== void 0 ? _50 : 16,
1094
1116
  hasBottomAxisTitle: false,
1095
1117
  hasLeftAxisTitle: false,
1096
1118
  leftAxisDepth: 50,
@@ -1103,8 +1125,8 @@ var BasicChart = function (_a) {
1103
1125
  font: { color: textColor },
1104
1126
  paper_bgcolor: bgColor,
1105
1127
  plot_bgcolor: bgColor,
1106
- showlegend: (_48 = radarLegendOverrides.showlegend) !== null && _48 !== void 0 ? _48 : radarTraces.length > 1,
1107
- legend: tslib_1.__assign(tslib_1.__assign({}, radarLegendOverrides.legend), ((_49 = radarBand.legend) !== null && _49 !== void 0 ? _49 : {})),
1128
+ showlegend: (_51 = radarLegendOverrides.showlegend) !== null && _51 !== void 0 ? _51 : radarTraces.length > 1,
1129
+ legend: tslib_1.__assign(tslib_1.__assign({}, radarLegendOverrides.legend), ((_52 = radarBand.legend) !== null && _52 !== void 0 ? _52 : {})),
1108
1130
  polar: {
1109
1131
  radialaxis: {
1110
1132
  visible: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
@@ -1126,13 +1148,13 @@ var BasicChart = function (_a) {
1126
1148
  // V-variants additionally get a volume column sub-pane below the
1127
1149
  // price plot.
1128
1150
  if (spec.chartType === "stock") {
1129
- variant = ((_50 = spec.stockVariant) !== null && _50 !== void 0 ? _50 : "HLC");
1151
+ variant = ((_53 = spec.stockVariant) !== null && _53 !== void 0 ? _53 : "HLC");
1130
1152
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1131
- seriesValues = ((_51 = spec.series) !== null && _51 !== void 0 ? _51 : []).map(function (seriesEntry) {
1153
+ seriesValues = ((_54 = spec.series) !== null && _54 !== void 0 ? _54 : []).map(function (seriesEntry) {
1132
1154
  return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
1133
1155
  });
1134
1156
  volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
1135
- hasVolume = ((_52 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _52 !== void 0 ? _52 : 0) > 0;
1157
+ hasVolume = ((_55 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _55 !== void 0 ? _55 : 0) > 0;
1136
1158
  buildVolumeTrace = function (xs) {
1137
1159
  return ({
1138
1160
  type: "bar",
@@ -1165,25 +1187,25 @@ var BasicChart = function (_a) {
1165
1187
  roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
1166
1188
  xs_1 = categories.length > 0
1167
1189
  ? categories
1168
- : ((_53 = roles.close) !== null && _53 !== void 0 ? _53 : []).map(function (_, i) { return i + 1; });
1190
+ : ((_56 = roles.close) !== null && _56 !== void 0 ? _56 : []).map(function (_, i) { return i + 1; });
1169
1191
  candleTrace = {
1170
1192
  type: "candlestick",
1171
1193
  x: xs_1,
1172
- open: ((_54 = roles.open) !== null && _54 !== void 0 ? _54 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1173
- high: ((_55 = roles.high) !== null && _55 !== void 0 ? _55 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1174
- low: ((_56 = roles.low) !== null && _56 !== void 0 ? _56 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1175
- close: ((_57 = roles.close) !== null && _57 !== void 0 ? _57 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1194
+ open: ((_57 = roles.open) !== null && _57 !== void 0 ? _57 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1195
+ high: ((_58 = roles.high) !== null && _58 !== void 0 ? _58 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1196
+ low: ((_59 = roles.low) !== null && _59 !== void 0 ? _59 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1197
+ close: ((_60 = roles.close) !== null && _60 !== void 0 ? _60 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1176
1198
  increasing: { line: { color: theme.themeColors.accent1 } },
1177
1199
  decreasing: { line: { color: theme.themeColors.accent2 } },
1178
1200
  };
1179
1201
  setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
1180
1202
  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: {
1181
- title: { text: (_58 = spec.horizontalAxisTitle) !== null && _58 !== void 0 ? _58 : "" },
1203
+ title: { text: (_61 = spec.horizontalAxisTitle) !== null && _61 !== void 0 ? _61 : "" },
1182
1204
  automargin: true,
1183
1205
  showgrid: true,
1184
1206
  gridcolor: gridColor,
1185
1207
  rangeslider: { visible: false },
1186
- }, yaxis: tslib_1.__assign({ title: { text: (_59 = spec.verticalAxisTitle) !== null && _59 !== void 0 ? _59 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1208
+ }, yaxis: tslib_1.__assign({ title: { text: (_62 = spec.verticalAxisTitle) !== null && _62 !== void 0 ? _62 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1187
1209
  return [2 /*return*/];
1188
1210
  }
1189
1211
  lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
@@ -1195,7 +1217,7 @@ var BasicChart = function (_a) {
1195
1217
  ]);
1196
1218
  xs_2 = categories.length > 0
1197
1219
  ? categories
1198
- : ((_61 = (_60 = lineSeries[0]) === null || _60 === void 0 ? void 0 : _60.values) !== null && _61 !== void 0 ? _61 : []).map(function (_, i) { return i + 1; });
1220
+ : ((_64 = (_63 = lineSeries[0]) === null || _63 === void 0 ? void 0 : _63.values) !== null && _64 !== void 0 ? _64 : []).map(function (_, i) { return i + 1; });
1199
1221
  stockTraces = lineSeries.map(function (s, i) { return ({
1200
1222
  type: "scatter",
1201
1223
  mode: "lines",
@@ -1206,11 +1228,11 @@ var BasicChart = function (_a) {
1206
1228
  }); });
1207
1229
  setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
1208
1230
  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: {
1209
- title: { text: (_62 = spec.horizontalAxisTitle) !== null && _62 !== void 0 ? _62 : "" },
1231
+ title: { text: (_65 = spec.horizontalAxisTitle) !== null && _65 !== void 0 ? _65 : "" },
1210
1232
  automargin: true,
1211
1233
  showgrid: true,
1212
1234
  gridcolor: gridColor,
1213
- }, yaxis: tslib_1.__assign({ title: { text: (_63 = spec.verticalAxisTitle) !== null && _63 !== void 0 ? _63 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1235
+ }, yaxis: tslib_1.__assign({ title: { text: (_66 = spec.verticalAxisTitle) !== null && _66 !== void 0 ? _66 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1214
1236
  return [2 /*return*/];
1215
1237
  }
1216
1238
  isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
@@ -1257,12 +1279,12 @@ var BasicChart = function (_a) {
1257
1279
  return extra;
1258
1280
  };
1259
1281
  shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
1260
- 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];
1282
+ primaryDomainSource = (_69 = (_68 = (_67 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _67 === void 0 ? void 0 : _67[0]) === null || _68 === void 0 ? void 0 : _68.sources) === null || _69 === void 0 ? void 0 : _69[0];
1261
1283
  rawPrimaryDomainValues = primaryDomainSource
1262
- ? (0, aggregation_1.sanitizeDomainValues)((_67 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _67 !== void 0 ? _67 : [])
1284
+ ? (0, aggregation_1.sanitizeDomainValues)((_70 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _70 !== void 0 ? _70 : [])
1263
1285
  : [];
1264
1286
  domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
1265
- categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_68 = spec.categoryLevels) === null || _68 === void 0 ? void 0 : _68.map(function (level) {
1287
+ categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_71 = spec.categoryLevels) === null || _71 === void 0 ? void 0 : _71.map(function (level) {
1266
1288
  return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
1267
1289
  }));
1268
1290
  multicategoryX = categoryLevels
@@ -1272,7 +1294,7 @@ var BasicChart = function (_a) {
1272
1294
  domainData = categoryLevels.leaf;
1273
1295
  }
1274
1296
  aggregateDomainValues = domainData;
1275
- domainAxisData = (categoryLevels ? [] : (_69 = spec.domains) !== null && _69 !== void 0 ? _69 : []).map(function (domain, domainIndex) {
1297
+ domainAxisData = (categoryLevels ? [] : (_72 = spec.domains) !== null && _72 !== void 0 ? _72 : []).map(function (domain, domainIndex) {
1276
1298
  return domain.sources.flatMap(function (sheetRange, sourceIndex) {
1277
1299
  var _a;
1278
1300
  if (domainIndex === 0 && sourceIndex === 0) {
@@ -1443,7 +1465,7 @@ var BasicChart = function (_a) {
1443
1465
  ofPieExtras = null;
1444
1466
  decorateCartesianTrace = function (trace, series, values, dataLabel) {
1445
1467
  var e_8, _a;
1446
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
1468
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
1447
1469
  var target = trace;
1448
1470
  // Secondary value axis. Plotly overlays a second value axis ("y2",
1449
1471
  // or "x2" for a horizontal bar) and the trace points at it.
@@ -1478,8 +1500,8 @@ var BasicChart = function (_a) {
1478
1500
  // Trendlines — one overlay scatter trace per spec, reusing the
1479
1501
  // shared regression util.
1480
1502
  var seriesColor = (_g = series.color) !== null && _g !== void 0 ? _g : theme.themeColors.accent1;
1481
- var _loop_3 = function (tl) {
1482
- var _p, _q;
1503
+ var _loop_4 = function (tl) {
1504
+ var _q, _r;
1483
1505
  var result = (0, trendline_1.computeTrendline)(values, {
1484
1506
  type: tl.type,
1485
1507
  order: tl.order,
@@ -1497,13 +1519,23 @@ var BasicChart = function (_a) {
1497
1519
  return p.x >= 0 && p.x < categories.length ? categories[p.x] : p.x;
1498
1520
  });
1499
1521
  var ys = result.points.map(function (p) { return p.y; });
1500
- var overlay = tslib_1.__assign(tslib_1.__assign({ type: "scatter", mode: "lines", name: tlName, line: {
1522
+ var label = (0, trendline_1.trendlineLabel)(tl, result);
1523
+ var overlay = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "scatter", mode: label ? "lines+text" : "lines", name: tlName, line: {
1501
1524
  color: (_l = tl.color) !== null && _l !== void 0 ? _l : seriesColor,
1502
1525
  dash: "dash",
1503
1526
  width: 2,
1504
- }, hoverinfo: "skip" }, (series.useSecondaryAxis
1505
- ? (_p = {}, _p[valueAxisKey] = secondaryValueAxisRef, _p) : {})), (series.useSecondaryAxis && secondaryDomainData
1506
- ? (_q = {}, _q[categoryAxisKey] = secondaryCategoryAxisRef, _q) : {}));
1527
+ }, hoverinfo: "skip" }, (label
1528
+ ? {
1529
+ // Excel prints the equation / R² at the line's end.
1530
+ text: result.points.map(function (_, i) {
1531
+ return i === result.points.length - 1 ? label.replace("\n", "<br>") : "";
1532
+ }),
1533
+ textposition: "top left",
1534
+ textfont: { color: (_m = tl.color) !== null && _m !== void 0 ? _m : seriesColor, size: 11 },
1535
+ }
1536
+ : {})), (series.useSecondaryAxis
1537
+ ? (_q = {}, _q[valueAxisKey] = secondaryValueAxisRef, _q) : {})), (series.useSecondaryAxis && secondaryDomainData
1538
+ ? (_r = {}, _r[categoryAxisKey] = secondaryCategoryAxisRef, _r) : {}));
1507
1539
  if (isHorizontalBarChart) {
1508
1540
  overlay.x = ys;
1509
1541
  overlay.y = xs;
@@ -1516,42 +1548,49 @@ var BasicChart = function (_a) {
1516
1548
  traces.push(overlay);
1517
1549
  };
1518
1550
  try {
1519
- for (var _m = tslib_1.__values((_h = series.trendlines) !== null && _h !== void 0 ? _h : []), _o = _m.next(); !_o.done; _o = _m.next()) {
1520
- var tl = _o.value;
1521
- _loop_3(tl);
1551
+ for (var _o = tslib_1.__values((_h = series.trendlines) !== null && _h !== void 0 ? _h : []), _p = _o.next(); !_p.done; _p = _o.next()) {
1552
+ var tl = _p.value;
1553
+ _loop_4(tl);
1522
1554
  }
1523
1555
  }
1524
1556
  catch (e_8_1) { e_8 = { error: e_8_1 }; }
1525
1557
  finally {
1526
1558
  try {
1527
- if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
1559
+ if (_p && !_p.done && (_a = _o.return)) _a.call(_o);
1528
1560
  }
1529
1561
  finally { if (e_8) throw e_8.error; }
1530
1562
  }
1531
1563
  };
1532
- domainSources = (_72 = (_71 = (_70 = spec.domains) === null || _70 === void 0 ? void 0 : _70[0]) === null || _71 === void 0 ? void 0 : _71.sources) !== null && _72 !== void 0 ? _72 : [];
1564
+ 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 : [];
1533
1565
  seriesIndex = 0;
1534
1566
  _loop_2 = function (series) {
1535
- var currentSeriesIndex, dataLabel, _106, _107, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, binningOptions, categories, prebinned, _108, labels, counts, cumulativePercents, barTrace, paretoLineColor, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, showInnerPoints, showMeanLine, boxDomainSource, boxCategories_1, grouped, values, trace, rawValues, totalIndices_1, increaseColor, trace, rawValues, trace, pieData, _109, 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, _110, x, y, orientation_1, trace, numericValues, _111, x, y, orientation_2, trace;
1536
- return tslib_1.__generator(this, function (_112) {
1537
- switch (_112.label) {
1567
+ var currentSeriesIndex, dataLabel, _110, _111, _112, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, binningOptions, categories, prebinned, _113, labels, counts, cumulativePercents, barTrace, paretoLineColor, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, showInnerPoints, showMeanLine, boxDomainSource, boxCategories_1, grouped_1, values, trace, rawValues, totalIndices_1, increaseColor, trace, rawValues, trace, pieData, _114, 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, _115, x, y, orientation_1, trace, numericValues, _116, x, y, orientation_2, trace;
1568
+ return tslib_1.__generator(this, function (_117) {
1569
+ switch (_117.label) {
1538
1570
  case 0:
1539
1571
  currentSeriesIndex = seriesIndex++;
1540
- if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1541
- _107 = chart_spec_utils_1.coerceCalculatedLabel;
1542
- return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_74 = position.sheetId) !== null && _74 !== void 0 ? _74 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1572
+ if (!((_77 = (0, series_name_1.linkedSeriesName)(series, getDomainValuesFromRange)) !== null && _77 !== void 0)) return [3 /*break*/, 1];
1573
+ _110 = _77;
1574
+ return [3 /*break*/, 5];
1543
1575
  case 1:
1544
- _106 = _107.apply(void 0, [_112.sent()]);
1545
- return [3 /*break*/, 3];
1576
+ if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 3];
1577
+ _112 = chart_spec_utils_1.coerceCalculatedLabel;
1578
+ return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_78 = position.sheetId) !== null && _78 !== void 0 ? _78 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1546
1579
  case 2:
1547
- _106 = (_75 = series.dataLabel) !== null && _75 !== void 0 ? _75 : "";
1548
- _112.label = 3;
1580
+ _111 = _112.apply(void 0, [_117.sent()]);
1581
+ return [3 /*break*/, 4];
1549
1582
  case 3:
1550
- dataLabel = _106;
1583
+ _111 = (_79 = series.dataLabel) !== null && _79 !== void 0 ? _79 : "";
1584
+ _117.label = 4;
1585
+ case 4:
1586
+ _110 = (_111);
1587
+ _117.label = 5;
1588
+ case 5:
1589
+ dataLabel = _110;
1551
1590
  // A series with no ranges draws nothing.
1552
1591
  if (series.sources.length === 0)
1553
1592
  return [2 /*return*/, "continue"];
1554
- effectiveChartType = (_76 = series.seriesChartType) !== null && _76 !== void 0 ? _76 : spec.chartType;
1593
+ effectiveChartType = (_80 = series.seriesChartType) !== null && _80 !== void 0 ? _80 : spec.chartType;
1555
1594
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1556
1595
  pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
1557
1596
  (domainSources.length > 1 || series.sources.length > 1)
@@ -1594,19 +1633,19 @@ var BasicChart = function (_a) {
1594
1633
  };
1595
1634
  categories = domainData;
1596
1635
  prebinned = categories.length
1597
- ? (0, histogram_1.aggregateByCategory)(categories, rawValues, (_77 = series.aggregateType) !== null && _77 !== void 0 ? _77 : "SUM")
1636
+ ? (0, histogram_1.aggregateByCategory)(categories, rawValues, (_81 = series.aggregateType) !== null && _81 !== void 0 ? _81 : "SUM")
1598
1637
  : (0, histogram_1.hasExcelBinning)(binningOptions)
1599
1638
  ? (0, histogram_1.binHistogram)(rawValues, binCount, binningOptions)
1600
1639
  : null;
1601
1640
  if (isPareto) {
1602
- _108 = (0, histogram_1.computePareto)(prebinned !== null && prebinned !== void 0 ? prebinned : (0, histogram_1.binHistogram)(rawValues, binCount)), labels = _108.labels, counts = _108.counts, cumulativePercents = _108.cumulativePercents;
1641
+ _113 = (0, histogram_1.computePareto)(prebinned !== null && prebinned !== void 0 ? prebinned : (0, histogram_1.binHistogram)(rawValues, binCount)), labels = _113.labels, counts = _113.counts, cumulativePercents = _113.cumulativePercents;
1603
1642
  barTrace = {
1604
1643
  type: "bar",
1605
1644
  x: labels,
1606
1645
  y: counts,
1607
1646
  name: dataLabel,
1608
1647
  };
1609
- applyTraceColor(barTrace, (_78 = series.color) !== null && _78 !== void 0 ? _78 : undefined, {
1648
+ applyTraceColor(barTrace, (_82 = series.color) !== null && _82 !== void 0 ? _82 : undefined, {
1610
1649
  noFill: series.noFill,
1611
1650
  dataPointColors: series.dataPointColors,
1612
1651
  seriesIndex: currentSeriesIndex,
@@ -1625,7 +1664,7 @@ var BasicChart = function (_a) {
1625
1664
  y: prebinned.counts,
1626
1665
  name: dataLabel,
1627
1666
  };
1628
- applyTraceColor(barTrace, (_79 = series.color) !== null && _79 !== void 0 ? _79 : undefined, {
1667
+ applyTraceColor(barTrace, (_83 = series.color) !== null && _83 !== void 0 ? _83 : undefined, {
1629
1668
  noFill: series.noFill,
1630
1669
  dataPointColors: series.dataPointColors,
1631
1670
  seriesIndex: currentSeriesIndex,
@@ -1637,7 +1676,7 @@ var BasicChart = function (_a) {
1637
1676
  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
1638
1677
  ? { nbinsx: binCount }
1639
1678
  : {}));
1640
- applyTraceColor(trace, (_80 = series.color) !== null && _80 !== void 0 ? _80 : undefined, {
1679
+ applyTraceColor(trace, (_84 = series.color) !== null && _84 !== void 0 ? _84 : undefined, {
1641
1680
  noFill: series.noFill,
1642
1681
  dataPointColors: series.dataPointColors,
1643
1682
  seriesIndex: currentSeriesIndex,
@@ -1653,16 +1692,14 @@ var BasicChart = function (_a) {
1653
1692
  showMeanMarker = spec.showMeanMarker === true;
1654
1693
  showInnerPoints = spec.showInnerPoints === true;
1655
1694
  showMeanLine = spec.showMeanLine === true;
1656
- boxDomainSource = (_83 = (_82 = (_81 = spec.domains) === null || _81 === void 0 ? void 0 : _81[0]) === null || _82 === void 0 ? void 0 : _82.sources) === null || _83 === void 0 ? void 0 : _83[0];
1695
+ boxDomainSource = (_87 = (_86 = (_85 = spec.domains) === null || _85 === void 0 ? void 0 : _85[0]) === null || _86 === void 0 ? void 0 : _86.sources) === null || _87 === void 0 ? void 0 : _87[0];
1657
1696
  boxCategories_1 = boxDomainSource
1658
- ? ((_84 = getDomainValuesFromRange(boxDomainSource, spec.hiddenDimensionStrategy)) !== null && _84 !== void 0 ? _84 : []).map(function (v) { return (v === null || v === undefined ? "" : "".concat(v).trim()); })
1697
+ ? ((_88 = getDomainValuesFromRange(boxDomainSource, spec.hiddenDimensionStrategy)) !== null && _88 !== void 0 ? _88 : []).map(function (v) { return (v === null || v === undefined ? "" : "".concat(v).trim()); })
1659
1698
  : [];
1660
- grouped = boxCategories_1.some(function (c) { return c !== ""; });
1699
+ grouped_1 = boxCategories_1.some(function (c) { return c !== ""; });
1661
1700
  values = rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); });
1662
- trace = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "box", name: dataLabel, y: values }, (grouped
1663
- ? { x: values.map(function (_, i) { var _a; return (_a = boxCategories_1[i]) !== null && _a !== void 0 ? _a : ""; }) }
1664
- : {})), (quartileMethod ? { quartilemethod: quartileMethod } : {})), { boxpoints: showInnerPoints ? "all" : showOutliers ? "outliers" : false }), (showInnerPoints ? { jitter: 0, pointpos: 0 } : {})), (showMeanMarker || showMeanLine ? { boxmean: true } : {}));
1665
- applyTraceColor(trace, (_85 = series.color) !== null && _85 !== void 0 ? _85 : undefined, {
1701
+ trace = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "box", name: dataLabel, y: values, x: values.map(function (_, i) { var _a; return (grouped_1 ? (_a = boxCategories_1[i]) !== null && _a !== void 0 ? _a : "" : "1"); }) }, (quartileMethod ? { quartilemethod: quartileMethod } : {})), { boxpoints: showInnerPoints ? "all" : showOutliers ? "outliers" : false }), (showInnerPoints ? { jitter: 0, pointpos: 0 } : {})), (showMeanMarker || showMeanLine ? { boxmean: true } : {}));
1702
+ applyTraceColor(trace, (_89 = series.color) !== null && _89 !== void 0 ? _89 : undefined, {
1666
1703
  noFill: series.noFill,
1667
1704
  dataPointColors: series.dataPointColors,
1668
1705
  seriesIndex: currentSeriesIndex,
@@ -1672,8 +1709,8 @@ var BasicChart = function (_a) {
1672
1709
  }
1673
1710
  else if (effectiveChartType === "waterfall") {
1674
1711
  rawValues = seriesValuesOf(seriesData);
1675
- totalIndices_1 = new Set((_86 = spec.totalIndices) !== null && _86 !== void 0 ? _86 : []);
1676
- increaseColor = (_87 = series.color) !== null && _87 !== void 0 ? _87 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
1712
+ totalIndices_1 = new Set((_90 = spec.totalIndices) !== null && _90 !== void 0 ? _90 : []);
1713
+ increaseColor = (_91 = series.color) !== null && _91 !== void 0 ? _91 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
1677
1714
  trace = {
1678
1715
  type: "waterfall",
1679
1716
  x: categoriesFor(series),
@@ -1685,10 +1722,10 @@ var BasicChart = function (_a) {
1685
1722
  increasing: { marker: { color: increaseColor } },
1686
1723
  decreasing: {
1687
1724
  marker: {
1688
- color: (_89 = (_88 = series.negativeColor) !== null && _88 !== void 0 ? _88 : theme.themeColors.accent2) !== null && _89 !== void 0 ? _89 : increaseColor,
1725
+ color: (_93 = (_92 = series.negativeColor) !== null && _92 !== void 0 ? _92 : theme.themeColors.accent2) !== null && _93 !== void 0 ? _93 : increaseColor,
1689
1726
  },
1690
1727
  },
1691
- totals: { marker: { color: (_90 = theme.themeColors.accent3) !== null && _90 !== void 0 ? _90 : increaseColor } },
1728
+ totals: { marker: { color: (_94 = theme.themeColors.accent3) !== null && _94 !== void 0 ? _94 : increaseColor } },
1692
1729
  connector: {
1693
1730
  line: {
1694
1731
  color: isDarkMode ? "rgba(255,255,255,0.45)" : "#999999",
@@ -1708,7 +1745,7 @@ var BasicChart = function (_a) {
1708
1745
  name: dataLabel,
1709
1746
  textinfo: "none",
1710
1747
  };
1711
- applyTraceColor(trace, (_91 = series.color) !== null && _91 !== void 0 ? _91 : undefined, {
1748
+ applyTraceColor(trace, (_95 = series.color) !== null && _95 !== void 0 ? _95 : undefined, {
1712
1749
  noFill: series.noFill,
1713
1750
  dataPointColors: series.dataPointColors,
1714
1751
  seriesIndex: currentSeriesIndex,
@@ -1726,10 +1763,10 @@ var BasicChart = function (_a) {
1726
1763
  return [2 /*return*/, "continue"];
1727
1764
  ofPieHandled = true;
1728
1765
  pieData = seriesData;
1729
- _109 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1766
+ _114 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1730
1767
  splitType: spec.splitType,
1731
1768
  splitPos: spec.splitPos,
1732
- }), main_1 = _109.main, secondary = _109.secondary, otherTotal = _109.otherTotal, total = _109.total;
1769
+ }), main_1 = _114.main, secondary = _114.secondary, otherTotal = _114.otherTotal, total = _114.total;
1733
1770
  ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
1734
1771
  secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
1735
1772
  halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
@@ -1862,7 +1899,7 @@ var BasicChart = function (_a) {
1862
1899
  trace.meta = {
1863
1900
  rncSeriesIndex: currentSeriesIndex,
1864
1901
  };
1865
- applyTraceColor(trace, (_92 = series.color) !== null && _92 !== void 0 ? _92 : undefined, {
1902
+ applyTraceColor(trace, (_96 = series.color) !== null && _96 !== void 0 ? _96 : undefined, {
1866
1903
  noFill: series.noFill,
1867
1904
  dataPointColors: series.dataPointColors,
1868
1905
  seriesIndex: currentSeriesIndex,
@@ -1871,13 +1908,13 @@ var BasicChart = function (_a) {
1871
1908
  traces.push(trace);
1872
1909
  }
1873
1910
  else if ("values" in seriesData && "labels" in seriesData) {
1874
- _110 = assignCartesianData(categoriesFor(series), seriesData.values), x = _110.x, y = _110.y, orientation_1 = _110.orientation;
1911
+ _115 = assignCartesianData(categoriesFor(series), seriesData.values), x = _115.x, y = _115.y, orientation_1 = _115.orientation;
1875
1912
  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));
1876
1913
  // Ties the trace back to spec.series for click selection
1877
1914
  trace.meta = {
1878
1915
  rncSeriesIndex: currentSeriesIndex,
1879
1916
  };
1880
- applyTraceColor(trace, (_93 = series.color) !== null && _93 !== void 0 ? _93 : undefined, {
1917
+ applyTraceColor(trace, (_97 = series.color) !== null && _97 !== void 0 ? _97 : undefined, {
1881
1918
  noFill: series.noFill,
1882
1919
  dataPointColors: series.dataPointColors,
1883
1920
  invertIfNegative: series.invertIfNegative,
@@ -1892,13 +1929,13 @@ var BasicChart = function (_a) {
1892
1929
  }
1893
1930
  else {
1894
1931
  numericValues = seriesData;
1895
- _111 = assignCartesianData(categoriesFor(series), numericValues), x = _111.x, y = _111.y, orientation_2 = _111.orientation;
1932
+ _116 = assignCartesianData(categoriesFor(series), numericValues), x = _116.x, y = _116.y, orientation_2 = _116.orientation;
1896
1933
  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));
1897
1934
  // Ties the trace back to spec.series for click selection
1898
1935
  trace.meta = {
1899
1936
  rncSeriesIndex: currentSeriesIndex,
1900
1937
  };
1901
- applyTraceColor(trace, (_94 = series.color) !== null && _94 !== void 0 ? _94 : undefined, {
1938
+ applyTraceColor(trace, (_98 = series.color) !== null && _98 !== void 0 ? _98 : undefined, {
1902
1939
  noFill: series.noFill,
1903
1940
  dataPointColors: series.dataPointColors,
1904
1941
  invertIfNegative: series.invertIfNegative,
@@ -1915,33 +1952,33 @@ var BasicChart = function (_a) {
1915
1952
  }
1916
1953
  });
1917
1954
  };
1918
- _105.label = 18;
1919
- case 18:
1920
- _105.trys.push([18, 23, 24, 25]);
1921
- _j = tslib_1.__values((_73 = spec.series) !== null && _73 !== void 0 ? _73 : []), _k = _j.next();
1922
- _105.label = 19;
1923
- case 19:
1924
- if (!!_k.done) return [3 /*break*/, 22];
1925
- series = _k.value;
1926
- return [5 /*yield**/, _loop_2(series)];
1955
+ _109.label = 20;
1927
1956
  case 20:
1928
- _105.sent();
1929
- _105.label = 21;
1957
+ _109.trys.push([20, 25, 26, 27]);
1958
+ _k = tslib_1.__values((_76 = spec.series) !== null && _76 !== void 0 ? _76 : []), _l = _k.next();
1959
+ _109.label = 21;
1930
1960
  case 21:
1931
- _k = _j.next();
1932
- return [3 /*break*/, 19];
1933
- case 22: return [3 /*break*/, 25];
1961
+ if (!!_l.done) return [3 /*break*/, 24];
1962
+ series = _l.value;
1963
+ return [5 /*yield**/, _loop_2(series)];
1964
+ case 22:
1965
+ _109.sent();
1966
+ _109.label = 23;
1934
1967
  case 23:
1935
- e_3_1 = _105.sent();
1968
+ _l = _k.next();
1969
+ return [3 /*break*/, 21];
1970
+ case 24: return [3 /*break*/, 27];
1971
+ case 25:
1972
+ e_3_1 = _109.sent();
1936
1973
  e_3 = { error: e_3_1 };
1937
- return [3 /*break*/, 25];
1938
- case 24:
1974
+ return [3 /*break*/, 27];
1975
+ case 26:
1939
1976
  try {
1940
- if (_k && !_k.done && (_p = _j.return)) _p.call(_j);
1977
+ if (_l && !_l.done && (_q = _k.return)) _q.call(_k);
1941
1978
  }
1942
1979
  finally { if (e_3) throw e_3.error; }
1943
1980
  return [7 /*endfinally*/];
1944
- case 25:
1981
+ case 27:
1945
1982
  authoredTitleFmt = spec.titleTextFormat;
1946
1983
  isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
1947
1984
  (spec.chartType === "bar" || spec.chartType === "column");
@@ -1949,17 +1986,17 @@ var BasicChart = function (_a) {
1949
1986
  ? undefined
1950
1987
  : (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1951
1988
  axisOptions: spec.valueAxisOptions,
1952
- series: ((_95 = spec.series) !== null && _95 !== void 0 ? _95 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1989
+ series: ((_99 = spec.series) !== null && _99 !== void 0 ? _99 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1953
1990
  getFormattingFromRange: getFormattingFromRange,
1954
1991
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1955
1992
  });
1956
1993
  secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1957
1994
  axisOptions: spec.secondaryValueAxisOptions,
1958
- series: ((_96 = spec.series) !== null && _96 !== void 0 ? _96 : []).filter(function (s) { return s.useSecondaryAxis; }),
1995
+ series: ((_100 = spec.series) !== null && _100 !== void 0 ? _100 : []).filter(function (s) { return s.useSecondaryAxis; }),
1959
1996
  getFormattingFromRange: getFormattingFromRange,
1960
1997
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1961
1998
  });
1962
- _l = applyLegendOverridesPlotly({ font: { color: textColor } }, spec.legend), legendOverrides = _l.legend, showlegend = _l.showlegend;
1999
+ _m = applyLegendOverridesPlotly({ font: { color: textColor } }, spec.legend), legendOverrides = _m.legend, showlegend = _m.showlegend;
1963
2000
  axisFontSize = 12;
1964
2001
  primaryValues = traces.flatMap(function (trace) {
1965
2002
  var values = isHorizontalBarChart ? trace === null || trace === void 0 ? void 0 : trace.x : trace === null || trace === void 0 ? void 0 : trace.y;
@@ -2003,14 +2040,14 @@ var BasicChart = function (_a) {
2003
2040
  ? VALUE_AXIS_TITLE_STANDOFF
2004
2041
  : legend_layout_1.BAND_GAP;
2005
2042
  legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
2006
- position: (_97 = spec.legend) === null || _97 === void 0 ? void 0 : _97.position,
2043
+ position: (_101 = spec.legend) === null || _101 === void 0 ? void 0 : _101.position,
2007
2044
  visible: showlegend !== false,
2008
2045
  labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
2009
- legendFontSize: (_100 = (_99 = (_98 = spec.legend) === null || _98 === void 0 ? void 0 : _98.textFormat) === null || _99 === void 0 ? void 0 : _99.fontSize) !== null && _100 !== void 0 ? _100 : axisFontSize,
2046
+ legendFontSize: (_104 = (_103 = (_102 = spec.legend) === null || _102 === void 0 ? void 0 : _102.textFormat) === null || _103 === void 0 ? void 0 : _103.fontSize) !== null && _104 !== void 0 ? _104 : axisFontSize,
2010
2047
  width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
2011
2048
  height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
2012
2049
  hasTitle: Boolean(title),
2013
- titleFontSize: (_101 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _101 !== void 0 ? _101 : 16,
2050
+ titleFontSize: (_105 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _105 !== void 0 ? _105 : 16,
2014
2051
  hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
2015
2052
  hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
2016
2053
  leftAxisDepth: leftAxisDepth,
@@ -2022,7 +2059,7 @@ var BasicChart = function (_a) {
2022
2059
  family: "Untitled Sans, apple-system, sans-serif",
2023
2060
  size: 16,
2024
2061
  color: textColor,
2025
- }, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_102 = legendBand.legend) !== null && _102 !== void 0 ? _102 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
2062
+ }, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_106 = legendBand.legend) !== null && _106 !== void 0 ? _106 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
2026
2063
  spec.stackedType
2027
2064
  ? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
2028
2065
  spec.stackedType === "PERCENT_STACKED"
@@ -2043,7 +2080,7 @@ var BasicChart = function (_a) {
2043
2080
  color: textColor,
2044
2081
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
2045
2082
  title: {
2046
- text: (_103 = spec.horizontalAxisTitle) !== null && _103 !== void 0 ? _103 : "",
2083
+ text: (_107 = spec.horizontalAxisTitle) !== null && _107 !== void 0 ? _107 : "",
2047
2084
  font: { color: textColor },
2048
2085
  standoff: bottomAxisTitleStandoff,
2049
2086
  },
@@ -2061,7 +2098,7 @@ var BasicChart = function (_a) {
2061
2098
  isHorizontalBarChart
2062
2099
  ? spec.valueAxisOptions
2063
2100
  : spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
2064
- title: tslib_1.__assign({ text: (_104 = spec.verticalAxisTitle) !== null && _104 !== void 0 ? _104 : "", font: { color: textColor } }, (isHorizontalBarChart
2101
+ title: tslib_1.__assign({ text: (_108 = spec.verticalAxisTitle) !== null && _108 !== void 0 ? _108 : "", font: { color: textColor } }, (isHorizontalBarChart
2065
2102
  ? {}
2066
2103
  : { standoff: VALUE_AXIS_TITLE_STANDOFF })),
2067
2104
  showgrid: !isHorizontalBarChart,
@@ -2075,16 +2112,16 @@ var BasicChart = function (_a) {
2075
2112
  }, isHorizontalBarChart
2076
2113
  ? spec.categoryAxisOptions
2077
2114
  : spec.valueAxisOptions, isHorizontalBarChart ? undefined : primaryAxisNumberFormat) }), (hasSecondaryAxis
2078
- ? (_q = {},
2079
- _q[isHorizontalBarChart ? "xaxis2" : "yaxis2"] = applyAxisOverridesPlotly(tslib_1.__assign({ title: {
2115
+ ? (_r = {},
2116
+ _r[isHorizontalBarChart ? "xaxis2" : "yaxis2"] = applyAxisOverridesPlotly(tslib_1.__assign({ title: {
2080
2117
  font: { color: textColor },
2081
2118
  standoff: VALUE_AXIS_TITLE_STANDOFF,
2082
2119
  }, overlaying: isHorizontalBarChart ? "x" : "y", side: isHorizontalBarChart ? "top" : "right", showgrid: false, automargin: true }, (isPareto
2083
2120
  ? { range: [0, 100], ticksuffix: "%" }
2084
2121
  : {})), spec.secondaryValueAxisOptions, secondaryAxisNumberFormat),
2085
- _q) : {})), (hasSecondaryCategoryAxis && secondaryDomainData
2086
- ? (_r = {},
2087
- _r[isHorizontalBarChart ? "yaxis2" : "xaxis2"] = {
2122
+ _r) : {})), (hasSecondaryCategoryAxis && secondaryDomainData
2123
+ ? (_s = {},
2124
+ _s[isHorizontalBarChart ? "yaxis2" : "xaxis2"] = {
2088
2125
  overlaying: isHorizontalBarChart ? "y" : "x",
2089
2126
  side: isHorizontalBarChart ? "right" : "top",
2090
2127
  type: "category",
@@ -2094,7 +2131,7 @@ var BasicChart = function (_a) {
2094
2131
  automargin: true,
2095
2132
  visible: (0, helpers_1.showXAxis)(spec === null || spec === void 0 ? void 0 : spec.chartType),
2096
2133
  },
2097
- _r) : {})), (ofPieExtras
2134
+ _s) : {})), (ofPieExtras
2098
2135
  ? 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 } : {})) : {}));
2099
2136
  dlOpts = spec.dataLabels;
2100
2137
  doughnutSeriesOrder = spec.chartType === "doughnut"