@rowsncolumns/charts 28.1.10 → 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 +268 -173
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +140 -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 -34
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +168 -40
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +63 -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 +10 -3
- package/package.json +2 -2
|
@@ -114,7 +114,8 @@ var isHierarchyChartSpec = function (spec) {
|
|
|
114
114
|
};
|
|
115
115
|
// Every level keeps the colour its node was given (one solid colour per
|
|
116
116
|
// top-level category, like Excel — no per-level saturation ramp); thin
|
|
117
|
-
// white gaps separate the cells.
|
|
117
|
+
// white gaps separate the cells. Index 0 is echarts' virtual root, 1 the
|
|
118
|
+
// top-level categories, 2+ the levels beneath them.
|
|
118
119
|
var HIERARCHY_LEVEL_STYLES = [
|
|
119
120
|
{
|
|
120
121
|
itemStyle: {
|
|
@@ -122,25 +123,53 @@ var HIERARCHY_LEVEL_STYLES = [
|
|
|
122
123
|
borderColor: "#ffffff",
|
|
123
124
|
borderWidth: 0,
|
|
124
125
|
},
|
|
125
|
-
upperLabel: { show: false },
|
|
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
|
},
|
|
133
140
|
},
|
|
134
141
|
];
|
|
142
|
+
/** Height of the strip a treemap category name is drawn in (Excel's "Banner"). */
|
|
143
|
+
var TREEMAP_BANNER_HEIGHT = 20;
|
|
144
|
+
/**
|
|
145
|
+
* Excel's treemap `parentLabelLayout`: the top-level category names are
|
|
146
|
+
* drawn in a banner strip (or not at all); the levels between the categories
|
|
147
|
+
* and the leaves are never labelled, so small groups keep their height for
|
|
148
|
+
* the leaf cells (rowsncolumns/spreadsheet#1072). Excel's default
|
|
149
|
+
* `overlapping` writes the name over the group's top-left corner, which an
|
|
150
|
+
* echarts treemap cannot draw (an upper label always reserves its strip and
|
|
151
|
+
* is dropped when the strip is too small for the text), so it draws as a
|
|
152
|
+
* banner.
|
|
153
|
+
*/
|
|
154
|
+
var treemapBannerShown = function (layout) { return layout !== "none"; };
|
|
135
155
|
/**
|
|
136
156
|
* Colour a hierarchy like Excel: each top-level node takes the next
|
|
137
157
|
* palette colour and every descendant inherits it (#1072).
|
|
138
158
|
*/
|
|
139
|
-
var colorHierarchyNodes = function (nodes, palette) {
|
|
159
|
+
var colorHierarchyNodes = function (nodes, palette, options) {
|
|
160
|
+
if (options === void 0) { options = {}; }
|
|
140
161
|
return nodes.map(function (node, index) {
|
|
141
162
|
var color = (0, utils_1.chartPaletteColorAt)(palette, index);
|
|
142
|
-
var paint = function (n) { return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, n), {
|
|
143
|
-
|
|
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);
|
|
144
173
|
});
|
|
145
174
|
};
|
|
146
175
|
/** Sunburst rings: Excel leaves the centre empty, so even the first level is a ring (#1073). */
|
|
@@ -181,13 +210,25 @@ var flattenChartDataValues = function (chartData, extractor, hiddenStrategy, ski
|
|
|
181
210
|
});
|
|
182
211
|
return values;
|
|
183
212
|
};
|
|
184
|
-
var buildHierarchyLevels = function (maxDepth) {
|
|
213
|
+
var buildHierarchyLevels = function (maxDepth, options) {
|
|
185
214
|
if (maxDepth <= 0)
|
|
186
215
|
return undefined;
|
|
187
216
|
var levels = [];
|
|
188
|
-
|
|
217
|
+
// One entry per depth, the virtual root included, so every level's upper
|
|
218
|
+
// label is explicit: the categories' banner on level 1 only.
|
|
219
|
+
for (var i = 0; i <= maxDepth; i++) {
|
|
189
220
|
var baseStyle = HIERARCHY_LEVEL_STYLES[Math.min(i, HIERARCHY_LEVEL_STYLES.length - 1)];
|
|
190
|
-
levels.push(tslib_1.__assign(tslib_1.__assign({}, baseStyle), { itemStyle: tslib_1.__assign({}, baseStyle.itemStyle) })
|
|
221
|
+
levels.push(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, baseStyle), { itemStyle: tslib_1.__assign({}, baseStyle.itemStyle) }), (options.treemap
|
|
222
|
+
? {
|
|
223
|
+
upperLabel: i === 1 && options.banner
|
|
224
|
+
? {
|
|
225
|
+
show: true,
|
|
226
|
+
height: TREEMAP_BANNER_HEIGHT,
|
|
227
|
+
padding: [0, 0, 0, 4],
|
|
228
|
+
}
|
|
229
|
+
: { show: false },
|
|
230
|
+
}
|
|
231
|
+
: {})));
|
|
191
232
|
}
|
|
192
233
|
return levels;
|
|
193
234
|
};
|
|
@@ -387,11 +428,11 @@ var BasicChart = function (_a) {
|
|
|
387
428
|
* Triggers a chart update
|
|
388
429
|
*/
|
|
389
430
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
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,
|
|
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;
|
|
391
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;
|
|
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 (
|
|
394
|
-
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) {
|
|
395
436
|
case 0:
|
|
396
437
|
(0, utils_1.debug)("Updating chart", chart);
|
|
397
438
|
threeDRenderKind = (0, three_d_1.resolve3DRenderKind)(spec.sourceChartType);
|
|
@@ -442,7 +483,7 @@ var BasicChart = function (_a) {
|
|
|
442
483
|
geoScope = (0, region_map_1.resolveGeoScope)(regionSpec.geoScope);
|
|
443
484
|
return [4 /*yield*/, (0, region_map_loader_1.loadRegionMapGeo)(geoScope)];
|
|
444
485
|
case 1:
|
|
445
|
-
geo =
|
|
486
|
+
geo = _167.sent();
|
|
446
487
|
// Entering the region map from a cartesian render: the previous
|
|
447
488
|
// grid/axis option doesn't merge into the map one, so start from
|
|
448
489
|
// a bare instance (theme options are re-applied after setOption).
|
|
@@ -557,7 +598,7 @@ var BasicChart = function (_a) {
|
|
|
557
598
|
});
|
|
558
599
|
seriesInputs = [];
|
|
559
600
|
i = 0;
|
|
560
|
-
|
|
601
|
+
_167.label = 3;
|
|
561
602
|
case 3:
|
|
562
603
|
if (!(i < spec.series.length)) return [3 /*break*/, 7];
|
|
563
604
|
seriesEntry = spec.series[i];
|
|
@@ -566,13 +607,13 @@ var BasicChart = function (_a) {
|
|
|
566
607
|
_b = chart_spec_utils_1.coerceCalculatedLabel;
|
|
567
608
|
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_23 = position.sheetId) !== null && _23 !== void 0 ? _23 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
568
609
|
case 4:
|
|
569
|
-
resolvedLabel = _b.apply(void 0, [
|
|
570
|
-
|
|
610
|
+
resolvedLabel = _b.apply(void 0, [_167.sent()]);
|
|
611
|
+
_167.label = 5;
|
|
571
612
|
case 5:
|
|
572
613
|
xValues = (_24 = perSeriesX[i]) !== null && _24 !== void 0 ? _24 : perSeriesX[0];
|
|
573
614
|
sizeValues_1 = (_25 = perSeriesSize[i]) !== null && _25 !== void 0 ? _25 : perSeriesSize[0];
|
|
574
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 } : {})));
|
|
575
|
-
|
|
616
|
+
_167.label = 6;
|
|
576
617
|
case 6:
|
|
577
618
|
i++;
|
|
578
619
|
return [3 /*break*/, 3];
|
|
@@ -783,12 +824,33 @@ var BasicChart = function (_a) {
|
|
|
783
824
|
theme.themeColors.accent5,
|
|
784
825
|
theme.themeColors.accent6,
|
|
785
826
|
]);
|
|
786
|
-
|
|
827
|
+
isTreemap = spec.chartType === "treemap";
|
|
828
|
+
banner = isTreemap && treemapBannerShown(spec.parentLabelLayout);
|
|
829
|
+
hierarchyData = colorHierarchyNodes((0, hierarchy_1.buildHierarchyTree)(hierarchyRows), hierarchyPalette, { banner: banner });
|
|
787
830
|
rootName = hierarchyData.length === 1 ? (_34 = (_33 = hierarchyData[0]) === null || _33 === void 0 ? void 0 : _33.name) !== null && _34 !== void 0 ? _34 : "" : "";
|
|
788
831
|
drillDown = Boolean(spec.drillDown);
|
|
789
832
|
seriesDisplayName = (_36 = (_35 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _35 !== void 0 ? _35 : rootName) !== null && _36 !== void 0 ? _36 : "";
|
|
790
833
|
hierarchyDepth = getHierarchyDepth(hierarchyData);
|
|
791
|
-
levels = buildHierarchyLevels(hierarchyDepth
|
|
834
|
+
levels = buildHierarchyLevels(hierarchyDepth, {
|
|
835
|
+
treemap: isTreemap,
|
|
836
|
+
banner: banner,
|
|
837
|
+
});
|
|
838
|
+
hierarchyLegend = (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: false }), spec.legend);
|
|
839
|
+
legendShown = hierarchyLegend.show !== false;
|
|
840
|
+
categoryLegendSeries = legendShown
|
|
841
|
+
? hierarchyData.map(function (node) {
|
|
842
|
+
var _a, _b;
|
|
843
|
+
return ({
|
|
844
|
+
type: "bar",
|
|
845
|
+
id: "rnc-hierarchy-legend-".concat((_a = node.id) !== null && _a !== void 0 ? _a : node.name),
|
|
846
|
+
name: node.name,
|
|
847
|
+
data: [],
|
|
848
|
+
silent: true,
|
|
849
|
+
itemStyle: { color: (_b = node.itemStyle) === null || _b === void 0 ? void 0 : _b.color },
|
|
850
|
+
tooltip: { show: false },
|
|
851
|
+
});
|
|
852
|
+
})
|
|
853
|
+
: [];
|
|
792
854
|
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);
|
|
793
855
|
tooltipFormatter = function (params) {
|
|
794
856
|
var _a;
|
|
@@ -798,9 +860,27 @@ var BasicChart = function (_a) {
|
|
|
798
860
|
return "".concat(params.name, ": ").concat((0, axis_number_format_1.formatAxisValue)(sizeNumberFormat_1, value, locale));
|
|
799
861
|
};
|
|
800
862
|
hierarchyDataLabels = spec.dataLabels;
|
|
801
|
-
|
|
802
|
-
? tslib_1.__assign(tslib_1.__assign({}, hierarchyDataLabels), { numberFormatPattern: sizeNumberFormat_1 }) : hierarchyDataLabels
|
|
803
|
-
|
|
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({
|
|
804
884
|
xAxis: [
|
|
805
885
|
{
|
|
806
886
|
type: "category",
|
|
@@ -813,7 +893,7 @@ var BasicChart = function (_a) {
|
|
|
813
893
|
show: false,
|
|
814
894
|
},
|
|
815
895
|
],
|
|
816
|
-
legend:
|
|
896
|
+
legend: tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, hierarchyLegend), hierarchyBand.legend), { data: hierarchyData.map(function (node) { return node.name; }), selectedMode: false }),
|
|
817
897
|
grid: {
|
|
818
898
|
left: 0,
|
|
819
899
|
right: 0,
|
|
@@ -824,25 +904,31 @@ var BasicChart = function (_a) {
|
|
|
824
904
|
trigger: "item",
|
|
825
905
|
formatter: tooltipFormatter,
|
|
826
906
|
},
|
|
827
|
-
series: [
|
|
828
|
-
tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label:
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
:
|
|
907
|
+
series: tslib_1.__spreadArray([
|
|
908
|
+
tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: chartType, name: seriesDisplayName, rootName: rootName || seriesDisplayName || "", data: hierarchyData, label: hierarchyLabel,
|
|
909
|
+
// Only `levels[1]` (the categories) may carry a banner; see
|
|
910
|
+
// buildHierarchyLevels.
|
|
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
|
+
: {})), {
|
|
836
922
|
// Excel has no drill-down on either chart: zooming into a
|
|
837
923
|
// branch on click (and the treemap breadcrumb) is opt-in.
|
|
838
924
|
nodeClick: drillDown
|
|
839
925
|
? spec.chartType === "treemap"
|
|
840
926
|
? "zoomToNode"
|
|
841
927
|
: "rootToNode"
|
|
842
|
-
: false }, (
|
|
928
|
+
: false }), (isTreemap
|
|
843
929
|
? { breadcrumb: { show: drillDown } }
|
|
844
|
-
: { radius: tslib_1.__spreadArray([], tslib_1.__read(SUNBURST_RADIUS), false) }))
|
|
845
|
-
],
|
|
930
|
+
: { radius: tslib_1.__spreadArray([], tslib_1.__read(SUNBURST_RADIUS), false) }))
|
|
931
|
+
], tslib_1.__read(categoryLegendSeries), false),
|
|
846
932
|
}, {
|
|
847
933
|
replaceMerge: [
|
|
848
934
|
"series",
|
|
@@ -854,7 +940,7 @@ var BasicChart = function (_a) {
|
|
|
854
940
|
],
|
|
855
941
|
});
|
|
856
942
|
previousChartType.current = spec.chartType;
|
|
857
|
-
previousSeriesCount.current = 1;
|
|
943
|
+
previousSeriesCount.current = 1 + categoryLegendSeries.length;
|
|
858
944
|
return [2 /*return*/];
|
|
859
945
|
}
|
|
860
946
|
else {
|
|
@@ -866,7 +952,7 @@ var BasicChart = function (_a) {
|
|
|
866
952
|
}
|
|
867
953
|
isContour = (0, three_d_1.isContourSpec)(spec);
|
|
868
954
|
if (renderedAsContour.current && !isContour) {
|
|
869
|
-
(
|
|
955
|
+
(_48 = chartRef.current) === null || _48 === void 0 ? void 0 : _48.dispose();
|
|
870
956
|
chartRef.current = undefined;
|
|
871
957
|
renderedAsContour.current = false;
|
|
872
958
|
previousChartType.current = undefined;
|
|
@@ -877,34 +963,34 @@ var BasicChart = function (_a) {
|
|
|
877
963
|
if (!isContour) return [3 /*break*/, 19];
|
|
878
964
|
categories_2 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
879
965
|
contourSeriesInputs = [];
|
|
880
|
-
|
|
966
|
+
_167.label = 9;
|
|
881
967
|
case 9:
|
|
882
|
-
|
|
883
|
-
_d = tslib_1.__values((
|
|
884
|
-
|
|
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;
|
|
885
971
|
case 10:
|
|
886
972
|
if (!!_e.done) return [3 /*break*/, 15];
|
|
887
973
|
seriesEntry = _e.value;
|
|
888
974
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 12];
|
|
889
975
|
_g = chart_spec_utils_1.coerceCalculatedLabel;
|
|
890
|
-
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)];
|
|
891
977
|
case 11:
|
|
892
|
-
_f = _g.apply(void 0, [
|
|
978
|
+
_f = _g.apply(void 0, [_167.sent()]);
|
|
893
979
|
return [3 /*break*/, 13];
|
|
894
980
|
case 12:
|
|
895
|
-
_f = (
|
|
896
|
-
|
|
981
|
+
_f = (_51 = seriesEntry.dataLabel) !== null && _51 !== void 0 ? _51 : "";
|
|
982
|
+
_167.label = 13;
|
|
897
983
|
case 13:
|
|
898
984
|
dataLabel = _f;
|
|
899
985
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
900
986
|
contourSeriesInputs.push({ name: dataLabel, values: values });
|
|
901
|
-
|
|
987
|
+
_167.label = 14;
|
|
902
988
|
case 14:
|
|
903
989
|
_e = _d.next();
|
|
904
990
|
return [3 /*break*/, 10];
|
|
905
991
|
case 15: return [3 /*break*/, 18];
|
|
906
992
|
case 16:
|
|
907
|
-
e_1_1 =
|
|
993
|
+
e_1_1 = _167.sent();
|
|
908
994
|
e_1 = { error: e_1_1 };
|
|
909
995
|
return [3 /*break*/, 18];
|
|
910
996
|
case 17:
|
|
@@ -929,7 +1015,7 @@ var BasicChart = function (_a) {
|
|
|
929
1015
|
chartRef.current = echarts.init(el.current);
|
|
930
1016
|
bindSeriesSelection(chartRef.current);
|
|
931
1017
|
}
|
|
932
|
-
(
|
|
1018
|
+
(_52 = chartRef.current) === null || _52 === void 0 ? void 0 : _52.setOption({
|
|
933
1019
|
tooltip: {
|
|
934
1020
|
textStyle: { fontSize: 12 },
|
|
935
1021
|
trigger: "item",
|
|
@@ -949,7 +1035,7 @@ var BasicChart = function (_a) {
|
|
|
949
1035
|
type: "category",
|
|
950
1036
|
data: categories_2,
|
|
951
1037
|
splitArea: { show: true },
|
|
952
|
-
name: (
|
|
1038
|
+
name: (_53 = spec.horizontalAxisTitle) !== null && _53 !== void 0 ? _53 : "",
|
|
953
1039
|
nameLocation: "middle",
|
|
954
1040
|
nameGap: 30,
|
|
955
1041
|
}, spec.categoryAxisOptions),
|
|
@@ -959,7 +1045,7 @@ var BasicChart = function (_a) {
|
|
|
959
1045
|
type: "category",
|
|
960
1046
|
data: seriesNames_1,
|
|
961
1047
|
splitArea: { show: true },
|
|
962
|
-
name: (
|
|
1048
|
+
name: (_54 = spec.verticalAxisTitle) !== null && _54 !== void 0 ? _54 : "",
|
|
963
1049
|
nameLocation: "middle",
|
|
964
1050
|
nameGap: 50,
|
|
965
1051
|
},
|
|
@@ -1012,34 +1098,34 @@ var BasicChart = function (_a) {
|
|
|
1012
1098
|
if (!(willRender3D && threeDRenderKind)) return [3 /*break*/, 30];
|
|
1013
1099
|
categories_3 = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1014
1100
|
threeDSeriesInputs = [];
|
|
1015
|
-
|
|
1101
|
+
_167.label = 20;
|
|
1016
1102
|
case 20:
|
|
1017
|
-
|
|
1018
|
-
_j = tslib_1.__values((
|
|
1019
|
-
|
|
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;
|
|
1020
1106
|
case 21:
|
|
1021
1107
|
if (!!_k.done) return [3 /*break*/, 26];
|
|
1022
1108
|
seriesEntry = _k.value;
|
|
1023
1109
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 23];
|
|
1024
1110
|
_m = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1025
|
-
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)];
|
|
1026
1112
|
case 22:
|
|
1027
|
-
_l = _m.apply(void 0, [
|
|
1113
|
+
_l = _m.apply(void 0, [_167.sent()]);
|
|
1028
1114
|
return [3 /*break*/, 24];
|
|
1029
1115
|
case 23:
|
|
1030
|
-
_l = (
|
|
1031
|
-
|
|
1116
|
+
_l = (_57 = seriesEntry.dataLabel) !== null && _57 !== void 0 ? _57 : "";
|
|
1117
|
+
_167.label = 24;
|
|
1032
1118
|
case 24:
|
|
1033
1119
|
dataLabel = _l;
|
|
1034
1120
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(sanitizeChartValue);
|
|
1035
1121
|
threeDSeriesInputs.push({ name: dataLabel, values: values });
|
|
1036
|
-
|
|
1122
|
+
_167.label = 25;
|
|
1037
1123
|
case 25:
|
|
1038
1124
|
_k = _j.next();
|
|
1039
1125
|
return [3 /*break*/, 21];
|
|
1040
1126
|
case 26: return [3 /*break*/, 29];
|
|
1041
1127
|
case 27:
|
|
1042
|
-
e_2_1 =
|
|
1128
|
+
e_2_1 = _167.sent();
|
|
1043
1129
|
e_2 = { error: e_2_1 };
|
|
1044
1130
|
return [3 /*break*/, 29];
|
|
1045
1131
|
case 28:
|
|
@@ -1208,12 +1294,12 @@ var BasicChart = function (_a) {
|
|
|
1208
1294
|
inRange: { color: tslib_1.__spreadArray([], tslib_1.__read(three_d_1.SURFACE_COLOR_RAMP), false) },
|
|
1209
1295
|
};
|
|
1210
1296
|
}
|
|
1211
|
-
(
|
|
1297
|
+
(_58 = chartRef.current) === null || _58 === void 0 ? void 0 : _58.setOption(tslib_1.__assign(tslib_1.__assign({ tooltip: {
|
|
1212
1298
|
textStyle: { fontSize: 12 },
|
|
1213
1299
|
formatter: threeDTooltipFormatter,
|
|
1214
1300
|
}, legend: threeDRenderKind === "line3D" || stackedBar3D_1
|
|
1215
1301
|
? (0, overrides_1.applyLegendOverrides)(tslib_1.__assign(tslib_1.__assign({}, defaultLegendConfig), { show: seriesNames_2.length > 1, data: seriesNames_2 }), spec.legend)
|
|
1216
|
-
: { 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: {
|
|
1217
1303
|
boxDepth: Math.max(20, Math.min(100, seriesNames_2.length * 20)),
|
|
1218
1304
|
viewControl: { autoRotate: false },
|
|
1219
1305
|
} }, (visualMap ? { visualMap: [visualMap] } : {})), { series: threeDSeries }), {
|
|
@@ -1244,7 +1330,7 @@ var BasicChart = function (_a) {
|
|
|
1244
1330
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders);
|
|
1245
1331
|
radarSeriesInputs = [];
|
|
1246
1332
|
try {
|
|
1247
|
-
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()) {
|
|
1248
1334
|
seriesEntry = _q.value;
|
|
1249
1335
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
1250
1336
|
? seriesEntry.dataLabel
|
|
@@ -1263,7 +1349,7 @@ var BasicChart = function (_a) {
|
|
|
1263
1349
|
radarAxisOptions_1 = spec.valueAxisOptions;
|
|
1264
1350
|
indicators_1 = (0, radar_1.buildRadarIndicators)(categories, radarSeriesInputs, radarAxisOptions_1);
|
|
1265
1351
|
radarData = (0, radar_1.buildRadarSeriesData)(radarSeriesInputs, indicators_1.length);
|
|
1266
|
-
radarStyle_1 = (
|
|
1352
|
+
radarStyle_1 = (_62 = spec.radarStyle) !== null && _62 !== void 0 ? _62 : "standard";
|
|
1267
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; });
|
|
1268
1354
|
radarFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
1269
1355
|
radarDataLabels_1 = spec.dataLabels;
|
|
@@ -1280,7 +1366,7 @@ var BasicChart = function (_a) {
|
|
|
1280
1366
|
});
|
|
1281
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/>");
|
|
1282
1368
|
};
|
|
1283
|
-
(
|
|
1369
|
+
(_63 = chartRef.current) === null || _63 === void 0 ? void 0 : _63.setOption({
|
|
1284
1370
|
radar: {
|
|
1285
1371
|
// The common scale's tick labels along ONE axis, as Excel draws
|
|
1286
1372
|
// them: echarts labels every indicator axis, so each indicator
|
|
@@ -1336,9 +1422,9 @@ var BasicChart = function (_a) {
|
|
|
1336
1422
|
// V-variants additionally get a volume column sub-pane below the
|
|
1337
1423
|
// price plot.
|
|
1338
1424
|
if (spec.chartType === "stock") {
|
|
1339
|
-
variant_1 = ((
|
|
1425
|
+
variant_1 = ((_64 = spec.stockVariant) !== null && _64 !== void 0 ? _64 : "HLC");
|
|
1340
1426
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1341
|
-
seriesValues = ((
|
|
1427
|
+
seriesValues = ((_65 = spec.series) !== null && _65 !== void 0 ? _65 : []).map(function (seriesEntry) {
|
|
1342
1428
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
1343
1429
|
});
|
|
1344
1430
|
stockFormats_1 = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
@@ -1356,7 +1442,7 @@ var BasicChart = function (_a) {
|
|
|
1356
1442
|
upColor_1 = theme.themeColors.accent1;
|
|
1357
1443
|
downColor_1 = theme.themeColors.accent2;
|
|
1358
1444
|
volumePoints = (0, stock_1.toVolumeSeries)(seriesValues, variant_1);
|
|
1359
|
-
hasVolume = ((
|
|
1445
|
+
hasVolume = ((_66 = volumePoints === null || volumePoints === void 0 ? void 0 : volumePoints.length) !== null && _66 !== void 0 ? _66 : 0) > 0;
|
|
1360
1446
|
stockGrid = hasVolume
|
|
1361
1447
|
? [
|
|
1362
1448
|
{ left: "10%", right: "4%", top: "8%", height: "56%" },
|
|
@@ -1370,7 +1456,7 @@ var BasicChart = function (_a) {
|
|
|
1370
1456
|
axisLine: { show: true },
|
|
1371
1457
|
axisTick: { show: true },
|
|
1372
1458
|
splitLine: { show: false },
|
|
1373
|
-
name: (
|
|
1459
|
+
name: (_67 = spec.horizontalAxisTitle) !== null && _67 !== void 0 ? _67 : "",
|
|
1374
1460
|
nameLocation: "middle",
|
|
1375
1461
|
nameGap: 30,
|
|
1376
1462
|
}, spec.categoryAxisOptions);
|
|
@@ -1412,14 +1498,14 @@ var BasicChart = function (_a) {
|
|
|
1412
1498
|
// (no open) fall through to the line-derived rendering below.
|
|
1413
1499
|
if (variant_1 === "OHLC" || variant_1 === "VOHLC") {
|
|
1414
1500
|
candleData = (0, stock_1.toCandlestick)(seriesValues, variant_1);
|
|
1415
|
-
(
|
|
1501
|
+
(_68 = chartRef.current) === null || _68 === void 0 ? void 0 : _68.setOption({
|
|
1416
1502
|
xAxis: stockXAxis,
|
|
1417
1503
|
yAxis: tslib_1.__spreadArray([
|
|
1418
1504
|
(0, overrides_1.applyAxisOverrides)({
|
|
1419
1505
|
type: "value",
|
|
1420
1506
|
show: true,
|
|
1421
1507
|
scale: true,
|
|
1422
|
-
name: (
|
|
1508
|
+
name: (_69 = spec.verticalAxisTitle) !== null && _69 !== void 0 ? _69 : "",
|
|
1423
1509
|
nameLocation: "middle",
|
|
1424
1510
|
nameGap: 50,
|
|
1425
1511
|
gridIndex: 0,
|
|
@@ -1464,13 +1550,13 @@ var BasicChart = function (_a) {
|
|
|
1464
1550
|
theme.themeColors.accent3,
|
|
1465
1551
|
theme.themeColors.accent4,
|
|
1466
1552
|
]);
|
|
1467
|
-
(
|
|
1553
|
+
(_70 = chartRef.current) === null || _70 === void 0 ? void 0 : _70.setOption({
|
|
1468
1554
|
xAxis: stockXAxis,
|
|
1469
1555
|
yAxis: tslib_1.__spreadArray([
|
|
1470
1556
|
(0, overrides_1.applyAxisOverrides)({
|
|
1471
1557
|
type: "value",
|
|
1472
1558
|
show: true,
|
|
1473
|
-
name: (
|
|
1559
|
+
name: (_71 = spec.verticalAxisTitle) !== null && _71 !== void 0 ? _71 : "",
|
|
1474
1560
|
nameLocation: "middle",
|
|
1475
1561
|
nameGap: 50,
|
|
1476
1562
|
gridIndex: 0,
|
|
@@ -1509,14 +1595,14 @@ var BasicChart = function (_a) {
|
|
|
1509
1595
|
ofPieLayout = null;
|
|
1510
1596
|
isHorizontalBarChart = spec.chartType === "bar";
|
|
1511
1597
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1512
|
-
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];
|
|
1513
1599
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1514
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1600
|
+
? (0, aggregation_1.sanitizeDomainValues)((_75 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _75 !== void 0 ? _75 : [])
|
|
1515
1601
|
: [];
|
|
1516
1602
|
aggregateDomainValues = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1517
1603
|
categoryLevels = isCircularChart
|
|
1518
1604
|
? undefined
|
|
1519
|
-
: (0, category_levels_1.resolveCategoryLevels)((
|
|
1605
|
+
: (0, category_levels_1.resolveCategoryLevels)((_76 = spec.categoryLevels) === null || _76 === void 0 ? void 0 : _76.map(function (level) {
|
|
1520
1606
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1521
1607
|
}));
|
|
1522
1608
|
if (categoryLevels) {
|
|
@@ -1527,15 +1613,15 @@ var BasicChart = function (_a) {
|
|
|
1527
1613
|
axisTick: { show: true },
|
|
1528
1614
|
splitLine: { show: true },
|
|
1529
1615
|
name: isHorizontalBarChart
|
|
1530
|
-
? (
|
|
1531
|
-
: (
|
|
1616
|
+
? (_77 = spec.verticalAxisTitle) !== null && _77 !== void 0 ? _77 : ""
|
|
1617
|
+
: (_78 = spec.horizontalAxisTitle) !== null && _78 !== void 0 ? _78 : "",
|
|
1532
1618
|
nameLocation: "middle",
|
|
1533
1619
|
nameGap: CATEGORY_AXIS_NAME_GAP + 24 * categoryLevels.outer.length,
|
|
1534
1620
|
})), false));
|
|
1535
1621
|
}
|
|
1536
1622
|
// One category axis per domain (Excel): a domain drawn from several
|
|
1537
1623
|
// ranges lists their categories in sequence on that single axis.
|
|
1538
|
-
(categoryLevels ? [] : (
|
|
1624
|
+
(categoryLevels ? [] : (_79 = spec.domains) !== null && _79 !== void 0 ? _79 : []).forEach(function (domain, domainIndex) {
|
|
1539
1625
|
var _a, _b;
|
|
1540
1626
|
var axisData = domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1541
1627
|
var _a;
|
|
@@ -1571,8 +1657,8 @@ var BasicChart = function (_a) {
|
|
|
1571
1657
|
splitLine: { show: true },
|
|
1572
1658
|
gridIndex: 0,
|
|
1573
1659
|
name: isHorizontalBarChart
|
|
1574
|
-
? (
|
|
1575
|
-
: (
|
|
1660
|
+
? (_80 = spec.verticalAxisTitle) !== null && _80 !== void 0 ? _80 : ""
|
|
1661
|
+
: (_81 = spec.horizontalAxisTitle) !== null && _81 !== void 0 ? _81 : "",
|
|
1576
1662
|
nameLocation: "middle",
|
|
1577
1663
|
nameGap: CATEGORY_AXIS_NAME_GAP,
|
|
1578
1664
|
});
|
|
@@ -1604,7 +1690,7 @@ var BasicChart = function (_a) {
|
|
|
1604
1690
|
};
|
|
1605
1691
|
sideBySideBarCount = isStacked
|
|
1606
1692
|
? 1
|
|
1607
|
-
: ((
|
|
1693
|
+
: ((_82 = spec.series) !== null && _82 !== void 0 ? _82 : []).reduce(function (count, s) {
|
|
1608
1694
|
var _a;
|
|
1609
1695
|
var seriesType = (_a = s.seriesChartType) !== null && _a !== void 0 ? _a : spec.chartType;
|
|
1610
1696
|
return seriesType === "bar" || seriesType === "column"
|
|
@@ -1628,29 +1714,29 @@ var BasicChart = function (_a) {
|
|
|
1628
1714
|
return (0, utils_1.chartPaletteColorAt)(seriesPalette, index);
|
|
1629
1715
|
};
|
|
1630
1716
|
_loop_1 = function (specSeriesIndex, series) {
|
|
1631
|
-
var dataLabel,
|
|
1632
|
-
var e_13,
|
|
1633
|
-
return tslib_1.__generator(this, function (
|
|
1634
|
-
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) {
|
|
1635
1721
|
case 0:
|
|
1636
1722
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1637
|
-
|
|
1638
|
-
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)];
|
|
1639
1725
|
case 1:
|
|
1640
|
-
|
|
1726
|
+
_168 = _169.apply(void 0, [_177.sent()]);
|
|
1641
1727
|
return [3 /*break*/, 3];
|
|
1642
1728
|
case 2:
|
|
1643
|
-
|
|
1644
|
-
|
|
1729
|
+
_168 = (_85 = series.dataLabel) !== null && _85 !== void 0 ? _85 : "";
|
|
1730
|
+
_177.label = 3;
|
|
1645
1731
|
case 3:
|
|
1646
|
-
dataLabel =
|
|
1732
|
+
dataLabel = _168;
|
|
1647
1733
|
// Label
|
|
1648
1734
|
if (dataLabel) {
|
|
1649
|
-
(
|
|
1735
|
+
(_86 = legend.data) === null || _86 === void 0 ? void 0 : _86.push(dataLabel);
|
|
1650
1736
|
}
|
|
1651
|
-
effectiveChartType = (
|
|
1737
|
+
effectiveChartType = (_87 = series.seriesChartType) !== null && _87 !== void 0 ? _87 : spec.chartType;
|
|
1652
1738
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1653
|
-
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 : [];
|
|
1654
1740
|
pieDomainLabels = isCircularChart &&
|
|
1655
1741
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
1656
1742
|
? domainSources.flatMap(function (sheetRange) {
|
|
@@ -1682,7 +1768,7 @@ var BasicChart = function (_a) {
|
|
|
1682
1768
|
seriesEntry = tslib_1.__assign(tslib_1.__assign({ type: seriesEchartsType,
|
|
1683
1769
|
// Ties the rendered series back to spec.series for click selection
|
|
1684
1770
|
// One rendered series per spec series (source index 0).
|
|
1685
|
-
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)
|
|
1686
1772
|
? { connectNulls: true }
|
|
1687
1773
|
: {})), seriesStyleAttrs);
|
|
1688
1774
|
// Plot this series against a secondary value axis. The 2nd
|
|
@@ -1707,17 +1793,17 @@ var BasicChart = function (_a) {
|
|
|
1707
1793
|
}
|
|
1708
1794
|
seriesAny = series;
|
|
1709
1795
|
if (effectiveChartType === "line") {
|
|
1710
|
-
markerSymbol = (
|
|
1796
|
+
markerSymbol = (_93 = seriesAny.marker) === null || _93 === void 0 ? void 0 : _93.symbol;
|
|
1711
1797
|
wantsMarkers = markerSymbol === "none"
|
|
1712
1798
|
? false
|
|
1713
1799
|
: Boolean(spec.showMarkers) || !(0, utils_1.isNil)(markerSymbol);
|
|
1714
1800
|
labelsWithoutMarkers = !wantsMarkers &&
|
|
1715
|
-
Boolean((
|
|
1801
|
+
Boolean((_94 = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesAny)) === null || _94 === void 0 ? void 0 : _94.show);
|
|
1716
1802
|
seriesEntry.showSymbol = wantsMarkers || labelsWithoutMarkers;
|
|
1717
1803
|
if (wantsMarkers) {
|
|
1718
1804
|
seriesEntry.symbol =
|
|
1719
|
-
(
|
|
1720
|
-
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;
|
|
1721
1807
|
}
|
|
1722
1808
|
else {
|
|
1723
1809
|
if (labelsWithoutMarkers) {
|
|
@@ -1740,7 +1826,7 @@ var BasicChart = function (_a) {
|
|
|
1740
1826
|
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
1741
1827
|
finally {
|
|
1742
1828
|
try {
|
|
1743
|
-
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);
|
|
1744
1830
|
}
|
|
1745
1831
|
finally { if (e_13) throw e_13.error; }
|
|
1746
1832
|
}
|
|
@@ -1752,9 +1838,9 @@ var BasicChart = function (_a) {
|
|
|
1752
1838
|
gradientArgs = (0, gradient_1.gradientToEcharts)(series.gradient);
|
|
1753
1839
|
if (gradientArgs && !seriesAny.noFill) {
|
|
1754
1840
|
gradient = new echarts.graphic.LinearGradient(gradientArgs.x, gradientArgs.y, gradientArgs.x2, gradientArgs.y2, gradientArgs.colorStops);
|
|
1755
|
-
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 });
|
|
1756
1842
|
if (effectiveChartType === "area") {
|
|
1757
|
-
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 });
|
|
1758
1844
|
}
|
|
1759
1845
|
}
|
|
1760
1846
|
else if (seriesAny.noFill) {
|
|
@@ -1762,15 +1848,15 @@ var BasicChart = function (_a) {
|
|
|
1762
1848
|
// with `transparent` so layout is preserved but nothing
|
|
1763
1849
|
// paints. Legend entries are also suppressed via `name: ""`
|
|
1764
1850
|
// since the series carries no semantic information.
|
|
1765
|
-
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" });
|
|
1766
1852
|
}
|
|
1767
1853
|
else if (isBarOrColumn &&
|
|
1768
1854
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1769
1855
|
seriesAny.dataPointColors.length) {
|
|
1770
1856
|
overrides_2 = new Map();
|
|
1771
1857
|
try {
|
|
1772
|
-
for (
|
|
1773
|
-
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;
|
|
1774
1860
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1775
1861
|
overrides_2.set(dp.idx, dp.color);
|
|
1776
1862
|
}
|
|
@@ -1779,20 +1865,20 @@ var BasicChart = function (_a) {
|
|
|
1779
1865
|
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
1780
1866
|
finally {
|
|
1781
1867
|
try {
|
|
1782
|
-
if (
|
|
1868
|
+
if (_171 && !_171.done && (_175 = _170.return)) _175.call(_170);
|
|
1783
1869
|
}
|
|
1784
1870
|
finally { if (e_14) throw e_14.error; }
|
|
1785
1871
|
}
|
|
1786
|
-
fallback_1 = (
|
|
1787
|
-
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; } });
|
|
1788
1874
|
}
|
|
1789
1875
|
else if (isCircularChart &&
|
|
1790
1876
|
Array.isArray(seriesAny.dataPointColors) &&
|
|
1791
1877
|
seriesAny.dataPointColors.length) {
|
|
1792
1878
|
overrides_3 = new Map();
|
|
1793
1879
|
try {
|
|
1794
|
-
for (
|
|
1795
|
-
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;
|
|
1796
1882
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1797
1883
|
overrides_3.set(dp.idx, dp.color);
|
|
1798
1884
|
}
|
|
@@ -1801,19 +1887,19 @@ var BasicChart = function (_a) {
|
|
|
1801
1887
|
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
1802
1888
|
finally {
|
|
1803
1889
|
try {
|
|
1804
|
-
if (
|
|
1890
|
+
if (_173 && !_173.done && (_176 = _172.return)) _176.call(_172);
|
|
1805
1891
|
}
|
|
1806
1892
|
finally { if (e_15) throw e_15.error; }
|
|
1807
1893
|
}
|
|
1808
|
-
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) {
|
|
1809
1895
|
var _a, _b;
|
|
1810
1896
|
return (_b = (_a = overrides_3.get(params.dataIndex)) !== null && _a !== void 0 ? _a : series.color) !== null && _b !== void 0 ? _b : paletteColorAt(params.dataIndex);
|
|
1811
1897
|
} });
|
|
1812
1898
|
}
|
|
1813
1899
|
else if (isBarOrColumn && series.invertIfNegative) {
|
|
1814
|
-
positiveColor_1 = (
|
|
1815
|
-
negativeColor_1 = (
|
|
1816
|
-
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) {
|
|
1817
1903
|
var _a, _b;
|
|
1818
1904
|
var value = Array.isArray(params.data)
|
|
1819
1905
|
? params.data[1]
|
|
@@ -1824,10 +1910,10 @@ var BasicChart = function (_a) {
|
|
|
1824
1910
|
} });
|
|
1825
1911
|
}
|
|
1826
1912
|
else if (series.color) {
|
|
1827
|
-
seriesEntry.itemStyle = tslib_1.__assign(tslib_1.__assign({}, ((
|
|
1828
|
-
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 });
|
|
1829
1915
|
if (effectiveChartType === "area") {
|
|
1830
|
-
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 });
|
|
1831
1917
|
}
|
|
1832
1918
|
}
|
|
1833
1919
|
chartSeries.push(seriesEntry);
|
|
@@ -1836,24 +1922,24 @@ var BasicChart = function (_a) {
|
|
|
1836
1922
|
}
|
|
1837
1923
|
});
|
|
1838
1924
|
};
|
|
1839
|
-
|
|
1925
|
+
_167.label = 31;
|
|
1840
1926
|
case 31:
|
|
1841
|
-
|
|
1842
|
-
_r = tslib_1.__values(((
|
|
1843
|
-
|
|
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;
|
|
1844
1930
|
case 32:
|
|
1845
1931
|
if (!!_s.done) return [3 /*break*/, 35];
|
|
1846
1932
|
_t = tslib_1.__read(_s.value, 2), specSeriesIndex = _t[0], series = _t[1];
|
|
1847
1933
|
return [5 /*yield**/, _loop_1(specSeriesIndex, series)];
|
|
1848
1934
|
case 33:
|
|
1849
|
-
|
|
1850
|
-
|
|
1935
|
+
_167.sent();
|
|
1936
|
+
_167.label = 34;
|
|
1851
1937
|
case 34:
|
|
1852
1938
|
_s = _r.next();
|
|
1853
1939
|
return [3 /*break*/, 32];
|
|
1854
1940
|
case 35: return [3 /*break*/, 38];
|
|
1855
1941
|
case 36:
|
|
1856
|
-
e_3_1 =
|
|
1942
|
+
e_3_1 = _167.sent();
|
|
1857
1943
|
e_3 = { error: e_3_1 };
|
|
1858
1944
|
return [3 /*break*/, 38];
|
|
1859
1945
|
case 37:
|
|
@@ -1871,7 +1957,7 @@ var BasicChart = function (_a) {
|
|
|
1871
1957
|
}
|
|
1872
1958
|
if (isOfPie) {
|
|
1873
1959
|
labels = rawPrimaryDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1874
|
-
seriesEntry = (
|
|
1960
|
+
seriesEntry = (_110 = spec.series) === null || _110 === void 0 ? void 0 : _110[0];
|
|
1875
1961
|
rawValues = seriesEntry
|
|
1876
1962
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
1877
1963
|
: [];
|
|
@@ -1918,7 +2004,7 @@ var BasicChart = function (_a) {
|
|
|
1918
2004
|
};
|
|
1919
2005
|
chartSeries.push({
|
|
1920
2006
|
type: "pie",
|
|
1921
|
-
name: (
|
|
2007
|
+
name: (_111 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _111 !== void 0 ? _111 : "",
|
|
1922
2008
|
center: ["".concat(MAIN_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
1923
2009
|
radius: [0, "".concat(MAIN_RADIUS_PCT_1, "%")],
|
|
1924
2010
|
// Rotate the pie so the "Other" slice's angular midpoint faces
|
|
@@ -1936,7 +2022,7 @@ var BasicChart = function (_a) {
|
|
|
1936
2022
|
if (ofPieType_1 === "pie") {
|
|
1937
2023
|
chartSeries.push({
|
|
1938
2024
|
type: "pie",
|
|
1939
|
-
name: (
|
|
2025
|
+
name: (_112 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _112 !== void 0 ? _112 : "",
|
|
1940
2026
|
center: ["".concat(SECONDARY_CX_1 * 100, "%"), "".concat(CY_1 * 100, "%")],
|
|
1941
2027
|
radius: [0, "".concat(secondaryRadiusPct_1, "%")],
|
|
1942
2028
|
data: secondary.map(function (s, i) { return ({
|
|
@@ -2031,16 +2117,16 @@ var BasicChart = function (_a) {
|
|
|
2031
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);
|
|
2032
2118
|
}
|
|
2033
2119
|
else if (spec.chartType === "waterfall") {
|
|
2034
|
-
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];
|
|
2035
2121
|
rawDomainValues = primaryDomainSource_1
|
|
2036
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2122
|
+
? (0, aggregation_1.sanitizeDomainValues)((_116 = getDomainValuesFromRange(primaryDomainSource_1, spec.hiddenDimensionStrategy)) !== null && _116 !== void 0 ? _116 : [])
|
|
2037
2123
|
: [];
|
|
2038
2124
|
labels = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2039
|
-
seriesEntry = (
|
|
2125
|
+
seriesEntry = (_117 = spec.series) === null || _117 === void 0 ? void 0 : _117[0];
|
|
2040
2126
|
rawValues_1 = seriesEntry
|
|
2041
2127
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
2042
2128
|
: [];
|
|
2043
|
-
totalIndices = new Set((
|
|
2129
|
+
totalIndices = new Set((_118 = spec.totalIndices) !== null && _118 !== void 0 ? _118 : []);
|
|
2044
2130
|
steps = (0, waterfall_1.computeWaterfall)(rawValues_1, labels, totalIndices);
|
|
2045
2131
|
chartDomains.length = 0;
|
|
2046
2132
|
chartDomains.push({
|
|
@@ -2050,7 +2136,7 @@ var BasicChart = function (_a) {
|
|
|
2050
2136
|
axisLine: { show: true },
|
|
2051
2137
|
axisTick: { show: true },
|
|
2052
2138
|
splitLine: { show: false },
|
|
2053
|
-
name: (
|
|
2139
|
+
name: (_119 = spec.horizontalAxisTitle) !== null && _119 !== void 0 ? _119 : "",
|
|
2054
2140
|
nameLocation: "middle",
|
|
2055
2141
|
nameGap: 30,
|
|
2056
2142
|
});
|
|
@@ -2067,12 +2153,12 @@ var BasicChart = function (_a) {
|
|
|
2067
2153
|
label: { show: false },
|
|
2068
2154
|
tooltip: { show: false },
|
|
2069
2155
|
});
|
|
2070
|
-
accent_1 = (
|
|
2071
|
-
decreaseColor_1 = (
|
|
2072
|
-
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;
|
|
2073
2159
|
pointColors_1 = new Map();
|
|
2074
2160
|
try {
|
|
2075
|
-
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()) {
|
|
2076
2162
|
dp = _w.value;
|
|
2077
2163
|
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2078
2164
|
pointColors_1.set(dp.idx, dp.color);
|
|
@@ -2094,7 +2180,7 @@ var BasicChart = function (_a) {
|
|
|
2094
2180
|
type: "bar",
|
|
2095
2181
|
id: (0, series_click_1.chartSeriesId)(0, 0),
|
|
2096
2182
|
stack: "waterfall",
|
|
2097
|
-
name: (
|
|
2183
|
+
name: (_125 = seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.dataLabel) !== null && _125 !== void 0 ? _125 : "",
|
|
2098
2184
|
// A bar's height is the step's magnitude; the signed source value
|
|
2099
2185
|
// rides along as `originalValue` so labels and tooltips read
|
|
2100
2186
|
// "-90" for a decrease, like Excel.
|
|
@@ -2128,12 +2214,12 @@ var BasicChart = function (_a) {
|
|
|
2128
2214
|
legend.data = [];
|
|
2129
2215
|
}
|
|
2130
2216
|
else if (spec.chartType === "funnel") {
|
|
2131
|
-
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];
|
|
2132
2218
|
rawDomainValues = primaryDomainSource_2
|
|
2133
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
2219
|
+
? (0, aggregation_1.sanitizeDomainValues)((_129 = getDomainValuesFromRange(primaryDomainSource_2, spec.hiddenDimensionStrategy)) !== null && _129 !== void 0 ? _129 : [])
|
|
2134
2220
|
: [];
|
|
2135
2221
|
labels_1 = rawDomainValues.map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
2136
|
-
seriesEntry = (
|
|
2222
|
+
seriesEntry = (_130 = spec.series) === null || _130 === void 0 ? void 0 : _130[0];
|
|
2137
2223
|
rawValues = seriesEntry
|
|
2138
2224
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : 0); })
|
|
2139
2225
|
: [];
|
|
@@ -2147,10 +2233,10 @@ var BasicChart = function (_a) {
|
|
|
2147
2233
|
theme.themeColors.accent5,
|
|
2148
2234
|
theme.themeColors.accent6,
|
|
2149
2235
|
]);
|
|
2150
|
-
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);
|
|
2151
2237
|
stageColors_1 = new Map();
|
|
2152
2238
|
try {
|
|
2153
|
-
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()) {
|
|
2154
2240
|
dp = _y.value;
|
|
2155
2241
|
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
2156
2242
|
stageColors_1.set(dp.idx, dp.color);
|
|
@@ -2178,7 +2264,7 @@ var BasicChart = function (_a) {
|
|
|
2178
2264
|
top: 60,
|
|
2179
2265
|
bottom: 20,
|
|
2180
2266
|
};
|
|
2181
|
-
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: {
|
|
2182
2268
|
color: function (params) { var _a; return (_a = stageColors_1.get(params.dataIndex)) !== null && _a !== void 0 ? _a : funnelColor_1; },
|
|
2183
2269
|
}, label: {
|
|
2184
2270
|
show: true,
|
|
@@ -2201,7 +2287,7 @@ var BasicChart = function (_a) {
|
|
|
2201
2287
|
outlierPoints = [];
|
|
2202
2288
|
meanPoints = [];
|
|
2203
2289
|
try {
|
|
2204
|
-
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()) {
|
|
2205
2291
|
seriesEntry = _0.value;
|
|
2206
2292
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
2207
2293
|
? seriesEntry.dataLabel
|
|
@@ -2250,7 +2336,7 @@ var BasicChart = function (_a) {
|
|
|
2250
2336
|
axisLine: { show: true },
|
|
2251
2337
|
axisTick: { show: true },
|
|
2252
2338
|
splitLine: { show: false },
|
|
2253
|
-
name: (
|
|
2339
|
+
name: (_135 = spec.horizontalAxisTitle) !== null && _135 !== void 0 ? _135 : "",
|
|
2254
2340
|
nameLocation: "middle",
|
|
2255
2341
|
nameGap: 30,
|
|
2256
2342
|
});
|
|
@@ -2260,7 +2346,7 @@ var BasicChart = function (_a) {
|
|
|
2260
2346
|
name: "",
|
|
2261
2347
|
data: boxStats,
|
|
2262
2348
|
};
|
|
2263
|
-
boxColor = (
|
|
2349
|
+
boxColor = (_137 = (_136 = spec.series) === null || _136 === void 0 ? void 0 : _136[0]) === null || _137 === void 0 ? void 0 : _137.color;
|
|
2264
2350
|
if (boxColor) {
|
|
2265
2351
|
boxSeries.itemStyle = { color: boxColor, borderColor: boxColor };
|
|
2266
2352
|
}
|
|
@@ -2275,7 +2361,18 @@ var BasicChart = function (_a) {
|
|
|
2275
2361
|
}
|
|
2276
2362
|
else if (spec.chartType === "histogram") {
|
|
2277
2363
|
rawValues = flattenChartDataValues(spec.series, getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
2278
|
-
|
|
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;
|
|
2279
2376
|
isPareto_1 = (0, histogram_1.isParetoSpec)(spec);
|
|
2280
2377
|
cumulativePercents = [];
|
|
2281
2378
|
if (isPareto_1) {
|
|
@@ -2292,34 +2389,32 @@ var BasicChart = function (_a) {
|
|
|
2292
2389
|
axisLine: { show: true },
|
|
2293
2390
|
axisTick: { show: true },
|
|
2294
2391
|
splitLine: { show: false },
|
|
2295
|
-
name: (
|
|
2392
|
+
name: (_145 = spec.horizontalAxisTitle) !== null && _145 !== void 0 ? _145 : "",
|
|
2296
2393
|
nameLocation: "middle",
|
|
2297
2394
|
nameGap: 30,
|
|
2298
2395
|
});
|
|
2299
2396
|
chartSeries.length = 0;
|
|
2300
2397
|
histogramSeries = {
|
|
2301
2398
|
type: "bar",
|
|
2302
|
-
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 : "",
|
|
2303
2400
|
data: counts,
|
|
2304
|
-
|
|
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%",
|
|
2305
2404
|
};
|
|
2306
|
-
histogramColor = (
|
|
2405
|
+
histogramColor = (_152 = (_151 = spec.series) === null || _151 === void 0 ? void 0 : _151[0]) === null || _152 === void 0 ? void 0 : _152.color;
|
|
2307
2406
|
if (histogramColor) {
|
|
2308
2407
|
histogramSeries.itemStyle = { color: histogramColor };
|
|
2309
2408
|
}
|
|
2310
2409
|
chartSeries.push(histogramSeries);
|
|
2311
2410
|
if (isPareto_1) {
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
yAxisIndex: 1,
|
|
2320
|
-
symbol: "circle",
|
|
2321
|
-
symbolSize: 6,
|
|
2322
|
-
});
|
|
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
|
+
: {})));
|
|
2323
2418
|
}
|
|
2324
2419
|
legend.data = [];
|
|
2325
2420
|
}
|
|
@@ -2340,20 +2435,20 @@ var BasicChart = function (_a) {
|
|
|
2340
2435
|
isPareto = spec.chartType === "histogram" && (0, histogram_1.isParetoSpec)(spec);
|
|
2341
2436
|
hasSecondaryAxis = !isCircularChart &&
|
|
2342
2437
|
!isHorizontalBarChart &&
|
|
2343
|
-
(((
|
|
2438
|
+
(((_153 = spec.series) !== null && _153 !== void 0 ? _153 : []).some(function (s) { return s.useSecondaryAxis; }) || isPareto);
|
|
2344
2439
|
isPercentStackedBars = spec.stackedType === "PERCENT_STACKED" &&
|
|
2345
2440
|
(spec.chartType === "bar" || spec.chartType === "column");
|
|
2346
2441
|
primaryAxisNumberFormat = isPercentStackedBars
|
|
2347
2442
|
? undefined
|
|
2348
2443
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2349
2444
|
axisOptions: spec.valueAxisOptions,
|
|
2350
|
-
series: ((
|
|
2445
|
+
series: ((_154 = spec.series) !== null && _154 !== void 0 ? _154 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
2351
2446
|
getFormattingFromRange: getFormattingFromRange,
|
|
2352
2447
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2353
2448
|
});
|
|
2354
2449
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
2355
2450
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
2356
|
-
series: ((
|
|
2451
|
+
series: ((_155 = spec.series) !== null && _155 !== void 0 ? _155 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
2357
2452
|
getFormattingFromRange: getFormattingFromRange,
|
|
2358
2453
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
2359
2454
|
});
|
|
@@ -2382,17 +2477,17 @@ var BasicChart = function (_a) {
|
|
|
2382
2477
|
finalLegend = (0, overrides_1.applyLegendOverrides)(legend, spec.legend);
|
|
2383
2478
|
bottomAxisNameGap = isHorizontalBarChart
|
|
2384
2479
|
? valueAxisBase.nameGap
|
|
2385
|
-
: Number((
|
|
2480
|
+
: Number((_157 = (_156 = chartDomains[0]) === null || _156 === void 0 ? void 0 : _156.nameGap) !== null && _157 !== void 0 ? _157 : CATEGORY_AXIS_NAME_GAP);
|
|
2386
2481
|
legendBand = (0, legend_layout_1.reserveEchartsLegendBand)({
|
|
2387
|
-
position: (
|
|
2482
|
+
position: (_158 = spec.legend) === null || _158 === void 0 ? void 0 : _158.position,
|
|
2388
2483
|
visible: finalLegend.show !== false,
|
|
2389
2484
|
labels: (0, legend_layout_1.legendLabelsFrom)(finalLegend.data, chartSeries.map(function (s) { return s === null || s === void 0 ? void 0 : s.name; })),
|
|
2390
|
-
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,
|
|
2391
2486
|
legendItemWidth: defaultLegendConfig.itemWidth,
|
|
2392
2487
|
width: width !== null && width !== void 0 ? width : 0,
|
|
2393
2488
|
height: height !== null && height !== void 0 ? height : 0,
|
|
2394
2489
|
hasTitle: Boolean(title),
|
|
2395
|
-
titleFontSize: (
|
|
2490
|
+
titleFontSize: (_165 = (_164 = spec.titleTextFormat) === null || _164 === void 0 ? void 0 : _164.fontSize) !== null && _165 !== void 0 ? _165 : 16,
|
|
2396
2491
|
hasBottomAxisTitle: !isCircularChart && Boolean(spec.horizontalAxisTitle),
|
|
2397
2492
|
bottomAxisNameGap: bottomAxisNameGap,
|
|
2398
2493
|
hasLeftAxisTitle: !isCircularChart && Boolean(spec.verticalAxisTitle),
|
|
@@ -2562,7 +2657,7 @@ var BasicChart = function (_a) {
|
|
|
2562
2657
|
return next;
|
|
2563
2658
|
});
|
|
2564
2659
|
// Update charts
|
|
2565
|
-
(
|
|
2660
|
+
(_166 = chartRef.current) === null || _166 === void 0 ? void 0 : _166.setOption({
|
|
2566
2661
|
xAxis: (function () {
|
|
2567
2662
|
var _a, _b;
|
|
2568
2663
|
if (isOfPie) {
|