@rowsncolumns/charts 28.1.11 → 28.1.13

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 (35) hide show
  1. package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
  2. package/dist/cjs/basic-chart/basic-chart.js +462 -286
  3. package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
  4. package/dist/cjs/basic-chart/helpers.js +2 -0
  5. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  6. package/dist/cjs/plotly/basic-chart/basic-chart.js +198 -149
  7. package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
  8. package/dist/cjs/plotly/basic-chart/helpers.js +2 -0
  9. package/dist/cjs/utils/hierarchy.d.ts +6 -0
  10. package/dist/cjs/utils/hierarchy.d.ts.map +1 -1
  11. package/dist/cjs/utils/hierarchy.js +23 -1
  12. package/dist/cjs/utils/histogram.d.ts +42 -3
  13. package/dist/cjs/utils/histogram.d.ts.map +1 -1
  14. package/dist/cjs/utils/histogram.js +193 -5
  15. package/dist/cjs/utils/overrides.d.ts +1 -1
  16. package/dist/cjs/utils/overrides.d.ts.map +1 -1
  17. package/dist/cjs/utils/overrides.js +44 -39
  18. package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
  19. package/dist/esm/basic-chart/basic-chart.js +297 -109
  20. package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
  21. package/dist/esm/basic-chart/helpers.js +2 -0
  22. package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  23. package/dist/esm/plotly/basic-chart/basic-chart.js +132 -70
  24. package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
  25. package/dist/esm/plotly/basic-chart/helpers.js +2 -0
  26. package/dist/esm/utils/hierarchy.d.ts +6 -0
  27. package/dist/esm/utils/hierarchy.d.ts.map +1 -1
  28. package/dist/esm/utils/hierarchy.js +21 -0
  29. package/dist/esm/utils/histogram.d.ts +42 -3
  30. package/dist/esm/utils/histogram.d.ts.map +1 -1
  31. package/dist/esm/utils/histogram.js +171 -4
  32. package/dist/esm/utils/overrides.d.ts +1 -1
  33. package/dist/esm/utils/overrides.d.ts.map +1 -1
  34. package/dist/esm/utils/overrides.js +4 -2
  35. package/package.json +2 -2
@@ -10,7 +10,6 @@ var utils_1 = require("@rowsncolumns/utils");
10
10
  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
- var boxplot_1 = require("../../utils/boxplot");
14
13
  var bubble_1 = require("../../utils/bubble");
15
14
  var chart_orientation_1 = require("../../utils/chart-orientation");
16
15
  var chart_image_1 = require("../../utils/chart-image");
@@ -507,11 +506,11 @@ var BasicChart = function (_a) {
507
506
  * Triggers a chart update
508
507
  */
509
508
  var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
510
- 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, 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, 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;
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;
511
510
  var e_2, _m, e_4, _o, e_3, _p, _q, _r;
512
- 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;
513
- return tslib_1.__generator(this, function (_82) {
514
- switch (_82.label) {
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) {
515
514
  case 0:
516
515
  (0, utils_1.debug)("Updating chart", chart);
517
516
  traces = [];
@@ -536,7 +535,7 @@ var BasicChart = function (_a) {
536
535
  });
537
536
  seriesInputs = [];
538
537
  i = 0;
539
- _82.label = 1;
538
+ _105.label = 1;
540
539
  case 1:
541
540
  if (!(i < spec.series.length)) return [3 /*break*/, 5];
542
541
  seriesEntry = spec.series[i];
@@ -545,13 +544,13 @@ var BasicChart = function (_a) {
545
544
  _a = chart_spec_utils_1.coerceCalculatedLabel;
546
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
546
  case 2:
548
- resolvedLabel = _a.apply(void 0, [_82.sent()]);
549
- _82.label = 3;
547
+ resolvedLabel = _a.apply(void 0, [_105.sent()]);
548
+ _105.label = 3;
550
549
  case 3:
551
550
  xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
552
551
  sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
553
552
  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 } : {})));
554
- _82.label = 4;
553
+ _105.label = 4;
555
554
  case 4:
556
555
  i++;
557
556
  return [3 /*break*/, 1];
