@rowsncolumns/charts 28.1.10 → 28.1.12

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.
@@ -509,9 +509,9 @@ var BasicChart = function (_a) {
509
509
  var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
510
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;
511
511
  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) {
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, _82, _83, _84, _85;
513
+ return tslib_1.__generator(this, function (_86) {
514
+ switch (_86.label) {
515
515
  case 0:
516
516
  (0, utils_1.debug)("Updating chart", chart);
517
517
  traces = [];
@@ -536,7 +536,7 @@ var BasicChart = function (_a) {
536
536
  });
537
537
  seriesInputs = [];
538
538
  i = 0;
539
- _82.label = 1;
539
+ _86.label = 1;
540
540
  case 1:
541
541
  if (!(i < spec.series.length)) return [3 /*break*/, 5];
542
542
  seriesEntry = spec.series[i];
@@ -545,13 +545,13 @@ var BasicChart = function (_a) {
545
545
  _a = chart_spec_utils_1.coerceCalculatedLabel;
546
546
  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
547
  case 2:
548
- resolvedLabel = _a.apply(void 0, [_82.sent()]);
549
- _82.label = 3;
548
+ resolvedLabel = _a.apply(void 0, [_86.sent()]);
549
+ _86.label = 3;
550
550
  case 3:
551
551
  xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
552
552
  sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
553
553
  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;
554
+ _86.label = 4;
555
555
  case 4:
556
556
  i++;
557
557
  return [3 /*break*/, 1];
@@ -824,7 +824,27 @@ var BasicChart = function (_a) {
824
824
  SUNBURST_ROOT_ID_1 = "__rnc_sunburst_root__";
825
825
  rootTotal = hierarchyData_1.values.reduce(function (sum, value, i) { return (hierarchyData_1.parents[i] === "" ? sum + value : sum); }, 0);
826
826
  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 ? {} : { textposition: "bottom left" }));
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,
828
+ // `dataLabels: { show: false }` turns the labels off (#1086).
829
+ textinfo: ((_19 = spec.dataLabels) === null || _19 === void 0 ? void 0 : _19.show) === false ? "none" : "label+value", branchvalues: "total" }, (isSunburst || ((_20 = spec.dataLabels) === null || _20 === void 0 ? void 0 : _20.show) === false
830
+ ? {}
831
+ : {
832
+ textposition: "bottom left",
833
+ // Excel labels a treemap's top-level categories (in a header
834
+ // strip, or not at all with parentLabelLayout "none") and its
835
+ // leaves; the levels in between are never labelled (#1072).
836
+ text: hierarchyData_1.labels.map(function () { return ""; }),
837
+ texttemplate: hierarchyData_1.ids.map(function (id, i) {
838
+ var isLeaf = !hierarchyData_1.parents.includes(id);
839
+ if (isLeaf)
840
+ return "%{label}<br>%{value}";
841
+ var isTopLevel = hierarchyData_1.depths[i] === 0;
842
+ return isTopLevel &&
843
+ spec.parentLabelLayout !== "none"
844
+ ? "%{label}"
845
+ : "%{text}";
846
+ }),
847
+ }));
828
848
  layoutForHierarchy = {
829
849
  title: {
830
850
  text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
@@ -864,7 +884,7 @@ var BasicChart = function (_a) {
864
884
  // country-name matching and silently skips labels it can't place.
865
885
  if ((0, region_map_1.isRegionMapSpec)(spec)) {
866
886
  labels = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : "").trim(); });
867
- seriesEntry = (_19 = spec.series) === null || _19 === void 0 ? void 0 : _19[0];
887
+ seriesEntry = (_21 = spec.series) === null || _21 === void 0 ? void 0 : _21[0];
868
888
  rawValues_1 = seriesEntry
869
889
  ? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
870
890
  : [];
@@ -929,34 +949,34 @@ var BasicChart = function (_a) {
929
949
  if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
930
950
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
931
951
  surfaceSeriesInputs = [];
932
- _82.label = 7;
952
+ _86.label = 7;
933
953
  case 7:
934
- _82.trys.push([7, 14, 15, 16]);
935
- _c = tslib_1.__values((_20 = spec.series) !== null && _20 !== void 0 ? _20 : []), _d = _c.next();
936
- _82.label = 8;
954
+ _86.trys.push([7, 14, 15, 16]);
955
+ _c = tslib_1.__values((_22 = spec.series) !== null && _22 !== void 0 ? _22 : []), _d = _c.next();
956
+ _86.label = 8;
937
957
  case 8:
938
958
  if (!!_d.done) return [3 /*break*/, 13];
939
959
  seriesEntry = _d.value;
940
960
  if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 10];
941
961
  _f = chart_spec_utils_1.coerceCalculatedLabel;
942
- return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_21 = position.sheetId) !== null && _21 !== void 0 ? _21 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
962
+ return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_23 = position.sheetId) !== null && _23 !== void 0 ? _23 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
943
963
  case 9:
