@rowsncolumns/charts 28.1.7 → 28.1.10
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 +525 -419
- package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/basic-chart/helpers.js +2 -0
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +351 -192
- package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/helpers.js +2 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils/bubble.d.ts +34 -1
- package/dist/cjs/utils/bubble.d.ts.map +1 -1
- package/dist/cjs/utils/bubble.js +39 -13
- package/dist/cjs/utils/doughnut.d.ts +19 -0
- package/dist/cjs/utils/doughnut.d.ts.map +1 -0
- package/dist/cjs/utils/doughnut.js +28 -0
- package/dist/cjs/utils/echarts-overlays.d.ts +46 -0
- package/dist/cjs/utils/echarts-overlays.d.ts.map +1 -0
- package/dist/cjs/utils/echarts-overlays.js +134 -0
- package/dist/cjs/utils/hierarchy.d.ts +23 -1
- package/dist/cjs/utils/hierarchy.d.ts.map +1 -1
- package/dist/cjs/utils/hierarchy.js +179 -55
- package/dist/cjs/utils/overrides.d.ts +9 -0
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +18 -3
- package/dist/cjs/utils/radar.d.ts +31 -5
- package/dist/cjs/utils/radar.d.ts.map +1 -1
- package/dist/cjs/utils/radar.js +67 -27
- package/dist/cjs/utils/trendline.d.ts +7 -1
- package/dist/cjs/utils/trendline.d.ts.map +1 -1
- package/dist/cjs/utils/trendline.js +82 -18
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +376 -248
- package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/basic-chart/helpers.js +2 -0
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +279 -69
- package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/helpers.js +2 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/bubble.d.ts +34 -1
- package/dist/esm/utils/bubble.d.ts.map +1 -1
- package/dist/esm/utils/bubble.js +35 -11
- package/dist/esm/utils/doughnut.d.ts +19 -0
- package/dist/esm/utils/doughnut.d.ts.map +1 -0
- package/dist/esm/utils/doughnut.js +21 -0
- package/dist/esm/utils/echarts-overlays.d.ts +46 -0
- package/dist/esm/utils/echarts-overlays.d.ts.map +1 -0
- package/dist/esm/utils/echarts-overlays.js +135 -0
- package/dist/esm/utils/hierarchy.d.ts +23 -1
- package/dist/esm/utils/hierarchy.d.ts.map +1 -1
- package/dist/esm/utils/hierarchy.js +168 -50
- package/dist/esm/utils/overrides.d.ts +9 -0
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +16 -2
- package/dist/esm/utils/radar.d.ts +31 -5
- package/dist/esm/utils/radar.d.ts.map +1 -1
- package/dist/esm/utils/radar.js +44 -16
- package/dist/esm/utils/trendline.d.ts +7 -1
- package/dist/esm/utils/trendline.d.ts.map +1 -1
- package/dist/esm/utils/trendline.js +67 -14
- package/package.json +4 -4
|
@@ -22,15 +22,16 @@ var chart_spec_utils_1 = require("../utils/chart-spec-utils");
|
|
|
22
22
|
var chart_orientation_1 = require("../utils/chart-orientation");
|
|
23
23
|
var chart_image_1 = require("../utils/chart-image");
|
|
24
24
|
var chart_styles_1 = require("../utils/chart-styles");
|
|
25
|
+
var echarts_overlays_1 = require("../utils/echarts-overlays");
|
|
25
26
|
var empty_cells_1 = require("../utils/empty-cells");
|
|
26
27
|
var echarts_gl_loader_1 = require("../utils/echarts-gl-loader");
|
|
27
|
-
var error_bars_1 = require("../utils/error-bars");
|
|
28
28
|
var category_levels_1 = require("../utils/category-levels");
|
|
29
29
|
var gradient_1 = require("../utils/gradient");
|
|
30
30
|
var hierarchy_1 = require("../utils/hierarchy");
|
|
31
31
|
var histogram_1 = require("../utils/histogram");
|
|
32
32
|
var legend_layout_1 = require("../utils/legend-layout");
|
|
33
33
|
var of_pie_1 = require("../utils/of-pie");
|
|
34
|
+
var doughnut_1 = require("../utils/doughnut");
|
|
34
35
|
var overrides_1 = require("../utils/overrides");
|
|
35
36
|
var radar_1 = require("../utils/radar");
|
|
36
37
|
var region_map_1 = require("../utils/region-map");
|
|
@@ -39,7 +40,6 @@ var stock_1 = require("../utils/stock");
|
|
|
39
40
|
var pie_explosion_1 = require("../utils/pie-explosion");
|
|
40
41
|
var series_click_1 = require("../utils/series-click");
|
|
41
42
|
var three_d_1 = require("../utils/three-d");
|
|
42
|
-
var trendline_1 = require("../utils/trendline");
|
|
43
43
|
var waterfall_1 = require("../utils/waterfall");
|
|
44
44
|
var webgl_1 = require("../utils/webgl");
|
|
45
45
|
var helpers_1 = require("./helpers");
|
|
@@ -112,29 +112,39 @@ var isBubbleChartSpec = function (spec) {
|
|
|
112
112
|
var isHierarchyChartSpec = function (spec) {
|
|
113
113
|
return HIERARCHY_CHART_TYPES.has(spec.chartType);
|
|
114
114
|
};
|
|
115
|
+
// Every level keeps the colour its node was given (one solid colour per
|
|
116
|
+
// top-level category, like Excel — no per-level saturation ramp); thin
|
|
117
|
+
// white gaps separate the cells.
|
|
115
118
|
var HIERARCHY_LEVEL_STYLES = [
|
|
116
119
|
{
|
|
117
120
|
itemStyle: {
|
|
118
|
-
gapWidth:
|
|
119
|
-
|
|
121
|
+
gapWidth: 2,
|
|
122
|
+
borderColor: "#ffffff",
|
|
123
|
+
borderWidth: 0,
|
|
120
124
|
},
|
|
121
125
|
upperLabel: { show: false },
|
|
122
126
|
},
|
|
123
127
|
{
|
|
124
|
-
colorSaturation: [0.35, 0.65],
|
|
125
|
-
itemStyle: {
|
|
126
|
-
gapWidth: 1,
|
|
127
|
-
borderColorSaturation: 0.6,
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
colorSaturation: [0.45, 0.75],
|
|
132
128
|
itemStyle: {
|
|
133
129
|
gapWidth: 1,
|
|
134
|
-
|
|
130
|
+
borderColor: "#ffffff",
|
|
131
|
+
borderWidth: 1,
|
|
135
132
|
},
|
|
136
133
|
},
|
|
137
134
|
];
|
|
135
|
+
/**
|
|
136
|
+
* Colour a hierarchy like Excel: each top-level node takes the next
|
|
137
|
+
* palette colour and every descendant inherits it (#1072).
|
|
138
|
+
*/
|
|
139
|
+
var colorHierarchyNodes = function (nodes, palette) {
|
|
140
|
+
return nodes.map(function (node, index) {
|
|
141
|
+
var color = (0, utils_1.chartPaletteColorAt)(palette, index);
|
|
142
|
+
var paint = function (n) { return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, n), { itemStyle: { color: color } }), (n.children ? { children: n.children.map(paint) } : {}))); };
|
|
143
|
+
return paint(node);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
/** Sunburst rings: Excel leaves the centre empty, so even the first level is a ring (#1073). */
|
|
147
|
+
var SUNBURST_RADIUS = ["15%", "80%"];
|
|
138
148
|
var getHierarchyDepth = function (nodes, depth) {
|
|
139
149
|
if (depth === void 0) { depth = 1; }
|
|
140
150
|
var maxDepth = depth;
|
|
@@ -183,6 +193,16 @@ var buildHierarchyLevels = function (maxDepth) {
|
|
|
183
193
|
};
|
|
184
194
|
/** Series whose tooltip value is one number on a value axis. */
|
|
185
195
|
var VALUE_TOOLTIP_SERIES_TYPES = new Set(["bar", "line", "scatter", "funnel"]);
|
|
196
|
+
/** The transparent spacer bars a waterfall stacks its visible bars on. */
|
|
197
|
+
var WATERFALL_PLACEHOLDER_ID = "rnc-waterfall-placeholder";
|
|
198
|
+
/** The invisible funnel that carries the stage names beside the bars. */
|
|
199
|
+
var FUNNEL_NAMES_ID = "rnc-funnel-names";
|
|
200
|
+
/**
|
|
201
|
+
* Layout-only series: they carry no data of their own, so they get no
|
|
202
|
+
* data labels and no tooltip entry (#1070 labelled every waterfall bar
|
|
203
|
+
* with its spacer's height too).
|
|
204
|
+
*/
|
|
205
|
+
var DECORATION_SERIES_IDS = new Set([WATERFALL_PLACEHOLDER_ID, FUNNEL_NAMES_ID]);
|
|
186
206
|
var defaultLegendConfig = {
|
|
187
207
|
padding: 10,
|
|
188
208
|
itemWidth: 10,
|
|
@@ -367,11 +387,11 @@ var BasicChart = function (_a) {
|
|
|
367
387
|
* Triggers a chart update
|
|
368
388
|
*/
|
|
369
389
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
370
|
-
var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, xAxisConfig, tooltipFormatter,
|
|
371
|
-
var e_1,
|
|
372
|
-
var
|
|
373
|
-
return tslib_1.__generator(this, function (
|
|
374
|
-
switch (
|
|
390
|
+
var threeDRenderKind, canRender3D, willRender3D, isRegionMap, regionSpec, geoScope, geo, labels, seriesEntry, values, _a, data, unmatched, min, max, textColor, ramp, noDataColor, borderColor, regionSeriesLabel, seriesName, chartDomains, chartSeries, legend, chartType, position, showAxis, isBubble, isHierarchy, skipHeaders_1, labelValues, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _b, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _c, categories_1, preparedSeries, sizeValues, sizeScale_1, bubblePalette_1, bubbleItemColor_1, hasBubbleSecondaryAxis, xAxisConfig, tooltipFormatter, bubbleSeriesLabelFor_1, bubbleSeries, bubbleOverlays, hierarchyRows, headerTitle, hierarchyPalette, hierarchyData, rootName, drillDown, seriesDisplayName, hierarchyDepth, levels, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchySeriesLabel, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, values, e_1_1, seriesNames_1, contourPoints, _h, zMin, zMax, contourFormats_1, contourLabel, categories_3, threeDSeriesInputs, _j, _k, seriesEntry, dataLabel, _l, _m, values, e_2_1, seriesNames_2, threeDPalette_1, seriesColorAt_1, categoryAxisLabel, seriesAxisLabel, stackedBar3D_1, threeDFormats_1, threeDTooltipFormatter, threeDSeries, visualMap, xAxis3D, yAxis3D, categoryCount, categoryTotals_1, threeDSeriesInputs_1, threeDSeriesInputs_1_1, entry, isPercent_1, surfacePoints, _o, zMin, zMax, skipHeaders, categories, radarSeriesInputs, _p, _q, seriesEntry, label, values, radarAxisOptions_1, indicators_1, radarData, radarStyle_1, radarColors_1, radarFormats_1, radarDataLabels_1, radarSeriesLabelFor_1, radarTooltipFormatter, variant_1, categories, seriesValues, stockFormats_1, stockRoleIndex_1, stockFormatFor_1, stockDataLabels_1, stockSeriesLabelFor_1, upColor_1, downColor_1, volumePoints, hasVolume, stockGrid, baseStockXAxis, stockXAxis, volumeYAxis, volumeSeries, stockAxisPointer, candleData, lineSeries, stockColors_1, isStacked, isCircularChart, isOfPie, ofPieLayout, isHorizontalBarChart, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, aggregateDomainValues, categoryLevels, pushSeriesOverlays, sideBySideBarCount, specBarGap, specBarCategoryGap, seriesPalette, paletteColorAt, _loop_1, _r, _s, _t, specSeriesIndex, series, e_3_1, labels, seriesEntry, rawValues, _u, main_1, secondary, otherTotal, total, ofPieType_1, secondScale, halfAngle_1, hasSecondary, MAIN_CX_1, CY_1, MAIN_RADIUS_PCT_1, SECONDARY_CX_1, secondaryRadiusPct_1, BAR_LEFT_1, BAR_RIGHT, barHalfFrac_1, ofPiePalette_1, paletteAt_1, connectorColor_1, primaryDomainSource_1, rawDomainValues, labels, seriesEntry, rawValues_1, totalIndices, steps, accent_1, decreaseColor_1, totalColor_1, pointColors_1, _v, _w, dp, connectors, primaryDomainSource_2, rawDomainValues, labels_1, seriesEntry, rawValues, funnelPalette, funnelColor_1, stageColors_1, _x, _y, dp, funnelData, funnelLayout, quartileMethod, showOutliers, showMeanMarker, boxStats, boxLabels, outlierPoints, meanPoints, _z, _0, seriesEntry, label, rawValues, summary, boxIndex, lo, hi, _1, _2, outlier, boxSeries, boxColor, rawValues, _3, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, 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;
|
|
391
|
+
var e_1, _4, e_2, _5, e_4, _6, e_5, _7, e_3, _8, e_6, _9, e_7, _10, e_8, _11, e_9, _12, e_10, _13, e_11, _14;
|
|
392
|
+
var _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;
|
|
393
|
+
return tslib_1.__generator(this, function (_150) {
|
|
394
|
+
switch (_150.label) {
|
|
375
395
|
case 0:
|
|
376
396
|
(0, utils_1.debug)("Updating chart", chart);
|
|
377
397
|
threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType);
|
|
@@ -395,7 +415,7 @@ var BasicChart = function (_a) {
|
|
|
395
415
|
// Leaving 3-D (spec edit) — the grid3D option doesn't merge back
|
|
396
416
|
// into a cartesian one, so re-initialize from a clean slate and
|
|
397
417
|
// let the normal 2-D flow below do a full structural render.
|
|
398
|
-
(
|
|
418
|
+
(_15 = chartRef.current) === null || _15 === void 0 ? void 0 : _15.dispose();
|
|
399
419
|
chartRef.current = undefined;
|
|
400
420
|
renderedIn3D.current = false;
|
|
401
421
|
previousChartType.current = undefined;
|
|
@@ -409,7 +429,7 @@ var BasicChart = function (_a) {
|
|
|
409
429
|
// doesn't merge back into a cartesian one, so re-initialize from
|
|
410
430
|
// a clean slate and let the normal flow below do a full
|
|
411
431
|
// structural render.
|
|
412
|
-
(
|
|
432
|
+
(_16 = chartRef.current) === null || _16 === void 0 ? void 0 : _16.dispose();
|
|
413
433
|
chartRef.current = undefined;
|
|
414
434
|
renderedAsRegionMap.current = false;
|
|
415
435
|
previousChartType.current = undefined;
|
|
@@ -422,7 +442,7 @@ var BasicChart = function (_a) {
|
|
|
422
442
|
geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
|
|
423
443
|
return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
|
|
424
444
|
case 1:
|
|
425
|
-
geo =
|
|
445
|
+
geo = _150.sent();
|
|
426
446
|
// Entering the region map from a cartesian render: the previous
|
|
427
447
|
// grid/axis option doesn't merge into the map one, so start from
|
|
428
448
|
// a bare instance (theme options are re-applied after setOption).
|
|
@@ -437,7 +457,7 @@ var BasicChart = function (_a) {
|
|
|
437
457
|
if (!geo) {
|
|
438
458
|
// Map asset failed to load (or unknown scope) — the loader
|
|
439
459
|
// already warned once; render an empty chart, never crash.
|
|
440
|
-
(
|
|
460
|
+
(_17 = chartRef.current) === null || _17 === void 0 ? void 0 : _17.setOption({ series: [] }, { replaceMerge: ["series", "visualMap"] });
|
|
441
461
|
renderedAsRegionMap.current = true;
|
|
442
462
|
applyThemeOptions();
|
|
443
463
|
previousChartType.current = spec.chartType;
|
|
@@ -445,7 +465,7 @@ var BasicChart = function (_a) {
|
|
|
445
465
|
return [2 /*return*/];
|
|
446
466
|
}
|
|
447
467
|
labels = flattenChartDataValues(regionSpec.domains, getDomainValuesFromRange, regionSpec.hiddenDimensionStrategy, false);
|
|
448
|
-
seriesEntry = (
|
|
468
|
+
seriesEntry = (_18 = regionSpec.series) === null || _18 === void 0 ? void 0 : _18[0];
|
|
449
469
|
values = seriesEntry
|
|
450
470
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, regionSpec.hiddenDimensionStrategy)
|
|
451
471
|
: [];
|
|
@@ -461,7 +481,7 @@ var BasicChart = function (_a) {
|
|
|
461
481
|
seriesName = (seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
462
482
|
? seriesEntry.dataLabel
|
|
463
483
|
: "";
|
|
464
|
-
(
|
|
484
|
+
(_19 = chartRef.current) === null || _19 === void 0 ? void 0 : _19.setOption({
|
|
465
485
|
// The visualMap color scale is the value legend; the series
|
|
466
486
|
// legend stays hidden unless an authored override turns it on.
|
|
467
487
|
legend: (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: false }), spec.legend),
|
|
@@ -529,54 +549,91 @@ var BasicChart = function (_a) {
|
|
|
529
549
|
hierarchyTitleRef.current = explicitChartTitle;
|
|
530
550
|
skipHeaders_1 = spec.useFirstRowAsHeaders !== false;
|
|
531
551
|
labelValues = flattenChartDataValues(spec.bubbleLabels, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
|
|
532
|
-
perSeriesX = ((
|
|
552
|
+
perSeriesX = ((_20 = spec.domains) !== null && _20 !== void 0 ? _20 : []).map(function (dom) {
|
|
533
553
|
return flattenChartDataValues([dom], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
|
|
534
554
|
});
|
|
535
|
-
perSeriesSize = ((
|
|
555
|
+
perSeriesSize = ((_21 = spec.bubbleSizes) !== null && _21 !== void 0 ? _21 : []).map(function (sz) {
|
|
536
556
|
return flattenChartDataValues([sz], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
|
|
537
557
|
});
|
|
538
558
|
seriesInputs = [];
|
|
539
559
|
i = 0;
|
|
540
|
-
|
|
560
|
+
_150.label = 3;
|
|
541
561
|
case 3:
|
|
542
562
|
if (!(i < spec.series.length)) return [3 /*break*/, 7];
|
|
543
563
|
seriesEntry = spec.series[i];
|
|
544
|
-
resolvedLabel = (
|
|
564
|
+
resolvedLabel = (_22 = seriesEntry.dataLabel) !== null && _22 !== void 0 ? _22 : "";
|
|
545
565
|
if (!(resolvedLabel && (0, utils_1.isAFormula)(resolvedLabel))) return [3 /*break*/, 5];
|
|
546
566
|
_b = chart_spec_utils_1.coerceCalculatedLabel;
|
|
547
|
-
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (
|
|
567
|
+
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_23 = position.sheetId) !== null && _23 !== void 0 ? _23 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
548
568
|
case 4:
|
|
549
|
-
resolvedLabel = _b.apply(void 0, [
|
|
550
|
-
|
|
569
|
+
resolvedLabel = _b.apply(void 0, [_150.sent()]);
|
|
570
|
+
_150.label = 5;
|
|
551
571
|
case 5:
|
|
552
|
-
xValues = (
|
|
553
|
-
sizeValues_1 = (
|
|
572
|
+
xValues = (_24 = perSeriesX[i]) !== null && _24 !== void 0 ? _24 : perSeriesX[0];
|
|
573
|
+
sizeValues_1 = (_25 = perSeriesSize[i]) !== null && _25 !== void 0 ? _25 : perSeriesSize[0];
|
|
554
574
|
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 } : {})));
|
|
555
|
-
|
|
575
|
+
_150.label = 6;
|
|
556
576
|
case 6:
|
|
557
577
|
i++;
|
|
558
578
|
return [3 /*break*/, 3];
|
|
559
579
|
case 7:
|
|
560
|
-
sharedXValues = (
|
|
561
|
-
sharedSizeValues = (
|
|
580
|
+
sharedXValues = (_26 = perSeriesX[0]) !== null && _26 !== void 0 ? _26 : [];
|
|
581
|
+
sharedSizeValues = (_27 = perSeriesSize[0]) !== null && _27 !== void 0 ? _27 : [];
|
|
562
582
|
_c = (0, bubble_1.prepareBubbleSeriesData)({
|
|
563
583
|
xValues: sharedXValues,
|
|
564
584
|
labelValues: labelValues,
|
|
565
585
|
sizeValues: sharedSizeValues,
|
|
566
586
|
series: seriesInputs,
|
|
567
587
|
}), categories_1 = _c.categories, preparedSeries = _c.series, sizeValues = _c.sizeValues;
|
|
568
|
-
sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues
|
|
588
|
+
sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues, {
|
|
589
|
+
sizeRepresents: spec.sizeRepresents,
|
|
590
|
+
bubbleScale: spec.bubbleScale,
|
|
591
|
+
plotMinSide: Math.min((width !== null && width !== void 0 ? width : 0) * 0.85, (height !== null && height !== void 0 ? height : 0) * 0.75),
|
|
592
|
+
});
|
|
593
|
+
bubblePalette_1 = (0, chart_styles_1.getChartPalette)(spec, [
|
|
594
|
+
theme.themeColors.accent1,
|
|
595
|
+
theme.themeColors.accent2,
|
|
596
|
+
theme.themeColors.accent3,
|
|
597
|
+
theme.themeColors.accent4,
|
|
598
|
+
theme.themeColors.accent5,
|
|
599
|
+
theme.themeColors.accent6,
|
|
600
|
+
]);
|
|
601
|
+
bubbleItemColor_1 = function (seriesEntry, index) {
|
|
602
|
+
var e_12, _a;
|
|
603
|
+
var _b, _c;
|
|
604
|
+
var base = (_b = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _b !== void 0 ? _b : (0, utils_1.chartPaletteColorAt)(bubblePalette_1, index);
|
|
605
|
+
var overrides = new Map();
|
|
606
|
+
try {
|
|
607
|
+
for (var _d = tslib_1.__values((_c = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _c !== void 0 ? _c : []), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
608
|
+
var dp = _e.value;
|
|
609
|
+
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
610
|
+
overrides.set(dp.idx, dp.color);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
615
|
+
finally {
|
|
616
|
+
try {
|
|
617
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
618
|
+
}
|
|
619
|
+
finally { if (e_12) throw e_12.error; }
|
|
620
|
+
}
|
|
621
|
+
return overrides.size
|
|
622
|
+
? function (params) { var _a, _b; return (_b = overrides.get((_a = params === null || params === void 0 ? void 0 : params.data) === null || _a === void 0 ? void 0 : _a.index)) !== null && _b !== void 0 ? _b : base; }
|
|
623
|
+
: base;
|
|
624
|
+
};
|
|
625
|
+
hasBubbleSecondaryAxis = ((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []).some(function (seriesEntry) { return seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis; });
|
|
569
626
|
xAxisConfig = categories_1.length > 0
|
|
570
627
|
? {
|
|
571
628
|
type: "category",
|
|
572
629
|
data: categories_1,
|
|
573
|
-
name: (
|
|
630
|
+
name: (_29 = spec.horizontalAxisTitle) !== null && _29 !== void 0 ? _29 : "",
|
|
574
631
|
nameLocation: "middle",
|
|
575
632
|
nameGap: 30,
|
|
576
633
|
}
|
|
577
634
|
: {
|
|
578
635
|
type: "value",
|
|
579
|
-
name: (
|
|
636
|
+
name: (_30 = spec.horizontalAxisTitle) !== null && _30 !== void 0 ? _30 : "",
|
|
580
637
|
nameLocation: "middle",
|
|
581
638
|
nameGap: 30,
|
|
582
639
|
};
|
|
@@ -590,19 +647,96 @@ var BasicChart = function (_a) {
|
|
|
590
647
|
var seriesName = params.seriesName ? "".concat(params.seriesName, "<br/>") : "";
|
|
591
648
|
return "".concat(seriesName).concat(bubbleName, "X: ").concat(label !== null && label !== void 0 ? label : "", "<br/>Y: ").concat(y !== null && y !== void 0 ? y : "", "<br/>Size: ").concat(size !== null && size !== void 0 ? size : "");
|
|
592
649
|
};
|
|
593
|
-
|
|
594
|
-
|
|
650
|
+
bubbleSeriesLabelFor_1 = function (index) {
|
|
651
|
+
var _a;
|
|
652
|
+
return (0, overrides_1.buildSeriesLabelOption)((0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, (_a = spec.series) === null || _a === void 0 ? void 0 : _a[index]), undefined, locale);
|
|
653
|
+
};
|
|
654
|
+
bubbleSeries = preparedSeries
|
|
655
|
+
.map(function (entry, index) {
|
|
656
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
657
|
+
var isScatter = spec.chartType === "scatter";
|
|
658
|
+
var scatterStyle = (_a = spec.scatterStyle) !== null && _a !== void 0 ? _a : (isScatter ? "lineMarker" : undefined);
|
|
659
|
+
var seriesEntry = (_b = spec.series) === null || _b === void 0 ? void 0 : _b[index];
|
|
660
|
+
var seriesColor = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color;
|
|
661
|
+
var perMarker = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.marker;
|
|
662
|
+
var itemColor = bubbleItemColor_1(seriesEntry, index);
|
|
663
|
+
var onSecondary = (seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis) ? { yAxisIndex: 1 } : {};
|
|
664
|
+
if (isScatter) {
|
|
665
|
+
var symbol = perMarker === null || perMarker === void 0 ? void 0 : perMarker.symbol;
|
|
666
|
+
var noMarkers = symbol === "none";
|
|
667
|
+
var wantsLine = scatterStyle === "line" ||
|
|
668
|
+
scatterStyle === "lineMarker" ||
|
|
669
|
+
scatterStyle === "smooth" ||
|
|
670
|
+
scatterStyle === "smoothMarker";
|
|
671
|
+
var wantsMarkers = !noMarkers &&
|
|
672
|
+
(scatterStyle === "marker" ||
|
|
673
|
+
scatterStyle === "lineMarker" ||
|
|
674
|
+
scatterStyle === "smoothMarker" ||
|
|
675
|
+
!scatterStyle);
|
|
676
|
+
var smooth = scatterStyle === "smooth" || scatterStyle === "smoothMarker";
|
|
677
|
+
// Labels hang off the point symbols: a marker-less line keeps
|
|
678
|
+
// an invisible 0-size symbol per point when they show (#1049).
|
|
679
|
+
var labelsWithoutMarkers = !wantsMarkers &&
|
|
680
|
+
Boolean((_c = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesEntry)) === null || _c === void 0 ? void 0 : _c.show);
|
|
681
|
+
// The series colour paints the line; the markers take the
|
|
682
|
+
// per-point overrides when the series has any.
|
|
683
|
+
var markerStyle = seriesColor || typeof itemColor === "function"
|
|
684
|
+
? { itemStyle: { color: itemColor } }
|
|
685
|
+
: {};
|
|
686
|
+
return wantsLine
|
|
687
|
+
? tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "line", name: entry.name, data: entry.points, showSymbol: wantsMarkers || labelsWithoutMarkers, smooth: smooth, symbol: (_d = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _d !== void 0 ? _d : "circle", symbolSize: labelsWithoutMarkers ? 0 : (_e = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _e !== void 0 ? _e : 6 }, markerStyle), (seriesColor ? { lineStyle: { color: seriesColor } } : {})), onSecondary) : tslib_1.__assign(tslib_1.__assign({ type: "scatter", name: entry.name, data: entry.points, symbol: (_f = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _f !== void 0 ? _f : "circle", symbolSize: (_g = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _g !== void 0 ? _g : 6 }, markerStyle), onSecondary);
|
|
688
|
+
}
|
|
689
|
+
return tslib_1.__assign(tslib_1.__assign({ type: chartType, name: entry.name, data: entry.points, symbolSize: function (data) { var _a; return sizeScale_1((_a = data === null || data === void 0 ? void 0 : data[2]) !== null && _a !== void 0 ? _a : 0); }, label: {
|
|
690
|
+
show: true,
|
|
691
|
+
formatter: function (params) { var _a; return (_a = params.name) !== null && _a !== void 0 ? _a : ""; },
|
|
692
|
+
} }, (seriesColor || typeof itemColor === "function"
|
|
693
|
+
? { itemStyle: { color: itemColor } }
|
|
694
|
+
: {})), onSecondary);
|
|
695
|
+
})
|
|
696
|
+
.map(function (s, index) {
|
|
697
|
+
var _a;
|
|
698
|
+
var bubbleSeriesLabel = bubbleSeriesLabelFor_1(index);
|
|
699
|
+
return bubbleSeriesLabel
|
|
700
|
+
? tslib_1.__assign(tslib_1.__assign({}, s), { label: tslib_1.__assign(tslib_1.__assign({}, ((_a = s.label) !== null && _a !== void 0 ? _a : {})), bubbleSeriesLabel) }) : s;
|
|
701
|
+
});
|
|
702
|
+
bubbleOverlays = preparedSeries.flatMap(function (entry, index) {
|
|
703
|
+
var _a, _b;
|
|
704
|
+
var seriesEntry = (_a = spec.series) === null || _a === void 0 ? void 0 : _a[index];
|
|
705
|
+
if (!seriesEntry)
|
|
706
|
+
return [];
|
|
707
|
+
return (0, echarts_overlays_1.buildEchartsOverlaySeries)({
|
|
708
|
+
series: seriesEntry,
|
|
709
|
+
values: entry.points.map(function (point) { return point.value[1]; }),
|
|
710
|
+
xValues: entry.points.map(function (point) { return point.value[0]; }),
|
|
711
|
+
dataLabel: entry.name,
|
|
712
|
+
seriesColor: (_b = seriesEntry.color) !== null && _b !== void 0 ? _b : (0, utils_1.chartPaletteColorAt)(bubblePalette_1, index),
|
|
713
|
+
resolveRange: function (range) {
|
|
714
|
+
return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
|
|
715
|
+
},
|
|
716
|
+
});
|
|
717
|
+
});
|
|
718
|
+
(_31 = chartRef.current) === null || _31 === void 0 ? void 0 : _31.setOption({
|
|
595
719
|
xAxis: [
|
|
596
720
|
(0, overrides_1.applyAxisOverrides)(tslib_1.__assign({}, xAxisConfig), spec.categoryAxisOptions),
|
|
597
721
|
],
|
|
598
|
-
yAxis: [
|
|
722
|
+
yAxis: tslib_1.__spreadArray([
|
|
599
723
|
(0, overrides_1.applyAxisOverrides)({
|
|
600
724
|
type: "value",
|
|
601
|
-
name: (
|
|
725
|
+
name: (_32 = spec.verticalAxisTitle) !== null && _32 !== void 0 ? _32 : "",
|
|
602
726
|
nameLocation: "middle",
|
|
603
727
|
nameGap: 45,
|
|
604
|
-
}, spec.valueAxisOptions, undefined, locale)
|
|
605
|
-
],
|
|
728
|
+
}, spec.valueAxisOptions, undefined, locale)
|
|
729
|
+
], tslib_1.__read((hasBubbleSecondaryAxis
|
|
730
|
+
? [
|
|
731
|
+
(0, overrides_1.applyAxisOverrides)({
|
|
732
|
+
type: "value",
|
|
733
|
+
position: "right",
|
|
734
|
+
nameLocation: "middle",
|
|
735
|
+
nameGap: 45,
|
|
736
|
+
splitLine: { show: false },
|
|
737
|
+
}, spec.secondaryValueAxisOptions, undefined, locale),
|
|
738
|
+
]
|
|
739
|
+
: [])), false),
|
|
606
740
|
legend: (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, legend), { show: preparedSeries.length > 1, data: preparedSeries.map(function (entry) { return entry.name; }) }), spec.legend),
|
|
607
741
|
grid: {
|
|
608
742
|
left: "3%",
|
|
@@ -614,55 +748,7 @@ var BasicChart = function (_a) {
|
|
|
614
748
|
trigger: "item",
|
|
615
749
|
formatter: tooltipFormatter,
|
|
616
750
|
},
|
|
617
|
-
|
|
618
|
-
// (optionally connected with a line per scatterStyle); bubble
|
|
619
|
-
// applies a size scale on the 3rd dimension. Pre-fix scatter
|
|
620
|
-
// routed through the bubble code, producing Y-scaled giant
|
|
621
|
-
// circles instead of Excel's small dots.
|
|
622
|
-
series: preparedSeries.map(function (entry, index) {
|
|
623
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
624
|
-
var isScatter = spec.chartType === "scatter";
|
|
625
|
-
var scatterStyle = (_a = spec.scatterStyle) !== null && _a !== void 0 ? _a : (isScatter ? "lineMarker" : undefined);
|
|
626
|
-
var seriesEntry = (_b = spec.series) === null || _b === void 0 ? void 0 : _b[index];
|
|
627
|
-
var seriesColor = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color;
|
|
628
|
-
var perMarker = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.marker;
|
|
629
|
-
if (isScatter) {
|
|
630
|
-
var symbol = perMarker === null || perMarker === void 0 ? void 0 : perMarker.symbol;
|
|
631
|
-
var noMarkers = symbol === "none";
|
|
632
|
-
var wantsLine = scatterStyle === "line" ||
|
|
633
|
-
scatterStyle === "lineMarker" ||
|
|
634
|
-
scatterStyle === "smooth" ||
|
|
635
|
-
scatterStyle === "smoothMarker";
|
|
636
|
-
var wantsMarkers = !noMarkers &&
|
|
637
|
-
(scatterStyle === "marker" ||
|
|
638
|
-
scatterStyle === "lineMarker" ||
|
|
639
|
-
scatterStyle === "smoothMarker" ||
|
|
640
|
-
!scatterStyle);
|
|
641
|
-
var smooth = scatterStyle === "smooth" || scatterStyle === "smoothMarker";
|
|
642
|
-
// Labels hang off the point symbols: a marker-less line keeps
|
|
643
|
-
// an invisible 0-size symbol per point when they show (#1049).
|
|
644
|
-
var labelsWithoutMarkers = !wantsMarkers && Boolean((_c = spec.dataLabels) === null || _c === void 0 ? void 0 : _c.show);
|
|
645
|
-
return wantsLine
|
|
646
|
-
? tslib_1.__assign({ type: "line", name: entry.name, data: entry.points, showSymbol: wantsMarkers || labelsWithoutMarkers, smooth: smooth, symbol: (_d = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _d !== void 0 ? _d : "circle", symbolSize: labelsWithoutMarkers
|
|
647
|
-
? 0
|
|
648
|
-
: (_e = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _e !== void 0 ? _e : 6 }, (seriesColor
|
|
649
|
-
? {
|
|
650
|
-
itemStyle: { color: seriesColor },
|
|
651
|
-
lineStyle: { color: seriesColor },
|
|
652
|
-
}
|
|
653
|
-
: {})) : tslib_1.__assign({ type: "scatter", name: entry.name, data: entry.points, symbol: (_f = (0, helpers_1.mapMarkerSymbolToEcharts)(symbol)) !== null && _f !== void 0 ? _f : "circle", symbolSize: (_g = perMarker === null || perMarker === void 0 ? void 0 : perMarker.size) !== null && _g !== void 0 ? _g : 6 }, (seriesColor
|
|
654
|
-
? { itemStyle: { color: seriesColor } }
|
|
655
|
-
: {}));
|
|
656
|
-
}
|
|
657
|
-
return tslib_1.__assign({ type: chartType, name: entry.name, data: entry.points, symbolSize: function (data) { var _a; return sizeScale_1((_a = data === null || data === void 0 ? void 0 : data[2]) !== null && _a !== void 0 ? _a : 0); }, label: {
|
|
658
|
-
show: true,
|
|
659
|
-
formatter: function (params) { var _a; return (_a = params.name) !== null && _a !== void 0 ? _a : ""; },
|
|
660
|
-
} }, (seriesColor ? { itemStyle: { color: seriesColor } } : {}));
|
|
661
|
-
}).map(function (s) {
|
|
662
|
-
var _a;
|
|
663
|
-
return bubbleSeriesLabel_1
|
|
664
|
-
? tslib_1.__assign(tslib_1.__assign({}, s), { label: tslib_1.__assign(tslib_1.__assign({}, ((_a = s.label) !== null && _a !== void 0 ? _a : {})), bubbleSeriesLabel_1) }) : s;
|
|
665
|
-
}),
|
|
751
|
+
series: tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(bubbleSeries), false), tslib_1.__read(bubbleOverlays), false),
|
|
666
752
|
}, {
|
|
667
753
|
replaceMerge: [
|
|
668
754
|
"series",
|
|
@@ -674,7 +760,7 @@ var BasicChart = function (_a) {
|
|
|
674
760
|
],
|
|
675
761
|
});
|
|
676
762
|
previousChartType.current = spec.chartType;
|
|
677
|
-
previousSeriesCount.current =
|
|
763
|
+
previousSeriesCount.current = bubbleSeries.length + bubbleOverlays.length;
|
|
678
764
|
return [2 /*return*/];
|
|
679
765
|
case 8:
|
|
680
766
|
if (isHierarchy) {
|
|
@@ -689,12 +775,21 @@ var BasicChart = function (_a) {
|
|
|
689
775
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
690
776
|
});
|
|
691
777
|
hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
778
|
+
hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
|
|
779
|
+
theme.themeColors.accent1,
|
|
780
|
+
theme.themeColors.accent2,
|
|
781
|
+
theme.themeColors.accent3,
|
|
782
|
+
theme.themeColors.accent4,
|
|
783
|
+
theme.themeColors.accent5,
|
|
784
|
+
theme.themeColors.accent6,
|
|
785
|
+
]);
|
|
786
|
+
hierarchyData = colorHierarchyNodes((0, hierarchy_1.buildHierarchyTree)(hierarchyRows), hierarchyPalette);
|
|
787
|
+
rootName = hierarchyData.length === 1 ? (_34 = (_33 = hierarchyData[0]) === null || _33 === void 0 ? void 0 : _33.name) !== null && _34 !== void 0 ? _34 : "" : "";
|
|
788
|
+
drillDown = Boolean(spec.drillDown);
|
|
789
|
+
seriesDisplayName = (_36 = (_35 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _35 !== void 0 ? _35 : rootName) !== null && _36 !== void 0 ? _36 : "";
|
|
695
790
|
hierarchyDepth = getHierarchyDepth(hierarchyData);
|
|
696
791
|
levels = buildHierarchyLevels(hierarchyDepth);
|
|
697
|
-
sizeNumberFormat_1 = (0, axis_number_format_1.resolveSourceNumberFormat)((
|
|
792
|
+
sizeNumberFormat_1 = (0, axis_number_format_1.resolveSourceNumberFormat)((_38 = (_37 = spec.sizeData) === null || _37 === void 0 ? void 0 : _37[0]) === null || _38 === void 0 ? void 0 : _38.sources, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
698
793
|
tooltipFormatter = function (params) {
|
|
699
794
|
var _a;
|
|
700
795
|
var value = Array.isArray(params.value)
|
|
@@ -705,7 +800,7 @@ var BasicChart = function (_a) {
|
|
|
705
800
|
hierarchyDataLabels = spec.dataLabels;
|
|
706
801
|
hierarchySeriesLabel = (0, overrides_1.buildSeriesLabelOption)(hierarchyDataLabels && !hierarchyDataLabels.numberFormatPattern
|
|
707
802
|
? tslib_1.__assign(tslib_1.__assign({}, hierarchyDataLabels), { numberFormatPattern: sizeNumberFormat_1 }) : hierarchyDataLabels, undefined, locale);
|
|
708
|
-
(
|
|
803
|
+
(_39 = chartRef.current) === null || _39 === void 0 ? void 0 : _39.setOption({
|
|
709
804
|
xAxis: [
|
|
710
805
|
{
|
|
711
806
|
type: "category",
|
|
@@ -730,21 +825,23 @@ var BasicChart = function (_a) {
|
|
|
730
825
|
formatter: tooltipFormatter,
|
|
731
826
|
},
|
|
732
827
|
series: [
|
|
733
|
-
{
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
rootName: rootName || seriesDisplayName || "",
|
|
737
|
-
data: hierarchyData,
|
|
738
|
-
label: tslib_1.__assign({ show: true, formatter: "{b}" }, (hierarchySeriesLabel !== null && hierarchySeriesLabel !== void 0 ? hierarchySeriesLabel : {})),
|
|
739
|
-
upperLabel: spec.chartType === "treemap"
|
|
828
|
+
tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label: tslib_1.__assign(tslib_1.__assign({ show: true, formatter: "{b}" }, (spec.chartType === "treemap"
|
|
829
|
+
? { position: "insideBottomLeft" }
|
|
830
|
+
: {})), (hierarchySeriesLabel !== null && hierarchySeriesLabel !== void 0 ? hierarchySeriesLabel : {})), upperLabel: spec.chartType === "treemap"
|
|
740
831
|
? {
|
|
741
832
|
show: true,
|
|
742
833
|
padding: [0, 0, 0, 4],
|
|
743
834
|
}
|
|
744
|
-
: undefined,
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
835
|
+
: undefined, levels: levels,
|
|
836
|
+
// Excel has no drill-down on either chart: zooming into a
|
|
837
|
+
// branch on click (and the treemap breadcrumb) is opt-in.
|
|
838
|
+
nodeClick: drillDown
|
|
839
|
+
? spec.chartType === "treemap"
|
|
840
|
+
? "zoomToNode"
|
|
841
|
+
: "rootToNode"
|
|
842
|
+
: false }, (spec.chartType === "treemap"
|
|
843
|
+
? { breadcrumb: { show: drillDown } }
|
|
844
|
+
: { radius: tslib_1.__spreadArray([], tslib_1.__read(SUNBURST_RADIUS), false) })),
|
|
748
845
|
],
|
|
749
846
|
}, {
|
|
750
847
|
replaceMerge: [
|
|
@@ -769,7 +866,7 @@ var BasicChart = function (_a) {
|
|
|
769
866
|
}
|
|
770
867
|
isContour = (0, three_d_1.isContourSpec)(spec);
|
|
771
868
|
if (renderedAsContour.current && !isContour) {
|
|
772
|
-
(
|
|
869
|
+
(_40 = chartRef.current) === null || _40 === void 0 ? void 0 : _40.dispose();
|
|
773
870
|
chartRef.current = undefined;
|
|
774
871
|
renderedAsContour.current = false;
|
|
775
872
|
previousChartType.current = undefined;
|
|
@@ -780,39 +877,39 @@ var BasicChart = function (_a) {
|
|
|
780
877
|
if (!isContour) return [3 /*break*/, 19];
|
|
781
878
|
categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
782
879
|
contourSeriesInputs = [];
|
|
783
|
-
|
|
880
|
+
_150.label = 9;
|
|
784
881
|
case 9:
|
|
785
|
-
|
|
786
|
-
_d = tslib_1.__values((
|
|
787
|
-
|
|
882
|
+
_150.trys.push([9, 16, 17, 18]);
|
|
883
|
+
_d = tslib_1.__values((_41 = spec.series) !== null && _41 !== void 0 ? _41 : []), _e = _d.next();
|
|
884
|
+
_150.label = 10;
|
|
788
885
|
case 10:
|
|
789
886
|
if (!!_e.done) return [3 /*break*/, 15];
|
|
790
887
|
seriesEntry = _e.value;
|
|
791
888
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 12];
|
|
792
889
|
_g = chart_spec_utils_1.coerceCalculatedLabel;
|
|
793
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
890
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_42 = position.sheetId) !== null && _42 !== void 0 ? _42 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
794
891
|
case 11:
|
|
795
|
-
_f = _g.apply(void 0, [
|
|
892
|
+
_f = _g.apply(void 0, [_150.sent()]);
|
|
796
893
|
return [3 /*break*/, 13];
|
|
797
894
|
case 12:
|
|
798
|
-
_f = (
|
|
799
|
-
|
|
895
|
+
_f = (_43 = seriesEntry.dataLabel) !== null && _43 !== void 0 ? _43 : "";
|
|
896
|
+
_150.label = 13;
|
|
800
897
|
case 13:
|
|
801
898
|
dataLabel = _f;
|
|
802
899
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
803
900
|
contourSeriesInputs.push({ name: dataLabel, values: values });
|
|
804
|
-
|
|
901
|
+
_150.label = 14;
|
|
805
902
|
case 14:
|
|
806
903
|
_e = _d.next();
|
|
807
904
|
return [3 /*break*/, 10];
|
|
808
905
|
case 15: return [3 /*break*/, 18];
|
|
809
906
|
case 16:
|
|
810
|
-
e_1_1 =
|
|
907
|
+
e_1_1 = _150.sent();
|
|
811
908
|
e_1 = { error: e_1_1 };
|
|
812
909
|
return [3 /*break*/, 18];
|
|
813
910
|
case 17:
|
|
814
911
|
try {
|
|
815
|
-
if (_e && !_e.done && (
|
|
912
|
+
if (_e && !_e.done && (_4 = _d.return)) _4.call(_d);
|
|
816
913
|
}
|
|
817
914
|
finally { if (e_1) throw e_1.error; }
|
|
818
915
|
return [7 /*endfinally*/];
|
|
@@ -832,7 +929,7 @@ var BasicChart = function (_a) {
|
|
|
832
929
|
chartRef.current = echarts.init(el.current);
|
|
833
930
|
bindSeriesSelection(chartRef.current);
|
|
834
931
|
}
|
|
835
|
-
(
|
|
932
|
+
(_44 = chartRef.current) === null || _44 === void 0 ? void 0 : _44.setOption({
|
|
836
933
|
tooltip: {
|
|
837
934
|
textStyle: { fontSize: 12 },
|
|
838
935
|
trigger: "item",
|
|
@@ -852,7 +949,7 @@ var BasicChart = function (_a) {
|
|
|
852
949
|
type: "category",
|
|
853
950
|
data: categories_2,
|
|
854
951
|
splitArea: { show: true },
|
|
855
|
-
name: (
|
|
952
|
+
name: (_45 = spec.horizontalAxisTitle) !== null && _45 !== void 0 ? _45 : "",
|
|
856
953
|
nameLocation: "middle",
|
|
857
954
|
nameGap: 30,
|
|
858
955
|
}, spec.categoryAxisOptions),
|
|
@@ -862,7 +959,7 @@ var BasicChart = function (_a) {
|
|
|
862
959
|
type: "category",
|
|
863
960
|
data: seriesNames_1,
|
|
864
961
|
splitArea: { show: true },
|
|
865
|
-
name: (
|
|
962
|
+
name: (_46 = spec.verticalAxisTitle) !== null && _46 !== void 0 ? _46 : "",
|
|
866
963
|
nameLocation: "middle",
|
|
867
964
|
nameGap: 50,
|
|
868
965
|
},
|
|
@@ -915,39 +1012,39 @@ var BasicChart = function (_a) {
|
|
|
915
1012
|
if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 30];
|
|
916
1013
|
categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
917
1014
|
threeDSeriesInputs = [];
|
|
918
|
-
|
|
1015
|
+
_150.label = 20;
|
|
919
1016
|
case 20:
|
|
920
|
-
|
|
921
|
-
_j = tslib_1.__values((
|
|
922
|
-
|
|
1017
|
+
_150.trys.push([20, 27, 28, 29]);
|
|
1018
|
+
_j = tslib_1.__values((_47 = spec.series) !== null && _47 !== void 0 ? _47 : []), _k = _j.next();
|
|
1019
|
+
_150.label = 21;
|
|
923
1020
|
case 21:
|
|
924
1021
|
if (!!_k.done) return [3 /*break*/, 26];
|
|
925
1022
|
seriesEntry = _k.value;
|
|
926
1023
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 23];
|
|
927
1024
|
_m = chart_spec_utils_1.coerceCalculatedLabel;
|
|
928
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
1025
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_48 = position.sheetId) !== null && _48 !== void 0 ? _48 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
929
1026
|
case 22:
|
|
930
|
-
_l = _m.apply(void 0, [
|
|
1027
|
+
_l = _m.apply(void 0, [_150.sent()]);
|
|
931
1028
|
return [3 /*break*/, 24];
|
|
932
1029
|
case 23:
|
|
933
|
-
_l = (
|
|
934
|
-
|
|
1030
|
+
_l = (_49 = seriesEntry.dataLabel) !== null && _49 !== void 0 ? _49 : "";
|
|
1031
|
+
_150.label = 24;
|
|
935
1032
|
case 24:
|
|
936
1033
|
dataLabel = _l;
|
|
937
1034
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
938
1035
|
threeDSeriesInputs.push({ name: dataLabel, values: values });
|
|
939
|
-
|
|
1036
|
+
_150.label = 25;
|
|
940
1037
|
case 25:
|
|
941
1038
|
_k = _j.next();
|
|
942
1039
|
return [3 /*break*/, 21];
|
|
943
1040
|
case 26: return [3 /*break*/, 29];
|
|
944
1041
|
case 27:
|
|
945
|
-
e_2_1 =
|
|
1042
|
+
e_2_1 = _150.sent();
|
|
946
1043
|
e_2 = { error: e_2_1 };
|
|
947
1044
|
return [3 /*break*/, 29];
|
|
948
1045
|
case 28:
|
|
949
1046
|
try {
|
|
950
|
-
if (_k && !_k.done && (
|
|
1047
|
+
if (_k && !_k.done && (_5 = _j.return)) _5.call(_j);
|
|
951
1048
|
}
|
|
952
1049
|
finally { if (e_2) throw e_2.error; }
|
|
953
1050
|
return [7 /*endfinally*/];
|
|
@@ -1021,7 +1118,7 @@ var BasicChart = function (_a) {
|
|
|
1021
1118
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1022
1119
|
finally {
|
|
1023
1120
|
try {
|
|
1024
|
-
if (threeDSeriesInputs_1_1 && !threeDSeriesInputs_1_1.done && (
|
|
1121
|
+
if (threeDSeriesInputs_1_1 && !threeDSeriesInputs_1_1.done && (_6 = threeDSeriesInputs_1.return)) _6.call(threeDSeriesInputs_1);
|
|
1025
1122
|
}
|
|
1026
1123
|
finally { if (e_4) throw e_4.error; }
|
|
1027
1124
|
}
|
|
@@ -1111,12 +1208,12 @@ var BasicChart = function (_a) {
|
|
|
1111
1208
|
inRange: { color: tslib_1.__spreadArray([], tslib_1.__read(three_d_1.SURFACE_COLOR_RAMP), false) },
|
|
1112
1209
|
};
|
|
1113
1210
|
}
|
|
1114
|
-
(
|
|
1211
|
+
(_50 = chartRef.current) === null || _50 === void 0 ? void 0 : _50.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
|
|
1115
1212
|
textStyle: { fontSize: 12 },
|
|
1116
1213
|
formatter: threeDTooltipFormatter,
|
|
1117
1214
|
}, legend: threeDRenderKind === "line3D" || stackedBar3D_1
|
|
1118
1215
|
? (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: seriesNames_2.length > 1, data: seriesNames_2 }), spec.legend)
|
|
1119
|
-
: { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (
|
|
1216
|
+
: { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (_51 = spec.horizontalAxisTitle) !== null && _51 !== void 0 ? _51 : "" }), yAxis3D: tslib_1.__assign(tslib_1.__assign({}, yAxis3D), { name: "" }), zAxis3D: { type: "value", name: (_52 = spec.verticalAxisTitle) !== null && _52 !== void 0 ? _52 : "" }, grid3D: {
|
|
1120
1217
|
boxDepth: Math.max(20, Math.min(100, seriesNames_2.length * 20)),
|
|
1121
1218
|
viewControl: { autoRotate: false },
|
|
1122
1219
|
} }, (visualMap ? { visualMap: [visualMap] } : {})), { series: threeDSeries }), {
|
|
@@ -1147,7 +1244,7 @@ var BasicChart = function (_a) {
|
|
|
1147
1244
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders);
|
|
1148
1245
|
radarSeriesInputs = [];
|
|
1149
1246
|
try {
|
|
1150
|
-
for (_p = tslib_1.__values((
|
|
1247
|
+
for (_p = tslib_1.__values((_53 = spec.series) !== null && _53 !== void 0 ? _53 : []), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1151
1248
|
seriesEntry = _q.value;
|
|
1152
1249
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
1153
1250
|
? seriesEntry.dataLabel
|
|
@@ -1159,13 +1256,14 @@ var BasicChart = function (_a) {
|
|
|
1159
1256
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1160
1257
|
finally {
|
|
1161
1258
|
try {
|
|
1162
|
-
if (_q && !_q.done && (
|
|
1259
|
+
if (_q && !_q.done && (_7 = _p.return)) _7.call(_p);
|
|
1163
1260
|
}
|
|
1164
1261
|
finally { if (e_5) throw e_5.error; }
|
|
1165
1262
|
}
|
|
1166
|
-
|
|
1263
|
+
radarAxisOptions_1 = spec.valueAxisOptions;
|
|
1264
|
+
indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions_1);
|
|
1167
1265
|
radarData = (0, radar_1.buildRadarSeriesData)(radarSeriesInputs, indicators_1.length);
|
|
1168
|
-
radarStyle_1 = (
|
|
1266
|
+
radarStyle_1 = (_54 = spec.radarStyle) !== null && _54 !== void 0 ? _54 : "standard";
|
|
1169
1267
|
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; });
|
|
1170
1268
|
radarFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
1171
1269
|
radarDataLabels_1 = spec.dataLabels;
|
|
@@ -1182,11 +1280,24 @@ var BasicChart = function (_a) {
|
|
|
1182
1280
|
});
|
|
1183
1281
|
return tslib_1.__spreadArray([(_b = params === null || params === void 0 ? void 0 : params.name) !== null && _b !== void 0 ? _b : ""], tslib_1.__read(lines), false).filter(Boolean).join("<br/>");
|
|
1184
1282
|
};
|
|
1185
|
-
(
|
|
1283
|
+
(_55 = chartRef.current) === null || _55 === void 0 ? void 0 : _55.setOption({
|
|
1186
1284
|
radar: {
|
|
1187
|
-
|
|
1285
|
+
// The common scale's tick labels along ONE axis, as Excel draws
|
|
1286
|
+
// them: echarts labels every indicator axis, so each indicator
|
|
1287
|
+
// carries its own `axisLabel.show` (an indicator's own options win
|
|
1288
|
+
// over the radar-level ones in echarts' merge) and only the first
|
|
1289
|
+
// shows (#1066 follow-up); hidden with the spec's value axis.
|
|
1290
|
+
indicator: (indicators_1.length
|
|
1188
1291
|
? indicators_1
|
|
1189
|
-
: [{ name: "", max: 1 }],
|
|
1292
|
+
: [{ name: "", min: 0, max: 1 }]).map(function (indicator, index) { return (tslib_1.__assign(tslib_1.__assign({}, indicator), { axisLabel: {
|
|
1293
|
+
show: index === 0 && (radarAxisOptions_1 === null || radarAxisOptions_1 === void 0 ? void 0 : radarAxisOptions_1.visible) !== false,
|
|
1294
|
+
} })); }),
|
|
1295
|
+
axisLabel: {
|
|
1296
|
+
show: (radarAxisOptions_1 === null || radarAxisOptions_1 === void 0 ? void 0 : radarAxisOptions_1.visible) !== false,
|
|
1297
|
+
formatter: function (value) {
|
|
1298
|
+
return (0, axis_number_format_1.formatAxisValue)(radarFormats_1[0], value, locale);
|
|
1299
|
+
},
|
|
1300
|
+
},
|
|
1190
1301
|
},
|
|
1191
1302
|
legend: (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),
|
|
1192
1303
|
tooltip: { trigger: "item", formatter: radarTooltipFormatter },
|
|
@@ -1225,9 +1336,9 @@ var BasicChart = function (_a) {
|
|
|
1225
1336
|
// V-variants additionally get a volume column sub-pane below the
|
|
1226
1337
|
// price plot.
|
|
1227
1338
|
if (spec.chartType === "stock") {
|
|
1228
|
-
variant_1 = ((
|
|
1339
|
+
variant_1 = ((_56 = spec.stockVariant) !== null && _56 !== void 0 ? _56 : "HLC");
|
|
1229
1340
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1230
|
-
seriesValues = ((
|
|
1341
|
+
seriesValues = ((_57 = spec.series) !== null && _57 !== void 0 ? _57 : []).map(function (seriesEntry) {
|
|
1231
1342
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
1232
1343
|
});
|
|
1233
1344
|
stockFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
@@ -1245,7 +1356,7 @@ var BasicChart = function (_a) {
|
|
|
1245
1356
|
upColor_1 = theme.themeColors.accent1;
|
|
1246
1357
|
downColor_1 = theme.themeColors.accent2;
|
|
1247
1358
|
volumePoints = (0, stock_1.toVolumeSeries)(seriesValues, variant_1);
|
|
1248
|
-
hasVolume = ((
|
|
1359
|
+
hasVolume = ((_58 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _58 !== void 0 ? _58 : 0) > 0;
|
|
1249
1360
|
stockGrid = hasVolume
|
|
1250
1361
|
? [
|
|
1251
1362
|
{ left: "10%", right: "4%", top: "8%", height: "56%" },
|
|
@@ -1259,7 +1370,7 @@ var BasicChart = function (_a) {
|
|
|
1259
1370
|
axisLine: { show: true },
|
|
1260
1371
|
axisTick: { show: true },
|
|
1261
1372
|
splitLine: { show: false },
|
|
1262
|
-
name: (
|
|
1373
|
+
name: (_59 = spec.horizontalAxisTitle) !== null && _59 !== void 0 ? _59 : "",
|
|
1263
1374
|
nameLocation: "middle",
|
|
1264
1375
|
nameGap: 30,
|
|
1265
1376
|
}, spec.categoryAxisOptions);
|
|
@@ -1301,14 +1412,14 @@ var BasicChart = function (_a) {
|
|
|
1301
1412
|
// (no open) fall through to the line-derived rendering below.
|
|
1302
1413
|
if (variant_1 === "OHLC" || variant_1 === "VOHLC") {
|
|
1303
1414
|
candleData = (0, stock_1.toCandlestick)(seriesValues, variant_1);
|
|
1304
|
-
(
|
|
1415
|
+
(_60 = chartRef.current) === null || _60 === void 0 ? void 0 : _60.setOption({
|
|
1305
1416
|
xAxis: stockXAxis,
|
|
1306
1417
|
yAxis: tslib_1.__spreadArray([
|
|
1307
1418
|
(0, overrides_1.applyAxisOverrides)({
|
|
1308
1419
|
type: "value",
|
|
1309
1420
|
show: true,
|
|
1310
1421
|
scale: true,
|
|
1311
|
-
name: (
|
|
1422
|
+
name: (_61 = spec.verticalAxisTitle) !== null && _61 !== void 0 ? _61 : "",
|
|
1312
1423
|
nameLocation: "middle",
|
|
1313
1424
|
nameGap: 50,
|
|
1314
1425
|
gridIndex: 0,
|
|
@@ -1353,13 +1464,13 @@ var BasicChart = function (_a) {
|
|
|
1353
1464
|
theme.themeColors.accent3,
|
|
1354
1465
|
theme.themeColors.accent4,
|
|
1355
1466
|
]);
|
|
1356
|
-
(
|
|
1467
|
+
(_62 = chartRef.current) === null || _62 === void 0 ? void 0 : _62.setOption({
|
|
1357
1468
|
xAxis: stockXAxis,
|
|
1358
1469
|
yAxis: tslib_1.__spreadArray([
|
|
1359
1470
|
(0, overrides_1.applyAxisOverrides)({
|
|
1360
1471
|
type: "value",
|
|
1361
1472
|
show: true,
|
|
1362
|
-
name: (
|
|
1473
|
+
name: (_63 = spec.verticalAxisTitle) !== null && _63 !== void 0 ? _63 : "",
|
|
1363
1474
|
nameLocation: "middle",
|
|
1364
1475
|
nameGap: 50,
|
|
1365
1476
|
gridIndex: 0,
|
|
@@ -1398,14 +1509,14 @@ var BasicChart = function (_a) {
|
|
|
1398
1509
|
ofPieLayout = null;
|
|
1399
1510
|
isHorizontalBarChart = spec.chartType === "bar";
|
|
1400
1511
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1401
|
-
primaryDomainSource = (
|
|
1512
|
+
primaryDomainSource = (_66 = (_65 = (_64 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _64 === void 0 ? void 0 : _64[0]) === null || _65 === void 0 ? void 0 : _65.sources) === null || _66 === void 0 ? void 0 : _66[0];
|
|
1402
1513
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1403
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1514
|
+
? (0, aggregation_1.sanitizeDomainValues)((_67 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _67 !== void 0 ? _67 : [])
|
|
1404
1515
|
: [];
|
|
1405
1516
|
aggregateDomainValues = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1406
1517
|
categoryLevels = isCircularChart
|
|
1407
1518
|
? undefined
|
|
1408
|
-
: (0, category_levels_1.resolveCategoryLevels)((
|
|
1519
|
+
: (0, category_levels_1.resolveCategoryLevels)((_68 = spec.categoryLevels) === null || _68 === void 0 ? void 0 : _68.map(function (level) {
|
|
1409
1520
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1410
1521
|
}));
|
|
1411
1522
|
if (categoryLevels) {
|
|
@@ -1416,15 +1527,15 @@ var BasicChart = function (_a) {
|
|
|
1416
1527
|
axisTick: { show: true },
|
|
1417
1528
|
splitLine: { show: true },
|
|
1418
1529
|
name: isHorizontalBarChart
|
|
1419
|
-
? (
|
|
1420
|
-
: (
|
|
1530
|
+
? (_69 = spec.verticalAxisTitle) !== null && _69 !== void 0 ? _69 : ""
|
|
1531
|
+
: (_70 = spec.horizontalAxisTitle) !== null && _70 !== void 0 ? _70 : "",
|
|
1421
1532
|
nameLocation: "middle",
|
|
1422
1533
|
nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
|
|
1423
1534
|
})), false));
|
|
1424
1535
|
}
|
|
1425
1536
|
// One category axis per domain (Excel): a domain drawn from several
|
|
1426
1537
|
// ranges lists their categories in sequence on that single axis.
|
|
1427
|
-
(categoryLevels ? [] : (
|
|
1538
|
+
(categoryLevels ? [] : (_71 = spec.domains) !== null && _71 !== void 0 ? _71 : []).forEach(function (domain, domainIndex) {
|
|
1428
1539
|
var _a, _b;
|
|
1429
1540
|
var axisData = domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1430
1541
|
var _a;
|
|
@@ -1460,15 +1571,14 @@ var BasicChart = function (_a) {
|
|
|
1460
1571
|
splitLine: { show: true },
|
|
1461
1572
|
gridIndex: 0,
|
|
1462
1573
|
name: isHorizontalBarChart
|
|
1463
|
-
? (
|
|
1464
|
-
: (
|
|
1574
|
+
? (_72 = spec.verticalAxisTitle) !== null && _72 !== void 0 ? _72 : ""
|
|
1575
|
+
: (_73 = spec.horizontalAxisTitle) !== null && _73 !== void 0 ? _73 : "",
|
|
1465
1576
|
nameLocation: "middle",
|
|
1466
1577
|
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
1467
1578
|
});
|
|
1468
1579
|
}
|
|
1469
1580
|
pushSeriesOverlays = function (series, data, dataLabel) {
|
|
1470
|
-
var
|
|
1471
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1581
|
+
var _a;
|
|
1472
1582
|
var numericValues = Array.isArray(data)
|
|
1473
1583
|
? data.map(function (v) {
|
|
1474
1584
|
return typeof v === "number"
|
|
@@ -1480,135 +1590,21 @@ var BasicChart = function (_a) {
|
|
|
1480
1590
|
: [];
|
|
1481
1591
|
if (numericValues.length === 0)
|
|
1482
1592
|
return;
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
//
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
forecastBackward: tl.forecastBackward,
|
|
1495
|
-
});
|
|
1496
|
-
if (!result || result.points.length < 2)
|
|
1497
|
-
continue;
|
|
1498
|
-
var tlName = (_d = tl.name) !== null && _d !== void 0 ? _d : "".concat(dataLabel ? dataLabel + " " : "").concat((_e = tl.type) !== null && _e !== void 0 ? _e : "linear", " trend");
|
|
1499
|
-
chartSeries.push(tslib_1.__assign({ type: "line", name: tlName,
|
|
1500
|
-
// Index x lets the trendline overlay the category axis even
|
|
1501
|
-
// when forecasting extends beyond the data range.
|
|
1502
|
-
data: result.points.map(function (p) { return [p.x, p.y]; }), showSymbol: false, smooth: tl.type === "poly", lineStyle: {
|
|
1503
|
-
color: (_f = tl.color) !== null && _f !== void 0 ? _f : seriesColor,
|
|
1504
|
-
type: "dashed",
|
|
1505
|
-
width: 2,
|
|
1506
|
-
}, itemStyle: { color: (_g = tl.color) !== null && _g !== void 0 ? _g : seriesColor }, tooltip: { show: false }, z: 5 }, useSecondary));
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
1510
|
-
finally {
|
|
1511
|
-
try {
|
|
1512
|
-
if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
|
|
1513
|
-
}
|
|
1514
|
-
finally { if (e_10) throw e_10.error; }
|
|
1515
|
-
}
|
|
1516
|
-
// Error bars — drawn as a custom series of vertical/horizontal
|
|
1517
|
-
// whiskers. valueType "custom" reads per-point magnitudes from the
|
|
1518
|
-
// spec's plus/minus ranges, resolved through the same extractor
|
|
1519
|
-
// the series values use.
|
|
1520
|
-
var magnitudes = (0, error_bars_1.computeErrorBars)(numericValues, (0, error_bars_1.resolveCustomErrorBarValues)(series.errorBars, function (range) {
|
|
1521
|
-
return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
|
|
1522
|
-
}));
|
|
1523
|
-
if (magnitudes) {
|
|
1524
|
-
var direction_1 = (_j = (_h = series.errorBars) === null || _h === void 0 ? void 0 : _h.direction) !== null && _j !== void 0 ? _j : "y";
|
|
1525
|
-
var noEndCap_1 = (_l = (_k = series.errorBars) === null || _k === void 0 ? void 0 : _k.noEndCap) !== null && _l !== void 0 ? _l : false;
|
|
1526
|
-
var errorData = numericValues.map(function (v, i) {
|
|
1527
|
-
var _a, _b;
|
|
1528
|
-
return [
|
|
1529
|
-
i,
|
|
1530
|
-
typeof v === "number" ? v : 0,
|
|
1531
|
-
(_a = magnitudes.plus[i]) !== null && _a !== void 0 ? _a : 0,
|
|
1532
|
-
(_b = magnitudes.minus[i]) !== null && _b !== void 0 ? _b : 0,
|
|
1533
|
-
];
|
|
1534
|
-
});
|
|
1535
|
-
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "custom", name: "".concat(dataLabel ? dataLabel + " " : "", "error"), data: errorData, z: 6, tooltip: { show: false } }, useSecondary), { renderItem: function (_params, api) {
|
|
1536
|
-
var value = api.value(1);
|
|
1537
|
-
var plus = api.value(2);
|
|
1538
|
-
var minus = api.value(3);
|
|
1539
|
-
var capHalf = 5;
|
|
1540
|
-
if (direction_1 === "x") {
|
|
1541
|
-
var center_1 = api.coord([value, api.value(0)]);
|
|
1542
|
-
var hi_1 = api.coord([value + plus, api.value(0)]);
|
|
1543
|
-
var lo_1 = api.coord([value - minus, api.value(0)]);
|
|
1544
|
-
var children_1 = [
|
|
1545
|
-
{
|
|
1546
|
-
type: "line",
|
|
1547
|
-
shape: { x1: lo_1[0], y1: center_1[1], x2: hi_1[0], y2: center_1[1] },
|
|
1548
|
-
style: { stroke: seriesColor, lineWidth: 1 },
|
|
1549
|
-
},
|
|
1550
|
-
];
|
|
1551
|
-
if (!noEndCap_1) {
|
|
1552
|
-
children_1.push({
|
|
1553
|
-
type: "line",
|
|
1554
|
-
shape: {
|
|
1555
|
-
x1: hi_1[0],
|
|
1556
|
-
y1: center_1[1] - capHalf,
|
|
1557
|
-
x2: hi_1[0],
|
|
1558
|
-
y2: center_1[1] + capHalf,
|
|
1559
|
-
},
|
|
1560
|
-
style: { stroke: seriesColor, lineWidth: 1 },
|
|
1561
|
-
}, {
|
|
1562
|
-
type: "line",
|
|
1563
|
-
shape: {
|
|
1564
|
-
x1: lo_1[0],
|
|
1565
|
-
y1: center_1[1] - capHalf,
|
|
1566
|
-
x2: lo_1[0],
|
|
1567
|
-
y2: center_1[1] + capHalf,
|
|
1568
|
-
},
|
|
1569
|
-
style: { stroke: seriesColor, lineWidth: 1 },
|
|
1570
|
-
});
|
|
1571
|
-
}
|
|
1572
|
-
return { type: "group", children: children_1 };
|
|
1573
|
-
}
|
|
1574
|
-
var center = api.coord([api.value(0), value]);
|
|
1575
|
-
var hi = api.coord([api.value(0), value + plus]);
|
|
1576
|
-
var lo = api.coord([api.value(0), value - minus]);
|
|
1577
|
-
var children = [
|
|
1578
|
-
{
|
|
1579
|
-
type: "line",
|
|
1580
|
-
shape: { x1: center[0], y1: lo[1], x2: center[0], y2: hi[1] },
|
|
1581
|
-
style: { stroke: seriesColor, lineWidth: 1 },
|
|
1582
|
-
},
|
|
1583
|
-
];
|
|
1584
|
-
if (!noEndCap_1) {
|
|
1585
|
-
children.push({
|
|
1586
|
-
type: "line",
|
|
1587
|
-
shape: {
|
|
1588
|
-
x1: center[0] - capHalf,
|
|
1589
|
-
y1: hi[1],
|
|
1590
|
-
x2: center[0] + capHalf,
|
|
1591
|
-
y2: hi[1],
|
|
1592
|
-
},
|
|
1593
|
-
style: { stroke: seriesColor, lineWidth: 1 },
|
|
1594
|
-
}, {
|
|
1595
|
-
type: "line",
|
|
1596
|
-
shape: {
|
|
1597
|
-
x1: center[0] - capHalf,
|
|
1598
|
-
y1: lo[1],
|
|
1599
|
-
x2: center[0] + capHalf,
|
|
1600
|
-
y2: lo[1],
|
|
1601
|
-
},
|
|
1602
|
-
style: { stroke: seriesColor, lineWidth: 1 },
|
|
1603
|
-
});
|
|
1604
|
-
}
|
|
1605
|
-
return { type: "group", children: children };
|
|
1606
|
-
} }));
|
|
1607
|
-
}
|
|
1593
|
+
chartSeries.push.apply(chartSeries, tslib_1.__spreadArray([], tslib_1.__read((0, echarts_overlays_1.buildEchartsOverlaySeries)({
|
|
1594
|
+
series: series,
|
|
1595
|
+
values: numericValues,
|
|
1596
|
+
// A horizontal bar keeps its categories on y (#1061).
|
|
1597
|
+
horizontal: isHorizontalBarChart,
|
|
1598
|
+
dataLabel: dataLabel,
|
|
1599
|
+
seriesColor: (_a = series.color) !== null && _a !== void 0 ? _a : theme.themeColors.accent1,
|
|
1600
|
+
resolveRange: function (range) {
|
|
1601
|
+
return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
|
|
1602
|
+
},
|
|
1603
|
+
})), false));
|
|
1608
1604
|
};
|
|
1609
1605
|
sideBySideBarCount = isStacked
|
|
1610
1606
|
? 1
|
|
1611
|
-
: ((
|
|
1607
|
+
: ((_74 = spec.series) !== null && _74 !== void 0 ? _74 : []).reduce(function (count, s) {
|
|
1612
1608
|
var _a;
|
|
1613
1609
|
var seriesType = (_a = s.seriesChartType) !== null && _a !== void 0 ? _a : spec.chartType;
|
|
1614
1610
|
return seriesType === "bar" || seriesType === "column"
|
|
@@ -1632,29 +1628,29 @@ var BasicChart = function (_a) {
|
|
|
1632
1628
|
return (0, utils_1.chartPaletteColorAt)(seriesPalette, index);
|
|
1633
1629
|
};
|
|
1634
1630
|
_loop_1 = function (specSeriesIndex, series) {
|
|
1635
|
-
var dataLabel,
|
|
1636
|
-
var
|
|
1637
|
-
return tslib_1.__generator(this, function (
|
|
1638
|
-
switch (
|
|
1631
|
+
var dataLabel, _151, _152, 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_2, _153, _154, dp, fallback_1, overrides_3, _155, _156, dp, positiveColor_1, negativeColor_1;
|
|
1632
|
+
var e_13, _157, e_14, _158, e_15, _159;
|
|
1633
|
+
return tslib_1.__generator(this, function (_160) {
|
|
1634
|
+
switch (_160.label) {
|
|
1639
1635
|
case 0:
|
|
1640
1636
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1641
|
-
|
|
1642
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1637
|
+
_152 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1638
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_76 = position.sheetId) !== null && _76 !== void 0 ? _76 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1643
1639
|
case 1:
|
|
1644
|
-
|
|
1640
|
+
_151 = _152.apply(void 0, [_160.sent()]);
|
|
1645
1641
|
return [3 /*break*/, 3];
|
|
1646
1642
|
case 2:
|
|
1647
|
-
|
|
1648
|
-
|
|
1643
|
+
_151 = (_77 = series.dataLabel) !== null && _77 !== void 0 ? _77 : "";
|
|
1644
|
+
_160.label = 3;
|
|
1649
1645
|
case 3:
|
|
1650
|
-
dataLabel =
|
|
1646
|
+
dataLabel = _151;
|
|
1651
1647
|
// Label
|
|
1652
1648
|
if (dataLabel) {
|
|
1653
|
-
(
|
|
1649
|
+
(_78 = legend.data) === null || _78 === void 0 ? void 0 : _78.push(dataLabel);
|
|
1654
1650
|
}
|
|
1655
|
-
effectiveChartType = (
|
|
1651
|
+
effectiveChartType = (_79 = series.seriesChartType) !== null && _79 !== void 0 ? _79 : spec.chartType;
|
|
1656
1652
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1657
|
-
domainSources = (
|
|
1653
|
+
domainSources = (_82 = (_81 = (_80 = spec.domains) === null || _80 === void 0 ? void 0 : _80[0]) === null || _81 === void 0 ? void 0 : _81.sources) !== null && _82 !== void 0 ? _82 : [];
|
|
1658
1654
|
pieDomainLabels = isCircularChart &&
|
|
1659
1655
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
1660
1656
|
? domainSources.flatMap(function (sheetRange) {
|
|
@@ -1686,7 +1682,7 @@ var BasicChart = function (_a) {
|
|
|
1686
1682
|
seriesEntry = tslib_1.__assign(tslib_1.__assign({ type: seriesEchartsType,
|
|
1687
1683
|
// Ties the rendered series back to spec.series for click selection
|
|
1688
1684
|
// One rendered series per spec series (source index 0).
|
|
1689
|
-
id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (
|
|
1685
|
+
id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (_83 = spec.smooth) !== null && _83 !== void 0 ? _83 : undefined, radius: (_84 = spec.radius) !== null && _84 !== void 0 ? _84 : (isCircularChart ? [0, "75%"] : undefined) }, ((0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike)
|
|
1690
1686
|
? { connectNulls: true }
|
|
1691
1687
|
: {})), seriesStyleAttrs);
|
|
1692
1688
|
// Plot this series against a secondary value axis. The 2nd
|
|
@@ -1711,16 +1707,17 @@ var BasicChart = function (_a) {
|
|
|
1711
1707
|
}
|
|
1712
1708
|
seriesAny = series;
|
|
1713
1709
|
if (effectiveChartType === "line") {
|
|
1714
|
-
markerSymbol = (
|
|
1710
|
+
markerSymbol = (_85 = seriesAny.marker) === null || _85 === void 0 ? void 0 : _85.symbol;
|
|
1715
1711
|
wantsMarkers = markerSymbol === "none"
|
|
1716
1712
|
? false
|
|
1717
1713
|
: Boolean(spec.showMarkers) || !(0, utils_1.isNil)(markerSymbol);
|
|
1718
|
-
labelsWithoutMarkers = !wantsMarkers &&
|
|
1714
|
+
labelsWithoutMarkers = !wantsMarkers &&
|
|
1715
|
+
Boolean((_86 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _86 === void 0 ? void 0 : _86.show);
|
|
1719
1716
|
seriesEntry.showSymbol = wantsMarkers || labelsWithoutMarkers;
|
|
1720
1717
|
if (wantsMarkers) {
|
|
1721
1718
|
seriesEntry.symbol =
|
|
1722
|
-
(
|
|
1723
|
-
seriesEntry.symbolSize = (
|
|
1719
|
+
(_87 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _87 !== void 0 ? _87 : "circle";
|
|
1720
|
+
seriesEntry.symbolSize = (_89 = (_88 = seriesAny.marker) === null || _88 === void 0 ? void 0 : _88.size) !== null && _89 !== void 0 ? _89 : 6;
|
|
1724
1721
|
}
|
|
1725
1722
|
else {
|
|
1726
1723
|
if (labelsWithoutMarkers) {
|
|
@@ -1735,17 +1732,17 @@ var BasicChart = function (_a) {
|
|
|
1735
1732
|
seriesEntry.symbol = "none";
|
|
1736
1733
|
marked = tslib_1.__spreadArray([], tslib_1.__read(data), false);
|
|
1737
1734
|
try {
|
|
1738
|
-
for (isolated_1 = (
|
|
1735
|
+
for (isolated_1 = (e_13 = void 0, tslib_1.__values(isolated)), isolated_1_1 = isolated_1.next(); !isolated_1_1.done; isolated_1_1 = isolated_1.next()) {
|
|
1739
1736
|
i = isolated_1_1.value;
|
|
1740
1737
|
marked[i] = { value: marked[i], symbol: "circle", symbolSize: 6 };
|
|
1741
1738
|
}
|
|
1742
1739
|
}
|
|
1743
|
-
catch (
|
|
1740
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1744
1741
|
finally {
|
|
1745
1742
|
try {
|
|
1746
|
-
if (isolated_1_1 && !isolated_1_1.done && (
|
|
1743
|
+
if (isolated_1_1 && !isolated_1_1.done && (_157 = isolated_1.return)) _157.call(isolated_1);
|
|
1747
1744
|
}
|
|
1748
|
-
finally { if (
|
|
1745
|
+
finally { if (e_13) throw e_13.error; }
|
|
1749
1746
|
}
|
|
1750
1747
|
seriesEntry.data = marked;
|
|
1751
1748
|
}
|
|
@@ -1755,9 +1752,9 @@ var BasicChart = function (_a) {
|
|
|
1755
1752
|
gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
|
|
1756
1753
|
if (gradientArgs && !seriesAny.noFill) {
|
|
1757
1754
|
gradient = new echarts.graphic.LinearGradient(gradientArgs.x, gradientArgs.y, gradientArgs.x2, gradientArgs.y2, gradientArgs.colorStops);
|
|
1758
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1755
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_90 = seriesEntry.itemStyle) !== null && _90 !== void 0 ? _90 : {})), { color: gradient });
|
|
1759
1756
|
if (effectiveChartType === "area") {
|
|
1760
|
-
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1757
|
+
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_91 = seriesEntry.areaStyle) !== null && _91 !== void 0 ? _91 : {})), { color: gradient });
|
|
1761
1758
|
}
|
|
1762
1759
|
}
|
|
1763
1760
|
else if (seriesAny.noFill) {
|
|
@@ -1765,58 +1762,58 @@ var BasicChart = function (_a) {
|
|
|
1765
1762
|
// with `transparent` so layout is preserved but nothing
|
|
1766
1763
|
// paints. Legend entries are also suppressed via `name: ""`
|
|
1767
1764
|
// since the series carries no semantic information.
|
|
1768
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1765
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_92 = seriesEntry.itemStyle) !== null && _92 !== void 0 ? _92 : {})), { color: "transparent", borderColor: "transparent" });
|
|
1769
1766
|
}
|
|
1770
1767
|
else if (isBarOrColumn &&
|
|
1771
1768
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1772
1769
|
seriesAny.dataPointColors.length) {
|
|
1773
1770
|
overrides_2 = new Map();
|
|
1774
1771
|
try {
|
|
1775
|
-
for (
|
|
1776
|
-
dp =
|
|
1772
|
+
for (_153 = (e_14 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _154 = _153.next(); !_154.done; _154 = _153.next()) {
|
|
1773
|
+
dp = _154.value;
|
|
1777
1774
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1778
1775
|
overrides_2.set(dp.idx, dp.color);
|
|
1779
1776
|
}
|
|
1780
1777
|
}
|
|
1781
1778
|
}
|
|
1782
|
-
catch (
|
|
1779
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1783
1780
|
finally {
|
|
1784
1781
|
try {
|
|
1785
|
-
if (
|
|
1782
|
+
if (_154 && !_154.done && (_158 = _153.return)) _158.call(_153);
|
|
1786
1783
|
}
|
|
1787
|
-
finally { if (
|
|
1784
|
+
finally { if (e_14) throw e_14.error; }
|
|
1788
1785
|
}
|
|
1789
|
-
fallback_1 = (
|
|
1790
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1786
|
+
fallback_1 = (_93 = series.color) !== null && _93 !== void 0 ? _93 : paletteColorAt(specSeriesIndex);
|
|
1787
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_94 = seriesEntry.itemStyle) !== null && _94 !== void 0 ? _94 : {})), { color: function (params) { var _a; return (_a = overrides_2.get(params.dataIndex)) !== null && _a !== void 0 ? _a : fallback_1; } });
|
|
1791
1788
|
}
|
|
1792
1789
|
else if (isCircularChart &&
|
|
1793
1790
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1794
1791
|
seriesAny.dataPointColors.length) {
|
|
1795
1792
|
overrides_3 = new Map();
|
|
1796
1793
|
try {
|
|
1797
|
-
for (
|
|
1798
|
-
dp =
|
|
1794
|
+
for (_155 = (e_15 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _156 = _155.next(); !_156.done; _156 = _155.next()) {
|
|
1795
|
+
dp = _156.value;
|
|
1799
1796
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1800
1797
|
overrides_3.set(dp.idx, dp.color);
|
|
1801
1798
|
}
|
|
1802
1799
|
}
|
|
1803
1800
|
}
|
|
1804
|
-
catch (
|
|
1801
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1805
1802
|
finally {
|
|
1806
1803
|
try {
|
|
1807
|
-
if (
|
|
1804
|
+
if (_156 && !_156.done && (_159 = _155.return)) _159.call(_155);
|
|
1808
1805
|
}
|
|
1809
|
-
finally { if (
|
|
1806
|
+
finally { if (e_15) throw e_15.error; }
|
|
1810
1807
|
}
|
|
1811
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1808
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_95 = seriesEntry.itemStyle) !== null && _95 !== void 0 ? _95 : {})), { color: function (params) {
|
|
1812
1809
|
var _a, _b;
|
|
1813
1810
|
return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
|
|
1814
1811
|
} });
|
|
1815
1812
|
}
|
|
1816
1813
|
else if (isBarOrColumn && series.invertIfNegative) {
|
|
1817
|
-
positiveColor_1 = (
|
|
1818
|
-
negativeColor_1 = (
|
|
1819
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1814
|
+
positiveColor_1 = (_96 = series.color) !== null && _96 !== void 0 ? _96 : paletteColorAt(specSeriesIndex);
|
|
1815
|
+
negativeColor_1 = (_97 = series.negativeColor) !== null && _97 !== void 0 ? _97 : "#FF0000";
|
|
1816
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_98 = seriesEntry.itemStyle) !== null && _98 !== void 0 ? _98 : {})), { color: function (params) {
|
|
1820
1817
|
var _a, _b;
|
|
1821
1818
|
var value = Array.isArray(params.data)
|
|
1822
1819
|
? params.data[1]
|
|
@@ -1827,10 +1824,10 @@ var BasicChart = function (_a) {
|
|
|
1827
1824
|
} });
|
|
1828
1825
|
}
|
|
1829
1826
|
else if (series.color) {
|
|
1830
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1831
|
-
seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1827
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_99 = seriesEntry.itemStyle) !== null && _99 !== void 0 ? _99 : {})), { color: series.color });
|
|
1828
|
+
seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((_100 = seriesEntry.lineStyle) !== null && _100 !== void 0 ? _100 : {})), { color: series.color });
|
|
1832
1829
|
if (effectiveChartType === "area") {
|
|
1833
|
-
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1830
|
+
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_101 = seriesEntry.areaStyle) !== null && _101 !== void 0 ? _101 : {})), { color: series.color });
|
|
1834
1831
|
}
|
|
1835
1832
|
}
|
|
1836
1833
|
chartSeries.push(seriesEntry);
|
|
@@ -1839,29 +1836,29 @@ var BasicChart = function (_a) {
|
|
|
1839
1836
|
}
|
|
1840
1837
|
});
|
|
1841
1838
|
};
|
|
1842
|
-
|
|
1839
|
+
_150.label = 31;
|
|
1843
1840
|
case 31:
|
|
1844
|
-
|
|
1845
|
-
_r = tslib_1.__values(((
|
|
1846
|
-
|
|
1841
|
+
_150.trys.push([31, 36, 37, 38]);
|
|
1842
|
+
_r = tslib_1.__values(((_75 = spec.series) !== null && _75 !== void 0 ? _75 : []).entries()), _s = _r.next();
|
|
1843
|
+
_150.label = 32;
|
|
1847
1844
|
case 32:
|
|
1848
1845
|
if (!!_s.done) return [3 /*break*/, 35];
|
|
1849
1846
|
_t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
|
|
1850
1847
|
return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
|
|
1851
1848
|
case 33:
|
|
1852
|
-
|
|
1853
|
-
|
|
1849
|
+
_150.sent();
|
|
1850
|
+
_150.label = 34;
|
|
1854
1851
|
case 34:
|
|
1855
1852
|
_s = _r.next();
|
|
1856
1853
|
return [3 /*break*/, 32];
|
|
1857
1854
|
case 35: return [3 /*break*/, 38];
|
|
1858
1855
|
case 36:
|
|
1859
|
-
e_3_1 =
|
|
1856
|
+
e_3_1 = _150.sent();
|
|
1860
1857
|
e_3 = { error: e_3_1 };
|
|
1861
1858
|
return [3 /*break*/, 38];
|
|
1862
1859
|
case 37:
|
|
1863
1860
|
try {
|
|
1864
|
-
if (_s && !_s.done && (
|
|
1861
|
+
if (_s && !_s.done && (_8 = _r.return)) _8.call(_r);
|
|
1865
1862
|
}
|
|
1866
1863
|
finally { if (e_3) throw e_3.error; }
|
|
1867
1864
|
return [7 /*endfinally*/];
|
|
@@ -1874,7 +1871,7 @@ var BasicChart = function (_a) {
|
|
|
1874
1871
|
}
|
|
1875
1872
|
if (isOfPie) {
|
|
1876
1873
|
labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1877
|
-
seriesEntry = (
|
|
1874
|
+
seriesEntry = (_102 = spec.series) === null || _102 === void 0 ? void 0 : _102[0];
|
|
1878
1875
|
rawValues = seriesEntry
|
|
1879
1876
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
1880
1877
|
: [];
|
|
@@ -1921,7 +1918,7 @@ var BasicChart = function (_a) {
|
|
|
1921
1918
|
};
|
|
1922
1919
|
chartSeries.push({
|
|
1923
1920
|
type: "pie",
|
|
1924
|
-
name: (
|
|
1921
|
+
name: (_103 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _103 !== void 0 ? _103 : "",
|
|
1925
1922
|
center: ["".concat(MAIN_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
1926
1923
|
radius: [0, "".concat(MAIN_RADIUS_PCT_1, "%")],
|
|
1927
1924
|
// Rotate the pie so the "Other" slice's angular midpoint faces
|
|
@@ -1939,7 +1936,7 @@ var BasicChart = function (_a) {
|
|
|
1939
1936
|
if (ofPieType_1 === "pie") {
|
|
1940
1937
|
chartSeries.push({
|
|
1941
1938
|
type: "pie",
|
|
1942
|
-
name: (
|
|
1939
|
+
name: (_104 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _104 !== void 0 ? _104 : "",
|
|
1943
1940
|
center: ["".concat(SECONDARY_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
1944
1941
|
radius: [0, "".concat(secondaryRadiusPct_1, "%")],
|
|
1945
1942
|
data: secondary.map(function (s, i) { return ({
|
|
@@ -2034,16 +2031,16 @@ var BasicChart = function (_a) {
|
|
|
2034
2031
|
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);
|
|
2035
2032
|
}
|
|
2036
2033
|
else if (spec.chartType === "waterfall") {
|
|
2037
|
-
primaryDomainSource_1 = (
|
|
2034
|
+
primaryDomainSource_1 = (_107 = (_106 = (_105 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _105 === void 0 ? void 0 : _105[0]) === null || _106 === void 0 ? void 0 : _106.sources) === null || _107 === void 0 ? void 0 : _107[0];
|
|
2038
2035
|
rawDomainValues = primaryDomainSource_1
|
|
2039
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2036
|
+
? (0, aggregation_1.sanitizeDomainValues)((_108 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _108 !== void 0 ? _108 : [])
|
|
2040
2037
|
: [];
|
|
2041
2038
|
labels = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2042
|
-
seriesEntry = (
|
|
2039
|
+
seriesEntry = (_109 = spec.series) === null || _109 === void 0 ? void 0 : _109[0];
|
|
2043
2040
|
rawValues_1 = seriesEntry
|
|
2044
2041
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
2045
2042
|
: [];
|
|
2046
|
-
totalIndices = new Set((
|
|
2043
|
+
totalIndices = new Set((_110 = spec.totalIndices) !== null && _110 !== void 0 ? _110 : []);
|
|
2047
2044
|
steps = (0, waterfall_1.computeWaterfall)(rawValues_1, labels, totalIndices);
|
|
2048
2045
|
chartDomains.length = 0;
|
|
2049
2046
|
chartDomains.push({
|
|
@@ -2053,40 +2050,68 @@ var BasicChart = function (_a) {
|
|
|
2053
2050
|
axisLine: { show: true },
|
|
2054
2051
|
axisTick: { show: true },
|
|
2055
2052
|
splitLine: { show: false },
|
|
2056
|
-
name: (
|
|
2053
|
+
name: (_111 = spec.horizontalAxisTitle) !== null && _111 !== void 0 ? _111 : "",
|
|
2057
2054
|
nameLocation: "middle",
|
|
2058
2055
|
nameGap: 30,
|
|
2059
2056
|
});
|
|
2060
2057
|
chartSeries.length = 0;
|
|
2058
|
+
// The spacer bars are layout only: no labels, no tooltip entry.
|
|
2061
2059
|
chartSeries.push({
|
|
2062
2060
|
type: "bar",
|
|
2061
|
+
id: WATERFALL_PLACEHOLDER_ID,
|
|
2063
2062
|
stack: "waterfall",
|
|
2064
2063
|
itemStyle: { color: "transparent" },
|
|
2065
2064
|
emphasis: { itemStyle: { color: "transparent" } },
|
|
2066
2065
|
data: steps.map(function (s) { return s.placeholder; }),
|
|
2067
2066
|
silent: true,
|
|
2067
|
+
label: { show: false },
|
|
2068
|
+
tooltip: { show: false },
|
|
2068
2069
|
});
|
|
2069
|
-
accent_1 = (
|
|
2070
|
-
decreaseColor_1 = (
|
|
2071
|
-
totalColor_1 = (
|
|
2070
|
+
accent_1 = (_112 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _112 !== void 0 ? _112 : theme.themeColors.accent1;
|
|
2071
|
+
decreaseColor_1 = (_114 = (_113 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.negativeColor) !== null && _113 !== void 0 ? _113 : theme.themeColors.accent2) !== null && _114 !== void 0 ? _114 : accent_1;
|
|
2072
|
+
totalColor_1 = (_115 = theme.themeColors.accent3) !== null && _115 !== void 0 ? _115 : accent_1;
|
|
2073
|
+
pointColors_1 = new Map();
|
|
2074
|
+
try {
|
|
2075
|
+
for (_v = tslib_1.__values((_116 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _116 !== void 0 ? _116 : []), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
2076
|
+
dp = _w.value;
|
|
2077
|
+
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2078
|
+
pointColors_1.set(dp.idx, dp.color);
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
2083
|
+
finally {
|
|
2084
|
+
try {
|
|
2085
|
+
if (_w && !_w.done && (_9 = _v.return)) _9.call(_v);
|
|
2086
|
+
}
|
|
2087
|
+
finally { if (e_6) throw e_6.error; }
|
|
2088
|
+
}
|
|
2072
2089
|
connectors = steps.slice(0, -1).map(function (s, i) { return [
|
|
2073
2090
|
{ coord: [i, s.cumulative] },
|
|
2074
2091
|
{ coord: [i + 1, s.cumulative] },
|
|
2075
2092
|
]; });
|
|
2076
2093
|
chartSeries.push({
|
|
2077
2094
|
type: "bar",
|
|
2095
|
+
id: (0, series_click_1.chartSeriesId)(0, 0),
|
|
2078
2096
|
stack: "waterfall",
|
|
2079
|
-
name: (
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2097
|
+
name: (_117 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _117 !== void 0 ? _117 : "",
|
|
2098
|
+
// A bar's height is the step's magnitude; the signed source value
|
|
2099
|
+
// rides along as `originalValue` so labels and tooltips read
|
|
2100
|
+
// "-90" for a decrease, like Excel.
|
|
2101
|
+
data: steps.map(function (s, i) {
|
|
2102
|
+
var _a;
|
|
2103
|
+
return ({
|
|
2104
|
+
value: s.value,
|
|
2105
|
+
originalValue: rawValues_1[i],
|
|
2106
|
+
itemStyle: {
|
|
2107
|
+
color: (_a = pointColors_1.get(i)) !== null && _a !== void 0 ? _a : (s.isTotal
|
|
2108
|
+
? totalColor_1
|
|
2109
|
+
: rawValues_1[i] < 0
|
|
2110
|
+
? decreaseColor_1
|
|
2111
|
+
: accent_1),
|
|
2112
|
+
},
|
|
2113
|
+
});
|
|
2114
|
+
}),
|
|
2090
2115
|
markLine: {
|
|
2091
2116
|
silent: true,
|
|
2092
2117
|
symbol: "none",
|
|
@@ -2103,29 +2128,68 @@ var BasicChart = function (_a) {
|
|
|
2103
2128
|
legend.data = [];
|
|
2104
2129
|
}
|
|
2105
2130
|
else if (spec.chartType === "funnel") {
|
|
2106
|
-
primaryDomainSource_2 = (
|
|
2131
|
+
primaryDomainSource_2 = (_120 = (_119 = (_118 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _118 === void 0 ? void 0 : _118[0]) === null || _119 === void 0 ? void 0 : _119.sources) === null || _120 === void 0 ? void 0 : _120[0];
|
|
2107
2132
|
rawDomainValues = primaryDomainSource_2
|
|
2108
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2133
|
+
? (0, aggregation_1.sanitizeDomainValues)((_121 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _121 !== void 0 ? _121 : [])
|
|
2109
2134
|
: [];
|
|
2110
2135
|
labels_1 = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2111
|
-
seriesEntry = (
|
|
2136
|
+
seriesEntry = (_122 = spec.series) === null || _122 === void 0 ? void 0 : _122[0];
|
|
2112
2137
|
rawValues = seriesEntry
|
|
2113
2138
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : 0); })
|
|
2114
2139
|
: [];
|
|
2115
2140
|
chartDomains.length = 0;
|
|
2116
2141
|
chartSeries.length = 0;
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2142
|
+
funnelPalette = (0, chart_styles_1.getChartPalette)(spec, [
|
|
2143
|
+
theme.themeColors.accent1,
|
|
2144
|
+
theme.themeColors.accent2,
|
|
2145
|
+
theme.themeColors.accent3,
|
|
2146
|
+
theme.themeColors.accent4,
|
|
2147
|
+
theme.themeColors.accent5,
|
|
2148
|
+
theme.themeColors.accent6,
|
|
2149
|
+
]);
|
|
2150
|
+
funnelColor_1 = (_123 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _123 !== void 0 ? _123 : (0, utils_1.chartPaletteColorAt)(funnelPalette, 0);
|
|
2151
|
+
stageColors_1 = new Map();
|
|
2152
|
+
try {
|
|
2153
|
+
for (_x = tslib_1.__values((_124 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _124 !== void 0 ? _124 : []), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
2154
|
+
dp = _y.value;
|
|
2155
|
+
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2156
|
+
stageColors_1.set(dp.idx, dp.color);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2161
|
+
finally {
|
|
2162
|
+
try {
|
|
2163
|
+
if (_y && !_y.done && (_10 = _x.return)) _10.call(_x);
|
|
2164
|
+
}
|
|
2165
|
+
finally { if (e_7) throw e_7.error; }
|
|
2166
|
+
}
|
|
2167
|
+
funnelData = rawValues.map(function (value, i) {
|
|
2168
|
+
var _a;
|
|
2169
|
+
return ({
|
|
2170
|
+
name: (_a = labels_1[i]) !== null && _a !== void 0 ? _a : String(i),
|
|
2171
|
+
value: value,
|
|
2172
|
+
});
|
|
2128
2173
|
});
|
|
2174
|
+
funnelLayout = {
|
|
2175
|
+
sort: "none",
|
|
2176
|
+
left: "22%",
|
|
2177
|
+
right: "10%",
|
|
2178
|
+
top: 60,
|
|
2179
|
+
bottom: 20,
|
|
2180
|
+
};
|
|
2181
|
+
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: (0, series_click_1.chartSeriesId)(0, 0), name: (_125 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _125 !== void 0 ? _125 : "", data: funnelData }, funnelLayout), { itemStyle: {
|
|
2182
|
+
color: function (params) { var _a; return (_a = stageColors_1.get(params.dataIndex)) !== null && _a !== void 0 ? _a : funnelColor_1; },
|
|
2183
|
+
}, label: {
|
|
2184
|
+
show: true,
|
|
2185
|
+
position: "inside",
|
|
2186
|
+
formatter: function (params) {
|
|
2187
|
+
return (0, axis_number_format_1.formatAxisValue)(undefined, params.value, locale);
|
|
2188
|
+
},
|
|
2189
|
+
} }));
|
|
2190
|
+
// The stage names sit to the left of the bars, where Excel's
|
|
2191
|
+
// category axis puts them: an invisible twin funnel carries them.
|
|
2192
|
+
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: FUNNEL_NAMES_ID, data: funnelData }, funnelLayout), { silent: true, itemStyle: { color: "transparent", borderWidth: 0 }, emphasis: { disabled: true }, tooltip: { show: false }, label: { show: true, position: "left", formatter: "{b}" }, labelLine: { show: false }, z: 1 }));
|
|
2129
2193
|
legend.data = [];
|
|
2130
2194
|
}
|
|
2131
2195
|
else if (spec.chartType === "boxplot") {
|
|
@@ -2137,8 +2201,8 @@ var BasicChart = function (_a) {
|
|
|
2137
2201
|
outlierPoints = [];
|
|
2138
2202
|
meanPoints = [];
|
|
2139
2203
|
try {
|
|
2140
|
-
for (
|
|
2141
|
-
seriesEntry =
|
|
2204
|
+
for (_z = tslib_1.__values((_126 = spec.series) !== null && _126 !== void 0 ? _126 : []), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
2205
|
+
seriesEntry = _0.value;
|
|
2142
2206
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
2143
2207
|
? seriesEntry.dataLabel
|
|
2144
2208
|
: "";
|
|
@@ -2152,17 +2216,17 @@ var BasicChart = function (_a) {
|
|
|
2152
2216
|
boxLabels.push(label);
|
|
2153
2217
|
if (showOutliers === true) {
|
|
2154
2218
|
try {
|
|
2155
|
-
for (
|
|
2156
|
-
outlier =
|
|
2219
|
+
for (_1 = (e_9 = void 0, tslib_1.__values(summary.outliers)), _2 = _1.next(); !_2.done; _2 = _1.next()) {
|
|
2220
|
+
outlier = _2.value;
|
|
2157
2221
|
outlierPoints.push([boxIndex, outlier]);
|
|
2158
2222
|
}
|
|
2159
2223
|
}
|
|
2160
|
-
catch (
|
|
2224
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
2161
2225
|
finally {
|
|
2162
2226
|
try {
|
|
2163
|
-
if (
|
|
2227
|
+
if (_2 && !_2.done && (_12 = _1.return)) _12.call(_1);
|
|
2164
2228
|
}
|
|
2165
|
-
finally { if (
|
|
2229
|
+
finally { if (e_9) throw e_9.error; }
|
|
2166
2230
|
}
|
|
2167
2231
|
}
|
|
2168
2232
|
if (showMeanMarker) {
|
|
@@ -2171,12 +2235,12 @@ var BasicChart = function (_a) {
|
|
|
2171
2235
|
}
|
|
2172
2236
|
}
|
|
2173
2237
|
}
|
|
2174
|
-
catch (
|
|
2238
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
2175
2239
|
finally {
|
|
2176
2240
|
try {
|
|
2177
|
-
if (
|
|
2241
|
+
if (_0 && !_0.done && (_11 = _z.return)) _11.call(_z);
|
|
2178
2242
|
}
|
|
2179
|
-
finally { if (
|
|
2243
|
+
finally { if (e_8) throw e_8.error; }
|
|
2180
2244
|
}
|
|
2181
2245
|
chartDomains.length = 0;
|
|
2182
2246
|
chartDomains.push({
|
|
@@ -2186,7 +2250,7 @@ var BasicChart = function (_a) {
|
|
|
2186
2250
|
axisLine: { show: true },
|
|
2187
2251
|
axisTick: { show: true },
|
|
2188
2252
|
splitLine: { show: false },
|
|
2189
|
-
name: (
|
|
2253
|
+
name: (_127 = spec.horizontalAxisTitle) !== null && _127 !== void 0 ? _127 : "",
|
|
2190
2254
|
nameLocation: "middle",
|
|
2191
2255
|
nameGap: 30,
|
|
2192
2256
|
});
|
|
@@ -2196,7 +2260,7 @@ var BasicChart = function (_a) {
|
|
|
2196
2260
|
name: "",
|
|
2197
2261
|
data: boxStats,
|
|
2198
2262
|
};
|
|
2199
|
-
boxColor = (
|
|
2263
|
+
boxColor = (_129 = (_128 = spec.series) === null || _128 === void 0 ? void 0 : _128[0]) === null || _129 === void 0 ? void 0 : _129.color;
|
|
2200
2264
|
if (boxColor) {
|
|
2201
2265
|
boxSeries.itemStyle = { color: boxColor, borderColor: boxColor };
|
|
2202
2266
|
}
|
|
@@ -2211,7 +2275,7 @@ var BasicChart = function (_a) {
|
|
|
2211
2275
|
}
|
|
2212
2276
|
else if (spec.chartType === "histogram") {
|
|
2213
2277
|
rawValues = flattenChartDataValues(spec.series, getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
2214
|
-
|
|
2278
|
+
_3 = (0, histogram_1.binHistogram)(rawValues, spec.binCount), labels = _3.labels, counts = _3.counts;
|
|
2215
2279
|
isPareto_1 = (0, histogram_1.isParetoSpec)(spec);
|
|
2216
2280
|
cumulativePercents = [];
|
|
2217
2281
|
if (isPareto_1) {
|
|
@@ -2228,18 +2292,18 @@ var BasicChart = function (_a) {
|
|
|
2228
2292
|
axisLine: { show: true },
|
|
2229
2293
|
axisTick: { show: true },
|
|
2230
2294
|
splitLine: { show: false },
|
|
2231
|
-
name: (
|
|
2295
|
+
name: (_130 = spec.horizontalAxisTitle) !== null && _130 !== void 0 ? _130 : "",
|
|
2232
2296
|
nameLocation: "middle",
|
|
2233
2297
|
nameGap: 30,
|
|
2234
2298
|
});
|
|
2235
2299
|
chartSeries.length = 0;
|
|
2236
2300
|
histogramSeries = {
|
|
2237
2301
|
type: "bar",
|
|
2238
|
-
name: (
|
|
2302
|
+
name: (_133 = (_132 = (_131 = spec.series) === null || _131 === void 0 ? void 0 : _131[0]) === null || _132 === void 0 ? void 0 : _132.dataLabel) !== null && _133 !== void 0 ? _133 : "",
|
|
2239
2303
|
data: counts,
|
|
2240
2304
|
barCategoryGap: "1%",
|
|
2241
2305
|
};
|
|
2242
|
-
histogramColor = (
|
|
2306
|
+
histogramColor = (_135 = (_134 = spec.series) === null || _134 === void 0 ? void 0 : _134[0]) === null || _135 === void 0 ? void 0 : _135.color;
|
|
2243
2307
|
if (histogramColor) {
|
|
2244
2308
|
histogramSeries.itemStyle = { color: histogramColor };
|
|
2245
2309
|
}
|
|
@@ -2276,20 +2340,20 @@ var BasicChart = function (_a) {
|
|
|
2276
2340
|
isPareto = spec.chartType === "histogram" && (0, histogram_1.isParetoSpec)(spec);
|
|
2277
2341
|
hasSecondaryAxis = !isCircularChart &&
|
|
2278
2342
|
!isHorizontalBarChart &&
|
|
2279
|
-
(((
|
|
2343
|
+
(((_136 = spec.series) !== null && _136 !== void 0 ? _136 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
|
|
2280
2344
|
isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
|
|
2281
2345
|
(spec.chartType === "bar" || spec.chartType === "column");
|
|
2282
2346
|
primaryAxisNumberFormat = isPercentStackedBars
|
|
2283
2347
|
? undefined
|
|
2284
2348
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2285
2349
|
axisOptions: spec.valueAxisOptions,
|
|
2286
|
-
series: ((
|
|
2350
|
+
series: ((_137 = spec.series) !== null && _137 !== void 0 ? _137 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
2287
2351
|
getFormattingFromRange: getFormattingFromRange,
|
|
2288
2352
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2289
2353
|
});
|
|
2290
2354
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2291
2355
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
2292
|
-
series: ((
|
|
2356
|
+
series: ((_138 = spec.series) !== null && _138 !== void 0 ? _138 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
2293
2357
|
getFormattingFromRange: getFormattingFromRange,
|
|
2294
2358
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2295
2359
|
});
|
|
@@ -2318,17 +2382,17 @@ var BasicChart = function (_a) {
|
|
|
2318
2382
|
finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
|
|
2319
2383
|
bottomAxisNameGap = isHorizontalBarChart
|
|
2320
2384
|
? valueAxisBase.nameGap
|
|
2321
|
-
: Number((
|
|
2385
|
+
: Number((_140 = (_139 = chartDomains[0]) === null || _139 === void 0 ? void 0 : _139.nameGap) !== null && _140 !== void 0 ? _140 : CATEGORY_AXIS_NAME_GAP);
|
|
2322
2386
|
legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
2323
|
-
position: (
|
|
2387
|
+
position: (_141 = spec.legend) === null || _141 === void 0 ? void 0 : _141.position,
|
|
2324
2388
|
visible: finalLegend.show !== false,
|
|
2325
2389
|
labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
|
|
2326
|
-
legendFontSize: (
|
|
2390
|
+
legendFontSize: (_146 = (_143 = (_142 = finalLegend.textStyle) === null || _142 === void 0 ? void 0 : _142.fontSize) !== null && _143 !== void 0 ? _143 : (_145 = (_144 = spec.legend) === null || _144 === void 0 ? void 0 : _144.textFormat) === null || _145 === void 0 ? void 0 : _145.fontSize) !== null && _146 !== void 0 ? _146 : 12,
|
|
2327
2391
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
2328
2392
|
width: width !== null && width !== void 0 ? width : 0,
|
|
2329
2393
|
height: height !== null && height !== void 0 ? height : 0,
|
|
2330
2394
|
hasTitle: Boolean(title),
|
|
2331
|
-
titleFontSize: (
|
|
2395
|
+
titleFontSize: (_148 = (_147 = spec.titleTextFormat) === null || _147 === void 0 ? void 0 : _147.fontSize) !== null && _148 !== void 0 ? _148 : 16,
|
|
2332
2396
|
hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
|
|
2333
2397
|
bottomAxisNameGap: bottomAxisNameGap,
|
|
2334
2398
|
hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
|
|
@@ -2348,13 +2412,26 @@ var BasicChart = function (_a) {
|
|
|
2348
2412
|
bottom: 0,
|
|
2349
2413
|
}
|
|
2350
2414
|
: legendBand.grid;
|
|
2351
|
-
|
|
2415
|
+
chartDataLabels = spec.dataLabels;
|
|
2352
2416
|
seriesLabelOptionFor = function (s) {
|
|
2417
|
+
var _a;
|
|
2418
|
+
var specIndex = (0, series_click_1.chartSeriesSpecIndex)(s === null || s === void 0 ? void 0 : s.id);
|
|
2419
|
+
var dataLabelOptions = (0, overrides_1.resolveSeriesDataLabels)(chartDataLabels, specIndex === undefined ? undefined : (_a = spec.series) === null || _a === void 0 ? void 0 : _a[specIndex]);
|
|
2353
2420
|
return (0, overrides_1.buildSeriesLabelOption)(dataLabelOptions && !dataLabelOptions.numberFormatPattern
|
|
2354
2421
|
? tslib_1.__assign(tslib_1.__assign({}, dataLabelOptions), { numberFormatPattern: seriesNumberFormatFor(s) }) : dataLabelOptions, s === null || s === void 0 ? void 0 : s.type, locale);
|
|
2355
2422
|
};
|
|
2356
2423
|
isDoughnut = spec.chartType === "doughnut";
|
|
2357
2424
|
doughnutHoleSize = spec.doughnutHoleSize;
|
|
2425
|
+
doughnutSeriesOrder = isDoughnut
|
|
2426
|
+
? chartSeries
|
|
2427
|
+
.filter(function (s) { return (s === null || s === void 0 ? void 0 : s.type) === "pie"; })
|
|
2428
|
+
.map(function (s) { return (0, series_click_1.chartSeriesSpecIndex)(s === null || s === void 0 ? void 0 : s.id); })
|
|
2429
|
+
.filter(function (i) { return i !== undefined; })
|
|
2430
|
+
.sort(function (a, b) { return a - b; })
|
|
2431
|
+
: [];
|
|
2432
|
+
doughnutRingSet = isDoughnut
|
|
2433
|
+
? (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(doughnutHoleSize), doughnutSeriesOrder.length)
|
|
2434
|
+
: [];
|
|
2358
2435
|
explosion = isCircularChart && !isOfPie ? (0, pie_explosion_1.resolveExplosion)(spec) : 0;
|
|
2359
2436
|
explodedRef.current = explosion > 0;
|
|
2360
2437
|
explosionOffset = (0, pie_explosion_1.explosionOffsetPx)(explosion, (0, pie_explosion_1.pieRadiusPx)(isDoughnut ? [0, "75%"] : spec.radius, width !== null && width !== void 0 ? width : 0, height !== null && height !== void 0 ? height : 0));
|
|
@@ -2388,12 +2465,12 @@ var BasicChart = function (_a) {
|
|
|
2388
2465
|
}
|
|
2389
2466
|
}
|
|
2390
2467
|
}
|
|
2391
|
-
catch (
|
|
2468
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
2392
2469
|
finally {
|
|
2393
2470
|
try {
|
|
2394
|
-
if (barSeries_1_1 && !barSeries_1_1.done && (
|
|
2471
|
+
if (barSeries_1_1 && !barSeries_1_1.done && (_13 = barSeries_1.return)) _13.call(barSeries_1);
|
|
2395
2472
|
}
|
|
2396
|
-
finally { if (
|
|
2473
|
+
finally { if (e_10) throw e_10.error; }
|
|
2397
2474
|
}
|
|
2398
2475
|
try {
|
|
2399
2476
|
for (barSeries_2 = tslib_1.__values(barSeries), barSeries_2_1 = barSeries_2.next(); !barSeries_2_1.done; barSeries_2_1 = barSeries_2.next()) {
|
|
@@ -2410,33 +2487,58 @@ var BasicChart = function (_a) {
|
|
|
2410
2487
|
});
|
|
2411
2488
|
}
|
|
2412
2489
|
}
|
|
2413
|
-
catch (
|
|
2490
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
2414
2491
|
finally {
|
|
2415
2492
|
try {
|
|
2416
|
-
if (barSeries_2_1 && !barSeries_2_1.done && (
|
|
2493
|
+
if (barSeries_2_1 && !barSeries_2_1.done && (_14 = barSeries_2.return)) _14.call(barSeries_2);
|
|
2417
2494
|
}
|
|
2418
|
-
finally { if (
|
|
2495
|
+
finally { if (e_11) throw e_11.error; }
|
|
2419
2496
|
}
|
|
2420
2497
|
}
|
|
2421
2498
|
seriesWithLabels = chartSeries.map(function (s) {
|
|
2422
|
-
var _a, _b, _c, _d, _e;
|
|
2499
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2423
2500
|
var next = tslib_1.__assign({}, s);
|
|
2501
|
+
if (DECORATION_SERIES_IDS.has(s === null || s === void 0 ? void 0 : s.id)) {
|
|
2502
|
+
return next;
|
|
2503
|
+
}
|
|
2424
2504
|
var seriesLabelOption = seriesLabelOptionFor(s);
|
|
2425
2505
|
if (seriesLabelOption) {
|
|
2426
2506
|
next.label = tslib_1.__assign(tslib_1.__assign({}, ((_a = s === null || s === void 0 ? void 0 : s.label) !== null && _a !== void 0 ? _a : {})), seriesLabelOption);
|
|
2427
2507
|
}
|
|
2508
|
+
else if ((s === null || s === void 0 ? void 0 : s.type) === "pie") {
|
|
2509
|
+
// echarts labels every pie slice by default (category name on a
|
|
2510
|
+
// leader line); Excel draws nothing until data labels are on (#1062).
|
|
2511
|
+
next.label = tslib_1.__assign(tslib_1.__assign({}, ((_b = s === null || s === void 0 ? void 0 : s.label) !== null && _b !== void 0 ? _b : {})), { show: false });
|
|
2512
|
+
next.labelLine = tslib_1.__assign(tslib_1.__assign({}, ((_c = s === null || s === void 0 ? void 0 : s.labelLine) !== null && _c !== void 0 ? _c : {})), { show: false });
|
|
2513
|
+
}
|
|
2428
2514
|
// Tooltip values of the value-axis series (a boxplot / candlestick
|
|
2429
2515
|
// tooltip lists its own statistics and keeps echarts' default).
|
|
2430
2516
|
var seriesTooltipValueFormatter = VALUE_TOOLTIP_SERIES_TYPES.has(s === null || s === void 0 ? void 0 : s.type)
|
|
2431
2517
|
? (0, axis_number_format_1.valueAxisLabelFormatter)(seriesNumberFormatFor(s), locale)
|
|
2432
2518
|
: undefined;
|
|
2433
|
-
|
|
2434
|
-
|
|
2519
|
+
// A data item carrying `originalValue` (a waterfall step's signed
|
|
2520
|
+
// source value, a percent-stacked bar's raw amount) reads as that
|
|
2521
|
+
// value in the tooltip, like its data label.
|
|
2522
|
+
var originalValueAt = function (dataIndex) {
|
|
2523
|
+
var item = Array.isArray(s === null || s === void 0 ? void 0 : s.data) ? s.data[dataIndex] : undefined;
|
|
2524
|
+
return item !== null && typeof item === "object"
|
|
2525
|
+
? item.originalValue
|
|
2526
|
+
: undefined;
|
|
2527
|
+
};
|
|
2528
|
+
var carriesOriginalValues = VALUE_TOOLTIP_SERIES_TYPES.has(s === null || s === void 0 ? void 0 : s.type) &&
|
|
2529
|
+
Array.isArray(s === null || s === void 0 ? void 0 : s.data) &&
|
|
2530
|
+
s.data.some(function (item) {
|
|
2531
|
+
return item !== null && typeof item === "object" && "originalValue" in item;
|
|
2532
|
+
});
|
|
2533
|
+
if ((seriesTooltipValueFormatter || carriesOriginalValues) &&
|
|
2534
|
+
((_d = s === null || s === void 0 ? void 0 : s.tooltip) === null || _d === void 0 ? void 0 : _d.show) !== false) {
|
|
2535
|
+
var formatValue_1 = seriesTooltipValueFormatter !== null && seriesTooltipValueFormatter !== void 0 ? seriesTooltipValueFormatter : (function (value) { return (0, axis_number_format_1.formatAxisValue)(undefined, value, locale); });
|
|
2536
|
+
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((_e = s === null || s === void 0 ? void 0 : s.tooltip) !== null && _e !== void 0 ? _e : {})), { valueFormatter: function (value, dataIndex) { var _a; return formatValue_1((_a = originalValueAt(dataIndex)) !== null && _a !== void 0 ? _a : value); } });
|
|
2435
2537
|
}
|
|
2436
2538
|
if (next.type === "pie") {
|
|
2437
2539
|
var pieNumberFormat = seriesNumberFormatFor(s);
|
|
2438
|
-
if (pieNumberFormat && ((
|
|
2439
|
-
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
2540
|
+
if (pieNumberFormat && ((_f = s === null || s === void 0 ? void 0 : s.tooltip) === null || _f === void 0 ? void 0 : _f.show) !== false) {
|
|
2541
|
+
next.tooltip = tslib_1.__assign(tslib_1.__assign({}, ((_g = s === null || s === void 0 ? void 0 : s.tooltip) !== null && _g !== void 0 ? _g : {})), { formatter: (0, axis_number_format_1.circularTooltipFormatter)(pieNumberFormat, locale) });
|
|
2440
2542
|
}
|
|
2441
2543
|
if (explosionOffset > 0 && Array.isArray(next.data)) {
|
|
2442
2544
|
next.selectedMode = "multiple";
|
|
@@ -2448,15 +2550,19 @@ var BasicChart = function (_a) {
|
|
|
2448
2550
|
}
|
|
2449
2551
|
}
|
|
2450
2552
|
if (isDoughnut && next.type === "pie") {
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2553
|
+
// The hole is a fraction of the OUTER radius (Excel's `<c:holeSize>`),
|
|
2554
|
+
// and the doughnut's outer edge sits at 75% of the chart — so every
|
|
2555
|
+
// ring edge is its fraction of 75%, not of the whole chart (#1064:
|
|
2556
|
+
// Excel's default 0.75 used to meet the outer edge, an empty ring).
|
|
2557
|
+
var rank = doughnutSeriesOrder.indexOf((0, series_click_1.chartSeriesSpecIndex)(s === null || s === void 0 ? void 0 : s.id));
|
|
2558
|
+
var ring = (_h = doughnutRingSet[rank]) !== null && _h !== void 0 ? _h : (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(doughnutHoleSize), 1)[0];
|
|
2559
|
+
var pct = function (fraction) { return "".concat(Math.round(fraction * 75 * 100) / 100, "%"); };
|
|
2560
|
+
next.radius = [pct(ring.inner), pct(ring.outer)];
|
|
2455
2561
|
}
|
|
2456
2562
|
return next;
|
|
2457
2563
|
});
|
|
2458
2564
|
// Update charts
|
|
2459
|
-
(
|
|
2565
|
+
(_149 = chartRef.current) === null || _149 === void 0 ? void 0 : _149.setOption({
|
|
2460
2566
|
xAxis: (function () {
|
|
2461
2567
|
var _a, _b;
|
|
2462
2568
|
if (isOfPie) {
|