@rowsncolumns/charts 28.1.18 → 28.1.19
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.
- package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/basic-chart/basic-chart.js +338 -233
- package/dist/cjs/basic-chart/helpers.d.ts +7 -3
- package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/basic-chart/helpers.js +30 -4
- package/dist/cjs/basic-chart/index.d.ts +7 -0
- package/dist/cjs/basic-chart/index.d.ts.map +1 -1
- package/dist/cjs/basic-chart/index.js +19 -2
- package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +21 -12
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts +6 -3
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts.map +1 -1
- package/dist/cjs/components/editors/fields/axis-options-fields.js +69 -7
- package/dist/cjs/components/editors/fields/chart-elements-fields.d.ts +15 -0
- package/dist/cjs/components/editors/fields/chart-elements-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/chart-elements-fields.js +23 -0
- package/dist/cjs/components/editors/fields/series-format-fields.d.ts.map +1 -1
- package/dist/cjs/components/editors/fields/series-format-fields.js +16 -2
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils/chart-lines.d.ts +36 -0
- package/dist/cjs/utils/chart-lines.d.ts.map +1 -0
- package/dist/cjs/utils/chart-lines.js +111 -0
- package/dist/cjs/utils/data-table.d.ts +31 -0
- package/dist/cjs/utils/data-table.d.ts.map +1 -0
- package/dist/cjs/utils/data-table.js +61 -0
- package/dist/cjs/utils/excel-axis-scale.d.ts +35 -0
- package/dist/cjs/utils/excel-axis-scale.d.ts.map +1 -0
- package/dist/cjs/utils/excel-axis-scale.js +210 -0
- package/dist/cjs/utils/overrides.d.ts +24 -3
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +119 -14
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +177 -38
- package/dist/esm/basic-chart/helpers.d.ts +7 -3
- package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/basic-chart/helpers.js +26 -3
- package/dist/esm/basic-chart/index.d.ts +7 -0
- package/dist/esm/basic-chart/index.d.ts.map +1 -1
- package/dist/esm/basic-chart/index.js +15 -1
- package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +12 -1
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts +6 -3
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts.map +1 -1
- package/dist/esm/components/editors/fields/axis-options-fields.js +56 -5
- package/dist/esm/components/editors/fields/chart-elements-fields.d.ts +15 -0
- package/dist/esm/components/editors/fields/chart-elements-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/chart-elements-fields.js +17 -0
- package/dist/esm/components/editors/fields/series-format-fields.d.ts.map +1 -1
- package/dist/esm/components/editors/fields/series-format-fields.js +9 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/chart-lines.d.ts +36 -0
- package/dist/esm/utils/chart-lines.d.ts.map +1 -0
- package/dist/esm/utils/chart-lines.js +121 -0
- package/dist/esm/utils/data-table.d.ts +31 -0
- package/dist/esm/utils/data-table.d.ts.map +1 -0
- package/dist/esm/utils/data-table.js +48 -0
- package/dist/esm/utils/excel-axis-scale.d.ts +35 -0
- package/dist/esm/utils/excel-axis-scale.d.ts.map +1 -0
- package/dist/esm/utils/excel-axis-scale.js +122 -0
- package/dist/esm/utils/overrides.d.ts +24 -3
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +111 -10
- package/package.json +7 -7
|
@@ -20,13 +20,16 @@ var boxplot_1 = require("../utils/boxplot");
|
|
|
20
20
|
var bubble_1 = require("../utils/bubble");
|
|
21
21
|
var category_levels_1 = require("../utils/category-levels");
|
|
22
22
|
var chart_image_1 = require("../utils/chart-image");
|
|
23
|
+
var chart_lines_1 = require("../utils/chart-lines");
|
|
23
24
|
var chart_orientation_1 = require("../utils/chart-orientation");
|
|
24
25
|
var chart_spec_utils_1 = require("../utils/chart-spec-utils");
|
|
25
26
|
var chart_styles_1 = require("../utils/chart-styles");
|
|
27
|
+
var data_table_1 = require("../utils/data-table");
|
|
26
28
|
var doughnut_1 = require("../utils/doughnut");
|
|
27
29
|
var echarts_gl_loader_1 = require("../utils/echarts-gl-loader");
|
|
28
30
|
var echarts_overlays_1 = require("../utils/echarts-overlays");
|
|
29
31
|
var empty_cells_1 = require("../utils/empty-cells");
|
|
32
|
+
var excel_axis_scale_1 = require("../utils/excel-axis-scale");
|
|
30
33
|
var gradient_1 = require("../utils/gradient");
|
|
31
34
|
var hierarchy_1 = require("../utils/hierarchy");
|
|
32
35
|
var histogram_1 = require("../utils/histogram");
|
|
@@ -254,11 +257,37 @@ var defaultLegendConfig = {
|
|
|
254
257
|
};
|
|
255
258
|
/** Category-axis title gap: clears one row of tick labels (#986). */
|
|
256
259
|
var CATEGORY_AXIS_NAME_GAP = (0, legend_layout_1.categoryAxisNameGap)();
|
|
260
|
+
/**
|
|
261
|
+
* Excel's chart text colour: Text 1 at 65% (`<a:schemeClr val="tx1"><a:lumMod
|
|
262
|
+
* val="65000"/><a:lumOff val="35000"/>`, #595959 on the light theme) — RD-24.
|
|
263
|
+
*/
|
|
264
|
+
var chartTextColor = function (theme, isDarkMode) {
|
|
265
|
+
return (0, spreadsheet_1.getStringifiedColor)({ theme: 1, tint: isDarkMode ? 1 : 0.35 }, theme);
|
|
266
|
+
};
|
|
267
|
+
/** The theme's body (minor) font, which Excel's chart text uses. */
|
|
268
|
+
var chartFontFamily = function (theme) {
|
|
269
|
+
return (theme === null || theme === void 0 ? void 0 : theme.primaryFontFamily) ? "".concat(theme.primaryFontFamily, ", sans-serif") : "sans-serif";
|
|
270
|
+
};
|
|
271
|
+
/** Chart types whose value axes take Excel's automatic bounds and major unit. */
|
|
272
|
+
var AUTO_SCALE_CHART_TYPES = new Set([
|
|
273
|
+
"column",
|
|
274
|
+
"bar",
|
|
275
|
+
"line",
|
|
276
|
+
"area",
|
|
277
|
+
"combo",
|
|
278
|
+
]);
|
|
257
279
|
var BasicChart = function (_a) {
|
|
258
|
-
var _b, _c, _d;
|
|
280
|
+
var _b, _c, _d, _e, _f;
|
|
259
281
|
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, locale = _a.locale, enable3D = _a.enable3D;
|
|
260
282
|
var spec = chart.spec;
|
|
261
|
-
|
|
283
|
+
// A title linked to a cell shows the cell's text (FT-08); `title` is its last copy.
|
|
284
|
+
var titleSource = chart.spec.titleSource;
|
|
285
|
+
var linkedTitleValue = titleSource
|
|
286
|
+
? (_b = getDomainValuesFromRange(titleSource)) === null || _b === void 0 ? void 0 : _b[0]
|
|
287
|
+
: undefined;
|
|
288
|
+
var explicitChartTitle = (_d = (_c = (linkedTitleValue !== undefined && linkedTitleValue !== null && linkedTitleValue !== ""
|
|
289
|
+
? String(linkedTitleValue)
|
|
290
|
+
: undefined)) !== null && _c !== void 0 ? _c : chart.spec.title) !== null && _d !== void 0 ? _d : undefined;
|
|
262
291
|
var hierarchyTitleRef = (0, react_1.useRef)(explicitChartTitle);
|
|
263
292
|
var title = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : hierarchyTitleRef.current;
|
|
264
293
|
var el = (0, react_1.useRef)(null);
|
|
@@ -311,7 +340,7 @@ var BasicChart = function (_a) {
|
|
|
311
340
|
// the chart upgrades from the immediate 2-D fallback to true 3-D.
|
|
312
341
|
var renderedIn3D = (0, react_1.useRef)(false);
|
|
313
342
|
var glUpgradeRequested = (0, react_1.useRef)(false);
|
|
314
|
-
var
|
|
343
|
+
var _g = tslib_1.__read((0, react_1.useState)(0), 2), glUpgradeTick = _g[0], setGlUpgradeTick = _g[1];
|
|
315
344
|
// Region-map (choropleth) pipeline state. The map option (geo +
|
|
316
345
|
// visualMap) doesn't merge back into a cartesian one, so the instance
|
|
317
346
|
// is re-initialized when entering/leaving the region-map rendering.
|
|
@@ -430,11 +459,11 @@ var BasicChart = function (_a) {
|
|
|
430
459
|
* Triggers a chart update
|
|
431
460
|
*/
|
|
432
461
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
433
|
-
var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, boxplotOverlayAxis, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, linkedLabel, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, bubblePalette_1, bubbleItemColor_1, hasBubbleSecondaryAxis, xAxisConfig, tooltipFormatter, bubbleSeriesLabelFor_1, bubbleSeries, bubbleOverlays, bubbleLegend, bubbleBand, hierarchyRows, headerTitle, hierarchyPalette, isTreemap, banner, hierarchyData, rootName, drillDown, seriesDisplayName, hierarchyDepth, levels, hierarchyLegend, legendShown, categoryLegendSeries, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchyLabelOpts, hierarchyLabel, hierarchyBand, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, _h, values, e_1_1, seriesNames_1, contourPoints, _j, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _k, _l, seriesEntry, dataLabel, _m, _o, _p, 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, _q, zMin, zMax, error_1, skipHeaders, categories, radarSeriesInputs, _r, _s, seriesEntry, label, values, radarAxisOptions_1, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, radarLegend, radarBand, radarPlotWidth, radarPlotHeight, radarGeometry, 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, _t, _u, _v, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _w, 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, pointColors_1, _x, _y, dp, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, funnelPalette, funnelColor_1, stageColors_1, _z, _0, dp, funnelData, funnelLayout, funnelLabelsOff, quartileMethod_1, showOutliers_1, showMeanMarker_1, showInnerPoints_1, showMeanLine_1, boxDomainSource, boxCategories_2, grouped_1, groups_1, boxCategories_1, boxCategories_1_1, c, boxSeriesSpecs, slots, boxGap, boxPlotWidth, boxBand_1, boxWidthMax_1, boxCount_1, boxCentre_1, boxLegend_1, rawValues, histogramDomainSource, histogramCategories, _1, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, paretoLineColor, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, chartDataLabels, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, doughnutSeriesOrder, doughnutRingSet, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels;
|
|
462
|
+
var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, boxplotOverlayAxis, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, linkedLabel, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, bubblePalette_1, bubbleItemColor_1, hasBubbleSecondaryAxis, xAxisConfig, tooltipFormatter, bubbleSeriesLabelFor_1, bubbleSeries, bubbleOverlays, bubbleLegend, bubbleBand, hierarchyRows, headerTitle, hierarchyPalette, isTreemap, banner, hierarchyData, rootName, drillDown, seriesDisplayName, hierarchyDepth, levels, hierarchyLegend, legendShown, categoryLegendSeries, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchyLabelOpts, hierarchyLabel, hierarchyBand, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, _h, values, e_1_1, seriesNames_1, contourPoints, _j, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _k, _l, seriesEntry, dataLabel, _m, _o, _p, 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, _q, zMin, zMax, error_1, skipHeaders, categories, radarSeriesInputs, _r, _s, seriesEntry, label, values, radarAxisOptions_1, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, radarLegend, radarBand, radarPlotWidth, radarPlotHeight, radarGeometry, 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, axisTextColor, axisTextStyle, isCircularChart, isOfPie, ofPieLayout, isHorizontalBarChart, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, aggregateDomainValues, categoryLevels, pushSeriesOverlays, sideBySideBarCount, specBarGap, specBarCategoryGap, seriesPalette, paletteColorAt, _loop_1, _t, _u, _v, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _w, 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, pointColors_1, _x, _y, dp, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, funnelPalette, funnelColor_1, stageColors_1, _z, _0, dp, funnelData, funnelLayout, funnelLabelsOff, quartileMethod_1, showOutliers_1, showMeanMarker_1, showInnerPoints_1, showMeanLine_1, boxDomainSource, boxCategories_2, grouped_1, groups_1, boxCategories_1, boxCategories_1_1, c, boxSeriesSpecs, slots, boxGap, boxPlotWidth, boxBand_1, boxWidthMax_1, boxCount_1, boxCentre_1, boxLegend_1, rawValues, histogramDomainSource, histogramCategories, _1, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, paretoLineColor, lineElementOptions, lineData, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, chartDataLabels, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, doughnutSeriesOrder, doughnutRingSet, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels, bareCategoryAxis, pointCount, dataTableOptions, dataTableRows, dataTableAxisList, autoScaleEligible, withExcelAutoScale;
|
|
434
463
|
var e_1, _2, e_2, _3, e_4, _4, e_5, _5, e_3, _6, e_6, _7, e_7, _8, e_8, _9, e_9, _10, e_10, _11;
|
|
435
|
-
var _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, _139, _140, _141, _142, _143, _144, _145, _146, _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, _158, _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, _170, _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181
|
|
436
|
-
return tslib_1.__generator(this, function (
|
|
437
|
-
switch (
|
|
464
|
+
var _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, _139, _140, _141, _142, _143, _144, _145, _146, _147, _148, _149, _150, _151, _152, _153, _154, _155, _156, _157, _158, _159, _160, _161, _162, _163, _164, _165, _166, _167, _168, _169, _170, _171, _172, _173, _174, _175, _176, _177, _178, _179, _180, _181;
|
|
465
|
+
return tslib_1.__generator(this, function (_182) {
|
|
466
|
+
switch (_182.label) {
|
|
438
467
|
case 0:
|
|
439
468
|
(0, utils_1.debug)("Updating chart", chart);
|
|
440
469
|
threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType, { enable3D: enable3D });
|
|
@@ -485,7 +514,7 @@ var BasicChart = function (_a) {
|
|
|
485
514
|
geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
|
|
486
515
|
return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
|
|
487
516
|
case 1:
|
|
488
|
-
geo =
|
|
517
|
+
geo = _182.sent();
|
|
489
518
|
// Entering the region map from a cartesian render: the previous
|
|
490
519
|
// grid/axis option doesn't merge into the map one, so start from
|
|
491
520
|
// a bare instance (theme options are re-applied after setOption).
|
|
@@ -600,7 +629,7 @@ var BasicChart = function (_a) {
|
|
|
600
629
|
});
|
|
601
630
|
seriesInputs = [];
|
|
602
631
|
i = 0;
|
|
603
|
-
|
|
632
|
+
_182.label = 3;
|
|
604
633
|
case 3:
|
|
605
634
|
if (!(i < spec.series.length)) return [3 /*break*/, 7];
|
|
606
635
|
seriesEntry = spec.series[i];
|
|
@@ -610,13 +639,13 @@ var BasicChart = function (_a) {
|
|
|
610
639
|
_b = chart_spec_utils_1.coerceCalculatedLabel;
|
|
611
640
|
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_21 = position.sheetId) !== null && _21 !== void 0 ? _21 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
612
641
|
case 4:
|
|
613
|
-
resolvedLabel = _b.apply(void 0, [
|
|
614
|
-
|
|
642
|
+
resolvedLabel = _b.apply(void 0, [_182.sent()]);
|
|
643
|
+
_182.label = 5;
|
|
615
644
|
case 5:
|
|
616
645
|
xValues = (_22 = perSeriesX[i]) !== null && _22 !== void 0 ? _22 : perSeriesX[0];
|
|
617
646
|
sizeValues_1 = (_23 = perSeriesSize[i]) !== null && _23 !== void 0 ? _23 : perSeriesSize[0];
|
|
618
647
|
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 } : {})));
|
|
619
|
-
|
|
648
|
+
_182.label = 6;
|
|
620
649
|
case 6:
|
|
621
650
|
i++;
|
|
622
651
|
return [3 /*break*/, 3];
|
|
@@ -764,24 +793,24 @@ var BasicChart = function (_a) {
|
|
|
764
793
|
position: (_29 = spec.legend) === null || _29 === void 0 ? void 0 : _29.position,
|
|
765
794
|
visible: bubbleLegend.show !== false,
|
|
766
795
|
labels: preparedSeries.map(function (entry) { return entry.name; }),
|
|
767
|
-
legendFontSize: (
|
|
796
|
+
legendFontSize: (_31 = (_30 = bubbleLegend.textStyle) === null || _30 === void 0 ? void 0 : _30.fontSize) !== null && _31 !== void 0 ? _31 : (0, overrides_2.fontSizePx)((_33 = (_32 = spec.legend) === null || _32 === void 0 ? void 0 : _32.textFormat) === null || _33 === void 0 ? void 0 : _33.fontSize, overrides_2.CHART_TEXT_PX),
|
|
768
797
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
769
798
|
width: width !== null && width !== void 0 ? width : 0,
|
|
770
799
|
height: height !== null && height !== void 0 ? height : 0,
|
|
771
800
|
hasTitle: Boolean(explicitChartTitle),
|
|
772
|
-
titleFontSize: (
|
|
801
|
+
titleFontSize: (0, overrides_2.fontSizePx)((_34 = spec.titleTextFormat) === null || _34 === void 0 ? void 0 : _34.fontSize, overrides_2.CHART_TITLE_PX),
|
|
773
802
|
hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
|
|
774
803
|
bottomAxisNameGap: 30,
|
|
775
804
|
hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
|
|
776
805
|
});
|
|
777
|
-
(
|
|
806
|
+
(_35 = chartRef.current) === null || _35 === void 0 ? void 0 : _35.setOption({
|
|
778
807
|
xAxis: [
|
|
779
|
-
(0, overrides_1.applyAxisOverrides)(tslib_1.__assign({}, xAxisConfig), spec.categoryAxisOptions),
|
|
808
|
+
(0, overrides_1.applyAxisOverrides)(tslib_1.__assign({}, xAxisConfig), spec.categoryAxisOptions, undefined, undefined, "x"),
|
|
780
809
|
],
|
|
781
810
|
yAxis: tslib_1.__spreadArray([
|
|
782
811
|
(0, overrides_1.applyAxisOverrides)({
|
|
783
812
|
type: "value",
|
|
784
|
-
name: (
|
|
813
|
+
name: (_36 = spec.verticalAxisTitle) !== null && _36 !== void 0 ? _36 : "",
|
|
785
814
|
nameLocation: "middle",
|
|
786
815
|
nameGap: 45,
|
|
787
816
|
}, spec.valueAxisOptions, undefined, locale)
|
|
@@ -842,9 +871,9 @@ var BasicChart = function (_a) {
|
|
|
842
871
|
isTreemap = spec.chartType === "treemap";
|
|
843
872
|
banner = isTreemap && treemapBannerShown(spec.parentLabelLayout);
|
|
844
873
|
hierarchyData = colorHierarchyNodes((0, hierarchy_1.buildHierarchyTree)(hierarchyRows), hierarchyPalette, { banner: banner });
|
|
845
|
-
rootName = hierarchyData.length === 1 ? (
|
|
874
|
+
rootName = hierarchyData.length === 1 ? (_38 = (_37 = hierarchyData[0]) === null || _37 === void 0 ? void 0 : _37.name) !== null && _38 !== void 0 ? _38 : "" : "";
|
|
846
875
|
drillDown = Boolean(spec.drillDown);
|
|
847
|
-
seriesDisplayName = (
|
|
876
|
+
seriesDisplayName = (_40 = (_39 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _39 !== void 0 ? _39 : rootName) !== null && _40 !== void 0 ? _40 : "";
|
|
848
877
|
hierarchyDepth = getHierarchyDepth(hierarchyData);
|
|
849
878
|
levels = buildHierarchyLevels(hierarchyDepth, {
|
|
850
879
|
treemap: isTreemap,
|
|
@@ -866,7 +895,7 @@ var BasicChart = function (_a) {
|
|
|
866
895
|
});
|
|
867
896
|
})
|
|
868
897
|
: [];
|
|
869
|
-
sizeNumberFormat_1 = (0, axis_number_format_1.resolveSourceNumberFormat)((
|
|
898
|
+
sizeNumberFormat_1 = (0, axis_number_format_1.resolveSourceNumberFormat)((_42 = (_41 = spec.sizeData) === null || _41 === void 0 ? void 0 : _41[0]) === null || _42 === void 0 ? void 0 : _42.sources, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
870
899
|
tooltipFormatter = function (params) {
|
|
871
900
|
var _a;
|
|
872
901
|
var value = Array.isArray(params.value)
|
|
@@ -882,20 +911,20 @@ var BasicChart = function (_a) {
|
|
|
882
911
|
: (hierarchyLabelOpts === null || hierarchyLabelOpts === void 0 ? void 0 : hierarchyLabelOpts.show)
|
|
883
912
|
? tslib_1.__assign({ show: true, formatter: (0, overrides_1.dataLabelFormatter)(hierarchyLabelOpts, locale, isTreemap ? "\n" : ": ") }, (isTreemap ? { position: "insideBottomLeft" } : {})) : tslib_1.__assign({ show: true, formatter: "{b}" }, (isTreemap ? { position: "insideBottomLeft" } : {}));
|
|
884
913
|
hierarchyBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
885
|
-
position: (
|
|
914
|
+
position: (_43 = spec.legend) === null || _43 === void 0 ? void 0 : _43.position,
|
|
886
915
|
visible: legendShown && hierarchyData.length > 0,
|
|
887
916
|
labels: hierarchyData.map(function (node) { return node.name; }),
|
|
888
|
-
legendFontSize: (
|
|
917
|
+
legendFontSize: (_45 = (_44 = hierarchyLegend.textStyle) === null || _44 === void 0 ? void 0 : _44.fontSize) !== null && _45 !== void 0 ? _45 : (0, overrides_2.fontSizePx)((_47 = (_46 = spec.legend) === null || _46 === void 0 ? void 0 : _46.textFormat) === null || _47 === void 0 ? void 0 : _47.fontSize, overrides_2.CHART_TEXT_PX),
|
|
889
918
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
890
919
|
width: width !== null && width !== void 0 ? width : 0,
|
|
891
920
|
height: height !== null && height !== void 0 ? height : 0,
|
|
892
921
|
hasTitle: Boolean(explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle),
|
|
893
|
-
titleFontSize: (
|
|
922
|
+
titleFontSize: (0, overrides_2.fontSizePx)((_48 = spec.titleTextFormat) === null || _48 === void 0 ? void 0 : _48.fontSize, overrides_2.CHART_TITLE_PX),
|
|
894
923
|
hasBottomAxisTitle: false,
|
|
895
924
|
bottomAxisNameGap: 0,
|
|
896
925
|
hasLeftAxisTitle: false,
|
|
897
926
|
});
|
|
898
|
-
(
|
|
927
|
+
(_49 = chartRef.current) === null || _49 === void 0 ? void 0 : _49.setOption({
|
|
899
928
|
xAxis: [
|
|
900
929
|
{
|
|
901
930
|
type: "category",
|
|
@@ -967,7 +996,7 @@ var BasicChart = function (_a) {
|
|
|
967
996
|
}
|
|
968
997
|
isContour = (0, three_d_1.isContourSpec)(spec);
|
|
969
998
|
if (renderedAsContour.current && !isContour) {
|
|
970
|
-
(
|
|
999
|
+
(_50 = chartRef.current) === null || _50 === void 0 ? void 0 : _50.dispose();
|
|
971
1000
|
chartRef.current = undefined;
|
|
972
1001
|
renderedAsContour.current = false;
|
|
973
1002
|
previousChartType.current = undefined;
|
|
@@ -978,41 +1007,41 @@ var BasicChart = function (_a) {
|
|
|
978
1007
|
if (!isContour) return [3 /*break*/, 21];
|
|
979
1008
|
categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
980
1009
|
contourSeriesInputs = [];
|
|
981
|
-
|
|
1010
|
+
_182.label = 9;
|
|
982
1011
|
case 9:
|
|
983
|
-
|
|
984
|
-
_d = tslib_1.__values((
|
|
985
|
-
|
|
1012
|
+
_182.trys.push([9, 18, 19, 20]);
|
|
1013
|
+
_d = tslib_1.__values((_51 = spec.series) !== null && _51 !== void 0 ? _51 : []), _e = _d.next();
|
|
1014
|
+
_182.label = 10;
|
|
986
1015
|
case 10:
|
|
987
1016
|
if (!!_e.done) return [3 /*break*/, 17];
|
|
988
1017
|
seriesEntry = _e.value;
|
|
989
|
-
if (!((
|
|
990
|
-
_f =
|
|
1018
|
+
if (!((_52 = (0, series_name_1.linkedSeriesName)(seriesEntry, getDomainValuesFromRange)) !== null && _52 !== void 0)) return [3 /*break*/, 11];
|
|
1019
|
+
_f = _52;
|
|
991
1020
|
return [3 /*break*/, 15];
|
|
992
1021
|
case 11:
|
|
993
1022
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 13];
|
|
994
1023
|
_h = chart_spec_utils_1.coerceCalculatedLabel;
|
|
995
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
1024
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_53 = position.sheetId) !== null && _53 !== void 0 ? _53 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
996
1025
|
case 12:
|
|
997
|
-
_g = _h.apply(void 0, [
|
|
1026
|
+
_g = _h.apply(void 0, [_182.sent()]);
|
|
998
1027
|
return [3 /*break*/, 14];
|
|
999
1028
|
case 13:
|
|
1000
|
-
_g = (
|
|
1001
|
-
|
|
1029
|
+
_g = (_54 = seriesEntry.dataLabel) !== null && _54 !== void 0 ? _54 : "";
|
|
1030
|
+
_182.label = 14;
|
|
1002
1031
|
case 14:
|
|
1003
1032
|
_f = (_g);
|
|
1004
|
-
|
|
1033
|
+
_182.label = 15;
|
|
1005
1034
|
case 15:
|
|
1006
1035
|
dataLabel = _f;
|
|
1007
1036
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
1008
1037
|
contourSeriesInputs.push({ name: dataLabel, values: values });
|
|
1009
|
-
|
|
1038
|
+
_182.label = 16;
|
|
1010
1039
|
case 16:
|
|
1011
1040
|
_e = _d.next();
|
|
1012
1041
|
return [3 /*break*/, 10];
|
|
1013
1042
|
case 17: return [3 /*break*/, 20];
|
|
1014
1043
|
case 18:
|
|
1015
|
-
e_1_1 =
|
|
1044
|
+
e_1_1 = _182.sent();
|
|
1016
1045
|
e_1 = { error: e_1_1 };
|
|
1017
1046
|
return [3 /*break*/, 20];
|
|
1018
1047
|
case 19:
|
|
@@ -1037,7 +1066,7 @@ var BasicChart = function (_a) {
|
|
|
1037
1066
|
chartRef.current = echarts.init(el.current);
|
|
1038
1067
|
bindSeriesSelection(chartRef.current);
|
|
1039
1068
|
}
|
|
1040
|
-
(
|
|
1069
|
+
(_55 = chartRef.current) === null || _55 === void 0 ? void 0 : _55.setOption({
|
|
1041
1070
|
tooltip: {
|
|
1042
1071
|
textStyle: { fontSize: 12 },
|
|
1043
1072
|
trigger: "item",
|
|
@@ -1057,7 +1086,7 @@ var BasicChart = function (_a) {
|
|
|
1057
1086
|
type: "category",
|
|
1058
1087
|
data: categories_2,
|
|
1059
1088
|
splitArea: { show: true },
|
|
1060
|
-
name: (
|
|
1089
|
+
name: (_56 = spec.horizontalAxisTitle) !== null && _56 !== void 0 ? _56 : "",
|
|
1061
1090
|
nameLocation: "middle",
|
|
1062
1091
|
nameGap: 30,
|
|
1063
1092
|
}, spec.categoryAxisOptions),
|
|
@@ -1067,7 +1096,7 @@ var BasicChart = function (_a) {
|
|
|
1067
1096
|
type: "category",
|
|
1068
1097
|
data: seriesNames_1,
|
|
1069
1098
|
splitArea: { show: true },
|
|
1070
|
-
name: (
|
|
1099
|
+
name: (_57 = spec.verticalAxisTitle) !== null && _57 !== void 0 ? _57 : "",
|
|
1071
1100
|
nameLocation: "middle",
|
|
1072
1101
|
nameGap: 50,
|
|
1073
1102
|
},
|
|
@@ -1120,41 +1149,41 @@ var BasicChart = function (_a) {
|
|
|
1120
1149
|
if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 38];
|
|
1121
1150
|
categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1122
1151
|
threeDSeriesInputs = [];
|
|
1123
|
-
|
|
1152
|
+
_182.label = 22;
|
|
1124
1153
|
case 22:
|
|
1125
|
-
|
|
1126
|
-
_k = tslib_1.__values((
|
|
1127
|
-
|
|
1154
|
+
_182.trys.push([22, 31, 32, 33]);
|
|
1155
|
+
_k = tslib_1.__values((_58 = spec.series) !== null && _58 !== void 0 ? _58 : []), _l = _k.next();
|
|
1156
|
+
_182.label = 23;
|
|
1128
1157
|
case 23:
|
|
1129
1158
|
if (!!_l.done) return [3 /*break*/, 30];
|
|
1130
1159
|
seriesEntry = _l.value;
|
|
1131
|
-
if (!((
|
|
1132
|
-
_m =
|
|
1160
|
+
if (!((_59 = (0, series_name_1.linkedSeriesName)(seriesEntry, getDomainValuesFromRange)) !== null && _59 !== void 0)) return [3 /*break*/, 24];
|
|
1161
|
+
_m = _59;
|
|
1133
1162
|
return [3 /*break*/, 28];
|
|
1134
1163
|
case 24:
|
|
1135
1164
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 26];
|
|
1136
1165
|
_p = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1137
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
1166
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_60 = position.sheetId) !== null && _60 !== void 0 ? _60 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1138
1167
|
case 25:
|
|
1139
|
-
_o = _p.apply(void 0, [
|
|
1168
|
+
_o = _p.apply(void 0, [_182.sent()]);
|
|
1140
1169
|
return [3 /*break*/, 27];
|
|
1141
1170
|
case 26:
|
|
1142
|
-
_o = (
|
|
1143
|
-
|
|
1171
|
+
_o = (_61 = seriesEntry.dataLabel) !== null && _61 !== void 0 ? _61 : "";
|
|
1172
|
+
_182.label = 27;
|
|
1144
1173
|
case 27:
|
|
1145
1174
|
_m = (_o);
|
|
1146
|
-
|
|
1175
|
+
_182.label = 28;
|
|
1147
1176
|
case 28:
|
|
1148
1177
|
dataLabel = _m;
|
|
1149
1178
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
1150
1179
|
threeDSeriesInputs.push({ name: dataLabel, values: values });
|
|
1151
|
-
|
|
1180
|
+
_182.label = 29;
|
|
1152
1181
|
case 29:
|
|
1153
1182
|
_l = _k.next();
|
|
1154
1183
|
return [3 /*break*/, 23];
|
|
1155
1184
|
case 30: return [3 /*break*/, 33];
|
|
1156
1185
|
case 31:
|
|
1157
|
-
e_2_1 =
|
|
1186
|
+
e_2_1 = _182.sent();
|
|
1158
1187
|
e_2 = { error: e_2_1 };
|
|
1159
1188
|
return [3 /*break*/, 33];
|
|
1160
1189
|
case 32:
|
|
@@ -1323,15 +1352,15 @@ var BasicChart = function (_a) {
|
|
|
1323
1352
|
inRange: { color: tslib_1.__spreadArray([], tslib_1.__read(three_d_1.SURFACE_COLOR_RAMP), false) },
|
|
1324
1353
|
};
|
|
1325
1354
|
}
|
|
1326
|
-
|
|
1355
|
+
_182.label = 34;
|
|
1327
1356
|
case 34:
|
|
1328
|
-
|
|
1329
|
-
(
|
|
1357
|
+
_182.trys.push([34, 35, , 37]);
|
|
1358
|
+
(_62 = chartRef.current) === null || _62 === void 0 ? void 0 : _62.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
|
|
1330
1359
|
textStyle: { fontSize: 12 },
|
|
1331
1360
|
formatter: threeDTooltipFormatter,
|
|
1332
1361
|
}, legend: threeDRenderKind === "line3D" || stackedBar3D_1
|
|
1333
1362
|
? (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: seriesNames_2.length > 1, data: seriesNames_2 }), spec.legend)
|
|
1334
|
-
: { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (
|
|
1363
|
+
: { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (_63 = spec.horizontalAxisTitle) !== null && _63 !== void 0 ? _63 : "" }), yAxis3D: tslib_1.__assign(tslib_1.__assign({}, yAxis3D), { name: "" }), zAxis3D: { type: "value", name: (_64 = spec.verticalAxisTitle) !== null && _64 !== void 0 ? _64 : "" }, grid3D: {
|
|
1335
1364
|
boxDepth: Math.max(20, Math.min(100, seriesNames_2.length * 20)),
|
|
1336
1365
|
viewControl: { autoRotate: false },
|
|
1337
1366
|
} }, (visualMap ? { visualMap: [visualMap] } : {})), { series: threeDSeries }), {
|
|
@@ -1347,12 +1376,12 @@ var BasicChart = function (_a) {
|
|
|
1347
1376
|
});
|
|
1348
1377
|
return [3 /*break*/, 37];
|
|
1349
1378
|
case 35:
|
|
1350
|
-
error_1 =
|
|
1379
|
+
error_1 = _182.sent();
|
|
1351
1380
|
(0, echarts_gl_loader_1.markEchartsGlFailed)(error_1);
|
|
1352
1381
|
try {
|
|
1353
|
-
(
|
|
1382
|
+
(_65 = chartRef.current) === null || _65 === void 0 ? void 0 : _65.dispose();
|
|
1354
1383
|
}
|
|
1355
|
-
catch (
|
|
1384
|
+
catch (_183) {
|
|
1356
1385
|
// A GL instance that threw mid-build may not dispose cleanly.
|
|
1357
1386
|
}
|
|
1358
1387
|
chartRef.current = undefined;
|
|
@@ -1363,7 +1392,7 @@ var BasicChart = function (_a) {
|
|
|
1363
1392
|
applyThemeOptions();
|
|
1364
1393
|
return [4 /*yield*/, updateChart()];
|
|
1365
1394
|
case 36:
|
|
1366
|
-
|
|
1395
|
+
_182.sent();
|
|
1367
1396
|
return [2 /*return*/];
|
|
1368
1397
|
case 37:
|
|
1369
1398
|
// Re-apply theme-derived title / palette / tooltip colors — lost
|
|
@@ -1383,9 +1412,9 @@ var BasicChart = function (_a) {
|
|
|
1383
1412
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders);
|
|
1384
1413
|
radarSeriesInputs = [];
|
|
1385
1414
|
try {
|
|
1386
|
-
for (_r = tslib_1.__values((
|
|
1415
|
+
for (_r = tslib_1.__values((_66 = spec.series) !== null && _66 !== void 0 ? _66 : []), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
1387
1416
|
seriesEntry = _s.value;
|
|
1388
|
-
label = (
|
|
1417
|
+
label = (_67 = (0, series_name_1.linkedSeriesName)(seriesEntry, getDomainValuesFromRange)) !== null && _67 !== void 0 ? _67 : (seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
1389
1418
|
? seriesEntry.dataLabel
|
|
1390
1419
|
: "");
|
|
1391
1420
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
@@ -1402,7 +1431,7 @@ var BasicChart = function (_a) {
|
|
|
1402
1431
|
radarAxisOptions_1 = spec.valueAxisOptions;
|
|
1403
1432
|
indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions_1);
|
|
1404
1433
|
radarData = (0, radar_1.buildRadarSeriesData)(radarSeriesInputs, indicators_1.length);
|
|
1405
|
-
radarStyle_1 = (
|
|
1434
|
+
radarStyle_1 = (_68 = spec.radarStyle) !== null && _68 !== void 0 ? _68 : "standard";
|
|
1406
1435
|
radarColors_1 = radarSeriesInputs.map(function (_, i) { var _a, _b; return (_b = (_a = spec.series) === null || _a === void 0 ? void 0 : _a[i]) === null || _b === void 0 ? void 0 : _b.color; });
|
|
1407
1436
|
radarFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
1408
1437
|
radarDataLabels_1 = spec.dataLabels;
|
|
@@ -1421,15 +1450,15 @@ var BasicChart = function (_a) {
|
|
|
1421
1450
|
};
|
|
1422
1451
|
radarLegend = (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, legend), { show: radarData.length > 1, data: radarData.map(function (d) { return d.name; }) }), spec.legend);
|
|
1423
1452
|
radarBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
1424
|
-
position: (
|
|
1453
|
+
position: (_69 = spec.legend) === null || _69 === void 0 ? void 0 : _69.position,
|
|
1425
1454
|
visible: radarLegend.show !== false,
|
|
1426
1455
|
labels: radarData.map(function (d) { return d.name; }),
|
|
1427
|
-
legendFontSize: (
|
|
1456
|
+
legendFontSize: (_71 = (_70 = radarLegend.textStyle) === null || _70 === void 0 ? void 0 : _70.fontSize) !== null && _71 !== void 0 ? _71 : (0, overrides_2.fontSizePx)((_73 = (_72 = spec.legend) === null || _72 === void 0 ? void 0 : _72.textFormat) === null || _73 === void 0 ? void 0 : _73.fontSize, overrides_2.CHART_TEXT_PX),
|
|
1428
1457
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
1429
1458
|
width: width !== null && width !== void 0 ? width : 0,
|
|
1430
1459
|
height: height !== null && height !== void 0 ? height : 0,
|
|
1431
1460
|
hasTitle: Boolean(explicitChartTitle),
|
|
1432
|
-
titleFontSize: (
|
|
1461
|
+
titleFontSize: (0, overrides_2.fontSizePx)((_74 = spec.titleTextFormat) === null || _74 === void 0 ? void 0 : _74.fontSize, overrides_2.CHART_TITLE_PX),
|
|
1433
1462
|
hasBottomAxisTitle: false,
|
|
1434
1463
|
bottomAxisNameGap: 0,
|
|
1435
1464
|
hasLeftAxisTitle: false,
|
|
@@ -1445,7 +1474,7 @@ var BasicChart = function (_a) {
|
|
|
1445
1474
|
radius: Math.max(10, Math.min(radarPlotWidth, radarPlotHeight) / 2 - 30),
|
|
1446
1475
|
}
|
|
1447
1476
|
: {};
|
|
1448
|
-
(
|
|
1477
|
+
(_75 = chartRef.current) === null || _75 === void 0 ? void 0 : _75.setOption({
|
|
1449
1478
|
radar: tslib_1.__assign(tslib_1.__assign({}, radarGeometry), {
|
|
1450
1479
|
// The common scale's tick labels along ONE axis, as Excel draws
|
|
1451
1480
|
// them: echarts labels every indicator axis, so each indicator
|
|
@@ -1499,9 +1528,9 @@ var BasicChart = function (_a) {
|
|
|
1499
1528
|
// V-variants additionally get a volume column sub-pane below the
|
|
1500
1529
|
// price plot.
|
|
1501
1530
|
if (spec.chartType === "stock") {
|
|
1502
|
-
variant_1 = ((
|
|
1531
|
+
variant_1 = ((_76 = spec.stockVariant) !== null && _76 !== void 0 ? _76 : "HLC");
|
|
1503
1532
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1504
|
-
seriesValues = ((
|
|
1533
|
+
seriesValues = ((_77 = spec.series) !== null && _77 !== void 0 ? _77 : []).map(function (seriesEntry) {
|
|
1505
1534
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
1506
1535
|
});
|
|
1507
1536
|
stockFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
@@ -1519,7 +1548,7 @@ var BasicChart = function (_a) {
|
|
|
1519
1548
|
upColor_1 = theme.themeColors.accent1;
|
|
1520
1549
|
downColor_1 = theme.themeColors.accent2;
|
|
1521
1550
|
volumePoints = (0, stock_1.toVolumeSeries)(seriesValues, variant_1);
|
|
1522
|
-
hasVolume = ((
|
|
1551
|
+
hasVolume = ((_78 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _78 !== void 0 ? _78 : 0) > 0;
|
|
1523
1552
|
stockGrid = hasVolume
|
|
1524
1553
|
? [
|
|
1525
1554
|
{ left: "10%", right: "4%", top: "8%", height: "56%" },
|
|
@@ -1533,7 +1562,7 @@ var BasicChart = function (_a) {
|
|
|
1533
1562
|
axisLine: { show: true },
|
|
1534
1563
|
axisTick: { show: true },
|
|
1535
1564
|
splitLine: { show: false },
|
|
1536
|
-
name: (
|
|
1565
|
+
name: (_79 = spec.horizontalAxisTitle) !== null && _79 !== void 0 ? _79 : "",
|
|
1537
1566
|
nameLocation: "middle",
|
|
1538
1567
|
nameGap: 30,
|
|
1539
1568
|
}, spec.categoryAxisOptions);
|
|
@@ -1575,14 +1604,14 @@ var BasicChart = function (_a) {
|
|
|
1575
1604
|
// (no open) fall through to the line-derived rendering below.
|
|
1576
1605
|
if (variant_1 === "OHLC" || variant_1 === "VOHLC") {
|
|
1577
1606
|
candleData = (0, stock_1.toCandlestick)(seriesValues, variant_1);
|
|
1578
|
-
(
|
|
1607
|
+
(_80 = chartRef.current) === null || _80 === void 0 ? void 0 : _80.setOption({
|
|
1579
1608
|
xAxis: stockXAxis,
|
|
1580
1609
|
yAxis: tslib_1.__spreadArray([
|
|
1581
1610
|
(0, overrides_1.applyAxisOverrides)({
|
|
1582
1611
|
type: "value",
|
|
1583
1612
|
show: true,
|
|
1584
1613
|
scale: true,
|
|
1585
|
-
name: (
|
|
1614
|
+
name: (_81 = spec.verticalAxisTitle) !== null && _81 !== void 0 ? _81 : "",
|
|
1586
1615
|
nameLocation: "middle",
|
|
1587
1616
|
nameGap: 50,
|
|
1588
1617
|
gridIndex: 0,
|
|
@@ -1627,13 +1656,13 @@ var BasicChart = function (_a) {
|
|
|
1627
1656
|
theme.themeColors.accent3,
|
|
1628
1657
|
theme.themeColors.accent4,
|
|
1629
1658
|
]);
|
|
1630
|
-
(
|
|
1659
|
+
(_82 = chartRef.current) === null || _82 === void 0 ? void 0 : _82.setOption({
|
|
1631
1660
|
xAxis: stockXAxis,
|
|
1632
1661
|
yAxis: tslib_1.__spreadArray([
|
|
1633
1662
|
(0, overrides_1.applyAxisOverrides)({
|
|
1634
1663
|
type: "value",
|
|
1635
1664
|
show: true,
|
|
1636
|
-
name: (
|
|
1665
|
+
name: (_83 = spec.verticalAxisTitle) !== null && _83 !== void 0 ? _83 : "",
|
|
1637
1666
|
nameLocation: "middle",
|
|
1638
1667
|
nameGap: 50,
|
|
1639
1668
|
gridIndex: 0,
|
|
@@ -1667,19 +1696,24 @@ var BasicChart = function (_a) {
|
|
|
1667
1696
|
return [2 /*return*/];
|
|
1668
1697
|
}
|
|
1669
1698
|
isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
|
|
1699
|
+
axisTextColor = chartTextColor(theme, isDarkMode);
|
|
1700
|
+
axisTextStyle = {
|
|
1701
|
+
axisLabel: { color: axisTextColor, fontSize: overrides_2.CHART_TEXT_PX },
|
|
1702
|
+
nameTextStyle: { color: axisTextColor, fontSize: (0, overrides_2.pointsToPixels)(10) },
|
|
1703
|
+
};
|
|
1670
1704
|
isCircularChart = spec.chartType === "pie" || spec.chartType === "doughnut";
|
|
1671
1705
|
isOfPie = isCircularChart && (0, of_pie_1.isOfPieChartSpec)(spec);
|
|
1672
1706
|
ofPieLayout = null;
|
|
1673
1707
|
isHorizontalBarChart = spec.chartType === "bar";
|
|
1674
1708
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1675
|
-
primaryDomainSource = (
|
|
1709
|
+
primaryDomainSource = (_86 = (_85 = (_84 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _84 === void 0 ? void 0 : _84[0]) === null || _85 === void 0 ? void 0 : _85.sources) === null || _86 === void 0 ? void 0 : _86[0];
|
|
1676
1710
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1677
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1711
|
+
? (0, aggregation_1.sanitizeDomainValues)((_87 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _87 !== void 0 ? _87 : [])
|
|
1678
1712
|
: [];
|
|
1679
1713
|
aggregateDomainValues = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1680
1714
|
categoryLevels = isCircularChart
|
|
1681
1715
|
? undefined
|
|
1682
|
-
: (0, category_levels_1.resolveCategoryLevels)((
|
|
1716
|
+
: (0, category_levels_1.resolveCategoryLevels)((_88 = spec.categoryLevels) === null || _88 === void 0 ? void 0 : _88.map(function (level) {
|
|
1683
1717
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1684
1718
|
}));
|
|
1685
1719
|
if (categoryLevels) {
|
|
@@ -1688,17 +1722,17 @@ var BasicChart = function (_a) {
|
|
|
1688
1722
|
show: showAxis,
|
|
1689
1723
|
axisLine: { show: true },
|
|
1690
1724
|
axisTick: { show: true },
|
|
1691
|
-
splitLine: { show:
|
|
1725
|
+
splitLine: { show: false },
|
|
1692
1726
|
name: isHorizontalBarChart
|
|
1693
|
-
? (
|
|
1694
|
-
: (
|
|
1727
|
+
? (_89 = spec.verticalAxisTitle) !== null && _89 !== void 0 ? _89 : ""
|
|
1728
|
+
: (_90 = spec.horizontalAxisTitle) !== null && _90 !== void 0 ? _90 : "",
|
|
1695
1729
|
nameLocation: "middle",
|
|
1696
1730
|
nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
|
|
1697
1731
|
})), false));
|
|
1698
1732
|
}
|
|
1699
1733
|
// One category axis per domain (Excel): a domain drawn from several
|
|
1700
1734
|
// ranges lists their categories in sequence on that single axis.
|
|
1701
|
-
(categoryLevels ? [] : (
|
|
1735
|
+
(categoryLevels ? [] : (_91 = spec.domains) !== null && _91 !== void 0 ? _91 : []).forEach(function (domain, domainIndex) {
|
|
1702
1736
|
var _a, _b;
|
|
1703
1737
|
var axisData = domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1704
1738
|
var _a;
|
|
@@ -1713,32 +1747,15 @@ var BasicChart = function (_a) {
|
|
|
1713
1747
|
? (_a = spec.verticalAxisTitle) !== null && _a !== void 0 ? _a : ""
|
|
1714
1748
|
: (_b = spec.horizontalAxisTitle) !== null && _b !== void 0 ? _b : ""
|
|
1715
1749
|
: undefined;
|
|
1716
|
-
chartDomains.push({
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
show:
|
|
1720
|
-
axisLine: { show: !isCircularChart },
|
|
1721
|
-
axisTick: { show: !isCircularChart },
|
|
1722
|
-
splitLine: { show: !isCircularChart },
|
|
1723
|
-
name: axisTitle,
|
|
1724
|
-
nameLocation: "middle",
|
|
1725
|
-
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
1726
|
-
});
|
|
1750
|
+
chartDomains.push(tslib_1.__assign(tslib_1.__assign({}, axisTextStyle), { type: "category", data: axisData, show: showAxis && !isCircularChart, axisLine: { show: !isCircularChart }, axisTick: { show: !isCircularChart },
|
|
1751
|
+
// Excel draws vertical (category) gridlines only when the axis asks
|
|
1752
|
+
// for them (`<c:catAx><c:majorGridlines/>`) — LV-05.
|
|
1753
|
+
splitLine: { show: false }, name: axisTitle, nameLocation: "middle", nameGap: CATEGORY_AXIS_NAME_GAP }));
|
|
1727
1754
|
});
|
|
1728
1755
|
if (chartDomains.length === 0 && !isCircularChart) {
|
|
1729
|
-
chartDomains.push({
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
axisLine: { show: true },
|
|
1733
|
-
axisTick: { show: true },
|
|
1734
|
-
splitLine: { show: true },
|
|
1735
|
-
gridIndex: 0,
|
|
1736
|
-
name: isHorizontalBarChart
|
|
1737
|
-
? (_98 = spec.verticalAxisTitle) !== null && _98 !== void 0 ? _98 : ""
|
|
1738
|
-
: (_99 = spec.horizontalAxisTitle) !== null && _99 !== void 0 ? _99 : "",
|
|
1739
|
-
nameLocation: "middle",
|
|
1740
|
-
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
1741
|
-
});
|
|
1756
|
+
chartDomains.push(tslib_1.__assign(tslib_1.__assign({}, axisTextStyle), { type: "category", show: showAxis, axisLine: { show: true }, axisTick: { show: true }, splitLine: { show: false }, gridIndex: 0, name: isHorizontalBarChart
|
|
1757
|
+
? (_92 = spec.verticalAxisTitle) !== null && _92 !== void 0 ? _92 : ""
|
|
1758
|
+
: (_93 = spec.horizontalAxisTitle) !== null && _93 !== void 0 ? _93 : "", nameLocation: "middle", nameGap: CATEGORY_AXIS_NAME_GAP }));
|
|
1742
1759
|
}
|
|
1743
1760
|
pushSeriesOverlays = function (series, data, dataLabel) {
|
|
1744
1761
|
var _a;
|
|
@@ -1767,7 +1784,7 @@ var BasicChart = function (_a) {
|
|
|
1767
1784
|
};
|
|
1768
1785
|
sideBySideBarCount = isStacked
|
|
1769
1786
|
? 1
|
|
1770
|
-
: ((
|
|
1787
|
+
: ((_94 = spec.series) !== null && _94 !== void 0 ? _94 : []).reduce(function (count, s) {
|
|
1771
1788
|
var _a;
|
|
1772
1789
|
var seriesType = (_a = s.seriesChartType) !== null && _a !== void 0 ? _a : spec.chartType;
|
|
1773
1790
|
return seriesType === "bar" || seriesType === "column"
|
|
@@ -1791,36 +1808,36 @@ var BasicChart = function (_a) {
|
|
|
1791
1808
|
return (0, utils_1.chartPaletteColorAt)(seriesPalette, index);
|
|
1792
1809
|
};
|
|
1793
1810
|
_loop_1 = function (specSeriesIndex, series) {
|
|
1794
|
-
var dataLabel,
|
|
1795
|
-
var e_12,
|
|
1796
|
-
return tslib_1.__generator(this, function (
|
|
1797
|
-
switch (
|
|
1811
|
+
var dataLabel, _184, _185, _186, effectiveChartType, lineLike, domainSources, pieDomainLabels, piePointOffset, data, seriesEchartsType, seriesStyleAttrs, seriesEntry, isBarOrColumn, seriesAny, markerSymbol, wantsMarkers, labelsWithoutMarkers, isolated, marked, isolated_1, isolated_1_1, i, gradientArgs, gradient, overrides_3, _187, _188, dp, fallback_1, overrides_4, _189, _190, dp, positiveColor_1, negativeColor_1;
|
|
1812
|
+
var e_12, _191, e_13, _192, e_14, _193;
|
|
1813
|
+
return tslib_1.__generator(this, function (_194) {
|
|
1814
|
+
switch (_194.label) {
|
|
1798
1815
|
case 0:
|
|
1799
|
-
if (!((
|
|
1800
|
-
|
|
1816
|
+
if (!((_96 = (0, series_name_1.linkedSeriesName)(series, getDomainValuesFromRange)) !== null && _96 !== void 0)) return [3 /*break*/, 1];
|
|
1817
|
+
_184 = _96;
|
|
1801
1818
|
return [3 /*break*/, 5];
|
|
1802
1819
|
case 1:
|
|
1803
1820
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 3];
|
|
1804
|
-
|
|
1805
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1821
|
+
_186 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1822
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_97 = position.sheetId) !== null && _97 !== void 0 ? _97 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1806
1823
|
case 2:
|
|
1807
|
-
|
|
1824
|
+
_185 = _186.apply(void 0, [_194.sent()]);
|
|
1808
1825
|
return [3 /*break*/, 4];
|
|
1809
1826
|
case 3:
|
|
1810
|
-
|
|
1811
|
-
|
|
1827
|
+
_185 = (_98 = series.dataLabel) !== null && _98 !== void 0 ? _98 : "";
|
|
1828
|
+
_194.label = 4;
|
|
1812
1829
|
case 4:
|
|
1813
|
-
|
|
1814
|
-
|
|
1830
|
+
_184 = (_185);
|
|
1831
|
+
_194.label = 5;
|
|
1815
1832
|
case 5:
|
|
1816
|
-
dataLabel =
|
|
1833
|
+
dataLabel = _184;
|
|
1817
1834
|
// Label
|
|
1818
1835
|
if (dataLabel) {
|
|
1819
|
-
(
|
|
1836
|
+
(_99 = legend.data) === null || _99 === void 0 ? void 0 : _99.push(dataLabel);
|
|
1820
1837
|
}
|
|
1821
|
-
effectiveChartType = (
|
|
1838
|
+
effectiveChartType = (_100 = series.seriesChartType) !== null && _100 !== void 0 ? _100 : spec.chartType;
|
|
1822
1839
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1823
|
-
domainSources = (
|
|
1840
|
+
domainSources = (_103 = (_102 = (_101 = spec.domains) === null || _101 === void 0 ? void 0 : _101[0]) === null || _102 === void 0 ? void 0 : _102.sources) !== null && _103 !== void 0 ? _103 : [];
|
|
1824
1841
|
pieDomainLabels = isCircularChart &&
|
|
1825
1842
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
1826
1843
|
? domainSources.flatMap(function (sheetRange) {
|
|
@@ -1852,7 +1869,7 @@ var BasicChart = function (_a) {
|
|
|
1852
1869
|
seriesEntry = tslib_1.__assign(tslib_1.__assign({ type: seriesEchartsType,
|
|
1853
1870
|
// Ties the rendered series back to spec.series for click selection
|
|
1854
1871
|
// One rendered series per spec series (source index 0).
|
|
1855
|
-
id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (
|
|
1872
|
+
id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (_104 = spec.smooth) !== null && _104 !== void 0 ? _104 : undefined, radius: (_105 = spec.radius) !== null && _105 !== void 0 ? _105 : (isCircularChart ? [0, "75%"] : undefined) }, ((0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike)
|
|
1856
1873
|
? { connectNulls: true }
|
|
1857
1874
|
: {})), seriesStyleAttrs);
|
|
1858
1875
|
// Plot this series against a secondary value axis. The 2nd
|
|
@@ -1877,17 +1894,18 @@ var BasicChart = function (_a) {
|
|
|
1877
1894
|
}
|
|
1878
1895
|
seriesAny = series;
|
|
1879
1896
|
if (effectiveChartType === "line") {
|
|
1880
|
-
markerSymbol = (
|
|
1897
|
+
markerSymbol = (_106 = seriesAny.marker) === null || _106 === void 0 ? void 0 : _106.symbol;
|
|
1881
1898
|
wantsMarkers = markerSymbol === "none"
|
|
1882
1899
|
? false
|
|
1883
1900
|
: Boolean(spec.showMarkers) || !(0, utils_1.isNil)(markerSymbol);
|
|
1884
1901
|
labelsWithoutMarkers = !wantsMarkers &&
|
|
1885
|
-
Boolean((
|
|
1902
|
+
Boolean((_107 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _107 === void 0 ? void 0 : _107.show);
|
|
1886
1903
|
seriesEntry.showSymbol = wantsMarkers || labelsWithoutMarkers;
|
|
1887
1904
|
if (wantsMarkers) {
|
|
1888
1905
|
seriesEntry.symbol =
|
|
1889
|
-
(
|
|
1890
|
-
|
|
1906
|
+
(_108 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol !== null && markerSymbol !== void 0 ? markerSymbol : (0, helpers_1.automaticMarkerSymbol)(specSeriesIndex))) !== null && _108 !== void 0 ? _108 : "circle";
|
|
1907
|
+
// Excel's automatic marker is 5 pt (7 px); an authored size is points too.
|
|
1908
|
+
seriesEntry.symbolSize = Math.round((((_110 = (_109 = seriesAny.marker) === null || _109 === void 0 ? void 0 : _109.size) !== null && _110 !== void 0 ? _110 : 5) * 4) / 3);
|
|
1891
1909
|
}
|
|
1892
1910
|
else {
|
|
1893
1911
|
if (labelsWithoutMarkers) {
|
|
@@ -1910,7 +1928,7 @@ var BasicChart = function (_a) {
|
|
|
1910
1928
|
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
1911
1929
|
finally {
|
|
1912
1930
|
try {
|
|
1913
|
-
if (isolated_1_1 && !isolated_1_1.done && (
|
|
1931
|
+
if (isolated_1_1 && !isolated_1_1.done && (_191 = isolated_1.return)) _191.call(isolated_1);
|
|
1914
1932
|
}
|
|
1915
1933
|
finally { if (e_12) throw e_12.error; }
|
|
1916
1934
|
}
|
|
@@ -1922,9 +1940,9 @@ var BasicChart = function (_a) {
|
|
|
1922
1940
|
gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
|
|
1923
1941
|
if (gradientArgs && !seriesAny.noFill) {
|
|
1924
1942
|
gradient = new echarts.graphic.LinearGradient(gradientArgs.x, gradientArgs.y, gradientArgs.x2, gradientArgs.y2, gradientArgs.colorStops);
|
|
1925
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1943
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_111 = seriesEntry.itemStyle) !== null && _111 !== void 0 ? _111 : {})), { color: gradient });
|
|
1926
1944
|
if (effectiveChartType === "area") {
|
|
1927
|
-
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1945
|
+
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_112 = seriesEntry.areaStyle) !== null && _112 !== void 0 ? _112 : {})), { color: gradient });
|
|
1928
1946
|
}
|
|
1929
1947
|
}
|
|
1930
1948
|
else if (seriesAny.noFill) {
|
|
@@ -1932,15 +1950,15 @@ var BasicChart = function (_a) {
|
|
|
1932
1950
|
// with `transparent` so layout is preserved but nothing
|
|
1933
1951
|
// paints. Legend entries are also suppressed via `name: ""`
|
|
1934
1952
|
// since the series carries no semantic information.
|
|
1935
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1953
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_113 = seriesEntry.itemStyle) !== null && _113 !== void 0 ? _113 : {})), { color: "transparent", borderColor: "transparent" });
|
|
1936
1954
|
}
|
|
1937
1955
|
else if (isBarOrColumn &&
|
|
1938
1956
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1939
1957
|
seriesAny.dataPointColors.length) {
|
|
1940
1958
|
overrides_3 = new Map();
|
|
1941
1959
|
try {
|
|
1942
|
-
for (
|
|
1943
|
-
dp =
|
|
1960
|
+
for (_187 = (e_13 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _188 = _187.next(); !_188.done; _188 = _187.next()) {
|
|
1961
|
+
dp = _188.value;
|
|
1944
1962
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1945
1963
|
overrides_3.set(dp.idx, dp.color);
|
|
1946
1964
|
}
|
|
@@ -1949,20 +1967,20 @@ var BasicChart = function (_a) {
|
|
|
1949
1967
|
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1950
1968
|
finally {
|
|
1951
1969
|
try {
|
|
1952
|
-
if (
|
|
1970
|
+
if (_188 && !_188.done && (_192 = _187.return)) _192.call(_187);
|
|
1953
1971
|
}
|
|
1954
1972
|
finally { if (e_13) throw e_13.error; }
|
|
1955
1973
|
}
|
|
1956
|
-
fallback_1 = (
|
|
1957
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1974
|
+
fallback_1 = (_114 = series.color) !== null && _114 !== void 0 ? _114 : paletteColorAt(specSeriesIndex);
|
|
1975
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_115 = seriesEntry.itemStyle) !== null && _115 !== void 0 ? _115 : {})), { color: function (params) { var _a; return (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : fallback_1; } });
|
|
1958
1976
|
}
|
|
1959
1977
|
else if (isCircularChart &&
|
|
1960
1978
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1961
1979
|
seriesAny.dataPointColors.length) {
|
|
1962
1980
|
overrides_4 = new Map();
|
|
1963
1981
|
try {
|
|
1964
|
-
for (
|
|
1965
|
-
dp =
|
|
1982
|
+
for (_189 = (e_14 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _190 = _189.next(); !_190.done; _190 = _189.next()) {
|
|
1983
|
+
dp = _190.value;
|
|
1966
1984
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1967
1985
|
overrides_4.set(dp.idx, dp.color);
|
|
1968
1986
|
}
|
|
@@ -1971,19 +1989,19 @@ var BasicChart = function (_a) {
|
|
|
1971
1989
|
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1972
1990
|
finally {
|
|
1973
1991
|
try {
|
|
1974
|
-
if (
|
|
1992
|
+
if (_190 && !_190.done && (_193 = _189.return)) _193.call(_189);
|
|
1975
1993
|
}
|
|
1976
1994
|
finally { if (e_14) throw e_14.error; }
|
|
1977
1995
|
}
|
|
1978
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1996
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_116 = seriesEntry.itemStyle) !== null && _116 !== void 0 ? _116 : {})), { color: function (params) {
|
|
1979
1997
|
var _a, _b;
|
|
1980
1998
|
return (_b = (_a = overrides_4.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
|
|
1981
1999
|
} });
|
|
1982
2000
|
}
|
|
1983
2001
|
else if (isBarOrColumn && series.invertIfNegative) {
|
|
1984
|
-
positiveColor_1 = (
|
|
1985
|
-
negativeColor_1 = (
|
|
1986
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2002
|
+
positiveColor_1 = (_117 = series.color) !== null && _117 !== void 0 ? _117 : paletteColorAt(specSeriesIndex);
|
|
2003
|
+
negativeColor_1 = (_118 = series.negativeColor) !== null && _118 !== void 0 ? _118 : "#FF0000";
|
|
2004
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_119 = seriesEntry.itemStyle) !== null && _119 !== void 0 ? _119 : {})), { color: function (params) {
|
|
1987
2005
|
var _a, _b;
|
|
1988
2006
|
var value = Array.isArray(params.data)
|
|
1989
2007
|
? params.data[1]
|
|
@@ -1994,10 +2012,10 @@ var BasicChart = function (_a) {
|
|
|
1994
2012
|
} });
|
|
1995
2013
|
}
|
|
1996
2014
|
else if (series.color) {
|
|
1997
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1998
|
-
seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2015
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_120 = seriesEntry.itemStyle) !== null && _120 !== void 0 ? _120 : {})), { color: series.color });
|
|
2016
|
+
seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((_121 = seriesEntry.lineStyle) !== null && _121 !== void 0 ? _121 : {})), { color: series.color });
|
|
1999
2017
|
if (effectiveChartType === "area") {
|
|
2000
|
-
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2018
|
+
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_122 = seriesEntry.areaStyle) !== null && _122 !== void 0 ? _122 : {})), { color: series.color });
|
|
2001
2019
|
}
|
|
2002
2020
|
}
|
|
2003
2021
|
chartSeries.push(seriesEntry);
|
|
@@ -2006,24 +2024,24 @@ var BasicChart = function (_a) {
|
|
|
2006
2024
|
}
|
|
2007
2025
|
});
|
|
2008
2026
|
};
|
|
2009
|
-
|
|
2027
|
+
_182.label = 39;
|
|
2010
2028
|
case 39:
|
|
2011
|
-
|
|
2012
|
-
_t = tslib_1.__values(((
|
|
2013
|
-
|
|
2029
|
+
_182.trys.push([39, 44, 45, 46]);
|
|
2030
|
+
_t = tslib_1.__values(((_95 = spec.series) !== null && _95 !== void 0 ? _95 : []).entries()), _u = _t.next();
|
|
2031
|
+
_182.label = 40;
|
|
2014
2032
|
case 40:
|
|
2015
2033
|
if (!!_u.done) return [3 /*break*/, 43];
|
|
2016
2034
|
_v = tslib_1.__read(_u.value, 2), specSeriesIndex = _v[0], series = _v[1];
|
|
2017
2035
|
return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
|
|
2018
2036
|
case 41:
|
|
2019
|
-
|
|
2020
|
-
|
|
2037
|
+
_182.sent();
|
|
2038
|
+
_182.label = 42;
|
|
2021
2039
|
case 42:
|
|
2022
2040
|
_u = _t.next();
|
|
2023
2041
|
return [3 /*break*/, 40];
|
|
2024
2042
|
case 43: return [3 /*break*/, 46];
|
|
2025
2043
|
case 44:
|
|
2026
|
-
e_3_1 =
|
|
2044
|
+
e_3_1 = _182.sent();
|
|
2027
2045
|
e_3 = { error: e_3_1 };
|
|
2028
2046
|
return [3 /*break*/, 46];
|
|
2029
2047
|
case 45:
|
|
@@ -2041,7 +2059,7 @@ var BasicChart = function (_a) {
|
|
|
2041
2059
|
}
|
|
2042
2060
|
if (isOfPie) {
|
|
2043
2061
|
labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2044
|
-
seriesEntry = (
|
|
2062
|
+
seriesEntry = (_123 = spec.series) === null || _123 === void 0 ? void 0 : _123[0];
|
|
2045
2063
|
rawValues = seriesEntry
|
|
2046
2064
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
2047
2065
|
: [];
|
|
@@ -2088,7 +2106,7 @@ var BasicChart = function (_a) {
|
|
|
2088
2106
|
};
|
|
2089
2107
|
chartSeries.push({
|
|
2090
2108
|
type: "pie",
|
|
2091
|
-
name: (
|
|
2109
|
+
name: (_124 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _124 !== void 0 ? _124 : "",
|
|
2092
2110
|
center: ["".concat(MAIN_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
2093
2111
|
radius: [0, "".concat(MAIN_RADIUS_PCT_1, "%")],
|
|
2094
2112
|
// Rotate the pie so the "Other" slice's angular midpoint faces
|
|
@@ -2106,7 +2124,7 @@ var BasicChart = function (_a) {
|
|
|
2106
2124
|
if (ofPieType_1 === "pie") {
|
|
2107
2125
|
chartSeries.push({
|
|
2108
2126
|
type: "pie",
|
|
2109
|
-
name: (
|
|
2127
|
+
name: (_125 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _125 !== void 0 ? _125 : "",
|
|
2110
2128
|
center: ["".concat(SECONDARY_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
2111
2129
|
radius: [0, "".concat(secondaryRadiusPct_1, "%")],
|
|
2112
2130
|
data: secondary.map(function (s, i) { return ({
|
|
@@ -2201,16 +2219,16 @@ var BasicChart = function (_a) {
|
|
|
2201
2219
|
legend.data = tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(main_1.map(function (s) { return s.label; })), false), tslib_1.__read(secondary.map(function (s) { return s.label; })), false);
|
|
2202
2220
|
}
|
|
2203
2221
|
else if (spec.chartType === "waterfall") {
|
|
2204
|
-
primaryDomainSource_1 = (
|
|
2222
|
+
primaryDomainSource_1 = (_128 = (_127 = (_126 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _126 === void 0 ? void 0 : _126[0]) === null || _127 === void 0 ? void 0 : _127.sources) === null || _128 === void 0 ? void 0 : _128[0];
|
|
2205
2223
|
rawDomainValues = primaryDomainSource_1
|
|
2206
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2224
|
+
? (0, aggregation_1.sanitizeDomainValues)((_129 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _129 !== void 0 ? _129 : [])
|
|
2207
2225
|
: [];
|
|
2208
2226
|
labels = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2209
|
-
seriesEntry = (
|
|
2227
|
+
seriesEntry = (_130 = spec.series) === null || _130 === void 0 ? void 0 : _130[0];
|
|
2210
2228
|
rawValues_1 = seriesEntry
|
|
2211
2229
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
2212
2230
|
: [];
|
|
2213
|
-
totalIndices = new Set((
|
|
2231
|
+
totalIndices = new Set((_131 = spec.totalIndices) !== null && _131 !== void 0 ? _131 : []);
|
|
2214
2232
|
steps = (0, waterfall_1.computeWaterfall)(rawValues_1, labels, totalIndices);
|
|
2215
2233
|
chartDomains.length = 0;
|
|
2216
2234
|
chartDomains.push({
|
|
@@ -2220,7 +2238,7 @@ var BasicChart = function (_a) {
|
|
|
2220
2238
|
axisLine: { show: true },
|
|
2221
2239
|
axisTick: { show: true },
|
|
2222
2240
|
splitLine: { show: false },
|
|
2223
|
-
name: (
|
|
2241
|
+
name: (_132 = spec.horizontalAxisTitle) !== null && _132 !== void 0 ? _132 : "",
|
|
2224
2242
|
nameLocation: "middle",
|
|
2225
2243
|
nameGap: 30,
|
|
2226
2244
|
});
|
|
@@ -2237,12 +2255,12 @@ var BasicChart = function (_a) {
|
|
|
2237
2255
|
label: { show: false },
|
|
2238
2256
|
tooltip: { show: false },
|
|
2239
2257
|
});
|
|
2240
|
-
accent_1 = (
|
|
2241
|
-
decreaseColor_1 = (
|
|
2242
|
-
totalColor_1 = (
|
|
2258
|
+
accent_1 = (_133 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _133 !== void 0 ? _133 : theme.themeColors.accent1;
|
|
2259
|
+
decreaseColor_1 = (_135 = (_134 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.negativeColor) !== null && _134 !== void 0 ? _134 : theme.themeColors.accent2) !== null && _135 !== void 0 ? _135 : accent_1;
|
|
2260
|
+
totalColor_1 = (_136 = theme.themeColors.accent3) !== null && _136 !== void 0 ? _136 : accent_1;
|
|
2243
2261
|
pointColors_1 = new Map();
|
|
2244
2262
|
try {
|
|
2245
|
-
for (_x = tslib_1.__values((
|
|
2263
|
+
for (_x = tslib_1.__values((_137 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _137 !== void 0 ? _137 : []), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
2246
2264
|
dp = _y.value;
|
|
2247
2265
|
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2248
2266
|
pointColors_1.set(dp.idx, dp.color);
|
|
@@ -2264,7 +2282,7 @@ var BasicChart = function (_a) {
|
|
|
2264
2282
|
type: "bar",
|
|
2265
2283
|
id: (0, series_click_1.chartSeriesId)(0, 0),
|
|
2266
2284
|
stack: "waterfall",
|
|
2267
|
-
name: (
|
|
2285
|
+
name: (_138 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _138 !== void 0 ? _138 : "",
|
|
2268
2286
|
// A bar's height is the step's magnitude; the signed source value
|
|
2269
2287
|
// rides along as `originalValue` so labels and tooltips read
|
|
2270
2288
|
// "-90" for a decrease, like Excel.
|
|
@@ -2298,12 +2316,12 @@ var BasicChart = function (_a) {
|
|
|
2298
2316
|
legend.data = [];
|
|
2299
2317
|
}
|
|
2300
2318
|
else if (spec.chartType === "funnel") {
|
|
2301
|
-
primaryDomainSource_2 = (
|
|
2319
|
+
primaryDomainSource_2 = (_141 = (_140 = (_139 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _139 === void 0 ? void 0 : _139[0]) === null || _140 === void 0 ? void 0 : _140.sources) === null || _141 === void 0 ? void 0 : _141[0];
|
|
2302
2320
|
rawDomainValues = primaryDomainSource_2
|
|
2303
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2321
|
+
? (0, aggregation_1.sanitizeDomainValues)((_142 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _142 !== void 0 ? _142 : [])
|
|
2304
2322
|
: [];
|
|
2305
2323
|
labels_1 = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2306
|
-
seriesEntry = (
|
|
2324
|
+
seriesEntry = (_143 = spec.series) === null || _143 === void 0 ? void 0 : _143[0];
|
|
2307
2325
|
rawValues = seriesEntry
|
|
2308
2326
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : 0); })
|
|
2309
2327
|
: [];
|
|
@@ -2317,10 +2335,10 @@ var BasicChart = function (_a) {
|
|
|
2317
2335
|
theme.themeColors.accent5,
|
|
2318
2336
|
theme.themeColors.accent6,
|
|
2319
2337
|
]);
|
|
2320
|
-
funnelColor_1 = (
|
|
2338
|
+
funnelColor_1 = (_144 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _144 !== void 0 ? _144 : (0, utils_1.chartPaletteColorAt)(funnelPalette, 0);
|
|
2321
2339
|
stageColors_1 = new Map();
|
|
2322
2340
|
try {
|
|
2323
|
-
for (_z = tslib_1.__values((
|
|
2341
|
+
for (_z = tslib_1.__values((_145 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _145 !== void 0 ? _145 : []), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
2324
2342
|
dp = _0.value;
|
|
2325
2343
|
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2326
2344
|
stageColors_1.set(dp.idx, dp.color);
|
|
@@ -2348,9 +2366,9 @@ var BasicChart = function (_a) {
|
|
|
2348
2366
|
top: 60,
|
|
2349
2367
|
bottom: 20,
|
|
2350
2368
|
};
|
|
2351
|
-
funnelLabelsOff = ((
|
|
2369
|
+
funnelLabelsOff = ((_146 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesEntry)) === null || _146 === void 0 ? void 0 : _146.show) ===
|
|
2352
2370
|
false;
|
|
2353
|
-
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: (0, series_click_1.chartSeriesId)(0, 0), name: (
|
|
2371
|
+
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: (0, series_click_1.chartSeriesId)(0, 0), name: (_147 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _147 !== void 0 ? _147 : "", data: funnelData }, funnelLayout), { itemStyle: {
|
|
2354
2372
|
color: function (params) { var _a; return (_a = stageColors_1.get(params.dataIndex)) !== null && _a !== void 0 ? _a : funnelColor_1; },
|
|
2355
2373
|
}, label: funnelLabelsOff
|
|
2356
2374
|
? { show: false }
|
|
@@ -2373,9 +2391,9 @@ var BasicChart = function (_a) {
|
|
|
2373
2391
|
showMeanMarker_1 = spec.showMeanMarker === true;
|
|
2374
2392
|
showInnerPoints_1 = spec.showInnerPoints === true;
|
|
2375
2393
|
showMeanLine_1 = spec.showMeanLine === true;
|
|
2376
|
-
boxDomainSource = (
|
|
2394
|
+
boxDomainSource = (_150 = (_149 = (_148 = spec.domains) === null || _148 === void 0 ? void 0 : _148[0]) === null || _149 === void 0 ? void 0 : _149.sources) === null || _150 === void 0 ? void 0 : _150[0];
|
|
2377
2395
|
boxCategories_2 = boxDomainSource
|
|
2378
|
-
? ((
|
|
2396
|
+
? ((_151 = getDomainValuesFromRange(boxDomainSource, spec.hiddenDimensionStrategy)) !== null && _151 !== void 0 ? _151 : []).map(function (v) { return (v === null || v === undefined ? "" : "".concat(v).trim()); })
|
|
2379
2397
|
: [];
|
|
2380
2398
|
grouped_1 = boxCategories_2.some(function (c) { return c !== ""; });
|
|
2381
2399
|
groups_1 = [];
|
|
@@ -2395,7 +2413,7 @@ var BasicChart = function (_a) {
|
|
|
2395
2413
|
finally { if (e_8) throw e_8.error; }
|
|
2396
2414
|
}
|
|
2397
2415
|
}
|
|
2398
|
-
boxSeriesSpecs = (
|
|
2416
|
+
boxSeriesSpecs = (_152 = spec.series) !== null && _152 !== void 0 ? _152 : [];
|
|
2399
2417
|
slots = grouped_1 ? groups_1 : ["1"];
|
|
2400
2418
|
boxGap = typeof spec.gapWidth === "number" ? Math.max(0, spec.gapWidth) : 150;
|
|
2401
2419
|
boxPlotWidth = Math.max(0, (width !== null && width !== void 0 ? width : 0) * 0.85 - 40);
|
|
@@ -2418,7 +2436,7 @@ var BasicChart = function (_a) {
|
|
|
2418
2436
|
axisLine: { show: true },
|
|
2419
2437
|
axisTick: { show: true },
|
|
2420
2438
|
splitLine: { show: false },
|
|
2421
|
-
name: (
|
|
2439
|
+
name: (_153 = spec.horizontalAxisTitle) !== null && _153 !== void 0 ? _153 : "",
|
|
2422
2440
|
nameLocation: "middle",
|
|
2423
2441
|
nameGap: 30,
|
|
2424
2442
|
});
|
|
@@ -2546,12 +2564,12 @@ var BasicChart = function (_a) {
|
|
|
2546
2564
|
}
|
|
2547
2565
|
else if (spec.chartType === "histogram") {
|
|
2548
2566
|
rawValues = flattenChartDataValues(spec.series, getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
2549
|
-
histogramDomainSource = (
|
|
2567
|
+
histogramDomainSource = (_156 = (_155 = (_154 = spec.domains) === null || _154 === void 0 ? void 0 : _154[0]) === null || _155 === void 0 ? void 0 : _155.sources) === null || _156 === void 0 ? void 0 : _156[0];
|
|
2550
2568
|
histogramCategories = histogramDomainSource
|
|
2551
|
-
? ((
|
|
2569
|
+
? ((_157 = getDomainValuesFromRange(histogramDomainSource, spec.hiddenDimensionStrategy)) !== null && _157 !== void 0 ? _157 : [])
|
|
2552
2570
|
: [];
|
|
2553
2571
|
_1 = histogramCategories.length
|
|
2554
|
-
? (0, histogram_1.aggregateByCategory)(histogramCategories, rawValues, (
|
|
2572
|
+
? (0, histogram_1.aggregateByCategory)(histogramCategories, rawValues, (_160 = (_159 = (_158 = spec.series) === null || _158 === void 0 ? void 0 : _158[0]) === null || _159 === void 0 ? void 0 : _159.aggregateType) !== null && _160 !== void 0 ? _160 : "SUM")
|
|
2555
2573
|
: (0, histogram_1.binHistogram)(rawValues, spec.binCount, {
|
|
2556
2574
|
binSize: spec.binSize,
|
|
2557
2575
|
intervalClosed: spec.intervalClosed,
|
|
@@ -2574,20 +2592,20 @@ var BasicChart = function (_a) {
|
|
|
2574
2592
|
axisLine: { show: true },
|
|
2575
2593
|
axisTick: { show: true },
|
|
2576
2594
|
splitLine: { show: false },
|
|
2577
|
-
name: (
|
|
2595
|
+
name: (_161 = spec.horizontalAxisTitle) !== null && _161 !== void 0 ? _161 : "",
|
|
2578
2596
|
nameLocation: "middle",
|
|
2579
2597
|
nameGap: 30,
|
|
2580
2598
|
});
|
|
2581
2599
|
chartSeries.length = 0;
|
|
2582
2600
|
histogramSeries = {
|
|
2583
2601
|
type: "bar",
|
|
2584
|
-
name: (
|
|
2602
|
+
name: (_164 = (_163 = (_162 = spec.series) === null || _162 === void 0 ? void 0 : _162[0]) === null || _163 === void 0 ? void 0 : _163.dataLabel) !== null && _164 !== void 0 ? _164 : "",
|
|
2585
2603
|
data: counts,
|
|
2586
2604
|
// Excel's histogram columns touch unless `gapWidth` says otherwise
|
|
2587
2605
|
// (#1087); the gap maps like a column chart's.
|
|
2588
|
-
barCategoryGap: (
|
|
2606
|
+
barCategoryGap: (_166 = (0, bar_layout_1.gapWidthToBarCategoryGap)((_165 = spec.gapWidth) !== null && _165 !== void 0 ? _165 : 0, { seriesCount: 1 })) !== null && _166 !== void 0 ? _166 : "0%",
|
|
2589
2607
|
};
|
|
2590
|
-
histogramColor = (
|
|
2608
|
+
histogramColor = (_168 = (_167 = spec.series) === null || _167 === void 0 ? void 0 : _167[0]) === null || _168 === void 0 ? void 0 : _168.color;
|
|
2591
2609
|
if (histogramColor) {
|
|
2592
2610
|
histogramSeries.itemStyle = { color: histogramColor };
|
|
2593
2611
|
}
|
|
@@ -2603,40 +2621,53 @@ var BasicChart = function (_a) {
|
|
|
2603
2621
|
}
|
|
2604
2622
|
legend.data = [];
|
|
2605
2623
|
}
|
|
2606
|
-
|
|
2624
|
+
lineElementOptions = spec;
|
|
2625
|
+
if (!isCircularChart &&
|
|
2626
|
+
(lineElementOptions.dropLines ||
|
|
2627
|
+
(spec.chartType === "line" &&
|
|
2628
|
+
(lineElementOptions.hiLowLines || lineElementOptions.upDownBars)))) {
|
|
2629
|
+
lineData = chartSeries
|
|
2630
|
+
.filter(function (s) {
|
|
2631
|
+
return (s === null || s === void 0 ? void 0 : s.type) === "line" &&
|
|
2632
|
+
s.yAxisIndex !== 1 &&
|
|
2633
|
+
(0, series_click_1.chartSeriesSpecIndex)(s.id) !== undefined &&
|
|
2634
|
+
Array.isArray(s.data);
|
|
2635
|
+
})
|
|
2636
|
+
.map(function (s) { return s.data; });
|
|
2637
|
+
chartSeries.push.apply(chartSeries, tslib_1.__spreadArray([], tslib_1.__read((0, chart_lines_1.buildChartLineSeries)({
|
|
2638
|
+
dropLines: lineElementOptions.dropLines &&
|
|
2639
|
+
(spec.chartType === "line" || spec.chartType === "area"),
|
|
2640
|
+
hiLowLines: lineElementOptions.hiLowLines,
|
|
2641
|
+
upDownBars: lineElementOptions.upDownBars,
|
|
2642
|
+
}, lineData, { isDarkMode: isDarkMode })), false));
|
|
2643
|
+
}
|
|
2644
|
+
renderedSeriesCount = chartSeries.length + (spec.dataTable ? 10000 : 0);
|
|
2607
2645
|
replaceMerge = previousChartType.current !== spec.chartType ||
|
|
2608
2646
|
previousSeriesCount.current !== renderedSeriesCount
|
|
2609
2647
|
? ["series", "xAxis", "yAxis", "legend", "grid", "tooltip"]
|
|
2610
2648
|
: [];
|
|
2611
|
-
valueAxisBase = {
|
|
2612
|
-
type: "value",
|
|
2613
|
-
show: !isCircularChart,
|
|
2649
|
+
valueAxisBase = tslib_1.__assign(tslib_1.__assign({}, axisTextStyle), { type: "value", show: !isCircularChart,
|
|
2614
2650
|
// echarts draws the value axis line at the zero of a value-type x
|
|
2615
2651
|
// axis in the grid; the box & whisker overlay axis (#1099) would pull
|
|
2616
2652
|
// it into the first category's slot, so it stays at the plot edge.
|
|
2617
|
-
axisLine: tslib_1.__assign({ show: !isCircularChart }, (boxplotOverlayAxis ? { onZero: false } : {})),
|
|
2618
|
-
axisTick: { show: !isCircularChart },
|
|
2619
|
-
splitLine: { show: !isCircularChart },
|
|
2620
|
-
nameLocation: "middle",
|
|
2621
|
-
nameGap: 50,
|
|
2622
|
-
};
|
|
2653
|
+
axisLine: tslib_1.__assign({ show: !isCircularChart }, (boxplotOverlayAxis ? { onZero: false } : {})), axisTick: { show: !isCircularChart }, splitLine: { show: !isCircularChart }, nameLocation: "middle", nameGap: 50 });
|
|
2623
2654
|
isPareto = spec.chartType === "histogram" && (0, histogram_1.isParetoSpec)(spec);
|
|
2624
2655
|
hasSecondaryAxis = !isCircularChart &&
|
|
2625
2656
|
!isHorizontalBarChart &&
|
|
2626
|
-
(((
|
|
2657
|
+
(((_169 = spec.series) !== null && _169 !== void 0 ? _169 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
|
|
2627
2658
|
isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
|
|
2628
2659
|
(spec.chartType === "bar" || spec.chartType === "column");
|
|
2629
2660
|
primaryAxisNumberFormat = isPercentStackedBars
|
|
2630
2661
|
? undefined
|
|
2631
2662
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2632
2663
|
axisOptions: spec.valueAxisOptions,
|
|
2633
|
-
series: ((
|
|
2664
|
+
series: ((_170 = spec.series) !== null && _170 !== void 0 ? _170 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
2634
2665
|
getFormattingFromRange: getFormattingFromRange,
|
|
2635
2666
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2636
2667
|
});
|
|
2637
2668
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2638
2669
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
2639
|
-
series: ((
|
|
2670
|
+
series: ((_171 = spec.series) !== null && _171 !== void 0 ? _171 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
2640
2671
|
getFormattingFromRange: getFormattingFromRange,
|
|
2641
2672
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2642
2673
|
});
|
|
@@ -2665,17 +2696,17 @@ var BasicChart = function (_a) {
|
|
|
2665
2696
|
finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
|
|
2666
2697
|
bottomAxisNameGap = isHorizontalBarChart
|
|
2667
2698
|
? valueAxisBase.nameGap
|
|
2668
|
-
: Number((
|
|
2699
|
+
: Number((_173 = (_172 = chartDomains[0]) === null || _172 === void 0 ? void 0 : _172.nameGap) !== null && _173 !== void 0 ? _173 : CATEGORY_AXIS_NAME_GAP);
|
|
2669
2700
|
legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
2670
|
-
position: (
|
|
2701
|
+
position: (_174 = spec.legend) === null || _174 === void 0 ? void 0 : _174.position,
|
|
2671
2702
|
visible: finalLegend.show !== false,
|
|
2672
2703
|
labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
|
|
2673
|
-
legendFontSize: (
|
|
2704
|
+
legendFontSize: (_176 = (_175 = finalLegend.textStyle) === null || _175 === void 0 ? void 0 : _175.fontSize) !== null && _176 !== void 0 ? _176 : (0, overrides_2.fontSizePx)((_178 = (_177 = spec.legend) === null || _177 === void 0 ? void 0 : _177.textFormat) === null || _178 === void 0 ? void 0 : _178.fontSize, overrides_2.CHART_TEXT_PX),
|
|
2674
2705
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
2675
2706
|
width: width !== null && width !== void 0 ? width : 0,
|
|
2676
2707
|
height: height !== null && height !== void 0 ? height : 0,
|
|
2677
2708
|
hasTitle: Boolean(title),
|
|
2678
|
-
titleFontSize: (
|
|
2709
|
+
titleFontSize: (0, overrides_2.fontSizePx)((_179 = spec.titleTextFormat) === null || _179 === void 0 ? void 0 : _179.fontSize, overrides_2.CHART_TITLE_PX),
|
|
2679
2710
|
hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
|
|
2680
2711
|
bottomAxisNameGap: bottomAxisNameGap,
|
|
2681
2712
|
hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
|
|
@@ -2697,11 +2728,15 @@ var BasicChart = function (_a) {
|
|
|
2697
2728
|
: legendBand.grid;
|
|
2698
2729
|
chartDataLabels = spec.dataLabels;
|
|
2699
2730
|
seriesLabelOptionFor = function (s) {
|
|
2700
|
-
var _a;
|
|
2731
|
+
var _a, _b;
|
|
2701
2732
|
var specIndex = (0, series_click_1.chartSeriesSpecIndex)(s === null || s === void 0 ? void 0 : s.id);
|
|
2702
2733
|
var dataLabelOptions = (0, overrides_1.resolveSeriesDataLabels)(chartDataLabels, specIndex === undefined ? undefined : (_a = spec.series) === null || _a === void 0 ? void 0 : _a[specIndex]);
|
|
2703
|
-
|
|
2704
|
-
? tslib_1.__assign(tslib_1.__assign({}, dataLabelOptions), { numberFormatPattern: seriesNumberFormatFor(s) }) : dataLabelOptions
|
|
2734
|
+
var withFormat = dataLabelOptions && !dataLabelOptions.numberFormatPattern
|
|
2735
|
+
? tslib_1.__assign(tslib_1.__assign({}, dataLabelOptions), { numberFormatPattern: seriesNumberFormatFor(s) }) : dataLabelOptions;
|
|
2736
|
+
// Value From Cells: the label range's cells, point by point.
|
|
2737
|
+
var cellRange = withFormat === null || withFormat === void 0 ? void 0 : withFormat.valueFromCells;
|
|
2738
|
+
return (0, overrides_1.buildSeriesLabelOption)(cellRange
|
|
2739
|
+
? tslib_1.__assign(tslib_1.__assign({}, withFormat), { cellLabels: (_b = getDomainValuesFromRange(cellRange, spec.hiddenDimensionStrategy)) !== null && _b !== void 0 ? _b : [] }) : withFormat, s === null || s === void 0 ? void 0 : s.type, locale);
|
|
2705
2740
|
};
|
|
2706
2741
|
isDoughnut = spec.chartType === "doughnut";
|
|
2707
2742
|
doughnutHoleSize = spec.doughnutHoleSize;
|
|
@@ -2779,20 +2814,21 @@ var BasicChart = function (_a) {
|
|
|
2779
2814
|
}
|
|
2780
2815
|
}
|
|
2781
2816
|
seriesWithLabels = chartSeries.map(function (s) {
|
|
2782
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2817
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2783
2818
|
var next = tslib_1.__assign({}, s);
|
|
2784
|
-
if (DECORATION_SERIES_IDS.has(s === null || s === void 0 ? void 0 : s.id)
|
|
2819
|
+
if (DECORATION_SERIES_IDS.has(s === null || s === void 0 ? void 0 : s.id) ||
|
|
2820
|
+
String((_a = s === null || s === void 0 ? void 0 : s.id) !== null && _a !== void 0 ? _a : "").startsWith(chart_lines_1.CHART_LINE_SERIES_PREFIX)) {
|
|
2785
2821
|
return next;
|
|
2786
2822
|
}
|
|
2787
2823
|
var seriesLabelOption = seriesLabelOptionFor(s);
|
|
2788
2824
|
if (seriesLabelOption) {
|
|
2789
|
-
next.label = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2825
|
+
next.label = tslib_1.__assign(tslib_1.__assign({}, ((_b = s === null || s === void 0 ? void 0 : s.label) !== null && _b !== void 0 ? _b : {})), seriesLabelOption);
|
|
2790
2826
|
}
|
|
2791
2827
|
else if ((s === null || s === void 0 ? void 0 : s.type) === "pie") {
|
|
2792
2828
|
// echarts labels every pie slice by default (category name on a
|
|
2793
2829
|
// leader line); Excel draws nothing until data labels are on (#1062).
|
|
2794
|
-
next.label = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2795
|
-
next.labelLine = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2830
|
+
next.label = tslib_1.__assign(tslib_1.__assign({}, ((_c = s === null || s === void 0 ? void 0 : s.label) !== null && _c !== void 0 ? _c : {})), { show: false });
|
|
2831
|
+
next.labelLine = tslib_1.__assign(tslib_1.__assign({}, ((_d = s === null || s === void 0 ? void 0 : s.labelLine) !== null && _d !== void 0 ? _d : {})), { show: false });
|
|
2796
2832
|
}
|
|
2797
2833
|
// Tooltip values of the value-axis series (a boxplot / candlestick
|
|
2798
2834
|
// tooltip lists its own statistics and keeps echarts' default).
|
|
@@ -2814,14 +2850,14 @@ var BasicChart = function (_a) {
|
|
|
2814
2850
|
return item !== null && typeof item === "object" && "originalValue" in item;
|
|
2815
2851
|
});
|
|
2816
2852
|
if ((seriesTooltipValueFormatter || carriesOriginalValues) &&
|
|
2817
|
-
((
|
|
2853
|
+
((_e = s === null || s === void 0 ? void 0 : s.tooltip) === null || _e === void 0 ? void 0 : _e.show) !== false) {
|
|
2818
2854
|
var formatValue_1 = seriesTooltipValueFormatter !== null && seriesTooltipValueFormatter !== void 0 ? seriesTooltipValueFormatter : (function (value) { return (0, axis_number_format_1.formatAxisValue)(undefined, value, locale); });
|
|
2819
|
-
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2855
|
+
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((_f = s === null || s === void 0 ? void 0 : s.tooltip) !== null && _f !== void 0 ? _f : {})), { valueFormatter: function (value, dataIndex) { var _a; return formatValue_1((_a = originalValueAt(dataIndex)) !== null && _a !== void 0 ? _a : value); } });
|
|
2820
2856
|
}
|
|
2821
2857
|
if (next.type === "pie") {
|
|
2822
2858
|
var pieNumberFormat = seriesNumberFormatFor(s);
|
|
2823
|
-
if (pieNumberFormat && ((
|
|
2824
|
-
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2859
|
+
if (pieNumberFormat && ((_g = s === null || s === void 0 ? void 0 : s.tooltip) === null || _g === void 0 ? void 0 : _g.show) !== false) {
|
|
2860
|
+
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((_h = s === null || s === void 0 ? void 0 : s.tooltip) !== null && _h !== void 0 ? _h : {})), { formatter: (0, axis_number_format_1.circularTooltipFormatter)(pieNumberFormat, locale) });
|
|
2825
2861
|
}
|
|
2826
2862
|
if (explosionOffset > 0 && Array.isArray(next.data)) {
|
|
2827
2863
|
next.selectedMode = "multiple";
|
|
@@ -2838,14 +2874,75 @@ var BasicChart = function (_a) {
|
|
|
2838
2874
|
// ring edge is its fraction of 75%, not of the whole chart (#1064:
|
|
2839
2875
|
// Excel's default 0.75 used to meet the outer edge, an empty ring).
|
|
2840
2876
|
var rank = doughnutSeriesOrder.indexOf((0, series_click_1.chartSeriesSpecIndex)(s === null || s === void 0 ? void 0 : s.id));
|
|
2841
|
-
var ring = (
|
|
2877
|
+
var ring = (_j = doughnutRingSet[rank]) !== null && _j !== void 0 ? _j : (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(doughnutHoleSize), 1)[0];
|
|
2842
2878
|
var pct = function (fraction) { return "".concat(Math.round(fraction * 75 * 100) / 100, "%"); };
|
|
2843
2879
|
next.radius = [pct(ring.inner), pct(ring.outer)];
|
|
2844
2880
|
}
|
|
2845
2881
|
return next;
|
|
2846
2882
|
});
|
|
2883
|
+
bareCategoryAxis = chartDomains[0];
|
|
2884
|
+
if (!isCircularChart &&
|
|
2885
|
+
!categoryLevels &&
|
|
2886
|
+
!((_180 = spec.domains) === null || _180 === void 0 ? void 0 : _180.length) &&
|
|
2887
|
+
bareCategoryAxis &&
|
|
2888
|
+
bareCategoryAxis.data === undefined) {
|
|
2889
|
+
pointCount = seriesWithLabels.reduce(function (count, s) {
|
|
2890
|
+
return ((s === null || s === void 0 ? void 0 : s.type) === "bar" || (s === null || s === void 0 ? void 0 : s.type) === "line") && Array.isArray(s.data)
|
|
2891
|
+
? Math.max(count, s.data.length)
|
|
2892
|
+
: count;
|
|
2893
|
+
}, 0);
|
|
2894
|
+
bareCategoryAxis.data = Array.from({ length: pointCount }, function (_, i) {
|
|
2895
|
+
return String(i + 1);
|
|
2896
|
+
});
|
|
2897
|
+
}
|
|
2898
|
+
dataTableOptions = spec.dataTable;
|
|
2899
|
+
dataTableRows = dataTableOptions && !isCircularChart && !isHorizontalBarChart && !isOfPie
|
|
2900
|
+
? seriesWithLabels
|
|
2901
|
+
.filter(function (s) {
|
|
2902
|
+
return ((s === null || s === void 0 ? void 0 : s.type) === "line" || (s === null || s === void 0 ? void 0 : s.type) === "bar") &&
|
|
2903
|
+
(0, series_click_1.chartSeriesSpecIndex)(s === null || s === void 0 ? void 0 : s.id) !== undefined &&
|
|
2904
|
+
Array.isArray(s.data);
|
|
2905
|
+
})
|
|
2906
|
+
.map(function (s) {
|
|
2907
|
+
var _a, _b, _c, _d, _e;
|
|
2908
|
+
var specIndex = (0, series_click_1.chartSeriesSpecIndex)(s.id);
|
|
2909
|
+
var pattern = seriesNumberFormatFor(s);
|
|
2910
|
+
return {
|
|
2911
|
+
name: String((_a = s.name) !== null && _a !== void 0 ? _a : ""),
|
|
2912
|
+
color: typeof ((_b = s.itemStyle) === null || _b === void 0 ? void 0 : _b.color) === "string"
|
|
2913
|
+
? s.itemStyle.color
|
|
2914
|
+
: (_e = (_d = (_c = spec.series) === null || _c === void 0 ? void 0 : _c[specIndex]) === null || _d === void 0 ? void 0 : _d.color) !== null && _e !== void 0 ? _e : paletteColorAt(specIndex),
|
|
2915
|
+
values: s.data.map(function (d) {
|
|
2916
|
+
var _a;
|
|
2917
|
+
var v = d !== null && typeof d === "object"
|
|
2918
|
+
? (_a = d.originalValue) !== null && _a !== void 0 ? _a : d.value
|
|
2919
|
+
: d;
|
|
2920
|
+
return v === null || v === undefined ? "" : (0, axis_number_format_1.formatAxisValue)(pattern, v, locale);
|
|
2921
|
+
}),
|
|
2922
|
+
};
|
|
2923
|
+
})
|
|
2924
|
+
: [];
|
|
2925
|
+
dataTableAxisList = dataTableRows.length
|
|
2926
|
+
? (0, data_table_1.dataTableAxes)(dataTableRows, dataTableOptions !== null && dataTableOptions !== void 0 ? dataTableOptions : {}, {
|
|
2927
|
+
textColor: axisTextColor,
|
|
2928
|
+
fontSize: overrides_2.CHART_TEXT_PX,
|
|
2929
|
+
borderColor: isDarkMode ? "rgba(255,255,255,0.3)" : "#D9D9D9",
|
|
2930
|
+
})
|
|
2931
|
+
: [];
|
|
2932
|
+
autoScaleEligible = !isCircularChart &&
|
|
2933
|
+
!isOfPie &&
|
|
2934
|
+
AUTO_SCALE_CHART_TYPES.has(spec.chartType) &&
|
|
2935
|
+
!spec.sourceChartType &&
|
|
2936
|
+
spec.stackedType !== "PERCENT_STACKED";
|
|
2937
|
+
withExcelAutoScale = function (axis, opts, axisIndex) {
|
|
2938
|
+
if (!autoScaleEligible || (axis === null || axis === void 0 ? void 0 : axis.type) === "log" || (opts === null || opts === void 0 ? void 0 : opts.logarithmic)) {
|
|
2939
|
+
return axis;
|
|
2940
|
+
}
|
|
2941
|
+
var scale = (0, excel_axis_scale_1.excelAutoAxisScale)((0, excel_axis_scale_1.valueAxisExtentValues)(seriesWithLabels, axisIndex), { min: opts === null || opts === void 0 ? void 0 : opts.min, max: opts === null || opts === void 0 ? void 0 : opts.max, majorUnit: opts === null || opts === void 0 ? void 0 : opts.majorUnit });
|
|
2942
|
+
return scale ? tslib_1.__assign(tslib_1.__assign({}, axis), scale) : axis;
|
|
2943
|
+
};
|
|
2847
2944
|
// Update charts
|
|
2848
|
-
(
|
|
2945
|
+
(_181 = chartRef.current) === null || _181 === void 0 ? void 0 : _181.setOption({
|
|
2849
2946
|
xAxis: (function () {
|
|
2850
2947
|
var _a, _b;
|
|
2851
2948
|
if (isOfPie) {
|
|
@@ -2889,7 +2986,7 @@ var BasicChart = function (_a) {
|
|
|
2889
2986
|
}
|
|
2890
2987
|
if (isHorizontalBarChart) {
|
|
2891
2988
|
return [
|
|
2892
|
-
(0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: (_a = spec.horizontalAxisTitle) !== null && _a !== void 0 ? _a : "" }), spec.valueAxisOptions, primaryAxisNumberFormat, locale),
|
|
2989
|
+
withExcelAutoScale((0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: (_a = spec.horizontalAxisTitle) !== null && _a !== void 0 ? _a : "" }), spec.valueAxisOptions, primaryAxisNumberFormat, locale, "x"), spec.valueAxisOptions, 0),
|
|
2893
2990
|
];
|
|
2894
2991
|
}
|
|
2895
2992
|
var base = chartDomains.length > 0
|
|
@@ -2900,7 +2997,7 @@ var BasicChart = function (_a) {
|
|
|
2900
2997
|
show: showAxis,
|
|
2901
2998
|
axisLine: { show: true },
|
|
2902
2999
|
axisTick: { show: true },
|
|
2903
|
-
splitLine: { show:
|
|
3000
|
+
splitLine: { show: false },
|
|
2904
3001
|
name: (_b = spec.horizontalAxisTitle) !== null && _b !== void 0 ? _b : "",
|
|
2905
3002
|
nameLocation: "middle",
|
|
2906
3003
|
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
@@ -2909,7 +3006,7 @@ var BasicChart = function (_a) {
|
|
|
2909
3006
|
var axes = base.map(function (axis) {
|
|
2910
3007
|
return (0, overrides_1.applyAxisOverrides)(axis, spec.categoryAxisOptions);
|
|
2911
3008
|
});
|
|
2912
|
-
return
|
|
3009
|
+
return tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(axes), false), tslib_1.__read((boxplotOverlayAxis ? [boxplotOverlayAxis] : [])), false), tslib_1.__read(dataTableAxisList), false);
|
|
2913
3010
|
})(),
|
|
2914
3011
|
yAxis: (function () {
|
|
2915
3012
|
var _a, _b;
|
|
@@ -2943,14 +3040,14 @@ var BasicChart = function (_a) {
|
|
|
2943
3040
|
show: showAxis,
|
|
2944
3041
|
axisLine: { show: true },
|
|
2945
3042
|
axisTick: { show: true },
|
|
2946
|
-
splitLine: { show:
|
|
3043
|
+
splitLine: { show: false },
|
|
2947
3044
|
name: (_a = spec.verticalAxisTitle) !== null && _a !== void 0 ? _a : "",
|
|
2948
3045
|
nameLocation: "middle",
|
|
2949
3046
|
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
2950
3047
|
},
|
|
2951
3048
|
];
|
|
2952
3049
|
return base.map(function (axis) {
|
|
2953
|
-
return (0, overrides_1.applyAxisOverrides)(axis, spec.categoryAxisOptions);
|
|
3050
|
+
return (0, overrides_1.applyAxisOverrides)(axis, spec.categoryAxisOptions, undefined, undefined, "y");
|
|
2954
3051
|
});
|
|
2955
3052
|
}
|
|
2956
3053
|
var axes = [
|
|
@@ -2971,6 +3068,7 @@ var BasicChart = function (_a) {
|
|
|
2971
3068
|
locale: locale,
|
|
2972
3069
|
}) }), spec.valueAxisOptions, primaryAxisNumberFormat, locale),
|
|
2973
3070
|
];
|
|
3071
|
+
axes[0] = withExcelAutoScale(axes[0], spec.valueAxisOptions, 0);
|
|
2974
3072
|
if (hasSecondaryAxis) {
|
|
2975
3073
|
axes.push((0, overrides_1.applyAxisOverrides)(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, valueAxisBase), { name: "", splitLine: { show: false } }), (isPareto
|
|
2976
3074
|
? {
|
|
@@ -2979,6 +3077,9 @@ var BasicChart = function (_a) {
|
|
|
2979
3077
|
axisLabel: { formatter: "{value}%" },
|
|
2980
3078
|
}
|
|
2981
3079
|
: {})), spec.secondaryValueAxisOptions, secondaryAxisNumberFormat, locale));
|
|
3080
|
+
if (!isPareto) {
|
|
3081
|
+
axes[1] = withExcelAutoScale(axes[1], spec.secondaryValueAxisOptions, 1);
|
|
3082
|
+
}
|
|
2982
3083
|
}
|
|
2983
3084
|
return axes;
|
|
2984
3085
|
})(),
|
|
@@ -3029,10 +3130,8 @@ var BasicChart = function (_a) {
|
|
|
3029
3130
|
var applyThemeOptions = function () {
|
|
3030
3131
|
var _a, _b, _c, _d;
|
|
3031
3132
|
if (chartRef.current) {
|
|
3032
|
-
var textColor = (
|
|
3033
|
-
|
|
3034
|
-
tint: isDarkMode ? 1 : 0,
|
|
3035
|
-
}, theme);
|
|
3133
|
+
var textColor = chartTextColor(theme, isDarkMode);
|
|
3134
|
+
var fontFamily = chartFontFamily(theme);
|
|
3036
3135
|
var bgColor = (0, spreadsheet_1.getStringifiedColor)({ theme: 0, tint: isDarkMode ? -1 : 1 }, theme);
|
|
3037
3136
|
var showAxis = (0, helpers_1.showXAxis)(chart.spec.chartType);
|
|
3038
3137
|
// Authored chart-level text formats override the theme-derived
|
|
@@ -3048,18 +3147,24 @@ var BasicChart = function (_a) {
|
|
|
3048
3147
|
// Every key is written (echarts merges setOption calls, so a key
|
|
3049
3148
|
// left out keeps its previous value — turning bold off used to
|
|
3050
3149
|
// leave the title bold, rowsncolumns/spreadsheet#1105).
|
|
3150
|
+
left: "center",
|
|
3051
3151
|
textStyle: (0, overrides_2.themedTextStyle)(authoredTitleFmt, {
|
|
3052
3152
|
color: textColor,
|
|
3053
|
-
fontSize:
|
|
3054
|
-
|
|
3153
|
+
fontSize: overrides_2.CHART_TITLE_PX,
|
|
3154
|
+
fontFamily: fontFamily,
|
|
3155
|
+
fontWeight: "normal",
|
|
3055
3156
|
}),
|
|
3056
3157
|
},
|
|
3057
3158
|
legend: {
|
|
3058
3159
|
textStyle: (0, overrides_2.themedTextStyle)(authoredLegendFmt, {
|
|
3059
3160
|
color: textColor,
|
|
3060
|
-
fontSize:
|
|
3161
|
+
fontSize: overrides_2.CHART_TEXT_PX,
|
|
3162
|
+
fontFamily: fontFamily,
|
|
3061
3163
|
}),
|
|
3062
3164
|
},
|
|
3165
|
+
// Every other chart text (tick labels, axis titles, data labels)
|
|
3166
|
+
// inherits the theme body font.
|
|
3167
|
+
textStyle: { fontFamily: fontFamily },
|
|
3063
3168
|
axisLabel: {
|
|
3064
3169
|
color: (_c = authoredDataLabelFmt === null || authoredDataLabelFmt === void 0 ? void 0 : authoredDataLabelFmt.color) !== null && _c !== void 0 ? _c : textColor,
|
|
3065
3170
|
},
|
|
@@ -3114,8 +3219,8 @@ var BasicChart = function (_a) {
|
|
|
3114
3219
|
chart.spec.palette,
|
|
3115
3220
|
chart.spec.backgroundColor,
|
|
3116
3221
|
chart.spec.titleTextFormat,
|
|
3117
|
-
(
|
|
3118
|
-
(
|
|
3222
|
+
(_e = chart.spec.legend) === null || _e === void 0 ? void 0 : _e.textFormat,
|
|
3223
|
+
(_f = chart.spec.dataLabels) === null || _f === void 0 ? void 0 : _f.textFormat,
|
|
3119
3224
|
]);
|
|
3120
3225
|
// Draw chart. `glUpgradeTick` re-runs the draw when the lazily loaded
|
|
3121
3226
|
// echarts-gl module resolves, upgrading a 3-D spec's immediate 2-D
|