944
- _e = _f.apply(void 0, [_82.sent()]);
964
+ _e = _f.apply(void 0, [_86.sent()]);
945
965
  return [3 /*break*/, 11];
946
966
  case 10:
947
- _e = (_22 = seriesEntry.dataLabel) !== null && _22 !== void 0 ? _22 : "";
948
- _82.label = 11;
967
+ _e = (_24 = seriesEntry.dataLabel) !== null && _24 !== void 0 ? _24 : "";
968
+ _86.label = 11;
949
969
  case 11:
950
970
  dataLabel = _e;
951
971
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
952
972
  surfaceSeriesInputs.push({ name: dataLabel, values: values });
953
- _82.label = 12;
973
+ _86.label = 12;
954
974
  case 12:
955
975
  _d = _c.next();
956
976
  return [3 /*break*/, 8];
957
977
  case 13: return [3 /*break*/, 16];
958
978
  case 14:
959
- e_2_1 = _82.sent();
979
+ e_2_1 = _86.sent();
960
980
  e_2 = { error: e_2_1 };
961
981
  return [3 /*break*/, 16];
962
982
  case 15:
@@ -984,21 +1004,21 @@ var BasicChart = function (_a) {
984
1004
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, margin: { l: 60, r: 20, t: 50, b: 50 } }, (surfaceToken === "SURFACE"
985
1005
  ? {
986
1006
  xaxis: {
987
- title: { text: (_23 = spec.horizontalAxisTitle) !== null && _23 !== void 0 ? _23 : "" },
1007
+ title: { text: (_25 = spec.horizontalAxisTitle) !== null && _25 !== void 0 ? _25 : "" },
988
1008
  automargin: true,
989
1009
  color: textColor,
990
1010
  },
991
1011
  yaxis: {
992
- title: { text: (_24 = spec.verticalAxisTitle) !== null && _24 !== void 0 ? _24 : "" },
1012
+ title: { text: (_26 = spec.verticalAxisTitle) !== null && _26 !== void 0 ? _26 : "" },
993
1013
  automargin: true,
994
1014
  color: textColor,
995
1015
  },
996
1016
  }
997
1017
  : {
998
1018
  scene: {
999
- xaxis: { title: { text: (_25 = spec.horizontalAxisTitle) !== null && _25 !== void 0 ? _25 : "" } },
1019
+ xaxis: { title: { text: (_27 = spec.horizontalAxisTitle) !== null && _27 !== void 0 ? _27 : "" } },
1000
1020
  yaxis: { title: { text: "" } },
1001
- zaxis: { title: { text: (_26 = spec.verticalAxisTitle) !== null && _26 !== void 0 ? _26 : "" } },
1021
+ zaxis: { title: { text: (_28 = spec.verticalAxisTitle) !== null && _28 !== void 0 ? _28 : "" } },
1002
1022
  },
1003
1023
  }));
1004
1024
  setPlotData([surfaceTrace]);
