@rowsncolumns/charts 28.1.11 → 28.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/basic-chart/basic-chart.js +212 -159
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +122 -95
- package/dist/cjs/utils/hierarchy.d.ts +6 -0
- package/dist/cjs/utils/hierarchy.d.ts.map +1 -1
- package/dist/cjs/utils/hierarchy.js +23 -1
- package/dist/cjs/utils/histogram.d.ts +42 -3
- package/dist/cjs/utils/histogram.d.ts.map +1 -1
- package/dist/cjs/utils/histogram.js +193 -5
- package/dist/cjs/utils/overrides.d.ts +1 -1
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +44 -39
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +106 -27
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +45 -6
- package/dist/esm/utils/hierarchy.d.ts +6 -0
- package/dist/esm/utils/hierarchy.d.ts.map +1 -1
- package/dist/esm/utils/hierarchy.js +21 -0
- package/dist/esm/utils/histogram.d.ts +42 -3
- package/dist/esm/utils/histogram.d.ts.map +1 -1
- package/dist/esm/utils/histogram.js +171 -4
- package/dist/esm/utils/overrides.d.ts +1 -1
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +4 -2
- package/package.json +2 -2
|
@@ -126,7 +126,14 @@ var HIERARCHY_LEVEL_STYLES = [
|
|
|
126
126
|
},
|
|
127
127
|
{
|
|
128
128
|
itemStyle: {
|
|
129
|
-
gapWidth:
|
|
129
|
+
gapWidth: 2,
|
|
130
|
+
borderColor: "#ffffff",
|
|
131
|
+
borderWidth: 1,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
itemStyle: {
|
|
136
|
+
gapWidth: 0,
|
|
130
137
|
borderColor: "#ffffff",
|
|
131
138
|
borderWidth: 1,
|
|
132
139
|
},
|
|
@@ -149,11 +156,20 @@ var treemapBannerShown = function (layout) { return layout !== "none"; };
|
|
|
149
156
|
* Colour a hierarchy like Excel: each top-level node takes the next
|
|
150
157
|
* palette colour and every descendant inherits it (#1072).
|
|
151
158
|
*/
|
|
152
|
-
var colorHierarchyNodes = function (nodes, palette) {
|
|
159
|
+
var colorHierarchyNodes = function (nodes, palette, options) {
|
|
160
|
+
if (options === void 0) { options = {}; }
|
|
153
161
|
return nodes.map(function (node, index) {
|
|
154
162
|
var color = (0, utils_1.chartPaletteColorAt)(palette, index);
|
|
155
|
-
var paint = function (n) { return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, n), {
|
|
156
|
-
|
|
163
|
+
var paint = function (n, depth) { return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, n), {
|
|
164
|
+
// A top-level node's "border" is what echarts paints behind its
|
|
165
|
+
// banner strip: fill it with the category colour and write the name
|
|
166
|
+
// in a contrasting colour, like Excel's banner (#1086).
|
|
167
|
+
itemStyle: depth === 0 && options.banner
|
|
168
|
+
? { color: color, borderColor: color }
|
|
169
|
+
: { color: color } }), (depth === 0 && options.banner
|
|
170
|
+
? { upperLabel: { color: (0, hierarchy_1.contrastTextColor)(color) } }
|
|
171
|
+
: {})), (n.children ? { children: n.children.map(function (c) { return paint(c, depth + 1); }) } : {}))); };
|
|
172
|
+
return paint(node, 0);
|
|
157
173
|
});
|
|
158
174
|
};
|
|
159
175
|
/** Sunburst rings: Excel leaves the centre empty, so even the first level is a ring (#1073). */
|
|
@@ -412,11 +428,11 @@ var BasicChart = function (_a) {
|
|
|
412
428
|
* Triggers a chart update
|
|
413
429
|
*/
|
|
414
430
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
415
|
-
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,
|
|
431
|
+
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, isTreemap, banner, hierarchyData, rootName, drillDown, seriesDisplayName, hierarchyDepth, levels, hierarchyLegend, legendShown, categoryLegendSeries, sizeNumberFormat_1, tooltipFormatter, hierarchyDataLabels, hierarchyLabelOpts, hierarchyLabel, hierarchyBand, isContour, categories_2, contourSeriesInputs, _d, _e, seriesEntry, dataLabel, _f, _g, 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, histogramDomainSource, histogramCategories, _3, labels, counts, isPareto_1, cumulativePercents, pareto, histogramSeries, histogramColor, paretoLineColor, renderedSeriesCount, replaceMerge, valueAxisBase, isPareto, hasSecondaryAxis, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, axisNumberFormatFor, seriesNumberFormats, seriesNumberFormatFor, tooltipConfig, finalLegend, bottomAxisNameGap, legendBand, positionedLegend, gridConfig, chartDataLabels, seriesLabelOptionFor, isDoughnut, doughnutHoleSize, doughnutSeriesOrder, doughnutRingSet, explosion, explosionOffset, barSeries, len, categoryTotals_2, barSeries_1, barSeries_1_1, s, i, raw, n, barSeries_2, barSeries_2_1, s, seriesWithLabels;
|
|
416
432
|
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;
|
|
417
|
-
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;
|
|
418
|
-
return tslib_1.__generator(this, function (
|
|
419
|
-
switch (
|
|
433
|
+
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, _150, _151, _152, _153, _154, _155, _156, _157, _158, _159, _160, _161, _162, _163, _164, _165, _166;
|
|
434
|
+
return tslib_1.__generator(this, function (_167) {
|
|
435
|
+
switch (_167.label) {
|
|
420
436
|
case 0:
|
|
421
437
|
(0, utils_1.debug)("Updating chart", chart);
|
|
422
438
|
threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType);
|
|
@@ -467,7 +483,7 @@ var BasicChart = function (_a) {
|
|
|
467
483
|
geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
|
|
468
484
|
return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
|
|
469
485
|
case 1:
|
|
470
|
-
geo =
|
|
486
|
+
geo = _167.sent();
|
|
471
487
|
// Entering the region map from a cartesian render: the previous
|
|
472
488
|
// grid/axis option doesn't merge into the map one, so start from
|
|
473
489
|
// a bare instance (theme options are re-applied after setOption).
|
|
@@ -582,7 +598,7 @@ var BasicChart = function (_a) {
|
|
|
582
598
|
});
|
|
583
599
|
seriesInputs = [];
|
|
584
600
|
i = 0;
|
|
585
|
-
|
|
601
|
+
_167.label = 3;
|
|
586
602
|
case 3:
|
|
587
603
|
if (!(i < spec.series.length)) return [3 /*break*/, 7];
|
|
588
604
|
seriesEntry = spec.series[i];
|
|
@@ -591,13 +607,13 @@ var BasicChart = function (_a) {
|
|
|
591
607
|
_b = chart_spec_utils_1.coerceCalculatedLabel;
|
|
592
608
|
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_23 = position.sheetId) !== null && _23 !== void 0 ? _23 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
593
609
|
case 4:
|
|
594
|
-
resolvedLabel = _b.apply(void 0, [
|
|
595
|
-
|
|
610
|
+
resolvedLabel = _b.apply(void 0, [_167.sent()]);
|
|
611
|
+
_167.label = 5;
|
|
596
612
|
case 5:
|
|
597
613
|
xValues = (_24 = perSeriesX[i]) !== null && _24 !== void 0 ? _24 : perSeriesX[0];
|
|
598
614
|
sizeValues_1 = (_25 = perSeriesSize[i]) !== null && _25 !== void 0 ? _25 : perSeriesSize[0];
|
|
599
615
|
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 } : {})));
|
|
600
|
-
|
|
616
|
+
_167.label = 6;
|
|
601
617
|
case 6:
|
|
602
618
|
i++;
|
|
603
619
|
return [3 /*break*/, 3];
|
|
@@ -808,13 +824,13 @@ var BasicChart = function (_a) {
|
|
|
808
824
|
theme.themeColors.accent5,
|
|
809
825
|
theme.themeColors.accent6,
|
|
810
826
|
]);
|
|
811
|
-
|
|
827
|
+
isTreemap = spec.chartType === "treemap";
|
|
828
|
+
banner = isTreemap && treemapBannerShown(spec.parentLabelLayout);
|
|
829
|
+
hierarchyData = colorHierarchyNodes((0, hierarchy_1.buildHierarchyTree)(hierarchyRows), hierarchyPalette, { banner: banner });
|
|
812
830
|
rootName = hierarchyData.length === 1 ? (_34 = (_33 = hierarchyData[0]) === null || _33 === void 0 ? void 0 : _33.name) !== null && _34 !== void 0 ? _34 : "" : "";
|
|
813
831
|
drillDown = Boolean(spec.drillDown);
|
|
814
832
|
seriesDisplayName = (_36 = (_35 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _35 !== void 0 ? _35 : rootName) !== null && _36 !== void 0 ? _36 : "";
|
|
815
833
|
hierarchyDepth = getHierarchyDepth(hierarchyData);
|
|
816
|
-
isTreemap = spec.chartType === "treemap";
|
|
817
|
-
banner = isTreemap && treemapBannerShown(spec.parentLabelLayout);
|
|
818
834
|
levels = buildHierarchyLevels(hierarchyDepth, {
|
|
819
835
|
treemap: isTreemap,
|
|
820
836
|
banner: banner,
|
|
@@ -844,9 +860,27 @@ var BasicChart = function (_a) {
|
|
|
844
860
|
return "".concat(params.name, ": ").concat((0, axis_number_format_1.formatAxisValue)(sizeNumberFormat_1, value, locale));
|
|
845
861
|
};
|
|
846
862
|
hierarchyDataLabels = spec.dataLabels;
|
|
847
|
-
|
|
848
|
-
? tslib_1.__assign(tslib_1.__assign({}, hierarchyDataLabels), { numberFormatPattern: sizeNumberFormat_1 }) : hierarchyDataLabels
|
|
849
|
-
|
|
863
|
+
hierarchyLabelOpts = hierarchyDataLabels && !hierarchyDataLabels.numberFormatPattern
|
|
864
|
+
? tslib_1.__assign(tslib_1.__assign({}, hierarchyDataLabels), { numberFormatPattern: sizeNumberFormat_1 }) : hierarchyDataLabels;
|
|
865
|
+
hierarchyLabel = (hierarchyLabelOpts === null || hierarchyLabelOpts === void 0 ? void 0 : hierarchyLabelOpts.show) === false
|
|
866
|
+
? { show: false }
|
|
867
|
+
: (hierarchyLabelOpts === null || hierarchyLabelOpts === void 0 ? void 0 : hierarchyLabelOpts.show)
|
|
868
|
+
? tslib_1.__assign({ show: true, formatter: (0, overrides_1.dataLabelFormatter)(hierarchyLabelOpts, locale, isTreemap ? "\n" : ": ") }, (isTreemap ? { position: "insideBottomLeft" } : {})) : tslib_1.__assign({ show: true, formatter: "{b}" }, (isTreemap ? { position: "insideBottomLeft" } : {}));
|
|
869
|
+
hierarchyBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
870
|
+
position: (_39 = spec.legend) === null || _39 === void 0 ? void 0 : _39.position,
|
|
871
|
+
visible: legendShown && hierarchyData.length > 0,
|
|
872
|
+
labels: hierarchyData.map(function (node) { return node.name; }),
|
|
873
|
+
legendFontSize: (_44 = (_41 = (_40 = hierarchyLegend.textStyle) === null || _40 === void 0 ? void 0 : _40.fontSize) !== null && _41 !== void 0 ? _41 : (_43 = (_42 = spec.legend) === null || _42 === void 0 ? void 0 : _42.textFormat) === null || _43 === void 0 ? void 0 : _43.fontSize) !== null && _44 !== void 0 ? _44 : 12,
|
|
874
|
+
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
875
|
+
width: width !== null && width !== void 0 ? width : 0,
|
|
876
|
+
height: height !== null && height !== void 0 ? height : 0,
|
|
877
|
+
hasTitle: Boolean(explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle),
|
|
878
|
+
titleFontSize: (_46 = (_45 = spec.titleTextFormat) === null || _45 === void 0 ? void 0 : _45.fontSize) !== null && _46 !== void 0 ? _46 : 16,
|
|
879
|
+
hasBottomAxisTitle: false,
|
|
880
|
+
bottomAxisNameGap: 0,
|
|
881
|
+
hasLeftAxisTitle: false,
|
|
882
|
+
});
|
|
883
|
+
(_47 = chartRef.current) === null || _47 === void 0 ? void 0 : _47.setOption({
|
|
850
884
|
xAxis: [
|
|
851
885
|
{
|
|
852
886
|
type: "category",
|
|
@@ -859,7 +893,7 @@ var BasicChart = function (_a) {
|
|
|
859
893
|
show: false,
|
|
860
894
|
},
|
|
861
895
|
],
|
|
862
|
-
legend: tslib_1.__assign(tslib_1.__assign({}, hierarchyLegend), { data: hierarchyData.map(function (node) { return node.name; }), selectedMode: false }),
|
|
896
|
+
legend: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, hierarchyLegend), hierarchyBand.legend), { data: hierarchyData.map(function (node) { return node.name; }), selectedMode: false }),
|
|
863
897
|
grid: {
|
|
864
898
|
left: 0,
|
|
865
899
|
right: 0,
|
|
@@ -871,17 +905,27 @@ var BasicChart = function (_a) {
|
|
|
871
905
|
formatter: tooltipFormatter,
|
|
872
906
|
},
|
|
873
907
|
series: tslib_1.__spreadArray([
|
|
874
|
-
tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label:
|
|
908
|
+
tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label: hierarchyLabel,
|
|
875
909
|
// Only `levels[1]` (the categories) may carry a banner; see
|
|
876
910
|
// buildHierarchyLevels.
|
|
877
|
-
upperLabel: isTreemap ? { show: false } : undefined, levels: levels,
|
|
911
|
+
upperLabel: isTreemap ? { show: false } : undefined, levels: levels }, (isTreemap
|
|
912
|
+
? {
|
|
913
|
+
// Excel has no wheel zoom / drag pan on a treemap; the
|
|
914
|
+
// sheet keeps scrolling under the pointer (#1086).
|
|
915
|
+
roam: drillDown,
|
|
916
|
+
left: hierarchyBand.grid.left,
|
|
917
|
+
right: hierarchyBand.grid.right,
|
|
918
|
+
top: hierarchyBand.grid.top,
|
|
919
|
+
bottom: hierarchyBand.grid.bottom,
|
|
920
|
+
}
|
|
921
|
+
: {})), {
|
|
878
922
|
// Excel has no drill-down on either chart: zooming into a
|
|
879
923
|
// branch on click (and the treemap breadcrumb) is opt-in.
|
|
880
924
|
nodeClick: drillDown
|
|
881
925
|
? spec.chartType === "treemap"
|
|
882
926
|
? "zoomToNode"
|
|
883
927
|
: "rootToNode"
|
|
884
|
-
: false }, (isTreemap
|
|
928
|
+
: false }), (isTreemap
|
|
885
929
|
? { breadcrumb: { show: drillDown } }
|
|
886
930
|
: { radius: tslib_1.__spreadArray([], tslib_1.__read(SUNBURST_RADIUS), false) }))
|
|
887
931
|
], tslib_1.__read(categoryLegendSeries), false),
|
|
@@ -908,7 +952,7 @@ var BasicChart = function (_a) {
|
|
|
908
952
|
}
|
|
909
953
|
isContour = (0, three_d_1.isContourSpec)(spec);
|
|
910
954
|
if (renderedAsContour.current && !isContour) {
|
|
911
|
-
(
|
|
955
|
+
(_48 = chartRef.current) === null || _48 === void 0 ? void 0 : _48.dispose();
|
|
912
956
|
chartRef.current = undefined;
|
|
913
957
|
renderedAsContour.current = false;
|
|
914
958
|
previousChartType.current = undefined;
|
|
@@ -919,34 +963,34 @@ var BasicChart = function (_a) {
|
|
|
919
963
|
if (!isContour) return [3 /*break*/, 19];
|
|
920
964
|
categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
921
965
|
contourSeriesInputs = [];
|
|
922
|
-
|
|
966
|
+
_167.label = 9;
|
|
923
967
|
case 9:
|
|
924
|
-
|
|
925
|
-
_d = tslib_1.__values((
|
|
926
|
-
|
|
968
|
+
_167.trys.push([9, 16, 17, 18]);
|
|
969
|
+
_d = tslib_1.__values((_49 = spec.series) !== null && _49 !== void 0 ? _49 : []), _e = _d.next();
|
|
970
|
+
_167.label = 10;
|
|
927
971
|
case 10:
|
|
928
972
|
if (!!_e.done) return [3 /*break*/, 15];
|
|
929
973
|
seriesEntry = _e.value;
|
|
930
974
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 12];
|
|
931
975
|
_g = chart_spec_utils_1.coerceCalculatedLabel;
|
|
932
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
976
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_50 = position.sheetId) !== null && _50 !== void 0 ? _50 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
933
977
|
case 11:
|
|
934
|
-
_f = _g.apply(void 0, [
|
|
978
|
+
_f = _g.apply(void 0, [_167.sent()]);
|
|
935
979
|
return [3 /*break*/, 13];
|
|
936
980
|
case 12:
|
|
937
|
-
_f = (
|
|
938
|
-
|
|
981
|
+
_f = (_51 = seriesEntry.dataLabel) !== null && _51 !== void 0 ? _51 : "";
|
|
982
|
+
_167.label = 13;
|
|
939
983
|
case 13:
|
|
940
984
|
dataLabel = _f;
|
|
941
985
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
942
986
|
contourSeriesInputs.push({ name: dataLabel, values: values });
|
|
943
|
-
|
|
987
|
+
_167.label = 14;
|
|
944
988
|
case 14:
|
|
945
989
|
_e = _d.next();
|
|
946
990
|
return [3 /*break*/, 10];
|
|
947
991
|
case 15: return [3 /*break*/, 18];
|
|
948
992
|
case 16:
|
|
949
|
-
e_1_1 =
|
|
993
|
+
e_1_1 = _167.sent();
|
|
950
994
|
e_1 = { error: e_1_1 };
|
|
951
995
|
return [3 /*break*/, 18];
|
|
952
996
|
case 17:
|
|
@@ -971,7 +1015,7 @@ var BasicChart = function (_a) {
|
|
|
971
1015
|
chartRef.current = echarts.init(el.current);
|
|
972
1016
|
bindSeriesSelection(chartRef.current);
|
|
973
1017
|
}
|
|
974
|
-
(
|
|
1018
|
+
(_52 = chartRef.current) === null || _52 === void 0 ? void 0 : _52.setOption({
|
|
975
1019
|
tooltip: {
|
|
976
1020
|
textStyle: { fontSize: 12 },
|
|
977
1021
|
trigger: "item",
|
|
@@ -991,7 +1035,7 @@ var BasicChart = function (_a) {
|
|
|
991
1035
|
type: "category",
|
|
992
1036
|
data: categories_2,
|
|
993
1037
|
splitArea: { show: true },
|
|
994
|
-
name: (
|
|
1038
|
+
name: (_53 = spec.horizontalAxisTitle) !== null && _53 !== void 0 ? _53 : "",
|
|
995
1039
|
nameLocation: "middle",
|
|
996
1040
|
nameGap: 30,
|
|
997
1041
|
}, spec.categoryAxisOptions),
|
|
@@ -1001,7 +1045,7 @@ var BasicChart = function (_a) {
|
|
|
1001
1045
|
type: "category",
|
|
1002
1046
|
data: seriesNames_1,
|
|
1003
1047
|
splitArea: { show: true },
|
|
1004
|
-
name: (
|
|
1048
|
+
name: (_54 = spec.verticalAxisTitle) !== null && _54 !== void 0 ? _54 : "",
|
|
1005
1049
|
nameLocation: "middle",
|
|
1006
1050
|
nameGap: 50,
|
|
1007
1051
|
},
|
|
@@ -1054,34 +1098,34 @@ var BasicChart = function (_a) {
|
|
|
1054
1098
|
if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 30];
|
|
1055
1099
|
categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1056
1100
|
threeDSeriesInputs = [];
|
|
1057
|
-
|
|
1101
|
+
_167.label = 20;
|
|
1058
1102
|
case 20:
|
|
1059
|
-
|
|
1060
|
-
_j = tslib_1.__values((
|
|
1061
|
-
|
|
1103
|
+
_167.trys.push([20, 27, 28, 29]);
|
|
1104
|
+
_j = tslib_1.__values((_55 = spec.series) !== null && _55 !== void 0 ? _55 : []), _k = _j.next();
|
|
1105
|
+
_167.label = 21;
|
|
1062
1106
|
case 21:
|
|
1063
1107
|
if (!!_k.done) return [3 /*break*/, 26];
|
|
1064
1108
|
seriesEntry = _k.value;
|
|
1065
1109
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 23];
|
|
1066
1110
|
_m = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1067
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
1111
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_56 = position.sheetId) !== null && _56 !== void 0 ? _56 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1068
1112
|
case 22:
|
|
1069
|
-
_l = _m.apply(void 0, [
|
|
1113
|
+
_l = _m.apply(void 0, [_167.sent()]);
|
|
1070
1114
|
return [3 /*break*/, 24];
|
|
1071
1115
|
case 23:
|
|
1072
|
-
_l = (
|
|
1073
|
-
|
|
1116
|
+
_l = (_57 = seriesEntry.dataLabel) !== null && _57 !== void 0 ? _57 : "";
|
|
1117
|
+
_167.label = 24;
|
|
1074
1118
|
case 24:
|
|
1075
1119
|
dataLabel = _l;
|
|
1076
1120
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
1077
1121
|
threeDSeriesInputs.push({ name: dataLabel, values: values });
|
|
1078
|
-
|
|
1122
|
+
_167.label = 25;
|
|
1079
1123
|
case 25:
|
|
1080
1124
|
_k = _j.next();
|
|
1081
1125
|
return [3 /*break*/, 21];
|
|
1082
1126
|
case 26: return [3 /*break*/, 29];
|
|
1083
1127
|
case 27:
|
|
1084
|
-
e_2_1 =
|
|
1128
|
+
e_2_1 = _167.sent();
|
|
1085
1129
|
e_2 = { error: e_2_1 };
|
|
1086
1130
|
return [3 /*break*/, 29];
|
|
1087
1131
|
case 28:
|
|
@@ -1250,12 +1294,12 @@ var BasicChart = function (_a) {
|
|
|
1250
1294
|
inRange: { color: tslib_1.__spreadArray([], tslib_1.__read(three_d_1.SURFACE_COLOR_RAMP), false) },
|
|
1251
1295
|
};
|
|
1252
1296
|
}
|
|
1253
|
-
(
|
|
1297
|
+
(_58 = chartRef.current) === null || _58 === void 0 ? void 0 : _58.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
|
|
1254
1298
|
textStyle: { fontSize: 12 },
|
|
1255
1299
|
formatter: threeDTooltipFormatter,
|
|
1256
1300
|
}, legend: threeDRenderKind === "line3D" || stackedBar3D_1
|
|
1257
1301
|
? (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: seriesNames_2.length > 1, data: seriesNames_2 }), spec.legend)
|
|
1258
|
-
: { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (
|
|
1302
|
+
: { show: false }, xAxis3D: tslib_1.__assign(tslib_1.__assign({}, xAxis3D), { name: (_59 = spec.horizontalAxisTitle) !== null && _59 !== void 0 ? _59 : "" }), yAxis3D: tslib_1.__assign(tslib_1.__assign({}, yAxis3D), { name: "" }), zAxis3D: { type: "value", name: (_60 = spec.verticalAxisTitle) !== null && _60 !== void 0 ? _60 : "" }, grid3D: {
|
|
1259
1303
|
boxDepth: Math.max(20, Math.min(100, seriesNames_2.length * 20)),
|
|
1260
1304
|
viewControl: { autoRotate: false },
|
|
1261
1305
|
} }, (visualMap ? { visualMap: [visualMap] } : {})), { series: threeDSeries }), {
|
|
@@ -1286,7 +1330,7 @@ var BasicChart = function (_a) {
|
|
|
1286
1330
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders);
|
|
1287
1331
|
radarSeriesInputs = [];
|
|
1288
1332
|
try {
|
|
1289
|
-
for (_p = tslib_1.__values((
|
|
1333
|
+
for (_p = tslib_1.__values((_61 = spec.series) !== null && _61 !== void 0 ? _61 : []), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
1290
1334
|
seriesEntry = _q.value;
|
|
1291
1335
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
1292
1336
|
? seriesEntry.dataLabel
|
|
@@ -1305,7 +1349,7 @@ var BasicChart = function (_a) {
|
|
|
1305
1349
|
radarAxisOptions_1 = spec.valueAxisOptions;
|
|
1306
1350
|
indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions_1);
|
|
1307
1351
|
radarData = (0, radar_1.buildRadarSeriesData)(radarSeriesInputs, indicators_1.length);
|
|
1308
|
-
radarStyle_1 = (
|
|
1352
|
+
radarStyle_1 = (_62 = spec.radarStyle) !== null && _62 !== void 0 ? _62 : "standard";
|
|
1309
1353
|
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; });
|
|
1310
1354
|
radarFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
1311
1355
|
radarDataLabels_1 = spec.dataLabels;
|
|
@@ -1322,7 +1366,7 @@ var BasicChart = function (_a) {
|
|
|
1322
1366
|
});
|
|
1323
1367
|
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/>");
|
|
1324
1368
|
};
|
|
1325
|
-
(
|
|
1369
|
+
(_63 = chartRef.current) === null || _63 === void 0 ? void 0 : _63.setOption({
|
|
1326
1370
|
radar: {
|
|
1327
1371
|
// The common scale's tick labels along ONE axis, as Excel draws
|
|
1328
1372
|
// them: echarts labels every indicator axis, so each indicator
|
|
@@ -1378,9 +1422,9 @@ var BasicChart = function (_a) {
|
|
|
1378
1422
|
// V-variants additionally get a volume column sub-pane below the
|
|
1379
1423
|
// price plot.
|
|
1380
1424
|
if (spec.chartType === "stock") {
|
|
1381
|
-
variant_1 = ((
|
|
1425
|
+
variant_1 = ((_64 = spec.stockVariant) !== null && _64 !== void 0 ? _64 : "HLC");
|
|
1382
1426
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1383
|
-
seriesValues = ((
|
|
1427
|
+
seriesValues = ((_65 = spec.series) !== null && _65 !== void 0 ? _65 : []).map(function (seriesEntry) {
|
|
1384
1428
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
1385
1429
|
});
|
|
1386
1430
|
stockFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
@@ -1398,7 +1442,7 @@ var BasicChart = function (_a) {
|
|
|
1398
1442
|
upColor_1 = theme.themeColors.accent1;
|
|
1399
1443
|
downColor_1 = theme.themeColors.accent2;
|
|
1400
1444
|
volumePoints = (0, stock_1.toVolumeSeries)(seriesValues, variant_1);
|
|
1401
|
-
hasVolume = ((
|
|
1445
|
+
hasVolume = ((_66 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _66 !== void 0 ? _66 : 0) > 0;
|
|
1402
1446
|
stockGrid = hasVolume
|
|
1403
1447
|
? [
|
|
1404
1448
|
{ left: "10%", right: "4%", top: "8%", height: "56%" },
|
|
@@ -1412,7 +1456,7 @@ var BasicChart = function (_a) {
|
|
|
1412
1456
|
axisLine: { show: true },
|
|
1413
1457
|
axisTick: { show: true },
|
|
1414
1458
|
splitLine: { show: false },
|
|
1415
|
-
name: (
|
|
1459
|
+
name: (_67 = spec.horizontalAxisTitle) !== null && _67 !== void 0 ? _67 : "",
|
|
1416
1460
|
nameLocation: "middle",
|
|
1417
1461
|
nameGap: 30,
|
|
1418
1462
|
}, spec.categoryAxisOptions);
|
|
@@ -1454,14 +1498,14 @@ var BasicChart = function (_a) {
|
|
|
1454
1498
|
// (no open) fall through to the line-derived rendering below.
|
|
1455
1499
|
if (variant_1 === "OHLC" || variant_1 === "VOHLC") {
|
|
1456
1500
|
candleData = (0, stock_1.toCandlestick)(seriesValues, variant_1);
|
|
1457
|
-
(
|
|
1501
|
+
(_68 = chartRef.current) === null || _68 === void 0 ? void 0 : _68.setOption({
|
|
1458
1502
|
xAxis: stockXAxis,
|
|
1459
1503
|
yAxis: tslib_1.__spreadArray([
|
|
1460
1504
|
(0, overrides_1.applyAxisOverrides)({
|
|
1461
1505
|
type: "value",
|
|
1462
1506
|
show: true,
|
|
1463
1507
|
scale: true,
|
|
1464
|
-
name: (
|
|
1508
|
+
name: (_69 = spec.verticalAxisTitle) !== null && _69 !== void 0 ? _69 : "",
|
|
1465
1509
|
nameLocation: "middle",
|
|
1466
1510
|
nameGap: 50,
|
|
1467
1511
|
gridIndex: 0,
|
|
@@ -1506,13 +1550,13 @@ var BasicChart = function (_a) {
|
|
|
1506
1550
|
theme.themeColors.accent3,
|
|
1507
1551
|
theme.themeColors.accent4,
|
|
1508
1552
|
]);
|
|
1509
|
-
(
|
|
1553
|
+
(_70 = chartRef.current) === null || _70 === void 0 ? void 0 : _70.setOption({
|
|
1510
1554
|
xAxis: stockXAxis,
|
|
1511
1555
|
yAxis: tslib_1.__spreadArray([
|
|
1512
1556
|
(0, overrides_1.applyAxisOverrides)({
|
|
1513
1557
|
type: "value",
|
|
1514
1558
|
show: true,
|
|
1515
|
-
name: (
|
|
1559
|
+
name: (_71 = spec.verticalAxisTitle) !== null && _71 !== void 0 ? _71 : "",
|
|
1516
1560
|
nameLocation: "middle",
|
|
1517
1561
|
nameGap: 50,
|
|
1518
1562
|
gridIndex: 0,
|
|
@@ -1551,14 +1595,14 @@ var BasicChart = function (_a) {
|
|
|
1551
1595
|
ofPieLayout = null;
|
|
1552
1596
|
isHorizontalBarChart = spec.chartType === "bar";
|
|
1553
1597
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1554
|
-
primaryDomainSource = (
|
|
1598
|
+
primaryDomainSource = (_74 = (_73 = (_72 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _72 === void 0 ? void 0 : _72[0]) === null || _73 === void 0 ? void 0 : _73.sources) === null || _74 === void 0 ? void 0 : _74[0];
|
|
1555
1599
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1556
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1600
|
+
? (0, aggregation_1.sanitizeDomainValues)((_75 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _75 !== void 0 ? _75 : [])
|
|
1557
1601
|
: [];
|
|
1558
1602
|
aggregateDomainValues = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1559
1603
|
categoryLevels = isCircularChart
|
|
1560
1604
|
? undefined
|
|
1561
|
-
: (0, category_levels_1.resolveCategoryLevels)((
|
|
1605
|
+
: (0, category_levels_1.resolveCategoryLevels)((_76 = spec.categoryLevels) === null || _76 === void 0 ? void 0 : _76.map(function (level) {
|
|
1562
1606
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1563
1607
|
}));
|
|
1564
1608
|
if (categoryLevels) {
|
|
@@ -1569,15 +1613,15 @@ var BasicChart = function (_a) {
|
|
|
1569
1613
|
axisTick: { show: true },
|
|
1570
1614
|
splitLine: { show: true },
|
|
1571
1615
|
name: isHorizontalBarChart
|
|
1572
|
-
? (
|
|
1573
|
-
: (
|
|
1616
|
+
? (_77 = spec.verticalAxisTitle) !== null && _77 !== void 0 ? _77 : ""
|
|
1617
|
+
: (_78 = spec.horizontalAxisTitle) !== null && _78 !== void 0 ? _78 : "",
|
|
1574
1618
|
nameLocation: "middle",
|
|
1575
1619
|
nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
|
|
1576
1620
|
})), false));
|
|
1577
1621
|
}
|
|
1578
1622
|
// One category axis per domain (Excel): a domain drawn from several
|
|
1579
1623
|
// ranges lists their categories in sequence on that single axis.
|
|
1580
|
-
(categoryLevels ? [] : (
|
|
1624
|
+
(categoryLevels ? [] : (_79 = spec.domains) !== null && _79 !== void 0 ? _79 : []).forEach(function (domain, domainIndex) {
|
|
1581
1625
|
var _a, _b;
|
|
1582
1626
|
var axisData = domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1583
1627
|
var _a;
|
|
@@ -1613,8 +1657,8 @@ var BasicChart = function (_a) {
|
|
|
1613
1657
|
splitLine: { show: true },
|
|
1614
1658
|
gridIndex: 0,
|
|
1615
1659
|
name: isHorizontalBarChart
|
|
1616
|
-
? (
|
|
1617
|
-
: (
|
|
1660
|
+
? (_80 = spec.verticalAxisTitle) !== null && _80 !== void 0 ? _80 : ""
|
|
1661
|
+
: (_81 = spec.horizontalAxisTitle) !== null && _81 !== void 0 ? _81 : "",
|
|
1618
1662
|
nameLocation: "middle",
|
|
1619
1663
|
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
1620
1664
|
});
|
|
@@ -1646,7 +1690,7 @@ var BasicChart = function (_a) {
|
|
|
1646
1690
|
};
|
|
1647
1691
|
sideBySideBarCount = isStacked
|
|
1648
1692
|
? 1
|
|
1649
|
-
: ((
|
|
1693
|
+
: ((_82 = spec.series) !== null && _82 !== void 0 ? _82 : []).reduce(function (count, s) {
|
|
1650
1694
|
var _a;
|
|
1651
1695
|
var seriesType = (_a = s.seriesChartType) !== null && _a !== void 0 ? _a : spec.chartType;
|
|
1652
1696
|
return seriesType === "bar" || seriesType === "column"
|
|
@@ -1670,29 +1714,29 @@ var BasicChart = function (_a) {
|
|
|
1670
1714
|
return (0, utils_1.chartPaletteColorAt)(seriesPalette, index);
|
|
1671
1715
|
};
|
|
1672
1716
|
_loop_1 = function (specSeriesIndex, series) {
|
|
1673
|
-
var dataLabel,
|
|
1674
|
-
var e_13,
|
|
1675
|
-
return tslib_1.__generator(this, function (
|
|
1676
|
-
switch (
|
|
1717
|
+
var dataLabel, _168, _169, 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, _170, _171, dp, fallback_1, overrides_3, _172, _173, dp, positiveColor_1, negativeColor_1;
|
|
1718
|
+
var e_13, _174, e_14, _175, e_15, _176;
|
|
1719
|
+
return tslib_1.__generator(this, function (_177) {
|
|
1720
|
+
switch (_177.label) {
|
|
1677
1721
|
case 0:
|
|
1678
1722
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1679
|
-
|
|
1680
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1723
|
+
_169 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1724
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_84 = position.sheetId) !== null && _84 !== void 0 ? _84 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1681
1725
|
case 1:
|
|
1682
|
-
|
|
1726
|
+
_168 = _169.apply(void 0, [_177.sent()]);
|
|
1683
1727
|
return [3 /*break*/, 3];
|
|
1684
1728
|
case 2:
|
|
1685
|
-
|
|
1686
|
-
|
|
1729
|
+
_168 = (_85 = series.dataLabel) !== null && _85 !== void 0 ? _85 : "";
|
|
1730
|
+
_177.label = 3;
|
|
1687
1731
|
case 3:
|
|
1688
|
-
dataLabel =
|
|
1732
|
+
dataLabel = _168;
|
|
1689
1733
|
// Label
|
|
1690
1734
|
if (dataLabel) {
|
|
1691
|
-
(
|
|
1735
|
+
(_86 = legend.data) === null || _86 === void 0 ? void 0 : _86.push(dataLabel);
|
|
1692
1736
|
}
|
|
1693
|
-
effectiveChartType = (
|
|
1737
|
+
effectiveChartType = (_87 = series.seriesChartType) !== null && _87 !== void 0 ? _87 : spec.chartType;
|
|
1694
1738
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1695
|
-
domainSources = (
|
|
1739
|
+
domainSources = (_90 = (_89 = (_88 = spec.domains) === null || _88 === void 0 ? void 0 : _88[0]) === null || _89 === void 0 ? void 0 : _89.sources) !== null && _90 !== void 0 ? _90 : [];
|
|
1696
1740
|
pieDomainLabels = isCircularChart &&
|
|
1697
1741
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
1698
1742
|
? domainSources.flatMap(function (sheetRange) {
|
|
@@ -1724,7 +1768,7 @@ var BasicChart = function (_a) {
|
|
|
1724
1768
|
seriesEntry = tslib_1.__assign(tslib_1.__assign({ type: seriesEchartsType,
|
|
1725
1769
|
// Ties the rendered series back to spec.series for click selection
|
|
1726
1770
|
// One rendered series per spec series (source index 0).
|
|
1727
|
-
id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (
|
|
1771
|
+
id: (0, series_click_1.chartSeriesId)(specSeriesIndex, 0), name: dataLabel, data: data, stack: isStacked ? "dataLabel" : undefined, smooth: (_91 = spec.smooth) !== null && _91 !== void 0 ? _91 : undefined, radius: (_92 = spec.radius) !== null && _92 !== void 0 ? _92 : (isCircularChart ? [0, "75%"] : undefined) }, ((0, empty_cells_1.connectsAcrossEmptyCells)(spec, lineLike)
|
|
1728
1772
|
? { connectNulls: true }
|
|
1729
1773
|
: {})), seriesStyleAttrs);
|
|
1730
1774
|
// Plot this series against a secondary value axis. The 2nd
|
|
@@ -1749,17 +1793,17 @@ var BasicChart = function (_a) {
|
|
|
1749
1793
|
}
|
|
1750
1794
|
seriesAny = series;
|
|
1751
1795
|
if (effectiveChartType === "line") {
|
|
1752
|
-
markerSymbol = (
|
|
1796
|
+
markerSymbol = (_93 = seriesAny.marker) === null || _93 === void 0 ? void 0 : _93.symbol;
|
|
1753
1797
|
wantsMarkers = markerSymbol === "none"
|
|
1754
1798
|
? false
|
|
1755
1799
|
: Boolean(spec.showMarkers) || !(0, utils_1.isNil)(markerSymbol);
|
|
1756
1800
|
labelsWithoutMarkers = !wantsMarkers &&
|
|
1757
|
-
Boolean((
|
|
1801
|
+
Boolean((_94 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _94 === void 0 ? void 0 : _94.show);
|
|
1758
1802
|
seriesEntry.showSymbol = wantsMarkers || labelsWithoutMarkers;
|
|
1759
1803
|
if (wantsMarkers) {
|
|
1760
1804
|
seriesEntry.symbol =
|
|
1761
|
-
(
|
|
1762
|
-
seriesEntry.symbolSize = (
|
|
1805
|
+
(_95 = (0, helpers_1.mapMarkerSymbolToEcharts)(markerSymbol)) !== null && _95 !== void 0 ? _95 : "circle";
|
|
1806
|
+
seriesEntry.symbolSize = (_97 = (_96 = seriesAny.marker) === null || _96 === void 0 ? void 0 : _96.size) !== null && _97 !== void 0 ? _97 : 6;
|
|
1763
1807
|
}
|
|
1764
1808
|
else {
|
|
1765
1809
|
if (labelsWithoutMarkers) {
|
|
@@ -1782,7 +1826,7 @@ var BasicChart = function (_a) {
|
|
|
1782
1826
|
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1783
1827
|
finally {
|
|
1784
1828
|
try {
|
|
1785
|
-
if (isolated_1_1 && !isolated_1_1.done && (
|
|
1829
|
+
if (isolated_1_1 && !isolated_1_1.done && (_174 = isolated_1.return)) _174.call(isolated_1);
|
|
1786
1830
|
}
|
|
1787
1831
|
finally { if (e_13) throw e_13.error; }
|
|
1788
1832
|
}
|
|
@@ -1794,9 +1838,9 @@ var BasicChart = function (_a) {
|
|
|
1794
1838
|
gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
|
|
1795
1839
|
if (gradientArgs && !seriesAny.noFill) {
|
|
1796
1840
|
gradient = new echarts.graphic.LinearGradient(gradientArgs.x, gradientArgs.y, gradientArgs.x2, gradientArgs.y2, gradientArgs.colorStops);
|
|
1797
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1841
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_98 = seriesEntry.itemStyle) !== null && _98 !== void 0 ? _98 : {})), { color: gradient });
|
|
1798
1842
|
if (effectiveChartType === "area") {
|
|
1799
|
-
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1843
|
+
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_99 = seriesEntry.areaStyle) !== null && _99 !== void 0 ? _99 : {})), { color: gradient });
|
|
1800
1844
|
}
|
|
1801
1845
|
}
|
|
1802
1846
|
else if (seriesAny.noFill) {
|
|
@@ -1804,15 +1848,15 @@ var BasicChart = function (_a) {
|
|
|
1804
1848
|
// with `transparent` so layout is preserved but nothing
|
|
1805
1849
|
// paints. Legend entries are also suppressed via `name: ""`
|
|
1806
1850
|
// since the series carries no semantic information.
|
|
1807
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1851
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_100 = seriesEntry.itemStyle) !== null && _100 !== void 0 ? _100 : {})), { color: "transparent", borderColor: "transparent" });
|
|
1808
1852
|
}
|
|
1809
1853
|
else if (isBarOrColumn &&
|
|
1810
1854
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1811
1855
|
seriesAny.dataPointColors.length) {
|
|
1812
1856
|
overrides_2 = new Map();
|
|
1813
1857
|
try {
|
|
1814
|
-
for (
|
|
1815
|
-
dp =
|
|
1858
|
+
for (_170 = (e_14 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _171 = _170.next(); !_171.done; _171 = _170.next()) {
|
|
1859
|
+
dp = _171.value;
|
|
1816
1860
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1817
1861
|
overrides_2.set(dp.idx, dp.color);
|
|
1818
1862
|
}
|
|
@@ -1821,20 +1865,20 @@ var BasicChart = function (_a) {
|
|
|
1821
1865
|
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1822
1866
|
finally {
|
|
1823
1867
|
try {
|
|
1824
|
-
if (
|
|
1868
|
+
if (_171 && !_171.done && (_175 = _170.return)) _175.call(_170);
|
|
1825
1869
|
}
|
|
1826
1870
|
finally { if (e_14) throw e_14.error; }
|
|
1827
1871
|
}
|
|
1828
|
-
fallback_1 = (
|
|
1829
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1872
|
+
fallback_1 = (_101 = series.color) !== null && _101 !== void 0 ? _101 : paletteColorAt(specSeriesIndex);
|
|
1873
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_102 = seriesEntry.itemStyle) !== null && _102 !== void 0 ? _102 : {})), { color: function (params) { var _a; return (_a = overrides_2.get(params.dataIndex)) !== null && _a !== void 0 ? _a : fallback_1; } });
|
|
1830
1874
|
}
|
|
1831
1875
|
else if (isCircularChart &&
|
|
1832
1876
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1833
1877
|
seriesAny.dataPointColors.length) {
|
|
1834
1878
|
overrides_3 = new Map();
|
|
1835
1879
|
try {
|
|
1836
|
-
for (
|
|
1837
|
-
dp =
|
|
1880
|
+
for (_172 = (e_15 = void 0, tslib_1.__values(seriesAny.dataPointColors)), _173 = _172.next(); !_173.done; _173 = _172.next()) {
|
|
1881
|
+
dp = _173.value;
|
|
1838
1882
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1839
1883
|
overrides_3.set(dp.idx, dp.color);
|
|
1840
1884
|
}
|
|
@@ -1843,19 +1887,19 @@ var BasicChart = function (_a) {
|
|
|
1843
1887
|
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1844
1888
|
finally {
|
|
1845
1889
|
try {
|
|
1846
|
-
if (
|
|
1890
|
+
if (_173 && !_173.done && (_176 = _172.return)) _176.call(_172);
|
|
1847
1891
|
}
|
|
1848
1892
|
finally { if (e_15) throw e_15.error; }
|
|
1849
1893
|
}
|
|
1850
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1894
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_103 = seriesEntry.itemStyle) !== null && _103 !== void 0 ? _103 : {})), { color: function (params) {
|
|
1851
1895
|
var _a, _b;
|
|
1852
1896
|
return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
|
|
1853
1897
|
} });
|
|
1854
1898
|
}
|
|
1855
1899
|
else if (isBarOrColumn && series.invertIfNegative) {
|
|
1856
|
-
positiveColor_1 = (
|
|
1857
|
-
negativeColor_1 = (
|
|
1858
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1900
|
+
positiveColor_1 = (_104 = series.color) !== null && _104 !== void 0 ? _104 : paletteColorAt(specSeriesIndex);
|
|
1901
|
+
negativeColor_1 = (_105 = series.negativeColor) !== null && _105 !== void 0 ? _105 : "#FF0000";
|
|
1902
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_106 = seriesEntry.itemStyle) !== null && _106 !== void 0 ? _106 : {})), { color: function (params) {
|
|
1859
1903
|
var _a, _b;
|
|
1860
1904
|
var value = Array.isArray(params.data)
|
|
1861
1905
|
? params.data[1]
|
|
@@ -1866,10 +1910,10 @@ var BasicChart = function (_a) {
|
|
|
1866
1910
|
} });
|
|
1867
1911
|
}
|
|
1868
1912
|
else if (series.color) {
|
|
1869
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1870
|
-
seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1913
|
+
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((_107 = seriesEntry.itemStyle) !== null && _107 !== void 0 ? _107 : {})), { color: series.color });
|
|
1914
|
+
seriesEntry.lineStyle = tslib_1.__assign(tslib_1.__assign({}, ((_108 = seriesEntry.lineStyle) !== null && _108 !== void 0 ? _108 : {})), { color: series.color });
|
|
1871
1915
|
if (effectiveChartType === "area") {
|
|
1872
|
-
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1916
|
+
seriesEntry.areaStyle = tslib_1.__assign(tslib_1.__assign({}, ((_109 = seriesEntry.areaStyle) !== null && _109 !== void 0 ? _109 : {})), { color: series.color });
|
|
1873
1917
|
}
|
|
1874
1918
|
}
|
|
1875
1919
|
chartSeries.push(seriesEntry);
|
|
@@ -1878,24 +1922,24 @@ var BasicChart = function (_a) {
|
|
|
1878
1922
|
}
|
|
1879
1923
|
});
|
|
1880
1924
|
};
|
|
1881
|
-
|
|
1925
|
+
_167.label = 31;
|
|
1882
1926
|
case 31:
|
|
1883
|
-
|
|
1884
|
-
_r = tslib_1.__values(((
|
|
1885
|
-
|
|
1927
|
+
_167.trys.push([31, 36, 37, 38]);
|
|
1928
|
+
_r = tslib_1.__values(((_83 = spec.series) !== null && _83 !== void 0 ? _83 : []).entries()), _s = _r.next();
|
|
1929
|
+
_167.label = 32;
|
|
1886
1930
|
case 32:
|
|
1887
1931
|
if (!!_s.done) return [3 /*break*/, 35];
|
|
1888
1932
|
_t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
|
|
1889
1933
|
return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
|
|
1890
1934
|
case 33:
|
|
1891
|
-
|
|
1892
|
-
|
|
1935
|
+
_167.sent();
|
|
1936
|
+
_167.label = 34;
|
|
1893
1937
|
case 34:
|
|
1894
1938
|
_s = _r.next();
|
|
1895
1939
|
return [3 /*break*/, 32];
|
|
1896
1940
|
case 35: return [3 /*break*/, 38];
|
|
1897
1941
|
case 36:
|
|
1898
|
-
e_3_1 =
|
|
1942
|
+
e_3_1 = _167.sent();
|
|
1899
1943
|
e_3 = { error: e_3_1 };
|
|
1900
1944
|
return [3 /*break*/, 38];
|
|
1901
1945
|
case 37:
|
|
@@ -1913,7 +1957,7 @@ var BasicChart = function (_a) {
|
|
|
1913
1957
|
}
|
|
1914
1958
|
if (isOfPie) {
|
|
1915
1959
|
labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1916
|
-
seriesEntry = (
|
|
1960
|
+
seriesEntry = (_110 = spec.series) === null || _110 === void 0 ? void 0 : _110[0];
|
|
1917
1961
|
rawValues = seriesEntry
|
|
1918
1962
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
1919
1963
|
: [];
|
|
@@ -1960,7 +2004,7 @@ var BasicChart = function (_a) {
|
|
|
1960
2004
|
};
|
|
1961
2005
|
chartSeries.push({
|
|
1962
2006
|
type: "pie",
|
|
1963
|
-
name: (
|
|
2007
|
+
name: (_111 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _111 !== void 0 ? _111 : "",
|
|
1964
2008
|
center: ["".concat(MAIN_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
1965
2009
|
radius: [0, "".concat(MAIN_RADIUS_PCT_1, "%")],
|
|
1966
2010
|
// Rotate the pie so the "Other" slice's angular midpoint faces
|
|
@@ -1978,7 +2022,7 @@ var BasicChart = function (_a) {
|
|
|
1978
2022
|
if (ofPieType_1 === "pie") {
|
|
1979
2023
|
chartSeries.push({
|
|
1980
2024
|
type: "pie",
|
|
1981
|
-
name: (
|
|
2025
|
+
name: (_112 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _112 !== void 0 ? _112 : "",
|
|
1982
2026
|
center: ["".concat(SECONDARY_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
1983
2027
|
radius: [0, "".concat(secondaryRadiusPct_1, "%")],
|
|
1984
2028
|
data: secondary.map(function (s, i) { return ({
|
|
@@ -2073,16 +2117,16 @@ var BasicChart = function (_a) {
|
|
|
2073
2117
|
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);
|
|
2074
2118
|
}
|
|
2075
2119
|
else if (spec.chartType === "waterfall") {
|
|
2076
|
-
primaryDomainSource_1 = (
|
|
2120
|
+
primaryDomainSource_1 = (_115 = (_114 = (_113 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _113 === void 0 ? void 0 : _113[0]) === null || _114 === void 0 ? void 0 : _114.sources) === null || _115 === void 0 ? void 0 : _115[0];
|
|
2077
2121
|
rawDomainValues = primaryDomainSource_1
|
|
2078
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2122
|
+
? (0, aggregation_1.sanitizeDomainValues)((_116 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _116 !== void 0 ? _116 : [])
|
|
2079
2123
|
: [];
|
|
2080
2124
|
labels = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2081
|
-
seriesEntry = (
|
|
2125
|
+
seriesEntry = (_117 = spec.series) === null || _117 === void 0 ? void 0 : _117[0];
|
|
2082
2126
|
rawValues_1 = seriesEntry
|
|
2083
2127
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
2084
2128
|
: [];
|
|
2085
|
-
totalIndices = new Set((
|
|
2129
|
+
totalIndices = new Set((_118 = spec.totalIndices) !== null && _118 !== void 0 ? _118 : []);
|
|
2086
2130
|
steps = (0, waterfall_1.computeWaterfall)(rawValues_1, labels, totalIndices);
|
|
2087
2131
|
chartDomains.length = 0;
|
|
2088
2132
|
chartDomains.push({
|
|
@@ -2092,7 +2136,7 @@ var BasicChart = function (_a) {
|
|
|
2092
2136
|
axisLine: { show: true },
|
|
2093
2137
|
axisTick: { show: true },
|
|
2094
2138
|
splitLine: { show: false },
|
|
2095
|
-
name: (
|
|
2139
|
+
name: (_119 = spec.horizontalAxisTitle) !== null && _119 !== void 0 ? _119 : "",
|
|
2096
2140
|
nameLocation: "middle",
|
|
2097
2141
|
nameGap: 30,
|
|
2098
2142
|
});
|
|
@@ -2109,12 +2153,12 @@ var BasicChart = function (_a) {
|
|
|
2109
2153
|
label: { show: false },
|
|
2110
2154
|
tooltip: { show: false },
|
|
2111
2155
|
});
|
|
2112
|
-
accent_1 = (
|
|
2113
|
-
decreaseColor_1 = (
|
|
2114
|
-
totalColor_1 = (
|
|
2156
|
+
accent_1 = (_120 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _120 !== void 0 ? _120 : theme.themeColors.accent1;
|
|
2157
|
+
decreaseColor_1 = (_122 = (_121 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.negativeColor) !== null && _121 !== void 0 ? _121 : theme.themeColors.accent2) !== null && _122 !== void 0 ? _122 : accent_1;
|
|
2158
|
+
totalColor_1 = (_123 = theme.themeColors.accent3) !== null && _123 !== void 0 ? _123 : accent_1;
|
|
2115
2159
|
pointColors_1 = new Map();
|
|
2116
2160
|
try {
|
|
2117
|
-
for (_v = tslib_1.__values((
|
|
2161
|
+
for (_v = tslib_1.__values((_124 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _124 !== void 0 ? _124 : []), _w = _v.next(); !_w.done; _w = _v.next()) {
|
|
2118
2162
|
dp = _w.value;
|
|
2119
2163
|
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2120
2164
|
pointColors_1.set(dp.idx, dp.color);
|
|
@@ -2136,7 +2180,7 @@ var BasicChart = function (_a) {
|
|
|
2136
2180
|
type: "bar",
|
|
2137
2181
|
id: (0, series_click_1.chartSeriesId)(0, 0),
|
|
2138
2182
|
stack: "waterfall",
|
|
2139
|
-
name: (
|
|
2183
|
+
name: (_125 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _125 !== void 0 ? _125 : "",
|
|
2140
2184
|
// A bar's height is the step's magnitude; the signed source value
|
|
2141
2185
|
// rides along as `originalValue` so labels and tooltips read
|
|
2142
2186
|
// "-90" for a decrease, like Excel.
|
|
@@ -2170,12 +2214,12 @@ var BasicChart = function (_a) {
|
|
|
2170
2214
|
legend.data = [];
|
|
2171
2215
|
}
|
|
2172
2216
|
else if (spec.chartType === "funnel") {
|
|
2173
|
-
primaryDomainSource_2 = (
|
|
2217
|
+
primaryDomainSource_2 = (_128 = (_127 = (_126 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _126 === void 0 ? void 0 : _126[0]) === null || _127 === void 0 ? void 0 : _127.sources) === null || _128 === void 0 ? void 0 : _128[0];
|
|
2174
2218
|
rawDomainValues = primaryDomainSource_2
|
|
2175
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2219
|
+
? (0, aggregation_1.sanitizeDomainValues)((_129 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _129 !== void 0 ? _129 : [])
|
|
2176
2220
|
: [];
|
|
2177
2221
|
labels_1 = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2178
|
-
seriesEntry = (
|
|
2222
|
+
seriesEntry = (_130 = spec.series) === null || _130 === void 0 ? void 0 : _130[0];
|
|
2179
2223
|
rawValues = seriesEntry
|
|
2180
2224
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : 0); })
|
|
2181
2225
|
: [];
|
|
@@ -2189,10 +2233,10 @@ var BasicChart = function (_a) {
|
|
|
2189
2233
|
theme.themeColors.accent5,
|
|
2190
2234
|
theme.themeColors.accent6,
|
|
2191
2235
|
]);
|
|
2192
|
-
funnelColor_1 = (
|
|
2236
|
+
funnelColor_1 = (_131 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.color) !== null && _131 !== void 0 ? _131 : (0, utils_1.chartPaletteColorAt)(funnelPalette, 0);
|
|
2193
2237
|
stageColors_1 = new Map();
|
|
2194
2238
|
try {
|
|
2195
|
-
for (_x = tslib_1.__values((
|
|
2239
|
+
for (_x = tslib_1.__values((_132 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataPointColors) !== null && _132 !== void 0 ? _132 : []), _y = _x.next(); !_y.done; _y = _x.next()) {
|
|
2196
2240
|
dp = _y.value;
|
|
2197
2241
|
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2198
2242
|
stageColors_1.set(dp.idx, dp.color);
|
|
@@ -2220,7 +2264,7 @@ var BasicChart = function (_a) {
|
|
|
2220
2264
|
top: 60,
|
|
2221
2265
|
bottom: 20,
|
|
2222
2266
|
};
|
|
2223
|
-
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: (0, series_click_1.chartSeriesId)(0, 0), name: (
|
|
2267
|
+
chartSeries.push(tslib_1.__assign(tslib_1.__assign({ type: "funnel", id: (0, series_click_1.chartSeriesId)(0, 0), name: (_133 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _133 !== void 0 ? _133 : "", data: funnelData }, funnelLayout), { itemStyle: {
|
|
2224
2268
|
color: function (params) { var _a; return (_a = stageColors_1.get(params.dataIndex)) !== null && _a !== void 0 ? _a : funnelColor_1; },
|
|
2225
2269
|
}, label: {
|
|
2226
2270
|
show: true,
|
|
@@ -2243,7 +2287,7 @@ var BasicChart = function (_a) {
|
|
|
2243
2287
|
outlierPoints = [];
|
|
2244
2288
|
meanPoints = [];
|
|
2245
2289
|
try {
|
|
2246
|
-
for (_z = tslib_1.__values((
|
|
2290
|
+
for (_z = tslib_1.__values((_134 = spec.series) !== null && _134 !== void 0 ? _134 : []), _0 = _z.next(); !_0.done; _0 = _z.next()) {
|
|
2247
2291
|
seriesEntry = _0.value;
|
|
2248
2292
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
2249
2293
|
? seriesEntry.dataLabel
|
|
@@ -2292,7 +2336,7 @@ var BasicChart = function (_a) {
|
|
|
2292
2336
|
axisLine: { show: true },
|
|
2293
2337
|
axisTick: { show: true },
|
|
2294
2338
|
splitLine: { show: false },
|
|
2295
|
-
name: (
|
|
2339
|
+
name: (_135 = spec.horizontalAxisTitle) !== null && _135 !== void 0 ? _135 : "",
|
|
2296
2340
|
nameLocation: "middle",
|
|
2297
2341
|
nameGap: 30,
|
|
2298
2342
|
});
|
|
@@ -2302,7 +2346,7 @@ var BasicChart = function (_a) {
|
|
|
2302
2346
|
name: "",
|
|
2303
2347
|
data: boxStats,
|
|
2304
2348
|
};
|
|
2305
|
-
boxColor = (
|
|
2349
|
+
boxColor = (_137 = (_136 = spec.series) === null || _136 === void 0 ? void 0 : _136[0]) === null || _137 === void 0 ? void 0 : _137.color;
|
|
2306
2350
|
if (boxColor) {
|
|
2307
2351
|
boxSeries.itemStyle = { color: boxColor, borderColor: boxColor };
|
|
2308
2352
|
}
|
|
@@ -2317,7 +2361,18 @@ var BasicChart = function (_a) {
|
|
|
2317
2361
|
}
|
|
2318
2362
|
else if (spec.chartType === "histogram") {
|
|
2319
2363
|
rawValues = flattenChartDataValues(spec.series, getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
2320
|
-
|
|
2364
|
+
histogramDomainSource = (_140 = (_139 = (_138 = spec.domains) === null || _138 === void 0 ? void 0 : _138[0]) === null || _139 === void 0 ? void 0 : _139.sources) === null || _140 === void 0 ? void 0 : _140[0];
|
|
2365
|
+
histogramCategories = histogramDomainSource
|
|
2366
|
+
? ((_141 = getDomainValuesFromRange(histogramDomainSource, spec.hiddenDimensionStrategy)) !== null && _141 !== void 0 ? _141 : [])
|
|
2367
|
+
: [];
|
|
2368
|
+
_3 = histogramCategories.length
|
|
2369
|
+
? (0, histogram_1.aggregateByCategory)(histogramCategories, rawValues, (_144 = (_143 = (_142 = spec.series) === null || _142 === void 0 ? void 0 : _142[0]) === null || _143 === void 0 ? void 0 : _143.aggregateType) !== null && _144 !== void 0 ? _144 : "SUM")
|
|
2370
|
+
: (0, histogram_1.binHistogram)(rawValues, spec.binCount, {
|
|
2371
|
+
binSize: spec.binSize,
|
|
2372
|
+
intervalClosed: spec.intervalClosed,
|
|
2373
|
+
overflow: spec.overflow,
|
|
2374
|
+
underflow: spec.underflow,
|
|
2375
|
+
}), labels = _3.labels, counts = _3.counts;
|
|
2321
2376
|
isPareto_1 = (0, histogram_1.isParetoSpec)(spec);
|
|
2322
2377
|
cumulativePercents = [];
|
|
2323
2378
|
if (isPareto_1) {
|
|
@@ -2334,34 +2389,32 @@ var BasicChart = function (_a) {
|
|
|
2334
2389
|
axisLine: { show: true },
|
|
2335
2390
|
axisTick: { show: true },
|
|
2336
2391
|
splitLine: { show: false },
|
|
2337
|
-
name: (
|
|
2392
|
+
name: (_145 = spec.horizontalAxisTitle) !== null && _145 !== void 0 ? _145 : "",
|
|
2338
2393
|
nameLocation: "middle",
|
|
2339
2394
|
nameGap: 30,
|
|
2340
2395
|
});
|
|
2341
2396
|
chartSeries.length = 0;
|
|
2342
2397
|
histogramSeries = {
|
|
2343
2398
|
type: "bar",
|
|
2344
|
-
name: (
|
|
2399
|
+
name: (_148 = (_147 = (_146 = spec.series) === null || _146 === void 0 ? void 0 : _146[0]) === null || _147 === void 0 ? void 0 : _147.dataLabel) !== null && _148 !== void 0 ? _148 : "",
|
|
2345
2400
|
data: counts,
|
|
2346
|
-
|
|
2401
|
+
// Excel's histogram columns touch unless `gapWidth` says otherwise
|
|
2402
|
+
// (#1087); the gap maps like a column chart's.
|
|
2403
|
+
barCategoryGap: (_150 = (0, bar_layout_1.gapWidthToBarCategoryGap)((_149 = spec.gapWidth) !== null && _149 !== void 0 ? _149 : 0, { seriesCount: 1 })) !== null && _150 !== void 0 ? _150 : "0%",
|
|
2347
2404
|
};
|
|
2348
|
-
histogramColor = (
|
|
2405
|
+
histogramColor = (_152 = (_151 = spec.series) === null || _151 === void 0 ? void 0 : _151[0]) === null || _152 === void 0 ? void 0 : _152.color;
|
|
2349
2406
|
if (histogramColor) {
|
|
2350
2407
|
histogramSeries.itemStyle = { color: histogramColor };
|
|
2351
2408
|
}
|
|
2352
2409
|
chartSeries.push(histogramSeries);
|
|
2353
2410
|
if (isPareto_1) {
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
yAxisIndex: 1,
|
|
2362
|
-
symbol: "circle",
|
|
2363
|
-
symbolSize: 6,
|
|
2364
|
-
});
|
|
2411
|
+
paretoLineColor = spec.paretoLineColor;
|
|
2412
|
+
chartSeries.push(tslib_1.__assign({ type: "line", name: "Cumulative %", data: cumulativePercents, yAxisIndex: 1, showSymbol: false, symbol: "none" }, (paretoLineColor
|
|
2413
|
+
? {
|
|
2414
|
+
itemStyle: { color: paretoLineColor },
|
|
2415
|
+
lineStyle: { color: paretoLineColor },
|
|
2416
|
+
}
|
|
2417
|
+
: {})));
|
|
2365
2418
|
}
|
|
2366
2419
|
legend.data = [];
|
|
2367
2420
|
}
|
|
@@ -2382,20 +2435,20 @@ var BasicChart = function (_a) {
|
|
|
2382
2435
|
isPareto = spec.chartType === "histogram" && (0, histogram_1.isParetoSpec)(spec);
|
|
2383
2436
|
hasSecondaryAxis = !isCircularChart &&
|
|
2384
2437
|
!isHorizontalBarChart &&
|
|
2385
|
-
(((
|
|
2438
|
+
(((_153 = spec.series) !== null && _153 !== void 0 ? _153 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
|
|
2386
2439
|
isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
|
|
2387
2440
|
(spec.chartType === "bar" || spec.chartType === "column");
|
|
2388
2441
|
primaryAxisNumberFormat = isPercentStackedBars
|
|
2389
2442
|
? undefined
|
|
2390
2443
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2391
2444
|
axisOptions: spec.valueAxisOptions,
|
|
2392
|
-
series: ((
|
|
2445
|
+
series: ((_154 = spec.series) !== null && _154 !== void 0 ? _154 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
2393
2446
|
getFormattingFromRange: getFormattingFromRange,
|
|
2394
2447
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2395
2448
|
});
|
|
2396
2449
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2397
2450
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
2398
|
-
series: ((
|
|
2451
|
+
series: ((_155 = spec.series) !== null && _155 !== void 0 ? _155 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
2399
2452
|
getFormattingFromRange: getFormattingFromRange,
|
|
2400
2453
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2401
2454
|
});
|
|
@@ -2424,17 +2477,17 @@ var BasicChart = function (_a) {
|
|
|
2424
2477
|
finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
|
|
2425
2478
|
bottomAxisNameGap = isHorizontalBarChart
|
|
2426
2479
|
? valueAxisBase.nameGap
|
|
2427
|
-
: Number((
|
|
2480
|
+
: Number((_157 = (_156 = chartDomains[0]) === null || _156 === void 0 ? void 0 : _156.nameGap) !== null && _157 !== void 0 ? _157 : CATEGORY_AXIS_NAME_GAP);
|
|
2428
2481
|
legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
2429
|
-
position: (
|
|
2482
|
+
position: (_158 = spec.legend) === null || _158 === void 0 ? void 0 : _158.position,
|
|
2430
2483
|
visible: finalLegend.show !== false,
|
|
2431
2484
|
labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
|
|
2432
|
-
legendFontSize: (
|
|
2485
|
+
legendFontSize: (_163 = (_160 = (_159 = finalLegend.textStyle) === null || _159 === void 0 ? void 0 : _159.fontSize) !== null && _160 !== void 0 ? _160 : (_162 = (_161 = spec.legend) === null || _161 === void 0 ? void 0 : _161.textFormat) === null || _162 === void 0 ? void 0 : _162.fontSize) !== null && _163 !== void 0 ? _163 : 12,
|
|
2433
2486
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
2434
2487
|
width: width !== null && width !== void 0 ? width : 0,
|
|
2435
2488
|
height: height !== null && height !== void 0 ? height : 0,
|
|
2436
2489
|
hasTitle: Boolean(title),
|
|
2437
|
-
titleFontSize: (
|
|
2490
|
+
titleFontSize: (_165 = (_164 = spec.titleTextFormat) === null || _164 === void 0 ? void 0 : _164.fontSize) !== null && _165 !== void 0 ? _165 : 16,
|
|
2438
2491
|
hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
|
|
2439
2492
|
bottomAxisNameGap: bottomAxisNameGap,
|
|
2440
2493
|
hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
|
|
@@ -2604,7 +2657,7 @@ var BasicChart = function (_a) {
|
|
|
2604
2657
|
return next;
|
|
2605
2658
|
});
|
|
2606
2659
|
// Update charts
|
|
2607
|
-
(
|
|
2660
|
+
(_166 = chartRef.current) === null || _166 === void 0 ? void 0 : _166.setOption({
|
|
2608
2661
|
xAxis: (function () {
|
|
2609
2662
|
var _a, _b;
|
|
2610
2663
|
if (isOfPie) {
|