@rowsncolumns/charts 28.1.1 → 28.1.4

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 (45) hide show
  1. package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
  2. package/dist/cjs/basic-chart/basic-chart.js +138 -76
  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/components/editors/chart-editor.d.ts.map +1 -1
  7. package/dist/cjs/components/editors/chart-editor.js +45 -45
  8. package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  9. package/dist/cjs/plotly/basic-chart/basic-chart.js +218 -128
  10. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  11. package/dist/cjs/utils/axis-number-format.d.ts +14 -0
  12. package/dist/cjs/utils/axis-number-format.d.ts.map +1 -1
  13. package/dist/cjs/utils/axis-number-format.js +41 -1
  14. package/dist/cjs/utils/chart-styles.d.ts +5 -1
  15. package/dist/cjs/utils/chart-styles.d.ts.map +1 -1
  16. package/dist/cjs/utils/chart-styles.js +1 -1
  17. package/dist/cjs/utils/empty-cells.d.ts +9 -0
  18. package/dist/cjs/utils/empty-cells.d.ts.map +1 -1
  19. package/dist/cjs/utils/empty-cells.js +26 -1
  20. package/dist/cjs/utils/legend-layout.d.ts +168 -0
  21. package/dist/cjs/utils/legend-layout.d.ts.map +1 -0
  22. package/dist/cjs/utils/legend-layout.js +338 -0
  23. package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
  24. package/dist/esm/basic-chart/basic-chart.js +96 -34
  25. package/dist/esm/basic-chart/helpers.d.ts +9 -0
  26. package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
  27. package/dist/esm/basic-chart/helpers.js +30 -0
  28. package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
  29. package/dist/esm/components/editors/chart-editor.js +2 -2
  30. package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
  31. package/dist/esm/plotly/basic-chart/basic-chart.js +136 -6
  32. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  33. package/dist/esm/utils/axis-number-format.d.ts +14 -0
  34. package/dist/esm/utils/axis-number-format.d.ts.map +1 -1
  35. package/dist/esm/utils/axis-number-format.js +36 -0
  36. package/dist/esm/utils/chart-styles.d.ts +5 -1
  37. package/dist/esm/utils/chart-styles.d.ts.map +1 -1
  38. package/dist/esm/utils/chart-styles.js +1 -1
  39. package/dist/esm/utils/empty-cells.d.ts +9 -0
  40. package/dist/esm/utils/empty-cells.d.ts.map +1 -1
  41. package/dist/esm/utils/empty-cells.js +21 -0
  42. package/dist/esm/utils/legend-layout.d.ts +168 -0
  43. package/dist/esm/utils/legend-layout.d.ts.map +1 -0
  44. package/dist/esm/utils/legend-layout.js +299 -0
  45. package/package.json +7 -7
@@ -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,sBAwyGjB,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, _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) {
@@ -1611,22 +1616,22 @@ var BasicChart = function (_a) {
1611
1616
  overlap: isStacked ? 0 : spec.overlap,
1612
1617
  });