@@ -750,12 +749,31 @@ var BasicChart = function (_a) {
750
749
  xAxisFmt = (_3 = spec.categoryAxisOptions) === null || _3 === void 0 ? void 0 : _3.textFormat;
751
750
  yAxisFmt = (_4 = spec.valueAxisOptions) === null || _4 === void 0 ? void 0 : _4.textFormat;
752
751
  legendFmt = (_5 = spec.legend) === null || _5 === void 0 ? void 0 : _5.textFormat;
752
+ 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 } : {})),
754
+ }, spec.legend);
755
+ 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) !==
758
+ false,
759
+ 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,
761
+ width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
762
+ height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
763
+ hasTitle: Boolean(title),
764
+ titleFontSize: (_10 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _10 !== void 0 ? _10 : 16,
765
+ hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
766
+ hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
767
+ leftAxisDepth: 60,
768
+ rightAxisDepth: hasBubbleSecondaryAxis ? 60 : 0,
769
+ axisFontSize: 12,
770
+ });
753
771
  bubbleLayout = tslib_1.__assign(tslib_1.__assign({ title: {
754
772
  text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
755
773
  font: {
756
- family: (_6 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontFamily) !== null && _6 !== void 0 ? _6 : "Untitled Sans, apple-system, sans-serif",
757
- size: (_7 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _7 !== void 0 ? _7 : 16,
758
- color: (_8 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.color) !== null && _8 !== void 0 ? _8 : textColor,
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,
759
777
  },
760
778
  x: 0.02,
761
779
  xanchor: "left",
@@ -765,19 +783,19 @@ var BasicChart = function (_a) {
765
783
  // renderer).
766
784
  xaxis: applyAxisOverridesPlotly({
767
785
  title: {
768
- text: (_9 = spec.horizontalAxisTitle) !== null && _9 !== void 0 ? _9 : "",
769
- font: { color: (_10 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _10 !== void 0 ? _10 : textColor },
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 },
770
788
  },
771
789
  gridcolor: gridColor,
772
- tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_11 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _11 !== void 0 ? _11 : 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 } : {})),
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 } : {})),
773
791
  type: hasStringX_1 ? "category" : "linear",
774
792
  }, spec.categoryAxisOptions), yaxis: applyAxisOverridesPlotly({
775
793
  title: {
776
- text: (_12 = spec.verticalAxisTitle) !== null && _12 !== void 0 ? _12 : "",
777
- font: { color: (_13 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _13 !== void 0 ? _13 : textColor },
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 },
778
796
  },
779
797
  gridcolor: gridColor,
780
- tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_14 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _14 !== void 0 ? _14 : 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 } : {})),
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 } : {})),
781
799
  }, spec.valueAxisOptions) }, (hasBubbleSecondaryAxis
782
800
  ? {
783
801
  yaxis2: applyAxisOverridesPlotly({
@@ -785,12 +803,12 @@ var BasicChart = function (_a) {
785
803
  side: "right",
786
804
  showgrid: false,
787
805
  automargin: true,
788
- tickfont: { color: (_15 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _15 !== void 0 ? _15 : textColor },
806
+ tickfont: { color: (_20 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _20 !== void 0 ? _20 : textColor },
789
807
  }, spec.secondaryValueAxisOptions),
790
808
  }
791
- : {})), { legend: {
792
- font: tslib_1.__assign(tslib_1.__assign({ color: (_16 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.color) !== null && _16 !== void 0 ? _16 : 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 } : {})),
793
- }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: preparedSeries.length > 1, margin: { l: 60, r: hasBubbleSecondaryAxis ? 60 : 20, t: 50, b: 50 } });
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,
810
+ // The plot shrinks to leave the legend its own band (#1089).
811
+ margin: bubbleBand.margin });
794
812
  setPlotData(traces_1);
795
813
  setLayout(bubbleLayout);
796
814
  return [2 /*return*/];
@@ -809,8 +827,8 @@ var BasicChart = function (_a) {
809
827
  hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
810
828
  hierarchyData_1 = (0, hierarchy_1.toPlotlyHierarchy)(hierarchyRows);
811
829
  seriesName = hierarchyData_1.labels.length === 1
812
- ? (_17 = hierarchyData_1.labels[0]) !== null && _17 !== void 0 ? _17 : ""
813
- : (_18 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _18 !== void 0 ? _18 : "";
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 : "";
814
832
  hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
815
833
  theme.themeColors.accent1,
816
834
  theme.themeColors.accent2,
@@ -824,7 +842,9 @@ var BasicChart = function (_a) {
824
842
  SUNBURST_ROOT_ID_1 = "__rnc_sunburst_root__";
825
843
  rootTotal = hierarchyData_1.values.reduce(function (sum, value, i) { return (hierarchyData_1.parents[i] === "" ? sum + value : sum); }, 0);
826
844
  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
827
- ? 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, textinfo: "label+value", branchvalues: "total" }, (isSunburst
845
+ ? 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
+ // `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
828
848
  ? {}
829
849
  : {
830
850
  textposition: "bottom left",
@@ -882,7 +902,7 @@ var BasicChart = function (_a) {
882
902
  // country-name matching and silently skips labels it can't place.
883
903
  if ((0, region_map_1.isRegionMapSpec)(spec)) {
884
904
  labels = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : "").trim(); });
885
- seriesEntry = (_19 = spec.series) === null || _19 === void 0 ? void 0 : _19[0];
905
+ seriesEntry = (_27 = spec.series) === null || _27 === void 0 ? void 0 : _27[0];
886
906
  rawValues_1 = seriesEntry
887
907
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
888
908
  : [];
@@ -947,34 +967,34 @@ var BasicChart = function (_a) {
947
967
  if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
948
968
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
949
969
  surfaceSeriesInputs = [];
950
- _82.label = 7;
970
+ _105.label = 7;
951
971
  case 7:
952
- _82.trys.push([7, 14, 15, 16]);
953
- _c = tslib_1.__values((_20 = spec.series) !== null && _20 !== void 0 ? _20 : []), _d = _c.next();
954
- _82.label = 8;
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;
955
975
  case 8:
956
976
  if (!!_d.done) return [3 /*break*/, 13];
957
977
  seriesEntry = _d.value;
958
978
  if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 10];
959
979
  _f = chart_spec_utils_1.coerceCalculatedLabel;
960
- return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_21 = position.sheetId) !== null && _21 !== void 0 ? _21 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
980
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_29 = position.sheetId) !== null && _29 !== void 0 ? _29 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
961
981
  case 9:
962
- _e = _f.apply(void 0, [_82.sent()]);
982
+ _e = _f.apply(void 0, [_105.sent()]);
963
983
  return [3 /*break*/, 11];
964
984
  case 10:
965
- _e = (_22 = seriesEntry.dataLabel) !== null && _22 !== void 0 ? _22 : "";
966
- _82.label = 11;
985
+ _e = (_30 = seriesEntry.dataLabel) !== null && _30 !== void 0 ? _30 : "";
986
+ _105.label = 11;
967
987
  case 11:
968
988
  dataLabel = _e;
969
989
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
970
990
  surfaceSeriesInputs.push({ name: dataLabel, values: values });
971
- _82.label = 12;
991
+ _105.label = 12;
972
992
  case 12:
973
993
  _d = _c.next();
974
994
  return [3 /*break*/, 8];
975
995
  case 13: return [3 /*break*/, 16];
976
996
  case 14:
977
- e_2_1 = _82.sent();
997
+ e_2_1 = _105.sent();
978
998
  e_2 = { error: e_2_1 };
979
999
  return [3 /*break*/, 16];
980
1000
  case 15:
@@ -1002,21 +1022,21 @@ var BasicChart = function (_a) {
1002
1022
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, margin: { l: 60, r: 20, t: 50, b: 50 } }, (surfaceToken === "SURFACE"
1003
1023
  ? {
1004
1024
  xaxis: {
1005
- title: { text: (_23 = spec.horizontalAxisTitle) !== null && _23 !== void 0 ? _23 : "" },
1025
+ title: { text: (_31 = spec.horizontalAxisTitle) !== null && _31 !== void 0 ? _31 : "" },
1006
1026
  automargin: true,
1007
1027
  color: textColor,
1008
1028
  },
1009
1029
  yaxis: {
1010
- title: { text: (_24 = spec.verticalAxisTitle) !== null && _24 !== void 0 ? _24 : "" },
1030
+ title: { text: (_32 = spec.verticalAxisTitle) !== null && _32 !== void 0 ? _32 : "" },
1011
1031
  automargin: true,
1012
1032
  color: textColor,
1013
1033
  },
1014
1034
  }
1015
1035
  : {
1016
1036
  scene: {
1017
- xaxis: { title: { text: (_25 = spec.horizontalAxisTitle) !== null && _25 !== void 0 ? _25 : "" } },
1037
+ xaxis: { title: { text: (_33 = spec.horizontalAxisTitle) !== null && _33 !== void 0 ? _33 : "" } },
1018
1038
  yaxis: { title: { text: "" } },
1019
- zaxis: { title: { text: (_26 = spec.verticalAxisTitle) !== null && _26 !== void 0 ? _26 : "" } },
1039
+ zaxis: { title: { text: (_34 = spec.verticalAxisTitle) !== null && _34 !== void 0 ? _34 : "" } },
1020
1040
  },
1021
1041
  }));