@@ -1010,11 +1030,11 @@ var BasicChart = function (_a) {
1010
1030
  // theta = the category names (closed by appending the first point).
1011
1031
  if (spec.chartType === "radar") {
1012
1032
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1013
- radarStyle = (_27 = spec.radarStyle) !== null && _27 !== void 0 ? _27 : "standard";
1033
+ radarStyle = (_29 = spec.radarStyle) !== null && _29 !== void 0 ? _29 : "standard";
1014
1034
  radarTraces = [];
1015
1035
  radarInputs = [];
1016
1036
  try {
1017
- for (_g = tslib_1.__values((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
1037
+ for (_g = tslib_1.__values((_30 = spec.series) !== null && _30 !== void 0 ? _30 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
1018
1038
  seriesEntry = _h.value;
1019
1039
  label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
1020
1040
  ? seriesEntry.dataLabel
@@ -1034,7 +1054,7 @@ var BasicChart = function (_a) {
1034
1054
  indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
1035
1055
  _loop_1 = function (i) {
1036
1056
  var input = radarInputs[i];
1037
- 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;
1057
+ var seriesColor = (_33 = (_32 = (_31 = spec.series) === null || _31 === void 0 ? void 0 : _31[i]) === null || _32 === void 0 ? void 0 : _32.color) !== null && _33 !== void 0 ? _33 : undefined;
1038
1058
  var r = indicators.map(function (_, idx) { var _a; return (_a = input.values[idx]) !== null && _a !== void 0 ? _a : 0; });
1039
1059
  var theta = indicators.map(function (ind) { return ind.name; });
1040
1060
  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 } } : {})));
@@ -1042,7 +1062,7 @@ var BasicChart = function (_a) {
1042
1062
  for (i = 0; i < radarInputs.length; i++) {
1043
1063
  _loop_1(i);
1044
1064
  }
1045
- radarScale = (_32 = indicators[0]) !== null && _32 !== void 0 ? _32 : { min: 0, max: 1 };
1065
+ radarScale = (_34 = indicators[0]) !== null && _34 !== void 0 ? _34 : { min: 0, max: 1 };
1046
1066
  setPlotData(radarTraces);
1047
1067
  setLayout({
1048
1068
  title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) },
@@ -1066,13 +1086,13 @@ var BasicChart = function (_a) {
1066
1086
  // V-variants additionally get a volume column sub-pane below the
1067
1087
  // price plot.
1068
1088
  if (spec.chartType === "stock") {
1069
- variant = ((_33 = spec.stockVariant) !== null && _33 !== void 0 ? _33 : "HLC");
1089
+ variant = ((_35 = spec.stockVariant) !== null && _35 !== void 0 ? _35 : "HLC");
1070
1090
  categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1071
- seriesValues = ((_34 = spec.series) !== null && _34 !== void 0 ? _34 : []).map(function (seriesEntry) {
1091
+ seriesValues = ((_36 = spec.series) !== null && _36 !== void 0 ? _36 : []).map(function (seriesEntry) {
1072
1092
  return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
1073
1093
  });
1074
1094
  volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
1075
- hasVolume = ((_35 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _35 !== void 0 ? _35 : 0) > 0;
1095
+ hasVolume = ((_37 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _37 !== void 0 ? _37 : 0) > 0;
1076
1096
  buildVolumeTrace = function (xs) {
1077
1097
  return ({
1078
1098
  type: "bar",
@@ -1105,25 +1125,25 @@ var BasicChart = function (_a) {
1105
1125
  roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
1106
1126
  xs_1 = categories.length > 0
1107
1127
  ? categories
1108
- : ((_36 = roles.close) !== null && _36 !== void 0 ? _36 : []).map(function (_, i) { return i + 1; });
1128
+ : ((_38 = roles.close) !== null && _38 !== void 0 ? _38 : []).map(function (_, i) { return i + 1; });
1109
1129
  candleTrace = {
1110
1130
  type: "candlestick",
1111
1131
  x: xs_1,
1112
- open: ((_37 = roles.open) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1113
- high: ((_38 = roles.high) !== null && _38 !== void 0 ? _38 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1114
- low: ((_39 = roles.low) !== null && _39 !== void 0 ? _39 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1115
- close: ((_40 = roles.close) !== null && _40 !== void 0 ? _40 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1132
+ open: ((_39 = roles.open) !== null && _39 !== void 0 ? _39 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1133
+ high: ((_40 = roles.high) !== null && _40 !== void 0 ? _40 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1134
+ low: ((_41 = roles.low) !== null && _41 !== void 0 ? _41 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1135
+ close: ((_42 = roles.close) !== null && _42 !== void 0 ? _42 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
1116
1136
  increasing: { line: { color: theme.themeColors.accent1 } },
1117
1137
  decreasing: { line: { color: theme.themeColors.accent2 } },
1118
1138
  };
1119
1139
  setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
1120
1140
  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: {
1121
- title: { text: (_41 = spec.horizontalAxisTitle) !== null && _41 !== void 0 ? _41 : "" },
1141
+ title: { text: (_43 = spec.horizontalAxisTitle) !== null && _43 !== void 0 ? _43 : "" },
1122
1142
  automargin: true,
1123
1143
  showgrid: true,
1124
1144
  gridcolor: gridColor,
1125
1145
  rangeslider: { visible: false },
1126
- }, 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 }));
1146
+ }, yaxis: tslib_1.__assign({ title: { text: (_44 = spec.verticalAxisTitle) !== null && _44 !== void 0 ? _44 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1127
1147
  return [2 /*return*/];
1128
1148
  }
1129
1149
  lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
@@ -1135,7 +1155,7 @@ var BasicChart = function (_a) {
1135
1155
  ]);
1136
1156
  xs_2 = categories.length > 0
1137
1157
  ? categories
1138
- : ((_44 = (_43 = lineSeries[0]) === null || _43 === void 0 ? void 0 : _43.values) !== null && _44 !== void 0 ? _44 : []).map(function (_, i) { return i + 1; });
1158
+ : ((_46 = (_45 = lineSeries[0]) === null || _45 === void 0 ? void 0 : _45.values) !== null && _46 !== void 0 ? _46 : []).map(function (_, i) { return i + 1; });
1139
1159
  stockTraces = lineSeries.map(function (s, i) { return ({
1140
1160
  type: "scatter",
1141
1161
  mode: "lines",
@@ -1146,11 +1166,11 @@ var BasicChart = function (_a) {
1146
1166
  }); });
1147
1167
  setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
1148
1168
  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: {
1149
- title: { text: (_45 = spec.horizontalAxisTitle) !== null && _45 !== void 0 ? _45 : "" },
1169
+ title: { text: (_47 = spec.horizontalAxisTitle) !== null && _47 !== void 0 ? _47 : "" },
1150
1170
  automargin: true,
1151
1171
  showgrid: true,
1152
1172
  gridcolor: gridColor,
1153
- }, 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 }));
1173
+ }, yaxis: tslib_1.__assign({ title: { text: (_48 = spec.verticalAxisTitle) !== null && _48 !== void 0 ? _48 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
1154
1174
  return [2 /*return*/];
1155
1175
  }
1156
1176
  isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
@@ -1197,12 +1217,12 @@ var BasicChart = function (_a) {
1197
1217
  return extra;
1198
1218
  };
1199
1219
  shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
1200
- 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];
1220
+ primaryDomainSource = (_51 = (_50 = (_49 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _49 === void 0 ? void 0 : _49[0]) === null || _50 === void 0 ? void 0 : _50.sources) === null || _51 === void 0 ? void 0 : _51[0];
1201
1221
  rawPrimaryDomainValues = primaryDomainSource
1202
- ? (0, aggregation_1.sanitizeDomainValues)((_50 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _50 !== void 0 ? _50 : [])
1222
+ ? (0, aggregation_1.sanitizeDomainValues)((_52 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _52 !== void 0 ? _52 : [])
1203
1223
  : [];
1204
1224
  domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
1205
- categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_51 = spec.categoryLevels) === null || _51 === void 0 ? void 0 : _51.map(function (level) {
1225
+ categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_53 = spec.categoryLevels) === null || _53 === void 0 ? void 0 : _53.map(function (level) {
1206
1226
  return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
1207
1227
  }));
1208
1228
  multicategoryX = categoryLevels
@@ -1212,7 +1232,7 @@ var BasicChart = function (_a) {
1212
1232
  domainData = categoryLevels.leaf;
1213
1233
  }
1214
1234
  aggregateDomainValues = domainData;
1215
- domainAxisData = (categoryLevels ? [] : (_52 = spec.domains) !== null && _52 !== void 0 ? _52 : []).map(function (domain, domainIndex) {
1235
+ domainAxisData = (categoryLevels ? [] : (_54 = spec.domains) !== null && _54 !== void 0 ? _54 : []).map(function (domain, domainIndex) {
1216
1236
  return domain.sources.flatMap(function (sheetRange, sourceIndex) {
1217
1237
  var _a;
1218
1238
  if (domainIndex === 0 && sourceIndex === 0) {
@@ -1469,29 +1489,29 @@ var BasicChart = function (_a) {
1469
1489
  finally { if (e_8) throw e_8.error; }
1470
1490
  }
1471
1491
  };
1472
- 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 : [];
1492
+ domainSources = (_57 = (_56 = (_55 = spec.domains) === null || _55 === void 0 ? void 0 : _55[0]) === null || _56 === void 0 ? void 0 : _56.sources) !== null && _57 !== void 0 ? _57 : [];
1473
1493
  seriesIndex = 0;
1474
1494
  _loop_2 = function (series) {
1475
- 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;
1476
- return tslib_1.__generator(this, function (_89) {
1477
- switch (_89.label) {
1495
+ var currentSeriesIndex, dataLabel, _87, _88, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, binningOptions, categories, prebinned, _89, labels, counts, cumulativePercents, barTrace, paretoLineColor, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, increaseColor, trace, rawValues, trace, pieData, _90, 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, _91, x, y, orientation_1, trace, numericValues, _92, x, y, orientation_2, trace;
1496
+ return tslib_1.__generator(this, function (_93) {
1497
+ switch (_93.label) {
1478
1498
  case 0:
1479
1499
  currentSeriesIndex = seriesIndex++;
1480
1500
  if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1481
- _84 = chart_spec_utils_1.coerceCalculatedLabel;
1482
- return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_57 = position.sheetId) !== null && _57 !== void 0 ? _57 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1501
+ _88 = chart_spec_utils_1.coerceCalculatedLabel;
1502
+ return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_59 = position.sheetId) !== null && _59 !== void 0 ? _59 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1483
1503
  case 1:
1484
- _83 = _84.apply(void 0, [_89.sent()]);
1504
+ _87 = _88.apply(void 0, [_93.sent()]);
1485
1505
  return [3 /*break*/, 3];
1486
1506
  case 2:
1487
- _83 = (_58 = series.dataLabel) !== null && _58 !== void 0 ? _58 : "";
1488
- _89.label = 3;
1507
+ _87 = (_60 = series.dataLabel) !== null && _60 !== void 0 ? _60 : "";
1508
+ _93.label = 3;
1489
1509
  case 3:
1490
- dataLabel = _83;
1510
+ dataLabel = _87;
1491
1511
  // A series with no ranges draws nothing.
1492
1512
  if (series.sources.length === 0)
1493
1513
  return [2 /*return*/, "continue"];
1494
- effectiveChartType = (_59 = series.seriesChartType) !== null && _59 !== void 0 ? _59 : spec.chartType;
1514
+ effectiveChartType = (_61 = series.seriesChartType) !== null && _61 !== void 0 ? _61 : spec.chartType;
1495
1515
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1496
1516
  pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
1497
1517
  (domainSources.length > 1 || series.sources.length > 1)
@@ -1526,36 +1546,58 @@ var BasicChart = function (_a) {
1526
1546
  if (effectiveChartType === "histogram") {
1527
1547
  rawValues = seriesValuesOf(seriesData);
1528
1548
  binCount = spec.binCount;
1549
+ binningOptions = {
1550
+ binSize: spec.binSize,
1551
+ intervalClosed: spec.intervalClosed,
1552
+ overflow: spec.overflow,
1553
+ underflow: spec.underflow,
1554
+ };
1555
+ categories = domainData;
1556
+ prebinned = categories.length
1557
+ ? (0, histogram_1.aggregateByCategory)(categories, rawValues, (_62 = series.aggregateType) !== null && _62 !== void 0 ? _62 : "SUM")
1558
+ : (0, histogram_1.hasExcelBinning)(binningOptions)
1559
+ ? (0, histogram_1.binHistogram)(rawValues, binCount, binningOptions)
1560
+ : null;
1529
1561
  if (isPareto) {
1530
- _85 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _85.labels, counts = _85.counts, cumulativePercents = _85.cumulativePercents;
1562
+ _89 = (0, histogram_1.computePareto)(prebinned !== null && prebinned !== void 0 ? prebinned : (0, histogram_1.binHistogram)(rawValues, binCount)), labels = _89.labels, counts = _89.counts, cumulativePercents = _89.cumulativePercents;
1531
1563
  barTrace = {
1532
1564
  type: "bar",
1533
1565
  x: labels,
1534
1566
  y: counts,
1535
1567
  name: dataLabel,
1536
1568
  };
1537
- applyTraceColor(barTrace, (_60 = series.color) !== null && _60 !== void 0 ? _60 : undefined, {
1569
+ applyTraceColor(barTrace, (_63 = series.color) !== null && _63 !== void 0 ? _63 : undefined, {
1538
1570
  noFill: series.noFill,
1539
1571
  dataPointColors: series.dataPointColors,
1540
1572
  seriesIndex: currentSeriesIndex,
1541
1573
  effectiveChartType: effectiveChartType,
1542
1574
  });
1543
1575
  traces.push(barTrace);
1544
- traces.push({
1545
- type: "scatter",
1546
- mode: "lines+markers",
1547
- x: labels,
1548
- y: cumulativePercents,
1549
- name: "Cumulative %",
1550
- yaxis: "y2",
1551
- });
1576
+ paretoLineColor = spec.paretoLineColor;
1577
+ // Excel draws the Pareto line without markers.
1578
+ traces.push(tslib_1.__assign({ type: "scatter", mode: "lines", x: labels, y: cumulativePercents, name: "Cumulative %", yaxis: "y2" }, (paretoLineColor ? { line: { color: paretoLineColor } } : {})));
1552
1579
  hasSecondaryAxis = true;
1553
1580
  }
1581
+ else if (prebinned) {
1582
+ barTrace = {
1583
+ type: "bar",
1584
+ x: prebinned.labels,
1585
+ y: prebinned.counts,
1586
+ name: dataLabel,
1587
+ };
1588
+ applyTraceColor(barTrace, (_64 = series.color) !== null && _64 !== void 0 ? _64 : undefined, {
1589
+ noFill: series.noFill,
1590
+ dataPointColors: series.dataPointColors,
1591
+ seriesIndex: currentSeriesIndex,
1592
+ effectiveChartType: effectiveChartType,
1593
+ });
1594
+ traces.push(barTrace);
1595
+ }
1554
1596
  else {
1555
1597
  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
1556
1598
  ? { nbinsx: binCount }
1557
1599
  : {}));
1558
- applyTraceColor(trace, (_61 = series.color) !== null && _61 !== void 0 ? _61 : undefined, {
1600
+ applyTraceColor(trace, (_65 = series.color) !== null && _65 !== void 0 ? _65 : undefined, {
1559
1601
  noFill: series.noFill,
1560
1602
  dataPointColors: series.dataPointColors,
1561
1603
  seriesIndex: currentSeriesIndex,
@@ -1603,7 +1645,7 @@ var BasicChart = function (_a) {
1603
1645
  // default and `showOutliers: true` alike).
1604
1646
  boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
1605
1647
  }
1606
- applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
1648
+ applyTraceColor(trace, (_66 = series.color) !== null && _66 !== void 0 ? _66 : undefined, {
1607
1649
  noFill: series.noFill,
1608
1650
  dataPointColors: series.dataPointColors,
1609
1651
  seriesIndex: currentSeriesIndex,
@@ -1613,8 +1655,8 @@ var BasicChart = function (_a) {
1613
1655
  }
1614
1656
  else if (effectiveChartType === "waterfall") {
1615
1657
  rawValues = seriesValuesOf(seriesData);
1616
- totalIndices_1 = new Set((_63 = spec.totalIndices) !== null && _63 !== void 0 ? _63 : []);
1617
- increaseColor = (_64 = series.color) !== null && _64 !== void 0 ? _64 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
1658
+ totalIndices_1 = new Set((_67 = spec.totalIndices) !== null && _67 !== void 0 ? _67 : []);
1659
+ increaseColor = (_68 = series.color) !== null && _68 !== void 0 ? _68 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
1618
1660
  trace = {
1619
1661
  type: "waterfall",
1620
1662
  x: categoriesFor(series),
@@ -1626,10 +1668,10 @@ var BasicChart = function (_a) {
1626
1668
  increasing: { marker: { color: increaseColor } },
1627
1669
  decreasing: {
1628
1670
  marker: {
1629
- color: (_66 = (_65 = series.negativeColor) !== null && _65 !== void 0 ? _65 : theme.themeColors.accent2) !== null && _66 !== void 0 ? _66 : increaseColor,
1671
+ color: (_70 = (_69 = series.negativeColor) !== null && _69 !== void 0 ? _69 : theme.themeColors.accent2) !== null && _70 !== void 0 ? _70 : increaseColor,
1630
1672
  },
1631
1673
  },
1632
- totals: { marker: { color: (_67 = theme.themeColors.accent3) !== null && _67 !== void 0 ? _67 : increaseColor } },
1674
+ totals: { marker: { color: (_71 = theme.themeColors.accent3) !== null && _71 !== void 0 ? _71 : increaseColor } },
1633
1675
  connector: {
1634
1676
  line: {
1635
1677
  color: isDarkMode ? "rgba(255,255,255,0.45)" : "#999999",
@@ -1649,7 +1691,7 @@ var BasicChart = function (_a) {
1649
1691
  name: dataLabel,
1650
1692
  textinfo: "none",
1651
1693
  };
1652
- applyTraceColor(trace, (_68 = series.color) !== null && _68 !== void 0 ? _68 : undefined, {
1694
+ applyTraceColor(trace, (_72 = series.color) !== null && _72 !== void 0 ? _72 : undefined, {
1653
1695
  noFill: series.noFill,
1654
1696
  dataPointColors: series.dataPointColors,
1655
1697
  seriesIndex: currentSeriesIndex,
@@ -1667,10 +1709,10 @@ var BasicChart = function (_a) {
1667
1709
  return [2 /*return*/, "continue"];
1668
1710
  ofPieHandled = true;
1669
1711
  pieData = seriesData;
1670
- _86 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1712
+ _90 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
1671
1713
  splitType: spec.splitType,
1672
1714
  splitPos: spec.splitPos,
1673
- }), main_1 = _86.main, secondary = _86.secondary, otherTotal = _86.otherTotal, total = _86.total;
1715
+ }), main_1 = _90.main, secondary = _90.secondary, otherTotal = _90.otherTotal, total = _90.total;
1674
1716
  ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
1675
1717
  secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
1676
1718
  halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
@@ -1803,7 +1845,7 @@ var BasicChart = function (_a) {
1803
1845
  trace.meta = {
1804
1846
  rncSeriesIndex: currentSeriesIndex,
1805
1847
  };
1806
- applyTraceColor(trace, (_69 = series.color) !== null && _69 !== void 0 ? _69 : undefined, {
1848
+ applyTraceColor(trace, (_73 = series.color) !== null && _73 !== void 0 ? _73 : undefined, {
1807
1849
  noFill: series.noFill,
1808
1850
  dataPointColors: series.dataPointColors,
1809
1851
  seriesIndex: currentSeriesIndex,
@@ -1812,13 +1854,13 @@ var BasicChart = function (_a) {
1812
1854
  traces.push(trace);
1813
1855
  }
1814
1856
  else if ("values" in seriesData && "labels" in seriesData) {
1815
- _87 = assignCartesianData(categoriesFor(series), seriesData.values), x = _87.x, y = _87.y, orientation_1 = _87.orientation;
1857
+ _91 = assignCartesianData(categoriesFor(series), seriesData.values), x = _91.x, y = _91.y, orientation_1 = _91.orientation;
1816
1858
  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));
1817
1859
  // Ties the trace back to spec.series for click selection
1818
1860
  trace.meta = {
1819
1861
  rncSeriesIndex: currentSeriesIndex,
1820
1862
  };
1821
- applyTraceColor(trace, (_70 = series.color) !== null && _70 !== void 0 ? _70 : undefined, {
1863
+ applyTraceColor(trace, (_74 = series.color) !== null && _74 !== void 0 ? _74 : undefined, {
1822
1864
  noFill: series.noFill,
1823
1865
  dataPointColors: series.dataPointColors,
1824
1866
  invertIfNegative: series.invertIfNegative,
@@ -1833,13 +1875,13 @@ var BasicChart = function (_a) {
1833
1875
  }
1834
1876
  else {
1835
1877
  numericValues = seriesData;
1836
- _88 = assignCartesianData(categoriesFor(series), numericValues), x = _88.x, y = _88.y, orientation_2 = _88.orientation;
1878
+ _92 = assignCartesianData(categoriesFor(series), numericValues), x = _92.x, y = _92.y, orientation_2 = _92.orientation;
1837
1879
  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));
1838
1880
  // Ties the trace back to spec.series for click selection
1839
1881
  trace.meta = {
1840
1882
  rncSeriesIndex: currentSeriesIndex,
1841
1883
  };
1842
- applyTraceColor(trace, (_71 = series.color) !== null && _71 !== void 0 ? _71 : undefined, {
1884
+ applyTraceColor(trace, (_75 = series.color) !== null && _75 !== void 0 ? _75 : undefined, {
1843
1885
  noFill: series.noFill,
1844
1886
  dataPointColors: series.dataPointColors,
1845
1887
  invertIfNegative: series.invertIfNegative,
@@ -1856,24 +1898,24 @@ var BasicChart = function (_a) {
1856
1898
  }
1857
1899
  });
1858
1900
  };
1859
- _82.label = 18;
1901
+ _86.label = 18;
1860
1902
  case 18:
1861
- _82.trys.push([18, 23, 24, 25]);
1862
- _j = tslib_1.__values((_56 = spec.series) !== null && _56 !== void 0 ? _56 : []), _k = _j.next();
1863
- _82.label = 19;
1903
+ _86.trys.push([18, 23, 24, 25]);
1904
+ _j = tslib_1.__values((_58 = spec.series) !== null && _58 !== void 0 ? _58 : []), _k = _j.next();
1905
+ _86.label = 19;
1864
1906
  case 19:
1865
1907
  if (!!_k.done) return [3 /*break*/, 22];
1866
1908
  series = _k.value;
1867
1909
  return [5 /*yield**/, _loop_2(series)];
1868
1910
  case 20:
1869
- _82.sent();
1870
- _82.label = 21;
1911
+ _86.sent();
1912
+ _86.label = 21;
1871
1913
  case 21:
1872
1914
  _k = _j.next();
1873
1915
  return [3 /*break*/, 19];
1874
1916
  case 22: return [3 /*break*/, 25];
1875
1917
  case 23:
1876
- e_3_1 = _82.sent();
1918
+ e_3_1 = _86.sent();
1877
1919
  e_3 = { error: e_3_1 };
1878
1920
  return [3 /*break*/, 25];
1879
1921
  case 24:
@@ -1890,13 +1932,13 @@ var BasicChart = function (_a) {
1890
1932
  ? undefined
1891
1933
  : (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1892
1934
  axisOptions: spec.valueAxisOptions,
1893
- series: ((_72 = spec.series) !== null && _72 !== void 0 ? _72 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1935
+ series: ((_76 = spec.series) !== null && _76 !== void 0 ? _76 : []).filter(function (s) { return !s.useSecondaryAxis; }),
1894
1936
  getFormattingFromRange: getFormattingFromRange,
1895
1937
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1896
1938
  });
1897
1939
  secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
1898
1940
  axisOptions: spec.secondaryValueAxisOptions,
1899
- series: ((_73 = spec.series) !== null && _73 !== void 0 ? _73 : []).filter(function (s) { return s.useSecondaryAxis; }),
1941
+ series: ((_77 = spec.series) !== null && _77 !== void 0 ? _77 : []).filter(function (s) { return s.useSecondaryAxis; }),
1900
1942
  getFormattingFromRange: getFormattingFromRange,
1901
1943
  hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
1902
1944
  });
@@ -1944,14 +1986,14 @@ var BasicChart = function (_a) {
1944
1986
  ? VALUE_AXIS_TITLE_STANDOFF
1945
1987
  : legend_layout_1.BAND_GAP;
1946
1988
  legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
1947
- position: (_74 = spec.legend) === null || _74 === void 0 ? void 0 : _74.position,
1989
+ position: (_78 = spec.legend) === null || _78 === void 0 ? void 0 : _78.position,
1948
1990
  visible: showlegend !== false,
1949
1991
  labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
1950
- 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,
1992
+ legendFontSize: (_81 = (_80 = (_79 = spec.legend) === null || _79 === void 0 ? void 0 : _79.textFormat) === null || _80 === void 0 ? void 0 : _80.fontSize) !== null && _81 !== void 0 ? _81 : axisFontSize,
1951
1993
  width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
1952
1994
  height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
1953
1995
  hasTitle: Boolean(title),
1954
- titleFontSize: (_78 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _78 !== void 0 ? _78 : 16,
1996
+ titleFontSize: (_82 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _82 !== void 0 ? _82 : 16,
1955
1997
  hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
1956
1998
  hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
1957
1999
  leftAxisDepth: leftAxisDepth,
@@ -1963,20 +2005,23 @@ var BasicChart = function (_a) {
1963
2005
  family: "Untitled Sans, apple-system, sans-serif",
1964
2006
  size: 16,
1965
2007
  color: textColor,
1966
- }, 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") &&
2008
+ }, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_83 = legendBand.legend) !== null && _83 !== void 0 ? _83 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
1967
2009
  spec.stackedType
1968
2010
  ? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
1969
2011
  spec.stackedType === "PERCENT_STACKED"
1970
2012
  ? "stack"
1971
2013
  : "group" }, (isPercentStackedBars ? { barnorm: "percent" } : {})) : {})), (typeof spec.gapWidth === "number"
1972
2014
  ? { bargap: Math.max(0, Math.min(0.95, spec.gapWidth / 400)) }
1973
- : {})), { font: {
2015
+ : spec.chartType === "histogram"
2016
+ ? // Excel's histogram columns touch by default (#1087).
2017
+ { bargap: 0 }
2018
+ : {})), { font: {
1974
2019
  family: "Untitled Sans, apple-system, sans-serif",
1975
2020
  size: 12,
1976
2021
  color: textColor,
1977
2022
  }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
1978
2023
  title: {
1979
- text: (_80 = spec.horizontalAxisTitle) !== null && _80 !== void 0 ? _80 : "",
2024
+ text: (_84 = spec.horizontalAxisTitle) !== null && _84 !== void 0 ? _84 : "",
1980
2025
  font: { color: textColor },
1981
2026
  standoff: bottomAxisTitleStandoff,
1982
2027
  },
@@ -1994,7 +2039,7 @@ var BasicChart = function (_a) {
1994
2039
  isHorizontalBarChart
1995
2040
  ? spec.valueAxisOptions
1996
2041
  : spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
1997
- title: tslib_1.__assign({ text: (_81 = spec.verticalAxisTitle) !== null && _81 !== void 0 ? _81 : "", font: { color: textColor } }, (isHorizontalBarChart
2042
+ title: tslib_1.__assign({ text: (_85 = spec.verticalAxisTitle) !== null && _85 !== void 0 ? _85 : "", font: { color: textColor } }, (isHorizontalBarChart
1998
2043
  ? {}
1999
2044
  : { standoff: VALUE_AXIS_TITLE_STANDOFF })),
2000
2045
  showgrid: !isHorizontalBarChart,