@rowsncolumns/charts 28.1.2 → 28.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
  2. package/dist/cjs/basic-chart/basic-chart.js +152 -88
  3. package/dist/cjs/basic-chart/helpers.d.ts +9 -0
  4. package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
  5. package/dist/cjs/basic-chart/helpers.js +55 -1
  6. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  7. package/dist/cjs/plotly/basic-chart/basic-chart.js +225 -140
  8. package/dist/cjs/plotly/plot.d.ts +12 -0
  9. package/dist/cjs/plotly/plot.d.ts.map +1 -0
  10. package/dist/cjs/plotly/plot.js +8 -0
  11. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  12. package/dist/cjs/utils/axis-number-format.d.ts +14 -0
  13. package/dist/cjs/utils/axis-number-format.d.ts.map +1 -1
  14. package/dist/cjs/utils/axis-number-format.js +41 -1
  15. package/dist/cjs/utils/empty-cells.d.ts +9 -0
  16. package/dist/cjs/utils/empty-cells.d.ts.map +1 -1
  17. package/dist/cjs/utils/empty-cells.js +26 -1
  18. package/dist/cjs/utils/legend-layout.d.ts +168 -0
  19. package/dist/cjs/utils/legend-layout.d.ts.map +1 -0
  20. package/dist/cjs/utils/legend-layout.js +338 -0
  21. package/dist/cjs/utils/trendline.d.ts +18 -5
  22. package/dist/cjs/utils/trendline.d.ts.map +1 -1
  23. package/dist/cjs/utils/trendline.js +38 -16
  24. package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
  25. package/dist/esm/basic-chart/basic-chart.js +118 -47
  26. package/dist/esm/basic-chart/helpers.d.ts +9 -0
  27. package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
  28. package/dist/esm/basic-chart/helpers.js +30 -0
  29. package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  30. package/dist/esm/plotly/basic-chart/basic-chart.js +140 -13
  31. package/dist/esm/plotly/plot.d.ts +12 -0
  32. package/dist/esm/plotly/plot.d.ts.map +1 -0
  33. package/dist/esm/plotly/plot.js +12 -0
  34. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  35. package/dist/esm/utils/axis-number-format.d.ts +14 -0
  36. package/dist/esm/utils/axis-number-format.d.ts.map +1 -1
  37. package/dist/esm/utils/axis-number-format.js +36 -0
  38. package/dist/esm/utils/empty-cells.d.ts +9 -0
  39. package/dist/esm/utils/empty-cells.d.ts.map +1 -1
  40. package/dist/esm/utils/empty-cells.js +21 -0
  41. package/dist/esm/utils/legend-layout.d.ts +168 -0
  42. package/dist/esm/utils/legend-layout.d.ts.map +1 -0
  43. package/dist/esm/utils/legend-layout.js +299 -0
  44. package/dist/esm/utils/trendline.d.ts +18 -5
  45. package/dist/esm/utils/trendline.d.ts.map +1 -1
  46. package/dist/esm/utils/trendline.js +36 -16
  47. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"basic-chart.d.ts","sourceRoot":"","sources":["../../../basic-chart/basic-chart.tsx"],"names":[],"mappings":"AA4DA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA0PrD,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAkEnD,eAAO,MAAM,UAAU,GAAI,wOAiBxB,eAAe,sBAmuGjB,CAAC"}
1
+ {"version":3,"file":"basic-chart.d.ts","sourceRoot":"","sources":["../../../basic-chart/basic-chart.tsx"],"names":[],"mappings":"AA4DA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAmQrD,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAqEnD,eAAO,MAAM,UAAU,GAAI,wOAiBxB,eAAe,sBAmzGjB,CAAC"}
@@ -29,6 +29,7 @@ var category_levels_1 = require("../utils/category-levels");
29
29
  var gradient_1 = require("../utils/gradient");
30
30
  var hierarchy_1 = require("../utils/hierarchy");
31
31
  var histogram_1 = require("../utils/histogram");
32
+ var legend_layout_1 = require("../utils/legend-layout");
32
33
  var of_pie_1 = require("../utils/of-pie");
33
34
  var overrides_1 = require("../utils/overrides");
34
35
  var radar_1 = require("../utils/radar");
@@ -188,6 +189,8 @@ var defaultLegendConfig = {
188
189
  itemHeight: 4,
189
190
  top: 20,
190
191
  };