1022
1042
  setPlotData([surfaceTrace]);
@@ -1028,11 +1048,11 @@ var BasicChart = function (_a) {
1028
1048
  // theta = the category names (closed by appending the first point).
1029
1049
  if (spec.chartType === "radar") {
1030
1050
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1031
- radarStyle = (_27 = spec.radarStyle) !== null && _27 !== void 0 ? _27 : "standard";
1051
+ radarStyle = (_35 = spec.radarStyle) !== null && _35 !== void 0 ? _35 : "standard";
1032
1052
  radarTraces = [];
1033
1053
  radarInputs = [];
1034
1054
  try {
1035
- for (_g = tslib_1.__values((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
1055
+ for (_g = tslib_1.__values((_36 = spec.series) !== null && _36 !== void 0 ? _36 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
1036
1056
  seriesEntry = _h.value;
1037
1057
  label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
1038
1058
  ? seriesEntry.dataLabel
@@ -1052,7 +1072,7 @@ var BasicChart = function (_a) {
1052
1072
  indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
1053
1073
  _loop_1 = function (i) {
1054
1074
  var input = radarInputs[i];
1055
- var seriesColor = (_31 = (_30 = (_29 = spec.series) === null || _29 === void 0 ? void 0 : _29[i]) === null || _30 === void 0 ? void 0 : _30.color) !== null && _31 !== void 0 ? _31 : undefined;
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;
1056
1076
  var r = indicators.map(function (_, idx) { var _a; return (_a = input.values[idx]) !== null && _a !== void 0 ? _a : 0; });
1057
1077
  var theta = indicators.map(function (ind) { return ind.name; });
1058
1078
  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 } } : {})));
@@ -1060,21 +1080,43 @@ var BasicChart = function (_a) {
1060
1080
  for (i = 0; i < radarInputs.length; i++) {
1061
1081
  _loop_1(i);
1062
1082
  }
1063
- radarScale = (_32 = indicators[0]) !== null && _32 !== void 0 ? _32 : { min: 0, max: 1 };
1083
+ radarScale = (_40 = indicators[0]) !== null && _40 !== void 0 ? _40 : { min: 0, max: 1 };
1084
+ radarLegendOverrides = applyLegendOverridesPlotly({ font: { color: textColor } }, spec.legend);
1085
+ 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,
1088
+ 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,
1090
+ width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
1091
+ height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
1092
+ hasTitle: Boolean(title),
1093
+ titleFontSize: (_47 = (_46 = spec.titleTextFormat) === null || _46 === void 0 ? void 0 : _46.fontSize) !== null && _47 !== void 0 ? _47 : 16,
1094
+ hasBottomAxisTitle: false,
1095
+ hasLeftAxisTitle: false,
1096
+ leftAxisDepth: 50,
1097
+ rightAxisDepth: 50,
1098
+ axisFontSize: 12,
1099
+ });
1064
1100
  setPlotData(radarTraces);
1065
1101
  setLayout({
1066
1102
  title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) },
1067
1103
  font: { color: textColor },
1068
1104
  paper_bgcolor: bgColor,
1069
1105
  plot_bgcolor: bgColor,
1070
- showlegend: radarTraces.length > 1,
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 : {})),
1071
1108
  polar: {
1072
1109
  radialaxis: {
1073
1110
  visible: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
1074
1111
  range: [radarScale.min, radarScale.max],
1075
1112
  },
1076
1113
  },
1077
- margin: { l: 50, r: 50, t: 50, b: 50 },
1114
+ margin: {
1115
+ l: Math.max(50, radarBand.margin.l),
1116
+ r: Math.max(50, radarBand.margin.r),
1117
+ t: Math.max(50, radarBand.margin.t),
1118
+ b: Math.max(50, radarBand.margin.b),
1119
+ },
1078
1120
  autosize: true,
1079
1121
  });