1613
1618
  _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) {
1619
+ 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, slicePalette_1, positiveColor_1, negativeColor_1;
1620
+ var e_11, _146, e_12, _147, e_13, _148;
1621
+ return tslib_1.__generator(this, function (_149) {
1622
+ switch (_149.label) {
1618
1623
  case 0:
1619
1624
  if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
1620
- _131 = chart_spec_utils_1.coerceCalculatedLabel;
1625
+ _141 = chart_spec_utils_1.coerceCalculatedLabel;
1621
1626
  return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_69 = position.sheetId) !== null && _69 !== void 0 ? _69 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
1622
1627
  case 1:
1623
- _130 = _131.apply(void 0, [_138.sent()]);
1628
+ _140 = _141.apply(void 0, [_149.sent()]);
1624
1629
  return [3 /*break*/, 3];
1625
1630
  case 2:
1626
- _130 = (_70 = series.dataLabel) !== null && _70 !== void 0 ? _70 : "";
1627
- _138.label = 3;
1631
+ _140 = (_70 = series.dataLabel) !== null && _70 !== void 0 ? _70 : "";
1632
+ _149.label = 3;
1628
1633
  case 3:
1629
- dataLabel = _130;
1634
+ dataLabel = _140;
1630
1635
  // Label
1631
1636
  if (dataLabel) {
1632
1637
  (_71 = legend.data) === null || _71 === void 0 ? void 0 : _71.push(dataLabel);
@@ -1634,7 +1639,7 @@ var BasicChart = function (_a) {
1634
1639
  effectiveChartType = (_72 = series.seriesChartType) !== null && _72 !== void 0 ? _72 : spec.chartType;
1635
1640
  lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
1636
1641
  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" &&
1642
+ pieDomainLabels = isCircularChart &&
1638
1643
  (domainSources.length > 1 || series.sources.length > 1)
1639
1644
  ? domainSources.flatMap(function (sheetRange) {
1640
1645
  var _a;
@@ -1700,6 +1705,28 @@ var BasicChart = function (_a) {
1700
1705
  (_79 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _79 !== void 0 ? _79 : "circle";
1701
1706
  seriesEntry.symbolSize = (_81 = (_80 = seriesAny.marker) === null || _80 === void 0 ? void 0 : _80.size) !== null && _81 !== void 0 ? _81 : 6;
1702
1707
  }
1708
+ else if (Array.isArray(data)) {
1709
+ isolated = (0, empty_cells_1.isolatedPointIndexes)(data, (0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike));
1710
+ if (isolated.length) {
1711
+ seriesEntry.showSymbol = true;
1712
+ seriesEntry.symbol = "none";
1713
+ marked = tslib_1.__spreadArray([], tslib_1.__read(data), false);
1714
+ try {
1715
+ 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()) {
1716
+ i = isolated_1_1.value;
1717
+ marked[i] = { value: marked[i], symbol: "circle", symbolSize: 6 };
1718
+ }
1719
+ }
1720
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
1721
+ finally {
1722
+ try {
1723
+ if (isolated_1_1 && !isolated_1_1.done && (_146 = isolated_1.return)) _146.call(isolated_1);
1724
+ }
1725
+ finally { if (e_11) throw e_11.error; }
1726
+ }
1727
+ seriesEntry.data = marked;
1728
+ }
1729
+ }
1703
1730
  }
1704
1731
  gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
1705
1732
  if (gradientArgs && !seriesAny.noFill) {
@@ -1721,19 +1748,19 @@ var BasicChart = function (_a) {
1721
1748
  seriesAny.dataPointColors.length) {
1722
1749
  overrides_2 = new Map();
1723
1750
  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;
1751
+ for (_142 = (e_12 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _143 = _142.next(); !_143.done; _143 = _142.next()) {
1752
+ dp = _143.value;
1726
1753
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1727
1754
  overrides_2.set(dp.idx, dp.color);
1728
1755
  }
1729
1756
  }
1730
1757
  }
1731
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
1758
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
1732
1759
  finally {
1733
1760
  try {
1734
- if (_133 && !_133.done && (_136 = _132.return)) _136.call(_132);
1761
+ if (_143 && !_143.done && (_147 = _142.return)) _147.call(_142);
1735
1762
  }
1736
- finally { if (e_11) throw e_11.error; }
1763
+ finally { if (e_12) throw e_12.error; }
1737
1764
  }
1738
1765
  fallback_1 = (_85 = series.color) !== null && _85 !== void 0 ? _85 : theme.themeColors.accent1;
1739
1766
  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; } });
@@ -1743,19 +1770,19 @@ var BasicChart = function (_a) {
1743
1770
  seriesAny.dataPointColors.length) {
1744
1771
  overrides_3 = new Map();
1745
1772
  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;
1773
+ for (_144 = (e_13 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _145 = _144.next(); !_145.done; _145 = _144.next()) {
1774
+ dp = _145.value;
1748
1775
  if (typeof dp.idx === "number" && typeof dp.color === "string") {
1749
1776
  overrides_3.set(dp.idx, dp.color);
1750
1777
  }
1751
1778
  }
1752
1779
  }
1753
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1780
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1754
1781
  finally {
1755
1782
  try {
1756
- if (_135 && !_135.done && (_137 = _134.return)) _137.call(_134);
1783
+ if (_145 && !_145.done && (_148 = _144.return)) _148.call(_144);
1757
1784
  }
1758
- finally { if (e_12) throw e_12.error; }
1785
+ finally { if (e_13) throw e_13.error; }
1759
1786
  }
1760
1787
  slicePalette_1 = (0, chart_styles_1.getChartPalette)(spec, [
1761
1788
  theme.themeColors.accent1,
@@ -1797,24 +1824,24 @@ var BasicChart = function (_a) {
1797
1824
  }
1798
1825
  });
1799
1826
  };
1800
- _129.label = 31;
1827
+ _139.label = 31;
1801
1828
  case 31:
1802
- _129.trys.push([31, 36, 37, 38]);
1829
+ _139.trys.push([31, 36, 37, 38]);
1803
1830
  _r = tslib_1.__values(((_68 = spec.series) !== null && _68 !== void 0 ? _68 : []).entries()), _s = _r.next();
1804
- _129.label = 32;
1831
+ _139.label = 32;
1805
1832
  case 32:
1806
1833
  if (!!_s.done) return [3 /*break*/, 35];
1807
1834
  _t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
1808
1835
  return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
1809
1836
  case 33:
1810
- _129.sent();
1811
- _129.label = 34;
1837
+ _139.sent();
1838
+ _139.label = 34;
1812
1839
  case 34:
1813
1840
  _s = _r.next();
1814
1841
  return [3 /*break*/, 32];
1815
1842
  case 35: return [3 /*break*/, 38];
1816
1843
  case 36:
1817
- e_3_1 = _129.sent();
1844
+ e_3_1 = _139.sent();
1818
1845
  e_3 = { error: e_3_1 };
1819
1846
  return [3 /*break*/, 38];
1820
1847
  case 37:
@@ -1824,6 +1851,12 @@ var BasicChart = function (_a) {
1824
1851
  finally { if (e_3) throw e_3.error; }
1825
1852
  return [7 /*endfinally*/];
1826
1853
  case 38:
1854
+ if (isCircularChart && !isOfPie) {
1855
+ // Excel's pie / doughnut legend lists the categories, one entry per
1856
+ // slice — not the series name (the loop above collected those). The
1857
+ // of-pie branch below builds its own category legend.
1858
+ legend.data = (0, helpers_1.circularLegendEntries)(chartSeries);
1859
+ }
1827
1860
  if (isOfPie) {
1828
1861
  labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
1829
1862
  seriesEntry = (_94 = spec.series) === null || _94 === void 0 ? void 0 : _94[0];
@@ -2216,23 +2249,6 @@ var BasicChart = function (_a) {
2216
2249
  previousSeriesCount.current !== renderedSeriesCount
2217
2250
  ? ["series", "xAxis", "yAxis", "legend", "grid", "tooltip"]
2218
2251
  : [];
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
2252
  valueAxisBase = {
2237
2253
  type: "value",
2238
2254
  show: !isCircularChart,
@@ -2285,6 +2301,38 @@ var BasicChart = function (_a) {
2285
2301
  : undefined,
2286
2302
  };
2287
2303
  finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
2304
+ bottomAxisNameGap = isHorizontalBarChart
2305
+ ? valueAxisBase.nameGap
2306
+ : Number((_129 = (_128 = chartDomains[0]) === null || _128 === void 0 ? void 0 : _128.nameGap) !== null && _129 !== void 0 ? _129 : CATEGORY_AXIS_NAME_GAP);
2307
+ legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
2308
+ position: (_130 = spec.legend) === null || _130 === void 0 ? void 0 : _130.position,
2309
+ visible: finalLegend.show !== false,
2310
+ labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
2311
+ 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,
2312
+ legendItemWidth: defaultLegendConfig.itemWidth,
2313
+ width: width !== null && width !== void 0 ? width : 0,
2314
+ height: height !== null && height !== void 0 ? height : 0,
2315
+ hasTitle: Boolean(title),
2316
+ titleFontSize: (_137 = (_136 = spec.titleTextFormat) === null || _136 === void 0 ? void 0 : _136.fontSize) !== null && _137 !== void 0 ? _137 : 16,
2317
+ hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
2318
+ bottomAxisNameGap: bottomAxisNameGap,
2319
+ hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
2320
+ });
2321
+ positionedLegend = isCircularChart
2322
+ ? finalLegend
2323
+ : tslib_1.__assign(tslib_1.__assign({}, finalLegend), legendBand.legend);
2324
+ gridConfig = isOfPie
2325
+ ? tslib_1.__spreadArray([
2326
+ { left: 0, right: 0, top: 0, bottom: 0 }
2327
+ ], tslib_1.__read(((ofPieLayout === null || ofPieLayout === void 0 ? void 0 : ofPieLayout.barGrid) ? [ofPieLayout.barGrid] : [])), false)
2328
+ : isCircularChart
2329
+ ? {
2330
+ left: 0,
2331
+ right: 0,
2332
+ top: 0,
2333
+ bottom: 0,
2334
+ }
2335
+ : legendBand.grid;
2288
2336
  dataLabelOptions = spec.dataLabels;
2289
2337
  seriesLabelOptionFor = function (s) {
2290
2338
  return (0, overrides_1.buildSeriesLabelOption)(dataLabelOptions && !dataLabelOptions.numberFormatPattern
@@ -2393,7 +2441,7 @@ var BasicChart = function (_a) {
2393
2441
  return next;
2394
2442
  });
2395
2443
  // Update charts
2396
- (_128 = chartRef.current) === null || _128 === void 0 ? void 0 : _128.setOption({
2444
+ (_138 = chartRef.current) === null || _138 === void 0 ? void 0 : _138.setOption({
2397
2445
  xAxis: (function () {
2398
2446
  var _a, _b;
2399
2447
  if (isOfPie) {
@@ -2451,7 +2499,7 @@ var BasicChart = function (_a) {
2451
2499
  splitLine: { show: true },
2452
2500
  name: (_b = spec.horizontalAxisTitle) !== null && _b !== void 0 ? _b : "",
2453
2501
  nameLocation: "middle",
2454
- nameGap: 30,
2502
+ nameGap: CATEGORY_AXIS_NAME_GAP,
2455
2503
  },
2456
2504
  ];
2457
2505
  return base.map(function (axis) {
@@ -2493,7 +2541,7 @@ var BasicChart = function (_a) {
2493
2541
  splitLine: { show: true },
2494
2542
  name: (_a = spec.verticalAxisTitle) !== null && _a !== void 0 ? _a : "",
2495
2543
  nameLocation: "middle",
2496
- nameGap: 30,
2544
+ nameGap: CATEGORY_AXIS_NAME_GAP,
2497
2545
  },
2498
2546
  ];
2499
2547
  return base.map(function (axis) {
@@ -2501,7 +2549,21 @@ var BasicChart = function (_a) {
2501
2549
  });
2502
2550
  }
2503
2551
  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),
2552
+ (0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: (_b = spec.verticalAxisTitle) !== null && _b !== void 0 ? _b : "",
2553
+ // Clear the tick labels: "$2,000.00" is wider than the 50px
2554
+ // default gap, and the title painted over its own labels.
2555
+ nameGap: (0, axis_number_format_1.valueAxisNameGap)({
2556
+ values: chartSeries
2557
+ .filter(function (s) { return (s === null || s === void 0 ? void 0 : s.yAxisIndex) !== 1; })
2558
+ .flatMap(function (s) {
2559
+ return Array.isArray(s === null || s === void 0 ? void 0 : s.data)
2560
+ ? s.data.map(function (d) {
2561
+ return d !== null && typeof d === "object" ? d.value : d;
2562
+ })
2563
+ : [];
2564
+ }),
2565
+ pattern: primaryAxisNumberFormat,
2566
+ }) }), spec.valueAxisOptions, primaryAxisNumberFormat),
2505
2567
  ];
2506
2568
  if (hasSecondaryAxis) {
2507
2569
  axes.push((0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: "", splitLine: { show: false } }), (isPareto
@@ -2515,7 +2577,7 @@ var BasicChart = function (_a) {
2515
2577
  return axes;
2516
2578
  })(),
2517
2579
  series: seriesWithLabels,
2518
- legend: finalLegend,
2580
+ legend: positionedLegend,
2519
2581
  grid: gridConfig,
2520
2582
  tooltip: tooltipConfig,
2521
2583
  }, { 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":
@@ -1 +1 @@
1
- {"version":3,"file":"chart-editor.d.ts","sourceRoot":"","sources":["../../../../components/editors/chart-editor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,2BAA2B,CAAC;AAuBnC,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,+BAA+B,CAAC;AA4CvC,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC;;;;OAIG;IACH,kBAAkB,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAChD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;CAC1C,CAAC;AAuBF,eAAO,MAAM,WAAW,GAAI,sEAMzB,gBAAgB,sBA+5DlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"chart-editor.d.ts","sourceRoot":"","sources":["../../../../components/editors/chart-editor.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,2BAA2B,CAAC;AAuBnC,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,OAAO,EAEL,KAAK,oBAAoB,EAG1B,MAAM,+BAA+B,CAAC;AA4CvC,KAAK,gBAAgB,GAAG;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACtC;;;;OAIG;IACH,kBAAkB,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAChD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;CAC1C,CAAC;AAuBF,eAAO,MAAM,WAAW,GAAI,sEAMzB,gBAAgB,sBAo6DlB,CAAC;AAEF,eAAe,WAAW,CAAC"}