192
+ /** Category-axis title gap: clears one row of tick labels (#986). */
193
+ var CATEGORY_AXIS_NAME_GAP = (0, legend_layout_1.categoryAxisNameGap)();
191
194
  var BasicChart = function (_a) {
192
195
  var _b;
193
196
  var width = _a.width, height = _a.height, chart = _a.chart, theme = _a.theme, isDarkMode = _a.isDarkMode, sheetId = _a.sheetId, readonly = _a.readonly, getDomainValuesFromRange = _a.getDomainValuesFromRange, getSeriesValuesFromRange = _a.getSeriesValuesFromRange, getFormattingFromRange = _a.getFormattingFromRange, onDeleteChart = _a.onDeleteChart, onUpdateChart = _a.onUpdateChart, onRequestEdit = _a.onRequestEdit, onRequestCalculate = _a.onRequestCalculate, isSelected = _a.isSelected, fieldButtons = _a.fieldButtons;
@@ -316,7 +319,7 @@ var BasicChart = function (_a) {
316
319
  rawDomainValues.length === seriesValues.length;
317
320
  if (canAggregate) {
318
321
  var aggregatedValues_1 = (0, aggregation_1.aggregateSeriesByDomain)(rawDomainValues, seriesValues, aggregateType, orderedDomainValues);
319
- if (spec.chartType === "pie") {
322
+ if ((0, helpers_1.isCircularChartType)(spec.chartType)) {
320
323
  return orderedDomainValues.map(function (name, idx) {
321
324
  var _a;
322
325
  return ({
@@ -328,7 +331,9 @@ var BasicChart = function (_a) {
328
331
  return aggregatedValues_1;
329
332
  }
330
333
  var numericValues = seriesValues;
331
- if (spec.chartType === "pie") {
334
+ // Pie and doughnut points are slices keyed by their category name;
335
+ // a doughnut is a pie series with a hole, so it labels the same way.
336
+ if ((0, helpers_1.isCircularChartType)(spec.chartType)) {
332
337
  if (options.pieLabels) {
333
338
  var _b = options.pieLabels, domainLabels = _b.domainLabels, offset = _b.offset;
334
339
  var labels = offset === undefined
@@ -362,11 +367,11 @@ var BasicChart = function (_a) {
362
367
  * Triggers a chart update
363
368
  */
364
369
  var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
365
- var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, xAxisConfig, tooltipFormatter, bubbleSeriesLabel_1, hierarchyRows, headerTitle, hierarchyData, rootName, seriesDisplayName, hierarchyDepth, levels, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchySeriesLabel, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, values, e_1_1, seriesNames_1, contourPoints, _h, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _j, _k, seriesEntry, dataLabel, _l, _m, values, e_2_1, seriesNames_2, threeDPalette_1, seriesColorAt_1, categoryAxisLabel, seriesAxisLabel, stackedBar3D_1, threeDFormats_1, threeDTooltipFormatter, threeDSeries, visualMap, xAxis3D, yAxis3D, categoryCount, categoryTotals_1, threeDSeriesInputs_1, threeDSeriesInputs_1_1, entry, isPercent_1, surfacePoints, _o, zMin, zMax, skipHeaders, categories, radarSeriesInputs, _p, _q, seriesEntry, label, values, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, variant_1, categories, seriesValues, stockFormats_1, stockRoleIndex_1, stockFormatFor_1, stockDataLabels_1, stockSeriesLabelFor_1, upColor_1, downColor_1, volumePoints, hasVolume, stockGrid, baseStockXAxis, stockXAxis, volumeYAxis, volumeSeries, stockAxisPointer, candleData, lineSeries, stockColors_1, isStacked, isCircularChart, isOfPie, ofPieLayout, isHorizontalBarChart, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, aggregateDomainValues, categoryLevels, pushSeriesOverlays, sideBySideBarCount, specBarGap, specBarCategoryGap, _loop_1, _r, _s, _t, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _u, main_1, secondary, otherTotal, total, ofPieType_1, secondScale, halfAngle_1, hasSecondary, MAIN_CX_1, CY_1, MAIN_RADIUS_PCT_1, SECONDARY_CX_1, secondaryRadiusPct_1, BAR_LEFT_1, BAR_RIGHT, barHalfFrac_1, ofPiePalette_1, paletteAt_1, connectorColor_1, primaryDomainSource_1, rawDomainValues, labels, seriesEntry, rawValues_1, totalIndices, steps, accent_1, decreaseColor_1, totalColor_1, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, quartileMethod, showOutliers, showMeanMarker, boxStats, boxLabels, outlierPoints, meanPoints, _v, _w, seriesEntry, label, rawValues, summary, boxIndex, lo, hi, _x, _y, outlier, boxSeries, boxColor, rawValues, _z, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, renderedSeriesCount, replaceMerge, gridConfig, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, dataLabelOptions, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels;
370
+ var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, xAxisConfig, tooltipFormatter, bubbleSeriesLabel_1, hierarchyRows, headerTitle, hierarchyData, rootName, seriesDisplayName, hierarchyDepth, levels, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchySeriesLabel, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, values, e_1_1, seriesNames_1, contourPoints, _h, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _j, _k, seriesEntry, dataLabel, _l, _m, values, e_2_1, seriesNames_2, threeDPalette_1, seriesColorAt_1, categoryAxisLabel, seriesAxisLabel, stackedBar3D_1, threeDFormats_1, threeDTooltipFormatter, threeDSeries, visualMap, xAxis3D, yAxis3D, categoryCount, categoryTotals_1, threeDSeriesInputs_1, threeDSeriesInputs_1_1, entry, isPercent_1, surfacePoints, _o, zMin, zMax, skipHeaders, categories, radarSeriesInputs, _p, _q, seriesEntry, label, values, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, variant_1, categories, seriesValues, stockFormats_1, stockRoleIndex_1, stockFormatFor_1, stockDataLabels_1, stockSeriesLabelFor_1, upColor_1, downColor_1, volumePoints, hasVolume, stockGrid, baseStockXAxis, stockXAxis, volumeYAxis, volumeSeries, stockAxisPointer, candleData, lineSeries, stockColors_1, isStacked, isCircularChart, isOfPie, ofPieLayout, isHorizontalBarChart, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, aggregateDomainValues, categoryLevels, pushSeriesOverlays, sideBySideBarCount, specBarGap, specBarCategoryGap, seriesPalette, paletteColorAt, _loop_1, _r, _s, _t, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _u, main_1, secondary, otherTotal, total, ofPieType_1, secondScale, halfAngle_1, hasSecondary, MAIN_CX_1, CY_1, MAIN_RADIUS_PCT_1, SECONDARY_CX_1, secondaryRadiusPct_1, BAR_LEFT_1, BAR_RIGHT, barHalfFrac_1, ofPiePalette_1, paletteAt_1, connectorColor_1, primaryDomainSource_1, rawDomainValues, labels, seriesEntry, rawValues_1, totalIndices, steps, accent_1, decreaseColor_1, totalColor_1, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, quartileMethod, showOutliers, showMeanMarker, boxStats, boxLabels, outlierPoints, meanPoints, _v, _w, seriesEntry, label, rawValues, summary, boxIndex, lo, hi, _x, _y, outlier, boxSeries, boxColor, rawValues, _z, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, dataLabelOptions, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels;
366
371
  var e_1, _0, e_2, _1, e_4, _2, e_5, _3, e_3, _4, e_6, _5, e_7, _6, e_8, _7, e_9, _8;
367
- var _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128;
368
- return tslib_1.__generator(this, function (_129) {
369
- switch (_129.label) {
372
+ var _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104, _105, _106, _107, _108, _109, _110, _111, _112, _113, _114, _115, _116, _117, _118, _119, _120, _121, _122, _123, _124, _125, _126, _127, _128, _129, _130, _131, _132, _133, _134, _135, _136, _137, _138;
373
+ return tslib_1.__generator(this, function (_139) {
374
+ switch (_139.label) {
370
375
  case 0:
371
376
  (0, utils_1.debug)("Updating chart", chart);
372
377
  threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType);
@@ -417,7 +422,7 @@ var BasicChart = function (_a) {
417
422
  geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
418
423
  return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
419
424
  case 1:
420
- geo = _129.sent();
425
+ geo = _139.sent();
421
426
  // Entering the region map from a cartesian render: the previous
422
427
  // grid/axis option doesn't merge into the map one, so start from
423
428
  // a bare instance (theme options are re-applied after setOption).
@@ -532,7 +537,7 @@ var BasicChart = function (_a) {
532
537
  });
533
538
  seriesInputs = [];
534
539
  i = 0;
535
- _129.label = 3;
540
+ _139.label = 3;
536
541
  case 3:
537
542
  if (!(i < spec.series.length)) return [3 /*break*/, 7];
538
543
  seriesEntry = spec.series[i];
@@ -541,13 +546,13 @@ var BasicChart = function (_a) {
541
546
  _b = chart_spec_utils_1.coerceCalculatedLabel;
542
547
  return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_17 = position.sheetId) !== null && _17 !== void 0 ? _17 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
543
548
  case 4:
544
- resolvedLabel = _b.apply(void 0, [_129.sent()]);
545
- _129.label = 5;
549
+ resolvedLabel = _b.apply(void 0, [_139.sent()]);
550
+ _139.label = 5;
546
551
  case 5:
547
552
  xValues = (_18 = perSeriesX[i]) !== null && _18 !== void 0 ? _18 : perSeriesX[0];
548
553
  sizeValues_1 = (_19 = perSeriesSize[i]) !== null && _19 !== void 0 ? _19 : perSeriesSize[0];
549
554
  seriesInputs.push(tslib_1.__assign(tslib_1.__assign({ name: resolvedLabel, values: flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1) }, (xValues ? { xValues: xValues } : {})), (sizeValues_1 ? { sizeValues: sizeValues_1 } : {})));
550
- _129.label = 6;
555
+ _139.label = 6;
551
556
  case 6:
552
557
  i++;
553
558
  return [3 /*break*/, 3];
@@ -770,11 +775,11 @@ var BasicChart = function (_a) {
770
775
  if (!isContour) return [3 /*break*/, 19];
771
776
  categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
772
777
  contourSeriesInputs = [];
773
- _129.label = 9;
778
+ _139.label = 9;
774
779
  case 9:
775
- _129.trys.push([9, 16, 17, 18]);
780
+ _139.trys.push([9, 16, 17, 18]);
776
781
  _d = tslib_1.__values((_34 = spec.series) !== null && _34 !== void 0 ? _34 : []), _e = _d.next();
777
- _129.label = 10;
782
+ _139.label = 10;
778
783
  case 10:
779
784
  if (!!_e.done) return [3 /*break*/, 15];
780
785
  seriesEntry = _e.value;
@@ -782,22 +787,22 @@ var BasicChart = function (_a) {
782
787
  _g = chart_spec_utils_1.coerceCalculatedLabel;
783
788
  return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_35 = position.sheetId) !== null && _35 !== void 0 ? _35 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
784
789
  case 11:
785
- _f = _g.apply(void 0, [_129.sent()]);
790
+ _f = _g.apply(void 0, [_139.sent()]);
786
791
  return [3 /*break*/, 13];
787
792
  case 12:
788
793
  _f = (_36 = seriesEntry.dataLabel) !== null && _36 !== void 0 ? _36 : "";
789
- _129.label = 13;
794
+ _139.label = 13;
790
795
  case 13:
791
796
  dataLabel = _f;
792
797
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
793
798
  contourSeriesInputs.push({ name: dataLabel, values: values });
794
- _129.label = 14;
799
+ _139.label = 14;
795
800
  case 14:
796
801
  _e = _d.next();
797
802
  return [3 /*break*/, 10];
798
803
  case 15: return [3 /*break*/, 18];
799
804
  case 16:
800
- e_1_1 = _129.sent();
805
+ e_1_1 = _139.sent();
801
806
  e_1 = { error: e_1_1 };
802
807
  return [3 /*break*/, 18];
803
808
  case 17:
@@ -905,11 +910,11 @@ var BasicChart = function (_a) {
905
910
  if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 30];
906
911
  categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
907
912
  threeDSeriesInputs = [];
908
- _129.label = 20;
913
+ _139.label = 20;
909
914
  case 20:
910
- _129.trys.push([20, 27, 28, 29]);
915
+ _139.trys.push([20, 27, 28, 29]);
911
916
  _j = tslib_1.__values((_40 = spec.series) !== null && _40 !== void 0 ? _40 : []), _k = _j.next();
912
- _129.label = 21;
917
+ _139.label = 21;
913
918
  case 21:
914
919
  if (!!_k.done) return [3 /*break*/, 26];
915
920
  seriesEntry = _k.value;
@@ -917,22 +922,22 @@ var BasicChart = function (_a) {
917
922
  _m = chart_spec_utils_1.coerceCalculatedLabel;
918
923
  return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_41 = position.sheetId) !== null && _41 !== void 0 ? _41 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
919
924
  case 22:
920
- _l = _m.apply(void 0, [_129.sent()]);
925
+ _l = _m.apply(void 0, [_139.sent()]);
921
926
  return [3 /*break*/, 24];
922
927
  case 23:
923
928
  _l = (_42 = seriesEntry.dataLabel) !== null && _42 !== void 0 ? _42 : "";
924
- _129.label = 24;
929
+ _139.label = 24;
925
930
  case 24:
926
931
  dataLabel = _l;
927
932
  values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
928
933
  threeDSeriesInputs.push({ name: dataLabel, values: values });
929
- _129.label = 25;
934
+ _139.label = 25;
930
935
  case 25:
931
936
  _k = _j.next();
932
937
  return [3 /*break*/, 21];
933
938
  case 26: return [3 /*break*/, 29];
934
939
  case 27:
935
- e_2_1 = _129.sent();
940
+ e_2_1 = _139.sent();
936
941
  e_2 = { error: e_2_1 };
937
942
  return [3 /*break*/, 29];
938
943
  case 28:
@@ -1409,7 +1414,7 @@ var BasicChart = function (_a) {
1409
1414
  ? (_62 = spec.verticalAxisTitle) !== null && _62 !== void 0 ? _62 : ""
1410
1415
  : (_63 = spec.horizontalAxisTitle) !== null && _63 !== void 0 ? _63 : "",
1411
1416
  nameLocation: "middle",
1412
- nameGap: 30 + 24 * categoryLevels.outer.length,
1417
+ nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
1413
1418
  })), false));
1414
1419
  }
1415
1420
  // One category axis per domain (Excel): a domain drawn from several
@@ -1438,7 +1443,7 @@ var BasicChart = function (_a) {
1438
1443
  splitLine: { show: !isCircularChart },
1439
1444
  name: axisTitle,
1440
1445
  nameLocation: "middle",
1441
- nameGap: 30,
1446
+ nameGap: CATEGORY_AXIS_NAME_GAP,
1442
1447
  });
1443
1448
  });
1444
1449
  if (chartDomains.length === 0 && !isCircularChart) {
@@ -1453,7 +1458,7 @@ var BasicChart = function (_a) {
1453
1458
  ? (_65 = spec.verticalAxisTitle) !== null && _65 !== void 0 ? _65 : ""
1454
1459
  : (_66 = spec.horizontalAxisTitle) !== null && _66 !== void 0 ? _66 : "",
1455
1460
  nameLocation: "middle",
1456
- nameGap: 30,
1461
+ nameGap: CATEGORY_AXIS_NAME_GAP,
1457
1462
  });
1458
1463
  }
1459
1464
  pushSeriesOverlays = function (series, data, dataLabel) {
@@ -1610,23 +1615,34 @@ var BasicChart = function (_a) {
1610
1615
  seriesCount: sideBySideBarCount,
1611
1616
  overlap: isStacked ? 0 : spec.overlap,
1612
1617
  });
1618
+ seriesPalette = (0, chart_styles_1.getChartPalette)(spec, [
1619
+ theme.themeColors.accent1,
1620
+ theme.themeColors.accent2,
1621
+ theme.themeColors.accent3,
1622
+ theme.themeColors.accent4,
1623
+ theme.themeColors.accent5,
1624
+ theme.themeColors.accent6,
1625
+ ]);
1626
+ paletteColorAt = function (index) {
1627
+ return seriesPalette[index % seriesPalette.length];
1628
+ };
1613
1629
  _loop_1 = function (specSeriesIndex, series) {
1614
- var dataLabel, _130, _131, effectiveChartType, lineLike, domainSources, pieDomainLabels, piePointOffset, data, seriesEchartsType, seriesStyleAttrs, seriesEntry, isBarOrColumn, seriesAny, markerSymbol, wantsMarkers, gradientArgs, gradient, overrides_2, _132, _133, dp, fallback_1, overrides_3, _134, _135, dp, slicePalette_1, positiveColor_1, negativeColor_1;
1615
- var e_11, _136, e_12, _137;
1616
- return tslib_1.__generator(this, function (_138) {
1617
- switch (_138.label) {
1630
+ var dataLabel, _140, _141, effectiveChartType, lineLike, domainSources, pieDomainLabels, piePointOffset, data, seriesEchartsType, seriesStyleAttrs, seriesEntry, isBarOrColumn, seriesAny, markerSymbol, wantsMarkers, isolated, marked, isolated_1, isolated_1_1, i, gradientArgs, gradient, overrides_2, _142, _143, dp, fallback_1, overrides_3, _144, _145, dp, positiveColor_1, negativeColor_1;
1631
+ var e_11, _146, e_12, _147, e_13, _148;
1632
+ return tslib_1.__generator(this, function (_149) {
1633
+ switch (_149.label) {
1618
1634
  case 0:
1619
1635
  if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1620
- _131 = chart_spec_utils_1.coerceCalculatedLabel;
1636
+ _141 = chart_spec_utils_1.coerceCalculatedLabel;
1621
1637
  return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_69 = position.sheetId) !== null && _69 !== void 0 ? _69 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1622
1638
  case 1:
1623
- _130 = _131.apply(void 0, [_138.sent()]);
1639
+ _140 = _141.apply(void 0, [_149.sent()]);
1624
1640
  return [3 /*break*/, 3];
1625
1641
  case 2:
1626
- _130 = (_70 = series.dataLabel) !== null && _70 !== void 0 ? _70 : "";
1627
- _138.label = 3;
1642
+ _140 = (_70 = series.dataLabel) !== null && _70 !== void 0 ? _70 : "";
1643
+ _149.label = 3;
1628
1644
  case 3:
1629
- dataLabel = _130;
1645
+ dataLabel = _140;
1630
1646
  // Label
1631
1647
  if (dataLabel) {
1632
1648
  (_71 = legend.data) === null || _71 === void 0 ? void 0 : _71.push(dataLabel);
@@ -1634,7 +1650,7 @@ var BasicChart = function (_a) {
1634
1650
  effectiveChartType = (_72 = series.seriesChartType) !== null && _72 !== void 0 ? _72 : spec.chartType;
1635
1651
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1636
1652
  domainSources = (_75 = (_74 = (_73 = spec.domains) === null || _73 === void 0 ? void 0 : _73[0]) === null || _74 === void 0 ? void 0 : _74.sources) !== null && _75 !== void 0 ? _75 : [];
1637
- pieDomainLabels = spec.chartType === "pie" &&
1653
+ pieDomainLabels = isCircularChart &&
1638
1654
  (domainSources.length > 1 || series.sources.length > 1)
1639
1655
  ? domainSources.flatMap(function (sheetRange) {
1640
1656
  var _a;
@@ -1700,6 +1716,28 @@ var BasicChart = function (_a) {
1700
1716
  (_79 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _79 !== void 0 ? _79 : "circle";
1701
1717
  seriesEntry.symbolSize = (_81 = (_80 = seriesAny.marker) === null || _80 === void 0 ? void 0 : _80.size) !== null && _81 !== void 0 ? _81 : 6;
1702
1718
  }
1719
+ else if (Array.isArray(data)) {
1720
+ isolated = (0, empty_cells_1.isolatedPointIndexes)(data, (0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike));
1721
+ if (isolated.length) {
1722
+ seriesEntry.showSymbol = true;
1723
+ seriesEntry.symbol = "none";
1724
+ marked = tslib_1.__spreadArray([], tslib_1.__read(data), false);
1725
+ try {
1726
+ for (isolated_1 = (e_11 = void 0, tslib_1.__values(isolated)), isolated_1_1 = isolated_1.next(); !isolated_1_1.done; isolated_1_1 = isolated_1.next()) {
1727
+ i = isolated_1_1.value;
1728
+ marked[i] = { value: marked[i], symbol: "circle", symbolSize: 6 };
1729
+ }
1730
+ }
1731
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
1732
+ finally {
1733
+ try {
1734
+ if (isolated_1_1 && !isolated_1_1.done && (_146 = isolated_1.return)) _146.call(isolated_1);
1735
+ }
1736
+ finally { if (e_11) throw e_11.error; }
1737
+ }
1738
+ seriesEntry.data = marked;
1739
+ }
1740
+ }
1703
1741
  }
1704
1742
  gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
1705
1743
  if (gradientArgs && !seriesAny.noFill) {
@@ -1721,21 +1759,21 @@ var BasicChart = function (_a) {
1721
1759
  seriesAny.dataPointColors.length) {
1722
1760
  overrides_2 = new Map();
1723
1761
  try {
1724
- for (_132 = (e_11 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _133 = _132.next(); !_133.done; _133 = _132.next()) {
1725
- dp = _133.value;
1762
+ for (_142 = (e_12 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _143 = _142.next(); !_143.done; _143 = _142.next()) {
1763
+ dp = _143.value;
1726
1764
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1727
1765
  overrides_2.set(dp.idx, dp.color);
1728
1766
  }
1729
1767
  }
1730
1768
  }
1731
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
1769
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
1732
1770
  finally {
1733
1771
  try {
1734
- if (_133 && !_133.done && (_136 = _132.return)) _136.call(_132);
1772
+ if (_143 && !_143.done && (_147 = _142.return)) _147.call(_142);
1735
1773
  }
1736
- finally { if (e_11) throw e_11.error; }
1774
+ finally { if (e_12) throw e_12.error; }
1737
1775
  }
1738
- fallback_1 = (_85 = series.color) !== null && _85 !== void 0 ? _85 : theme.themeColors.accent1;
1776
+ fallback_1 = (_85 = series.color) !== null && _85 !== void 0 ? _85 : paletteColorAt(specSeriesIndex);
1739
1777
  seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_86 = seriesEntry.itemStyle) !== null && _86 !== void 0 ? _86 : {})), { color: function (params) { var _a; return (_a = overrides_2.get(params.dataIndex)) !== null && _a !== void 0 ? _a : fallback_1; } });
1740
1778
  }
1741
1779
  else if (isCircularChart &&
@@ -1743,37 +1781,28 @@ var BasicChart = function (_a) {
1743
1781
  seriesAny.dataPointColors.length) {
1744
1782
  overrides_3 = new Map();
1745
1783
  try {
1746
- for (_134 = (e_12 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _135 = _134.next(); !_135.done; _135 = _134.next()) {
1747
- dp = _135.value;
1784
+ for (_144 = (e_13 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _145 = _144.next(); !_145.done; _145 = _144.next()) {
1785
+ dp = _145.value;
1748
1786
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1749
1787
  overrides_3.set(dp.idx, dp.color);
1750
1788
  }
1751
1789
  }
1752
1790
  }
1753
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1791
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1754
1792
  finally {
1755
1793
  try {
1756
- if (_135 && !_135.done && (_137 = _134.return)) _137.call(_134);
1794
+ if (_145 && !_145.done && (_148 = _144.return)) _148.call(_144);
1757
1795
  }
1758
- finally { if (e_12) throw e_12.error; }
1796
+ finally { if (e_13) throw e_13.error; }
1759
1797
  }
1760
- slicePalette_1 = (0, chart_styles_1.getChartPalette)(spec, [
1761
- theme.themeColors.accent1,
1762
- theme.themeColors.accent2,
1763
- theme.themeColors.accent3,
1764
- theme.themeColors.accent4,
1765
- theme.themeColors.accent5,
1766
- theme.themeColors.accent6,
1767
- ]);
1768
1798
  seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_87 = seriesEntry.itemStyle) !== null && _87 !== void 0 ? _87 : {})), { color: function (params) {
1769
1799
  var _a, _b;
1770
- return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : slicePalette_1[params.dataIndex % slicePalette_1.length];
1800
+ return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
1771
1801
  } });
1772
1802
  }
1773
1803
  else if (isBarOrColumn && series.invertIfNegative) {
1774
- positiveColor_1 = (_88 = series.color) !== null && _88 !== void 0 ? _88 : theme.themeColors.accent1;
1804
+ positiveColor_1 = (_88 = series.color) !== null && _88 !== void 0 ? _88 : paletteColorAt(specSeriesIndex);
1775
1805
  negativeColor_1 = (_89 = series.negativeColor) !== null && _89 !== void 0 ? _89 : "#FF0000";
1776
- // Use a color function that returns different colors based on value
1777
1806
  seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_90 = seriesEntry.itemStyle) !== null && _90 !== void 0 ? _90 : {})), { color: function (params) {
1778
1807
  var _a, _b;
1779
1808
  var value = Array.isArray(params.data)
@@ -1797,24 +1826,24 @@ var BasicChart = function (_a) {
1797
1826
  }
1798
1827
  });
1799
1828
  };
1800
- _129.label = 31;
1829
+ _139.label = 31;
1801
1830
  case 31:
1802
- _129.trys.push([31, 36, 37, 38]);
1831
+ _139.trys.push([31, 36, 37, 38]);
1803
1832
  _r = tslib_1.__values(((_68 = spec.series) !== null && _68 !== void 0 ? _68 : []).entries()), _s = _r.next();
1804
- _129.label = 32;
1833
+ _139.label = 32;
1805
1834
  case 32:
1806
1835
  if (!!_s.done) return [3 /*break*/, 35];
1807
1836
  _t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
1808
1837
  return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
1809
1838
  case 33:
1810
- _129.sent();
1811
- _129.label = 34;
1839
+ _139.sent();
1840
+ _139.label = 34;
1812
1841
  case 34:
1813
1842
  _s = _r.next();
1814
1843
  return [3 /*break*/, 32];
1815
1844
  case 35: return [3 /*break*/, 38];
1816
1845
  case 36:
1817
- e_3_1 = _129.sent();
1846
+ e_3_1 = _139.sent();
1818
1847
  e_3 = { error: e_3_1 };
1819
1848
  return [3 /*break*/, 38];
1820
1849
  case 37:
@@ -1824,6 +1853,12 @@ var BasicChart = function (_a) {
1824
1853
  finally { if (e_3) throw e_3.error; }
1825
1854
  return [7 /*endfinally*/];
1826
1855
  case 38:
1856
+ if (isCircularChart && !isOfPie) {
1857
+ // Excel's pie / doughnut legend lists the categories, one entry per
1858
+ // slice — not the series name (the loop above collected those). The
1859
+ // of-pie branch below builds its own category legend.
1860
+ legend.data = (0, helpers_1.circularLegendEntries)(chartSeries);
1861
+ }
1827
1862
  if (isOfPie) {
1828
1863
  labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1829
1864
  seriesEntry = (_94 = spec.series) === null || _94 === void 0 ? void 0 : _94[0];
@@ -2216,23 +2251,6 @@ var BasicChart = function (_a) {
2216
2251
  previousSeriesCount.current !== renderedSeriesCount
2217
2252
  ? ["series", "xAxis", "yAxis", "legend", "grid", "tooltip"]
2218
2253
  : [];
2219
- gridConfig = isOfPie
2220
- ? tslib_1.__spreadArray([
2221
- { left: 0, right: 0, top: 0, bottom: 0 }
2222
- ], tslib_1.__read(((ofPieLayout === null || ofPieLayout === void 0 ? void 0 : ofPieLayout.barGrid) ? [ofPieLayout.barGrid] : [])), false)
2223
- : isCircularChart
2224
- ? {
2225
- left: 0,
2226
- right: 0,
2227
- top: 0,
2228
- bottom: 0,
2229
- }
2230
- : {
2231
- left: "3%",
2232
- right: "4%",
2233
- bottom: "3%",
2234
- containLabel: true,
2235
- };
2236
2254
  valueAxisBase = {
2237
2255
  type: "value",
2238
2256
  show: !isCircularChart,
@@ -2285,6 +2303,38 @@ var BasicChart = function (_a) {
2285
2303
  : undefined,
2286
2304
  };
2287
2305
  finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
2306
+ bottomAxisNameGap = isHorizontalBarChart
2307
+ ? valueAxisBase.nameGap
2308
+ : Number((_129 = (_128 = chartDomains[0]) === null || _128 === void 0 ? void 0 : _128.nameGap) !== null && _129 !== void 0 ? _129 : CATEGORY_AXIS_NAME_GAP);
2309
+ legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
2310
+ position: (_130 = spec.legend) === null || _130 === void 0 ? void 0 : _130.position,
2311
+ visible: finalLegend.show !== false,
2312
+ labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
2313
+ legendFontSize: (_135 = (_132 = (_131 = finalLegend.textStyle) === null || _131 === void 0 ? void 0 : _131.fontSize) !== null && _132 !== void 0 ? _132 : (_134 = (_133 = spec.legend) === null || _133 === void 0 ? void 0 : _133.textFormat) === null || _134 === void 0 ? void 0 : _134.fontSize) !== null && _135 !== void 0 ? _135 : 12,
2314
+ legendItemWidth: defaultLegendConfig.itemWidth,
2315
+ width: width !== null && width !== void 0 ? width : 0,
2316
+ height: height !== null && height !== void 0 ? height : 0,
2317
+ hasTitle: Boolean(title),
2318
+ titleFontSize: (_137 = (_136 = spec.titleTextFormat) === null || _136 === void 0 ? void 0 : _136.fontSize) !== null && _137 !== void 0 ? _137 : 16,
2319
+ hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
2320
+ bottomAxisNameGap: bottomAxisNameGap,
2321
+ hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
2322
+ });
2323
+ positionedLegend = isCircularChart
2324
+ ? finalLegend
2325
+ : tslib_1.__assign(tslib_1.__assign({}, finalLegend), legendBand.legend);
2326
+ gridConfig = isOfPie
2327
+ ? tslib_1.__spreadArray([
2328
+ { left: 0, right: 0, top: 0, bottom: 0 }
2329
+ ], tslib_1.__read(((ofPieLayout === null || ofPieLayout === void 0 ? void 0 : ofPieLayout.barGrid) ? [ofPieLayout.barGrid] : [])), false)
2330
+ : isCircularChart
2331
+ ? {
2332
+ left: 0,
2333
+ right: 0,
2334
+ top: 0,
2335
+ bottom: 0,
2336
+ }
2337
+ : legendBand.grid;
2288
2338
  dataLabelOptions = spec.dataLabels;
2289
2339
  seriesLabelOptionFor = function (s) {
2290
2340
  return (0, overrides_1.buildSeriesLabelOption)(dataLabelOptions && !dataLabelOptions.numberFormatPattern
@@ -2393,7 +2443,7 @@ var BasicChart = function (_a) {
2393
2443
  return next;
2394
2444
  });
2395
2445
  // Update charts
2396
- (_128 = chartRef.current) === null || _128 === void 0 ? void 0 : _128.setOption({
2446
+ (_138 = chartRef.current) === null || _138 === void 0 ? void 0 : _138.setOption({
2397
2447
  xAxis: (function () {
2398
2448
  var _a, _b;
2399
2449
  if (isOfPie) {
@@ -2451,7 +2501,7 @@ var BasicChart = function (_a) {
2451
2501
  splitLine: { show: true },
2452
2502
  name: (_b = spec.horizontalAxisTitle) !== null && _b !== void 0 ? _b : "",
2453
2503
  nameLocation: "middle",
2454
- nameGap: 30,
2504
+ nameGap: CATEGORY_AXIS_NAME_GAP,
2455
2505
  },
2456
2506
  ];
2457
2507
  return base.map(function (axis) {
@@ -2493,7 +2543,7 @@ var BasicChart = function (_a) {
2493
2543
  splitLine: { show: true },
2494
2544
  name: (_a = spec.verticalAxisTitle) !== null && _a !== void 0 ? _a : "",
2495
2545
  nameLocation: "middle",
2496
- nameGap: 30,
2546
+ nameGap: CATEGORY_AXIS_NAME_GAP,
2497
2547
  },
2498
2548
  ];
2499
2549
  return base.map(function (axis) {
@@ -2501,7 +2551,21 @@ var BasicChart = function (_a) {
2501
2551
  });
2502
2552
  }
2503
2553
  var axes = [
2504
- (0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: (_b = spec.verticalAxisTitle) !== null && _b !== void 0 ? _b : "" }), spec.valueAxisOptions, primaryAxisNumberFormat),
2554
+ (0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: (_b = spec.verticalAxisTitle) !== null && _b !== void 0 ? _b : "",
2555
+ // Clear the tick labels: "$2,000.00" is wider than the 50px
2556
+ // default gap, and the title painted over its own labels.
2557
+ nameGap: (0, axis_number_format_1.valueAxisNameGap)({
2558
+ values: chartSeries
2559
+ .filter(function (s) { return (s === null || s === void 0 ? void 0 : s.yAxisIndex) !== 1; })
2560
+ .flatMap(function (s) {
2561
+ return Array.isArray(s === null || s === void 0 ? void 0 : s.data)
2562
+ ? s.data.map(function (d) {
2563
+ return d !== null && typeof d === "object" ? d.value : d;
2564
+ })
2565
+ : [];
2566
+ }),
2567
+ pattern: primaryAxisNumberFormat,
2568
+ }) }), spec.valueAxisOptions, primaryAxisNumberFormat),
2505
2569
  ];
2506
2570
  if (hasSecondaryAxis) {
2507
2571
  axes.push((0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: "", splitLine: { show: false } }), (isPareto
@@ -2515,7 +2579,7 @@ var BasicChart = function (_a) {
2515
2579
  return axes;
2516
2580
  })(),
2517
2581
  series: seriesWithLabels,
2518
- legend: finalLegend,
2582
+ legend: positionedLegend,
2519
2583
  grid: gridConfig,
2520
2584
  tooltip: tooltipConfig,
2521
2585
  }, { replaceMerge: replaceMerge, lazyUpdate: true });
@@ -5,6 +5,15 @@ export declare const chartTypeToEchartsType: (type: EmbeddedChart["spec"]["chart
5
5
  * Returns undefined for "auto" / unknown — caller defaults to "circle".
6
6
  */
7
7
  export declare const mapMarkerSymbolToEcharts: (symbol: string | undefined | null) => string | undefined;
8
+ /** Pie and doughnut — the pie-family types whose points are slices. */
9
+ export declare const isCircularChartType: (type: EmbeddedChart["spec"]["chartType"] | undefined) => boolean;
10
+ /**
11
+ * Legend entries of a pie / doughnut: the slice names (the categories), in
12
+ * order, each once across every pie series — Excel's pie legend lists the
13
+ * categories, not the series name. echarts keys pie legend items by data
14
+ * item name, so an entry toggles that slice in every series.
15
+ */
16
+ export declare const circularLegendEntries: (series: ReadonlyArray<unknown>) => string[];
8
17
  export declare const getEchartsSeriesStyle: (type: EmbeddedChart["spec"]["chartType"]) => {
9
18
  areaStyle: {};
10
19
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../basic-chart/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yGA6DzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAChC,MAAM,GAAG,SAuBX,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;;aASzC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,YAejE,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../basic-chart/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GACjC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,yGA6DzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,GAAG,SAAS,GAAG,IAAI,KAChC,MAAM,GAAG,SAuBX,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,mBAAmB,GAC9B,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,GAAG,SAAS,KACnD,OAAgD,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,aAAa,CAAC,OAAO,CAAC,KAC7B,MAAM,EAmBR,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC;;aASzC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,YAejE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.showXAxis = exports.getEchartsSeriesStyle = exports.mapMarkerSymbolToEcharts = exports.chartTypeToEchartsType = void 0;
3
+ exports.showXAxis = exports.getEchartsSeriesStyle = exports.circularLegendEntries = exports.isCircularChartType = exports.mapMarkerSymbolToEcharts = exports.chartTypeToEchartsType = void 0;
4
+ var tslib_1 = require("tslib");
4
5
  var chartTypeToEchartsType = function (type) {
5
6
  switch (type) {
6
7
  case "column":
@@ -79,6 +80,59 @@ var mapMarkerSymbolToEcharts = function (symbol) {
79
80
  }
80
81
  };
81
82
  exports.mapMarkerSymbolToEcharts = mapMarkerSymbolToEcharts;
83
+ /** Pie and doughnut — the pie-family types whose points are slices. */
84
+ var isCircularChartType = function (type) { return type === "pie" || type === "doughnut"; };
85
+ exports.isCircularChartType = isCircularChartType;
86
+ /**
87
+ * Legend entries of a pie / doughnut: the slice names (the categories), in
88
+ * order, each once across every pie series — Excel's pie legend lists the
89
+ * categories, not the series name. echarts keys pie legend items by data
90
+ * item name, so an entry toggles that slice in every series.
91
+ */
92
+ var circularLegendEntries = function (series) {
93
+ var e_1, _a, e_2, _b;
94
+ var seen = new Set();
95
+ var entries = [];
96
+ try {
97
+ for (var series_1 = tslib_1.__values(series), series_1_1 = series_1.next(); !series_1_1.done; series_1_1 = series_1.next()) {
98
+ var raw = series_1_1.value;
99
+ var entry = raw;
100
+ if ((entry === null || entry === void 0 ? void 0 : entry.type) !== "pie" || !Array.isArray(entry.data))
101
+ continue;
102
+ try {
103
+ for (var _c = (e_2 = void 0, tslib_1.__values(entry.data)), _d = _c.next(); !_d.done; _d = _c.next()) {
104
+ var item = _d.value;
105
+ var name_1 = item !== null && typeof item === "object" && "name" in item
106
+ ? item.name
107
+ : undefined;
108
+ if (name_1 === undefined || name_1 === null)
109
+ continue;
110
+ var label = String(name_1);
111
+ if (label === "" || seen.has(label))
112
+ continue;
113
+ seen.add(label);
114
+ entries.push(label);
115
+ }
116
+ }
117
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
118
+ finally {
119
+ try {
120
+ if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
121
+ }
122
+ finally { if (e_2) throw e_2.error; }
123
+ }
124
+ }
125
+ }
126
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
127
+ finally {
128
+ try {
129
+ if (series_1_1 && !series_1_1.done && (_a = series_1.return)) _a.call(series_1);
130
+ }
131
+ finally { if (e_1) throw e_1.error; }
132
+ }
133
+ return entries;
134
+ };
135
+ exports.circularLegendEntries = circularLegendEntries;
82
136
  var getEchartsSeriesStyle = function (type) {
83
137
  switch (type) {
84
138
  case "area":