1080
1122
  return [2 /*return*/];
@@ -1084,13 +1126,13 @@ var BasicChart = function (_a) {
1084
1126
  // V-variants additionally get a volume column sub-pane below the
1085
1127
  // price plot.
1086
1128
  if (spec.chartType === "stock") {
1087
- variant = ((_33 = spec.stockVariant) !== null && _33 !== void 0 ? _33 : "HLC");
1129
+ variant = ((_50 = spec.stockVariant) !== null && _50 !== void 0 ? _50 : "HLC");
1088
1130
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1089
- seriesValues = ((_34 = spec.series) !== null && _34 !== void 0 ? _34 : []).map(function (seriesEntry) {
1131
+ seriesValues = ((_51 = spec.series) !== null && _51 !== void 0 ? _51 : []).map(function (seriesEntry) {
1090
1132
  return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
1091
1133
  });
1092
1134
  volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
1093
- hasVolume = ((_35 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _35 !== void 0 ? _35 : 0) > 0;
1135
+ hasVolume = ((_52 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _52 !== void 0 ? _52 : 0) > 0;
1094
1136
  buildVolumeTrace = function (xs) {
1095
1137
  return ({
1096
1138
  type: "bar",
@@ -1123,25 +1165,25 @@ var BasicChart = function (_a) {
1123
1165
  roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
1124
1166
  xs_1 = categories.length > 0
1125
1167
  ? categories
1126
- : ((_36 = roles.close) !== null && _36 !== void 0 ? _36 : []).map(function (_, i) { return i + 1; });
1168
+ : ((_53 = roles.close) !== null && _53 !== void 0 ? _53 : []).map(function (_, i) { return i + 1; });
1127
1169
  candleTrace = {
1128
1170
  type: "candlestick",
1129
1171
  x: xs_1,
1130
- open: ((_37 = roles.open) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1131
- high: ((_38 = roles.high) !== null && _38 !== void 0 ? _38 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1132
- low: ((_39 = roles.low) !== null && _39 !== void 0 ? _39 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1133
- close: ((_40 = roles.close) !== null && _40 !== void 0 ? _40 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
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; }),
1134
1176
  increasing: { line: { color: theme.themeColors.accent1 } },
1135
1177
  decreasing: { line: { color: theme.themeColors.accent2 } },
1136
1178
  };
1137
1179
  setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
1138
1180
  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: {
1139
- title: { text: (_41 = spec.horizontalAxisTitle) !== null && _41 !== void 0 ? _41 : "" },
1181
+ title: { text: (_58 = spec.horizontalAxisTitle) !== null && _58 !== void 0 ? _58 : "" },
1140
1182
  automargin: true,
1141
1183
  showgrid: true,
1142
1184
  gridcolor: gridColor,
1143
1185
  rangeslider: { visible: false },
1144
- }, yaxis: tslib_1.__assign({ title: { text: (_42 = spec.verticalAxisTitle) !== null && _42 !== void 0 ? _42 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
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 }));
1145
1187
  return [2 /*return*/];
1146
1188
  }
1147
1189
  lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
@@ -1153,7 +1195,7 @@ var BasicChart = function (_a) {
1153
1195
  ]);
1154
1196
  xs_2 = categories.length > 0
1155
1197
  ? categories
1156
- : ((_44 = (_43 = lineSeries[0]) === null || _43 === void 0 ? void 0 : _43.values) !== null && _44 !== void 0 ? _44 : []).map(function (_, i) { return i + 1; });
1198
+ : ((_61 = (_60 = lineSeries[0]) === null || _60 === void 0 ? void 0 : _60.values) !== null && _61 !== void 0 ? _61 : []).map(function (_, i) { return i + 1; });
1157
1199
  stockTraces = lineSeries.map(function (s, i) { return ({
1158
1200
  type: "scatter",
1159
1201
  mode: "lines",
@@ -1164,11 +1206,11 @@ var BasicChart = function (_a) {
1164
1206
  }); });
1165
1207
  setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
1166
1208
  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: {
1167
- title: { text: (_45 = spec.horizontalAxisTitle) !== null && _45 !== void 0 ? _45 : "" },
1209
+ title: { text: (_62 = spec.horizontalAxisTitle) !== null && _62 !== void 0 ? _62 : "" },
1168
1210
  automargin: true,
1169
1211
  showgrid: true,
1170
1212
  gridcolor: gridColor,
1171
- }, yaxis: tslib_1.__assign({ title: { text: (_46 = spec.verticalAxisTitle) !== null && _46 !== void 0 ? _46 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
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 }));
1172
1214
  return [2 /*return*/];
1173
1215
  }
1174
1216
  isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
@@ -1215,12 +1257,12 @@ var BasicChart = function (_a) {
1215
1257
  return extra;
1216
1258
  };
1217
1259
  shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
1218
- primaryDomainSource = (_49 = (_48 = (_47 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _47 === void 0 ? void 0 : _47[0]) === null || _48 === void 0 ? void 0 : _48.sources) === null || _49 === void 0 ? void 0 : _49[0];
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];
1219
1261
  rawPrimaryDomainValues = primaryDomainSource
1220
- ? (0, aggregation_1.sanitizeDomainValues)((_50 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _50 !== void 0 ? _50 : [])
1262
+ ? (0, aggregation_1.sanitizeDomainValues)((_67 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _67 !== void 0 ? _67 : [])
1221
1263
  : [];
1222
1264
  domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
1223
- categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_51 = spec.categoryLevels) === null || _51 === void 0 ? void 0 : _51.map(function (level) {
1265
+ categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_68 = spec.categoryLevels) === null || _68 === void 0 ? void 0 : _68.map(function (level) {
1224
1266
  return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
1225
1267
  }));
1226
1268
  multicategoryX = categoryLevels
@@ -1230,7 +1272,7 @@ var BasicChart = function (_a) {
1230
1272
  domainData = categoryLevels.leaf;
1231
1273
  }
1232
1274
  aggregateDomainValues = domainData;
1233
- domainAxisData = (categoryLevels ? [] : (_52 = spec.domains) !== null && _52 !== void 0 ? _52 : []).map(function (domain, domainIndex) {
1275
+ domainAxisData = (categoryLevels ? [] : (_69 = spec.domains) !== null && _69 !== void 0 ? _69 : []).map(function (domain, domainIndex) {
1234
1276
  return domain.sources.flatMap(function (sheetRange, sourceIndex) {
1235
1277
  var _a;
1236
1278
  if (domainIndex === 0 && sourceIndex === 0) {
@@ -1487,29 +1529,29 @@ var BasicChart = function (_a) {
1487
1529
  finally { if (e_8) throw e_8.error; }
1488
1530
  }
1489
1531
  };
1490
- domainSources = (_55 = (_54 = (_53 = spec.domains) === null || _53 === void 0 ? void 0 : _53[0]) === null || _54 === void 0 ? void 0 : _54.sources) !== null && _55 !== void 0 ? _55 : [];
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 : [];
1491
1533
  seriesIndex = 0;
1492
1534
  _loop_2 = function (series) {
1493
- var currentSeriesIndex, dataLabel, _83, _84, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, _85, labels, counts, cumulativePercents, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, increaseColor, trace, rawValues, trace, pieData, _86, 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, _87, x, y, orientation_1, trace, numericValues, _88, x, y, orientation_2, trace;
1494
- return tslib_1.__generator(this, function (_89) {
1495
- switch (_89.label) {
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) {
1496
1538
  case 0:
1497
1539
  currentSeriesIndex = seriesIndex++;
1498
1540
  if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1499
- _84 = chart_spec_utils_1.coerceCalculatedLabel;
1500
- return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_57 = position.sheetId) !== null && _57 !== void 0 ? _57 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
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)];
1501
1543
  case 1:
1502
- _83 = _84.apply(void 0, [_89.sent()]);
1544
+ _106 = _107.apply(void 0, [_112.sent()]);
1503
1545
  return [3 /*break*/, 3];
1504
1546
  case 2:
1505
- _83 = (_58 = series.dataLabel) !== null && _58 !== void 0 ? _58 : "";
1506
- _89.label = 3;
1547
+ _106 = (_75 = series.dataLabel) !== null && _75 !== void 0 ? _75 : "";
1548
+ _112.label = 3;
1507
1549
  case 3:
1508
- dataLabel = _83;
1550
+ dataLabel = _106;
1509
1551
  // A series with no ranges draws nothing.
1510
1552
  if (series.sources.length === 0)
1511
1553
  return [2 /*return*/, "continue"];
1512
- effectiveChartType = (_59 = series.seriesChartType) !== null && _59 !== void 0 ? _59 : spec.chartType;
1554
+ effectiveChartType = (_76 = series.seriesChartType) !== null && _76 !== void 0 ? _76 : spec.chartType;
1513
1555
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1514
1556
  pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
1515
1557
  (domainSources.length > 1 || series.sources.length > 1)
@@ -1544,36 +1586,58 @@ var BasicChart = function (_a) {
1544
1586
  if (effectiveChartType === "histogram") {
1545
1587
  rawValues = seriesValuesOf(seriesData);
1546
1588
  binCount = spec.binCount;
1589
+ binningOptions = {
1590
+ binSize: spec.binSize,
1591
+ intervalClosed: spec.intervalClosed,
1592
+ overflow: spec.overflow,
1593
+ underflow: spec.underflow,
1594
+ };
1595
+ categories = domainData;
1596
+ prebinned = categories.length
1597
+ ? (0, histogram_1.aggregateByCategory)(categories, rawValues, (_77 = series.aggregateType) !== null && _77 !== void 0 ? _77 : "SUM")
1598
+ : (0, histogram_1.hasExcelBinning)(binningOptions)
1599
+ ? (0, histogram_1.binHistogram)(rawValues, binCount, binningOptions)
1600
+ : null;
1547
1601
  if (isPareto) {
1548
- _85 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _85.labels, counts = _85.counts, cumulativePercents = _85.cumulativePercents;
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;
1549
1603
  barTrace = {
1550
1604
  type: "bar",
1551
1605
  x: labels,
1552
1606
  y: counts,
1553
1607
  name: dataLabel,
1554
1608
  };
1555
- applyTraceColor(barTrace, (_60 = series.color) !== null && _60 !== void 0 ? _60 : undefined, {
1609
+ applyTraceColor(barTrace, (_78 = series.color) !== null && _78 !== void 0 ? _78 : undefined, {
1556
1610
  noFill: series.noFill,
1557
1611
  dataPointColors: series.dataPointColors,
1558
1612
  seriesIndex: currentSeriesIndex,
1559
1613
  effectiveChartType: effectiveChartType,
1560
1614
  });
1561
1615
  traces.push(barTrace);
1562
- traces.push({
1563
- type: "scatter",
1564
- mode: "lines+markers",
1565
- x: labels,
1566
- y: cumulativePercents,
1567
- name: "Cumulative %",
1568
- yaxis: "y2",
1569
- });
1616
+ paretoLineColor = spec.paretoLineColor;
1617
+ // Excel draws the Pareto line without markers.
1618
+ traces.push(tslib_1.__assign({ type: "scatter", mode: "lines", x: labels, y: cumulativePercents, name: "Cumulative %", yaxis: "y2" }, (paretoLineColor ? { line: { color: paretoLineColor } } : {})));
1570
1619
  hasSecondaryAxis = true;
1571
1620
  }
1621
+ else if (prebinned) {
1622
+ barTrace = {
1623
+ type: "bar",
1624
+ x: prebinned.labels,
1625
+ y: prebinned.counts,
1626
+ name: dataLabel,
1627
+ };
1628
+ applyTraceColor(barTrace, (_79 = series.color) !== null && _79 !== void 0 ? _79 : undefined, {
1629
+ noFill: series.noFill,
1630
+ dataPointColors: series.dataPointColors,
1631
+ seriesIndex: currentSeriesIndex,
1632
+ effectiveChartType: effectiveChartType,
1633
+ });
1634
+ traces.push(barTrace);
1635
+ }
1572
1636
  else {
1573
1637
  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
1574
1638
  ? { nbinsx: binCount }
1575
1639
  : {}));
1576
- applyTraceColor(trace, (_61 = series.color) !== null && _61 !== void 0 ? _61 : undefined, {
1640
+ applyTraceColor(trace, (_80 = series.color) !== null && _80 !== void 0 ? _80 : undefined, {
1577
1641
  noFill: series.noFill,
1578
1642
  dataPointColors: series.dataPointColors,
1579
1643
  seriesIndex: currentSeriesIndex,
@@ -1585,43 +1649,20 @@ var BasicChart = function (_a) {
1585
1649
  else if (effectiveChartType === "boxplot") {
1586
1650
  rawValues = seriesValuesOf(seriesData);
1587
1651
  quartileMethod = spec.quartileMethod;
1588
- showOutliers = spec.showOutliers;
1652
+ showOutliers = spec.showOutliers !== false;
1589
1653
  showMeanMarker = spec.showMeanMarker === true;
1590
- usePrecomputed = quartileMethod != null || showOutliers === false;
1591
- trace = void 0;
1592
- if (usePrecomputed) {
1593
- summary = (0, boxplot_1.computeBoxplotSummary)(rawValues, {
1594
- quartileMethod: quartileMethod,
1595
- });
1596
- if (!summary)
1597
- return [2 /*return*/, "continue"];
1598
- hideOutliers = showOutliers === false;
1599
- trace = tslib_1.__assign(tslib_1.__assign({ type: "box", name: dataLabel,
1600
- // Precomputed boxes need an explicit category so each
1601
- // series lands on its own slot (raw mode derives it from
1602
- // the trace name).
1603
- x: [dataLabel || "trace ".concat(currentSeriesIndex)], q1: [summary.q1], median: [summary.median], q3: [summary.q3],
1604
- // Excel: hiding outlier points extends the whiskers to
1605
- // the full min/max; with outliers shown they stop at the
1606
- // most extreme points inside the 1.5×IQR fences.
1607
- lowerfence: [hideOutliers ? summary.min : summary.lowerWhisker], upperfence: [hideOutliers ? summary.max : summary.upperWhisker] }, (hideOutliers
1608
- ? { boxpoints: false }
1609
- : {
1610
- // Sample points ride along so plotly can still draw
1611
- // the outlier dots against the precomputed fences.
1612
- y: [rawValues.filter(function (v) { return v != null; })],
1613
- boxpoints: "outliers",
1614
- })), (showMeanMarker
1615
- ? { mean: [summary.mean], boxmean: true }
1616
- : {}));
1617
- }
1618
- else {
1619
- trace = tslib_1.__assign({ type: "box", y: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }), name: dataLabel,
1620
- // Raw mode is used when outliers are visible (today's
1621
- // default and `showOutliers: true` alike).
1622
- boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
1623
- }
1624
- applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
1654
+ showInnerPoints = spec.showInnerPoints === true;
1655
+ 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];
1657
+ 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()); })
1659
+ : [];
1660
+ grouped = boxCategories_1.some(function (c) { return c !== ""; });
1661
+ 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, {
1625
1666
  noFill: series.noFill,
1626
1667
  dataPointColors: series.dataPointColors,
1627
1668
  seriesIndex: currentSeriesIndex,
@@ -1631,8 +1672,8 @@ var BasicChart = function (_a) {
1631
1672
  }
1632
1673
  else if (effectiveChartType === "waterfall") {
1633
1674
  rawValues = seriesValuesOf(seriesData);
1634
- totalIndices_1 = new Set((_63 = spec.totalIndices) !== null && _63 !== void 0 ? _63 : []);
1635
- increaseColor = (_64 = series.color) !== null && _64 !== void 0 ? _64 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
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);
1636
1677
  trace = {
1637
1678
  type: "waterfall",
1638
1679
  x: categoriesFor(series),
@@ -1644,10 +1685,10 @@ var BasicChart = function (_a) {
1644
1685
  increasing: { marker: { color: increaseColor } },
1645
1686
  decreasing: {
1646
1687
  marker: {
1647
- color: (_66 = (_65 = series.negativeColor) !== null && _65 !== void 0 ? _65 : theme.themeColors.accent2) !== null && _66 !== void 0 ? _66 : increaseColor,
1688
+ color: (_89 = (_88 = series.negativeColor) !== null && _88 !== void 0 ? _88 : theme.themeColors.accent2) !== null && _89 !== void 0 ? _89 : increaseColor,
1648
1689
  },
1649
1690
  },
1650
- totals: { marker: { color: (_67 = theme.themeColors.accent3) !== null && _67 !== void 0 ? _67 : increaseColor } },
1691
+ totals: { marker: { color: (_90 = theme.themeColors.accent3) !== null && _90 !== void 0 ? _90 : increaseColor } },
1651
1692
  connector: {
1652
1693
  line: {
1653
1694
  color: isDarkMode ? "rgba(255,255,255,0.45)" : "#999999",
@@ -1667,7 +1708,7 @@ var BasicChart = function (_a) {
1667
1708
  name: dataLabel,
1668
1709
  textinfo: "none",
1669
1710
  };
1670
- applyTraceColor(trace, (_68 = series.color) !== null && _68 !== void 0 ? _68 : undefined, {
1711
+ applyTraceColor(trace, (_91 = series.color) !== null && _91 !== void 0 ? _91 : undefined, {
1671
1712
  noFill: series.noFill,
1672
1713
  dataPointColors: series.dataPointColors,
1673
1714
  seriesIndex: currentSeriesIndex,
@@ -1685,10 +1726,10 @@ var BasicChart = function (_a) {
1685
1726
  return [2 /*return*/, "continue"];
1686
1727
  ofPieHandled = true;
1687
1728
  pieData = seriesData;
1688
- _86 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1729
+ _109 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1689
1730
  splitType: spec.splitType,
1690
1731
  splitPos: spec.splitPos,
1691
- }), main_1 = _86.main, secondary = _86.secondary, otherTotal = _86.otherTotal, total = _86.total;
1732
+ }), main_1 = _109.main, secondary = _109.secondary, otherTotal = _109.otherTotal, total = _109.total;
1692
1733
  ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
1693
1734
  secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
1694
1735
  halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
@@ -1821,7 +1862,7 @@ var BasicChart = function (_a) {
1821
1862
  trace.meta = {
1822
1863
  rncSeriesIndex: currentSeriesIndex,
1823
1864
  };
1824
- applyTraceColor(trace, (_69 = series.color) !== null && _69 !== void 0 ? _69 : undefined, {
1865
+ applyTraceColor(trace, (_92 = series.color) !== null && _92 !== void 0 ? _92 : undefined, {
1825
1866
  noFill: series.noFill,
1826
1867
  dataPointColors: series.dataPointColors,
1827
1868
  seriesIndex: currentSeriesIndex,
@@ -1830,13 +1871,13 @@ var BasicChart = function (_a) {
1830
1871
  traces.push(trace);
1831
1872
  }
1832
1873
  else if ("values" in seriesData && "labels" in seriesData) {
1833
- _87 = assignCartesianData(categoriesFor(series), seriesData.values), x = _87.x, y = _87.y, orientation_1 = _87.orientation;
1874
+ _110 = assignCartesianData(categoriesFor(series), seriesData.values), x = _110.x, y = _110.y, orientation_1 = _110.orientation;
1834
1875
  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));
1835
1876
  // Ties the trace back to spec.series for click selection
1836
1877
  trace.meta = {
1837
1878
  rncSeriesIndex: currentSeriesIndex,
1838
1879
  };
1839
- applyTraceColor(trace, (_70 = series.color) !== null && _70 !== void 0 ? _70 : undefined, {
1880
+ applyTraceColor(trace, (_93 = series.color) !== null && _93 !== void 0 ? _93 : undefined, {
1840
1881
  noFill: series.noFill,
1841
1882
  dataPointColors: series.dataPointColors,
1842
1883
  invertIfNegative: series.invertIfNegative,
@@ -1851,13 +1892,13 @@ var BasicChart = function (_a) {
1851
1892
  }
1852
1893
  else {
1853
1894
  numericValues = seriesData;
1854
- _88 = assignCartesianData(categoriesFor(series), numericValues), x = _88.x, y = _88.y, orientation_2 = _88.orientation;
1895
+ _111 = assignCartesianData(categoriesFor(series), numericValues), x = _111.x, y = _111.y, orientation_2 = _111.orientation;
1855
1896
  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));
1856
1897
  // Ties the trace back to spec.series for click selection
1857
1898
  trace.meta = {
1858
1899
  rncSeriesIndex: currentSeriesIndex,
1859
1900
  };
1860
- applyTraceColor(trace, (_71 = series.color) !== null && _71 !== void 0 ? _71 : undefined, {
1901
+ applyTraceColor(trace, (_94 = series.color) !== null && _94 !== void 0 ? _94 : undefined, {
1861
1902
  noFill: series.noFill,
1862
1903
  dataPointColors: series.dataPointColors,
1863
1904
  invertIfNegative: series.invertIfNegative,
@@ -1874,24 +1915,24 @@ var BasicChart = function (_a) {
1874
1915
  }
1875
1916
  });
1876
1917
  };
1877
- _82.label = 18;
1918
+ _105.label = 18;
1878
1919
  case 18:
1879
- _82.trys.push([18, 23, 24, 25]);
1880
- _j = tslib_1.__values((_56 = spec.series) !== null && _56 !== void 0 ? _56 : []), _k = _j.next();
1881
- _82.label = 19;
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;
1882
1923
  case 19:
1883
1924
  if (!!_k.done) return [3 /*break*/, 22];
1884
1925
  series = _k.value;
1885
1926
  return [5 /*yield**/, _loop_2(series)];
1886
1927
  case 20:
1887
- _82.sent();
1888
- _82.label = 21;
1928
+ _105.sent();
1929
+ _105.label = 21;
1889
1930
  case 21:
1890
1931
  _k = _j.next();
1891
1932
  return [3 /*break*/, 19];
1892
1933
  case 22: return [3 /*break*/, 25];
1893
1934
  case 23:
1894
- e_3_1 = _82.sent();
1935
+ e_3_1 = _105.sent();
1895
1936
  e_3 = { error: e_3_1 };
1896
1937
  return [3 /*break*/, 25];
1897
1938
  case 24:
@@ -1908,13 +1949,13 @@ var BasicChart = function (_a) {
1908
1949
  ? undefined
1909
1950
  : (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1910
1951
  axisOptions: spec.valueAxisOptions,
1911
- series: ((_72 = spec.series) !== null && _72 !== void 0 ? _72 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1952
+ series: ((_95 = spec.series) !== null && _95 !== void 0 ? _95 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1912
1953
  getFormattingFromRange: getFormattingFromRange,
1913
1954
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1914
1955
  });
1915
1956
  secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1916
1957
  axisOptions: spec.secondaryValueAxisOptions,
1917
- series: ((_73 = spec.series) !== null && _73 !== void 0 ? _73 : []).filter(function (s) { return s.useSecondaryAxis; }),
1958
+ series: ((_96 = spec.series) !== null && _96 !== void 0 ? _96 : []).filter(function (s) { return s.useSecondaryAxis; }),
1918
1959
  getFormattingFromRange: getFormattingFromRange,
1919
1960
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1920
1961
  });
@@ -1962,14 +2003,14 @@ var BasicChart = function (_a) {
1962
2003
  ? VALUE_AXIS_TITLE_STANDOFF
1963
2004
  : legend_layout_1.BAND_GAP;
1964
2005
  legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
1965
- position: (_74 = spec.legend) === null || _74 === void 0 ? void 0 : _74.position,
2006
+ position: (_97 = spec.legend) === null || _97 === void 0 ? void 0 : _97.position,
1966
2007
  visible: showlegend !== false,
1967
2008
  labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
1968
- legendFontSize: (_77 = (_76 = (_75 = spec.legend) === null || _75 === void 0 ? void 0 : _75.textFormat) === null || _76 === void 0 ? void 0 : _76.fontSize) !== null && _77 !== void 0 ? _77 : axisFontSize,
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,
1969
2010
  width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
1970
2011
  height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
1971
2012
  hasTitle: Boolean(title),
1972
- titleFontSize: (_78 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _78 !== void 0 ? _78 : 16,
2013
+ titleFontSize: (_101 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _101 !== void 0 ? _101 : 16,
1973
2014
  hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
1974
2015
  hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
1975
2016
  leftAxisDepth: leftAxisDepth,
@@ -1977,24 +2018,32 @@ var BasicChart = function (_a) {
1977
2018
  bottomAxisTitleStandoff: bottomAxisTitleStandoff,
1978
2019
  axisFontSize: axisFontSize,
1979
2020
  });
1980
- newLayout = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ title: tslib_1.__assign({ text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat), font: applyTextFormatToFont({
2021
+ newLayout = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ title: tslib_1.__assign({ text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat), font: applyTextFormatToFont({
1981
2022
  family: "Untitled Sans, apple-system, sans-serif",
1982
2023
  size: 16,
1983
2024
  color: textColor,
1984
- }, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_79 = legendBand.legend) !== null && _79 !== void 0 ? _79 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
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") &&
1985
2026
  spec.stackedType
1986
2027
  ? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
1987
2028
  spec.stackedType === "PERCENT_STACKED"
1988
2029
  ? "stack"
1989
2030
  : "group" }, (isPercentStackedBars ? { barnorm: "percent" } : {})) : {})), (typeof spec.gapWidth === "number"
1990
2031
  ? { bargap: Math.max(0, Math.min(0.95, spec.gapWidth / 400)) }
2032
+ : spec.chartType === "histogram"
2033
+ ? // Excel's histogram columns touch by default (#1087).
2034
+ { bargap: 0 }
2035
+ : {})), (spec.chartType === "boxplot"
2036
+ ? {
2037
+ boxmode: "group",
2038
+ boxgap: Math.max(0, Math.min(0.95, (typeof spec.gapWidth === "number" ? spec.gapWidth : 150) / 400)),
2039
+ }
1991
2040
  : {})), { font: {
1992
2041
  family: "Untitled Sans, apple-system, sans-serif",
1993
2042
  size: 12,
1994
2043
  color: textColor,
1995
2044
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
1996
2045
  title: {
1997
- text: (_80 = spec.horizontalAxisTitle) !== null && _80 !== void 0 ? _80 : "",
2046
+ text: (_103 = spec.horizontalAxisTitle) !== null && _103 !== void 0 ? _103 : "",
1998
2047
  font: { color: textColor },
1999
2048
  standoff: bottomAxisTitleStandoff,
2000
2049
  },
@@ -2012,7 +2061,7 @@ var BasicChart = function (_a) {
2012
2061
  isHorizontalBarChart
2013
2062
  ? spec.valueAxisOptions
2014
2063
  : spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
2015
- title: tslib_1.__assign({ text: (_81 = spec.verticalAxisTitle) !== null && _81 !== void 0 ? _81 : "", font: { color: textColor } }, (isHorizontalBarChart
2064
+ title: tslib_1.__assign({ text: (_104 = spec.verticalAxisTitle) !== null && _104 !== void 0 ? _104 : "", font: { color: textColor } }, (isHorizontalBarChart
2016
2065
  ? {}
2017
2066
  : { standoff: VALUE_AXIS_TITLE_STANDOFF })),
2018
2067
  showgrid: !isHorizontalBarChart,