@rowsncolumns/charts 28.1.6 → 28.1.8
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 +1 -1
- package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/basic-chart/basic-chart.js +207 -152
- package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +5 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +169 -96
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils/axis-number-format.d.ts +26 -7
- package/dist/cjs/utils/axis-number-format.d.ts.map +1 -1
- package/dist/cjs/utils/axis-number-format.js +94 -16
- package/dist/cjs/utils/doughnut.d.ts +19 -0
- package/dist/cjs/utils/doughnut.d.ts.map +1 -0
- package/dist/cjs/utils/doughnut.js +28 -0
- package/dist/cjs/utils/overrides.d.ts +12 -3
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +41 -16
- package/dist/cjs/utils/radar.d.ts +31 -5
- package/dist/cjs/utils/radar.d.ts.map +1 -1
- package/dist/cjs/utils/radar.js +67 -27
- package/dist/esm/basic-chart/basic-chart.d.ts +1 -1
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +129 -63
- package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +5 -1
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +99 -23
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/axis-number-format.d.ts +26 -7
- package/dist/esm/utils/axis-number-format.d.ts.map +1 -1
- package/dist/esm/utils/axis-number-format.js +83 -13
- package/dist/esm/utils/doughnut.d.ts +19 -0
- package/dist/esm/utils/doughnut.d.ts.map +1 -0
- package/dist/esm/utils/doughnut.js +21 -0
- package/dist/esm/utils/overrides.d.ts +12 -3
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +40 -16
- package/dist/esm/utils/radar.d.ts +31 -5
- package/dist/esm/utils/radar.d.ts.map +1 -1
- package/dist/esm/utils/radar.js +44 -16
- package/package.json +4 -4
|
@@ -21,6 +21,8 @@ var error_bars_1 = require("../../utils/error-bars");
|
|
|
21
21
|
var category_levels_1 = require("../../utils/category-levels");
|
|
22
22
|
var gradient_1 = require("../../utils/gradient");
|
|
23
23
|
var legend_layout_1 = require("../../utils/legend-layout");
|
|
24
|
+
var doughnut_1 = require("../../utils/doughnut");
|
|
25
|
+
var overrides_1 = require("../../utils/overrides");
|
|
24
26
|
var plotly_title_1 = require("../../utils/plotly-title");
|
|
25
27
|
var pie_explosion_1 = require("../../utils/pie-explosion");
|
|
26
28
|
var plotly_click_1 = require("../../utils/plotly-click");
|
|
@@ -181,15 +183,45 @@ var PLOTLY_DLBL_POS_BAR = {
|
|
|
181
183
|
insideEnd: "inside",
|
|
182
184
|
outsideEnd: "outside",
|
|
183
185
|
bestFit: "outside",
|
|
186
|
+
above: "outside",
|
|
187
|
+
below: "outside",
|
|
188
|
+
left: "outside",
|
|
189
|
+
right: "outside",
|
|
184
190
|
};
|
|
185
|
-
|
|
191
|
+
// A scatter trace (line / area / scatter) places its text with the compass
|
|
192
|
+
// positions, and only draws it when `mode` carries `text`. Excel's line
|
|
193
|
+
// placements are centre / left / right / above / below; the bar-only ones
|
|
194
|
+
// land on Excel's default for a line, above the point (#1049).
|
|
195
|
+
var PLOTLY_DLBL_POS_POINT = {
|
|
196
|
+
center: "middle center",
|
|
197
|
+
inside: "middle center",
|
|
198
|
+
outside: "top center",
|
|
199
|
+
insideEnd: "top center",
|
|
200
|
+
outsideEnd: "top center",
|
|
201
|
+
bestFit: "top center",
|
|
202
|
+
above: "top center",
|
|
203
|
+
below: "bottom center",
|
|
204
|
+
left: "middle left",
|
|
205
|
+
right: "middle right",
|
|
206
|
+
};
|
|
207
|
+
var withTextMode = function (mode) {
|
|
208
|
+
var base = typeof mode === "string" && mode ? mode : "lines+markers";
|
|
209
|
+
return base.split("+").includes("text") ? base : "".concat(base, "+text");
|
|
210
|
+
};
|
|
211
|
+
var applyDataLabelsToTracePlotly = function (trace, opts, chartType, sourceNumberFormat, locale) {
|
|
186
212
|
var _a, _b, _c;
|
|
187
213
|
if (!(opts === null || opts === void 0 ? void 0 : opts.show))
|
|
188
214
|
return trace;
|
|
189
215
|
var next = tslib_1.__assign({}, trace);
|
|
190
216
|
var isCircular = chartType === "pie" || chartType === "doughnut";
|
|
191
|
-
var
|
|
192
|
-
var
|
|
217
|
+
var isPoint = !isCircular && next.type === "scatter";
|
|
218
|
+
var posMap = isCircular
|
|
219
|
+
? PLOTLY_DLBL_POS_PIE
|
|
220
|
+
: isPoint
|
|
221
|
+
? PLOTLY_DLBL_POS_POINT
|
|
222
|
+
: PLOTLY_DLBL_POS_BAR;
|
|
223
|
+
var fallback = isPoint ? "top center" : "inside";
|
|
224
|
+
var position = opts.position ? (_a = posMap[opts.position]) !== null && _a !== void 0 ? _a : fallback : fallback;
|
|
193
225
|
if (isCircular) {
|
|
194
226
|
// Plotly's pie trace uses `textinfo` to control which fields render.
|
|
195
227
|
var parts = [];
|
|
@@ -207,7 +239,9 @@ var applyDataLabelsToTracePlotly = function (trace, opts, chartType, sourceNumbe
|
|
|
207
239
|
var pattern_1 = (_b = opts.numberFormatPattern) !== null && _b !== void 0 ? _b : sourceNumberFormat;
|
|
208
240
|
if (pattern_1) {
|
|
209
241
|
var values = Array.isArray(next.values) ? next.values : [];
|
|
210
|
-
next.text = values.map(function (v) {
|
|
242
|
+
next.text = values.map(function (v) {
|
|
243
|
+
return (0, axis_number_format_1.formatAxisValue)(pattern_1, v, locale);
|
|
244
|
+
});
|
|
211
245
|
next.texttemplate = next.textinfo
|
|
212
246
|
.split("+")
|
|
213
247
|
.map(function (part) { return (part === "value" ? "%{text}" : "%{".concat(part, "}")); })
|
|
@@ -226,9 +260,15 @@ var applyDataLabelsToTracePlotly = function (trace, opts, chartType, sourceNumbe
|
|
|
226
260
|
var values = next.orientation === "h" ? next.x : next.y;
|
|
227
261
|
var vals = Array.isArray(values) ? values : [];
|
|
228
262
|
next.text = pattern_2
|
|
229
|
-
? vals.map(function (v) {
|
|
230
|
-
|
|
263
|
+
? vals.map(function (v) {
|
|
264
|
+
return v === null || v === undefined ? "" : (0, utils_1.ssfFormat)(pattern_2, v, locale);
|
|
265
|
+
})
|
|
266
|
+
: locale
|
|
267
|
+
? vals.map(function (v) { return (0, axis_number_format_1.formatAxisValue)(undefined, v, locale); })
|
|
268
|
+
: values;
|
|
231
269
|
next.textposition = position;
|
|
270
|
+
if (isPoint)
|
|
271
|
+
next.mode = withTextMode(next.mode);
|
|
232
272
|
}
|
|
233
273
|
return next;
|
|
234
274
|
};
|
|
@@ -369,7 +409,7 @@ var addAlphaToColor = function (color, alpha) {
|
|
|
369
409
|
};
|
|
370
410
|
var BasicChart = function (_a) {
|
|
371
411
|
var _b;
|
|
372
|
-
var width = _a.width, height = _a.height, chart = _a.chart, theme = _a.theme, isDarkMode = _a.isDarkMode, sheetId = _a.sheetId, readonly = _a.readonly, getDomainValuesFromRange = _a.getDomainValuesFromRange, getSeriesValuesFromRange = _a.getSeriesValuesFromRange, getFormattingFromRange = _a.getFormattingFromRange, onDeleteChart = _a.onDeleteChart, onUpdateChart = _a.onUpdateChart, onRequestEdit = _a.onRequestEdit, onRequestCalculate = _a.onRequestCalculate, isSelected = _a.isSelected, fieldButtons = _a.fieldButtons;
|
|
412
|
+
var width = _a.width, height = _a.height, chart = _a.chart, theme = _a.theme, isDarkMode = _a.isDarkMode, sheetId = _a.sheetId, readonly = _a.readonly, getDomainValuesFromRange = _a.getDomainValuesFromRange, getSeriesValuesFromRange = _a.getSeriesValuesFromRange, getFormattingFromRange = _a.getFormattingFromRange, onDeleteChart = _a.onDeleteChart, onUpdateChart = _a.onUpdateChart, onRequestEdit = _a.onRequestEdit, onRequestCalculate = _a.onRequestCalculate, isSelected = _a.isSelected, fieldButtons = _a.fieldButtons, locale = _a.locale;
|
|
373
413
|
var spec = chart.spec;
|
|
374
414
|
var hierarchyTitleRef = (0, react_1.useRef)(undefined);
|
|
375
415
|
var explicitChartTitle = (_b = chart.spec.title) !== null && _b !== void 0 ? _b : undefined;
|
|
@@ -453,11 +493,11 @@ var BasicChart = function (_a) {
|
|
|
453
493
|
* Triggers a chart update
|
|
454
494
|
*/
|
|
455
495
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
456
|
-
var traces, chartType, position, isBubble, isHierarchy, textColor, bgColor, gridColor, skipHeaders_1, labels, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _a, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _b, categories_1, preparedSeries, sizeValues, sizeScale_1, hasStringX_1, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLayout, hierarchyRows, headerTitle, hierarchyData, seriesName, hierarchyTrace, layoutForHierarchy, labels, seriesEntry, rawValues_1, locations_1, z_1, ramp_1, colorscale, geoScope, regionTrace, surfaceToken, categories, surfaceSeriesInputs, _c, _d, seriesEntry, dataLabel, _e, _f, values, e_2_1, seriesNames, surfaceTrace, surfaceLayout, categories, radarStyle, radarTraces, radarInputs, _g, _h, seriesEntry, label, values, indicators, _loop_1, i,
|
|
496
|
+
var traces, chartType, position, isBubble, isHierarchy, textColor, bgColor, gridColor, skipHeaders_1, labels, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _a, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _b, categories_1, preparedSeries, sizeValues, sizeScale_1, hasStringX_1, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLayout, hierarchyRows, headerTitle, hierarchyData, seriesName, hierarchyTrace, layoutForHierarchy, labels, seriesEntry, rawValues_1, locations_1, z_1, ramp_1, colorscale, geoScope, regionTrace, surfaceToken, categories, surfaceSeriesInputs, _c, _d, seriesEntry, dataLabel, _e, _f, values, e_2_1, seriesNames, surfaceTrace, surfaceLayout, categories, radarStyle, radarTraces, radarInputs, _g, _h, seriesEntry, label, values, radarAxisOptions, indicators, _loop_1, i, radarScale, variant, categories, seriesValues, volumePoints_1, hasVolume, buildVolumeTrace, volumeLayout, priceYAxisDomain, roles, xs_1, candleTrace, lineSeries, stockPalette_1, xs_2, stockTraces, isStacked, isHorizontalBarChart, lineTraceVariant, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, domainData, categoryLevels, multicategoryX, aggregateDomainValues, domainAxisData, secondaryDomainData, categoriesFor, assignCartesianData, themeColorPalette, applyTraceColor, hasSecondaryAxis, hasSecondaryCategoryAxis, valueAxisKey, categoryAxisKey, secondaryValueAxisRef, secondaryCategoryAxisRef, isPareto, isOfPie, ofPieHandled, ofPieExtras, decorateCartesianTrace, domainSources, seriesIndex, _loop_2, _j, _k, series, e_3_1, authoredTitleFmt, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, _l, legendOverrides, showlegend, axisFontSize, primaryValues, leftAxisLabelDepth, leftAxisDepth, rightAxisDepth, bottomAxisTitleStandoff, legendBand, newLayout, dlOpts, doughnutSeriesOrder, doughnutRingSet, traceDataLabels, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
|
|
457
497
|
var e_2, _m, e_4, _o, e_3, _p, _q, _r;
|
|
458
|
-
var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75;
|
|
459
|
-
return tslib_1.__generator(this, function (
|
|
460
|
-
switch (
|
|
498
|
+
var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76;
|
|
499
|
+
return tslib_1.__generator(this, function (_77) {
|
|
500
|
+
switch (_77.label) {
|
|
461
501
|
case 0:
|
|
462
502
|
(0, utils_1.debug)("Updating chart", chart);
|
|
463
503
|
traces = [];
|
|
@@ -482,7 +522,7 @@ var BasicChart = function (_a) {
|
|
|
482
522
|
});
|
|
483
523
|
seriesInputs = [];
|
|
484
524
|
i = 0;
|
|
485
|
-
|
|
525
|
+
_77.label = 1;
|
|
486
526
|
case 1:
|
|
487
527
|
if (!(i < spec.series.length)) return [3 /*break*/, 5];
|
|
488
528
|
seriesEntry = spec.series[i];
|
|
@@ -491,13 +531,13 @@ var BasicChart = function (_a) {
|
|
|
491
531
|
_a = chart_spec_utils_1.coerceCalculatedLabel;
|
|
492
532
|
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (_w = chart.position.sheetId) !== null && _w !== void 0 ? _w : sheetId, chart.position.overlayPosition.anchorCell.rowIndex, chart.position.overlayPosition.anchorCell.columnIndex)];
|
|
493
533
|
case 2:
|
|
494
|
-
resolvedLabel = _a.apply(void 0, [
|
|
495
|
-
|
|
534
|
+
resolvedLabel = _a.apply(void 0, [_77.sent()]);
|
|
535
|
+
_77.label = 3;
|
|
496
536
|
case 3:
|
|
497
537
|
xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
|
|
498
538
|
sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
|
|
499
539
|
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 } : {})));
|
|
500
|
-
|
|
540
|
+
_77.label = 4;
|
|
501
541
|
case 4:
|
|
502
542
|
i++;
|
|
503
543
|
return [3 /*break*/, 1];
|
|
@@ -772,11 +812,11 @@ var BasicChart = function (_a) {
|
|
|
772
812
|
if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
|
|
773
813
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
774
814
|
surfaceSeriesInputs = [];
|
|
775
|
-
|
|
815
|
+
_77.label = 7;
|
|
776
816
|
case 7:
|
|
777
|
-
|
|
817
|
+
_77.trys.push([7, 14, 15, 16]);
|
|
778
818
|
_c = tslib_1.__values((_18 = spec.series) !== null && _18 !== void 0 ? _18 : []), _d = _c.next();
|
|
779
|
-
|
|
819
|
+
_77.label = 8;
|
|
780
820
|
case 8:
|
|
781
821
|
if (!!_d.done) return [3 /*break*/, 13];
|
|
782
822
|
seriesEntry = _d.value;
|
|
@@ -784,22 +824,22 @@ var BasicChart = function (_a) {
|
|
|
784
824
|
_f = chart_spec_utils_1.coerceCalculatedLabel;
|
|
785
825
|
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_19 = position.sheetId) !== null && _19 !== void 0 ? _19 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
786
826
|
case 9:
|
|
787
|
-
_e = _f.apply(void 0, [
|
|
827
|
+
_e = _f.apply(void 0, [_77.sent()]);
|
|
788
828
|
return [3 /*break*/, 11];
|
|
789
829
|
case 10:
|
|
790
830
|
_e = (_20 = seriesEntry.dataLabel) !== null && _20 !== void 0 ? _20 : "";
|
|
791
|
-
|
|
831
|
+
_77.label = 11;
|
|
792
832
|
case 11:
|
|
793
833
|
dataLabel = _e;
|
|
794
834
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
795
835
|
surfaceSeriesInputs.push({ name: dataLabel, values: values });
|
|
796
|
-
|
|
836
|
+
_77.label = 12;
|
|
797
837
|
case 12:
|
|
798
838
|
_d = _c.next();
|
|
799
839
|
return [3 /*break*/, 8];
|
|
800
840
|
case 13: return [3 /*break*/, 16];
|
|
801
841
|
case 14:
|
|
802
|
-
e_2_1 =
|
|
842
|
+
e_2_1 = _77.sent();
|
|
803
843
|
e_2 = { error: e_2_1 };
|
|
804
844
|
return [3 /*break*/, 16];
|
|
805
845
|
case 15:
|
|
@@ -873,7 +913,8 @@ var BasicChart = function (_a) {
|
|
|
873
913
|
}
|
|
874
914
|
finally { if (e_4) throw e_4.error; }
|
|
875
915
|
}
|
|
876
|
-
|
|
916
|
+
radarAxisOptions = spec.valueAxisOptions;
|
|
917
|
+
indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
|
|
877
918
|
_loop_1 = function (i) {
|
|
878
919
|
var input = radarInputs[i];
|
|
879
920
|
var seriesColor = (_29 = (_28 = (_27 = spec.series) === null || _27 === void 0 ? void 0 : _27[i]) === null || _28 === void 0 ? void 0 : _28.color) !== null && _29 !== void 0 ? _29 : undefined;
|
|
@@ -884,7 +925,7 @@ var BasicChart = function (_a) {
|
|
|
884
925
|
for (i = 0; i < radarInputs.length; i++) {
|
|
885
926
|
_loop_1(i);
|
|
886
927
|
}
|
|
887
|
-
|
|
928
|
+
radarScale = (_30 = indicators[0]) !== null && _30 !== void 0 ? _30 : { min: 0, max: 1 };
|
|
888
929
|
setPlotData(radarTraces);
|
|
889
930
|
setLayout({
|
|
890
931
|
title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) },
|
|
@@ -894,8 +935,8 @@ var BasicChart = function (_a) {
|
|
|
894
935
|
showlegend: radarTraces.length > 1,
|
|
895
936
|
polar: {
|
|
896
937
|
radialaxis: {
|
|
897
|
-
visible:
|
|
898
|
-
range: [
|
|
938
|
+
visible: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
|
|
939
|
+
range: [radarScale.min, radarScale.max],
|
|
899
940
|
},
|
|
900
941
|
},
|
|
901
942
|
margin: { l: 50, r: 50, t: 50, b: 50 },
|
|
@@ -908,13 +949,13 @@ var BasicChart = function (_a) {
|
|
|
908
949
|
// V-variants additionally get a volume column sub-pane below the
|
|
909
950
|
// price plot.
|
|
910
951
|
if (spec.chartType === "stock") {
|
|
911
|
-
variant = ((
|
|
952
|
+
variant = ((_31 = spec.stockVariant) !== null && _31 !== void 0 ? _31 : "HLC");
|
|
912
953
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
913
|
-
seriesValues = ((
|
|
954
|
+
seriesValues = ((_32 = spec.series) !== null && _32 !== void 0 ? _32 : []).map(function (seriesEntry) {
|
|
914
955
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
915
956
|
});
|
|
916
957
|
volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
|
|
917
|
-
hasVolume = ((
|
|
958
|
+
hasVolume = ((_33 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _33 !== void 0 ? _33 : 0) > 0;
|
|
918
959
|
buildVolumeTrace = function (xs) {
|
|
919
960
|
return ({
|
|
920
961
|
type: "bar",
|
|
@@ -947,25 +988,25 @@ var BasicChart = function (_a) {
|
|
|
947
988
|
roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
|
|
948
989
|
xs_1 = categories.length > 0
|
|
949
990
|
? categories
|
|
950
|
-
: ((
|
|
991
|
+
: ((_34 = roles.close) !== null && _34 !== void 0 ? _34 : []).map(function (_, i) { return i + 1; });
|
|
951
992
|
candleTrace = {
|
|
952
993
|
type: "candlestick",
|
|
953
994
|
x: xs_1,
|
|
954
|
-
open: ((
|
|
955
|
-
high: ((
|
|
956
|
-
low: ((
|
|
957
|
-
close: ((
|
|
995
|
+
open: ((_35 = roles.open) !== null && _35 !== void 0 ? _35 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
996
|
+
high: ((_36 = roles.high) !== null && _36 !== void 0 ? _36 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
997
|
+
low: ((_37 = roles.low) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
998
|
+
close: ((_38 = roles.close) !== null && _38 !== void 0 ? _38 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
958
999
|
increasing: { line: { color: theme.themeColors.accent1 } },
|
|
959
1000
|
decreasing: { line: { color: theme.themeColors.accent2 } },
|
|
960
1001
|
};
|
|
961
1002
|
setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
|
|
962
1003
|
setLayout(tslib_1.__assign(tslib_1.__assign({ title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) }, font: { color: textColor }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, xaxis: {
|
|
963
|
-
title: { text: (
|
|
1004
|
+
title: { text: (_39 = spec.horizontalAxisTitle) !== null && _39 !== void 0 ? _39 : "" },
|
|
964
1005
|
automargin: true,
|
|
965
1006
|
showgrid: true,
|
|
966
1007
|
gridcolor: gridColor,
|
|
967
1008
|
rangeslider: { visible: false },
|
|
968
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
1009
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_40 = spec.verticalAxisTitle) !== null && _40 !== void 0 ? _40 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
969
1010
|
return [2 /*return*/];
|
|
970
1011
|
}
|
|
971
1012
|
lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
|
|
@@ -977,7 +1018,7 @@ var BasicChart = function (_a) {
|
|
|
977
1018
|
]);
|
|
978
1019
|
xs_2 = categories.length > 0
|
|
979
1020
|
? categories
|
|
980
|
-
: ((
|
|
1021
|
+
: ((_42 = (_41 = lineSeries[0]) === null || _41 === void 0 ? void 0 : _41.values) !== null && _42 !== void 0 ? _42 : []).map(function (_, i) { return i + 1; });
|
|
981
1022
|
stockTraces = lineSeries.map(function (s, i) { return ({
|
|
982
1023
|
type: "scatter",
|
|
983
1024
|
mode: "lines",
|
|
@@ -988,11 +1029,11 @@ var BasicChart = function (_a) {
|
|
|
988
1029
|
}); });
|
|
989
1030
|
setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
|
|
990
1031
|
setLayout(tslib_1.__assign(tslib_1.__assign({ title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) }, font: { color: textColor }, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: stockTraces.length > 1, xaxis: {
|
|
991
|
-
title: { text: (
|
|
1032
|
+
title: { text: (_43 = spec.horizontalAxisTitle) !== null && _43 !== void 0 ? _43 : "" },
|
|
992
1033
|
automargin: true,
|
|
993
1034
|
showgrid: true,
|
|
994
1035
|
gridcolor: gridColor,
|
|
995
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
1036
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_44 = spec.verticalAxisTitle) !== null && _44 !== void 0 ? _44 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
996
1037
|
return [2 /*return*/];
|
|
997
1038
|
}
|
|
998
1039
|
isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
|
|
@@ -1039,12 +1080,12 @@ var BasicChart = function (_a) {
|
|
|
1039
1080
|
return extra;
|
|
1040
1081
|
};
|
|
1041
1082
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1042
|
-
primaryDomainSource = (
|
|
1083
|
+
primaryDomainSource = (_47 = (_46 = (_45 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _45 === void 0 ? void 0 : _45[0]) === null || _46 === void 0 ? void 0 : _46.sources) === null || _47 === void 0 ? void 0 : _47[0];
|
|
1043
1084
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1044
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1085
|
+
? (0, aggregation_1.sanitizeDomainValues)((_48 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _48 !== void 0 ? _48 : [])
|
|
1045
1086
|
: [];
|
|
1046
1087
|
domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1047
|
-
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((
|
|
1088
|
+
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_49 = spec.categoryLevels) === null || _49 === void 0 ? void 0 : _49.map(function (level) {
|
|
1048
1089
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1049
1090
|
}));
|
|
1050
1091
|
multicategoryX = categoryLevels
|
|
@@ -1054,7 +1095,7 @@ var BasicChart = function (_a) {
|
|
|
1054
1095
|
domainData = categoryLevels.leaf;
|
|
1055
1096
|
}
|
|
1056
1097
|
aggregateDomainValues = domainData;
|
|
1057
|
-
domainAxisData = (categoryLevels ? [] : (
|
|
1098
|
+
domainAxisData = (categoryLevels ? [] : (_50 = spec.domains) !== null && _50 !== void 0 ? _50 : []).map(function (domain, domainIndex) {
|
|
1058
1099
|
return domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1059
1100
|
var _a;
|
|
1060
1101
|
if (domainIndex === 0 && sourceIndex === 0) {
|
|
@@ -1123,12 +1164,12 @@ var BasicChart = function (_a) {
|
|
|
1123
1164
|
if ((isBarOrColumn || isPie) &&
|
|
1124
1165
|
Array.isArray(options === null || options === void 0 ? void 0 : options.dataPointColors) &&
|
|
1125
1166
|
(options === null || options === void 0 ? void 0 : options.dataPointColors.length)) {
|
|
1126
|
-
var
|
|
1167
|
+
var overrides_2 = new Map();
|
|
1127
1168
|
try {
|
|
1128
1169
|
for (var _u = tslib_1.__values(options.dataPointColors), _v = _u.next(); !_v.done; _v = _u.next()) {
|
|
1129
1170
|
var dp = _v.value;
|
|
1130
1171
|
if (typeof dp.idx === "number" && typeof dp.color === "string") {
|
|
1131
|
-
|
|
1172
|
+
overrides_2.set(dp.idx, dp.color);
|
|
1132
1173
|
}
|
|
1133
1174
|
}
|
|
1134
1175
|
}
|
|
@@ -1151,7 +1192,7 @@ var BasicChart = function (_a) {
|
|
|
1151
1192
|
: 0;
|
|
1152
1193
|
target.marker = tslib_1.__assign(tslib_1.__assign({}, ((_j = target.marker) !== null && _j !== void 0 ? _j : {})), { colors: Array.from({ length: labelCount }, function (_, i) {
|
|
1153
1194
|
var _a, _b;
|
|
1154
|
-
return (_b = (_a =
|
|
1195
|
+
return (_b = (_a = overrides_2.get(i)) !== null && _a !== void 0 ? _a : seriesColor) !== null && _b !== void 0 ? _b : existing_1[i % Math.max(1, existing_1.length)];
|
|
1155
1196
|
}) });
|
|
1156
1197
|
return trace;
|
|
1157
1198
|
}
|
|
@@ -1161,7 +1202,7 @@ var BasicChart = function (_a) {
|
|
|
1161
1202
|
: Array.isArray(target.x)
|
|
1162
1203
|
? target.x
|
|
1163
1204
|
: [];
|
|
1164
|
-
var colors = yArray.map(function (_, i) { var _a; return (_a =
|
|
1205
|
+
var colors = yArray.map(function (_, i) { var _a; return (_a = overrides_2.get(i)) !== null && _a !== void 0 ? _a : fallback_1; });
|
|
1165
1206
|
target.marker = tslib_1.__assign(tslib_1.__assign({}, ((_k = target.marker) !== null && _k !== void 0 ? _k : {})), { color: colors });
|
|
1166
1207
|
return trace;
|
|
1167
1208
|
}
|
|
@@ -1310,29 +1351,29 @@ var BasicChart = function (_a) {
|
|
|
1310
1351
|
finally { if (e_6) throw e_6.error; }
|
|
1311
1352
|
}
|
|
1312
1353
|
};
|
|
1313
|
-
domainSources = (
|
|
1354
|
+
domainSources = (_53 = (_52 = (_51 = spec.domains) === null || _51 === void 0 ? void 0 : _51[0]) === null || _52 === void 0 ? void 0 : _52.sources) !== null && _53 !== void 0 ? _53 : [];
|
|
1314
1355
|
seriesIndex = 0;
|
|
1315
1356
|
_loop_2 = function (series) {
|
|
1316
|
-
var currentSeriesIndex, dataLabel,
|
|
1317
|
-
return tslib_1.__generator(this, function (
|
|
1318
|
-
switch (
|
|
1357
|
+
var currentSeriesIndex, dataLabel, _78, _79, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, _80, labels, counts, cumulativePercents, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, trace, rawValues, trace, pieData, _81, main_1, secondary, otherTotal, total, ofPieType, secondScale, halfAngle, paletteAt_1, MAIN_DOMAIN_X, CY, SECONDARY_CX, BAR_LEFT, BAR_RIGHT, plotW, plotH, hasGeometry, r, r2, clampFrac, rx2, ry2, barHalf, shapes, connectorColor, mainCx, px, pyTop, pyBottom, tx, half, line, pieData, trace, _82, x, y, orientation_1, trace, numericValues, _83, x, y, orientation_2, trace;
|
|
1358
|
+
return tslib_1.__generator(this, function (_84) {
|
|
1359
|
+
switch (_84.label) {
|
|
1319
1360
|
case 0:
|
|
1320
1361
|
currentSeriesIndex = seriesIndex++;
|
|
1321
1362
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1322
|
-
|
|
1323
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1363
|
+
_79 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1364
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_55 = position.sheetId) !== null && _55 !== void 0 ? _55 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1324
1365
|
case 1:
|
|
1325
|
-
|
|
1366
|
+
_78 = _79.apply(void 0, [_84.sent()]);
|
|
1326
1367
|
return [3 /*break*/, 3];
|
|
1327
1368
|
case 2:
|
|
1328
|
-
|
|
1329
|
-
|
|
1369
|
+
_78 = (_56 = series.dataLabel) !== null && _56 !== void 0 ? _56 : "";
|
|
1370
|
+
_84.label = 3;
|
|
1330
1371
|
case 3:
|
|
1331
|
-
dataLabel =
|
|
1372
|
+
dataLabel = _78;
|
|
1332
1373
|
// A series with no ranges draws nothing.
|
|
1333
1374
|
if (series.sources.length === 0)
|
|
1334
1375
|
return [2 /*return*/, "continue"];
|
|
1335
|
-
effectiveChartType = (
|
|
1376
|
+
effectiveChartType = (_57 = series.seriesChartType) !== null && _57 !== void 0 ? _57 : spec.chartType;
|
|
1336
1377
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1337
1378
|
pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
|
|
1338
1379
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
@@ -1370,14 +1411,14 @@ var BasicChart = function (_a) {
|
|
|
1370
1411
|
: seriesData;
|
|
1371
1412
|
binCount = spec.binCount;
|
|
1372
1413
|
if (isPareto) {
|
|
1373
|
-
|
|
1414
|
+
_80 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _80.labels, counts = _80.counts, cumulativePercents = _80.cumulativePercents;
|
|
1374
1415
|
barTrace = {
|
|
1375
1416
|
type: "bar",
|
|
1376
1417
|
x: labels,
|
|
1377
1418
|
y: counts,
|
|
1378
1419
|
name: dataLabel,
|
|
1379
1420
|
};
|
|
1380
|
-
applyTraceColor(barTrace, (
|
|
1421
|
+
applyTraceColor(barTrace, (_58 = series.color) !== null && _58 !== void 0 ? _58 : undefined, {
|
|
1381
1422
|
noFill: series.noFill,
|
|
1382
1423
|
dataPointColors: series.dataPointColors,
|
|
1383
1424
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1398,7 +1439,7 @@ var BasicChart = function (_a) {
|
|
|
1398
1439
|
trace = tslib_1.__assign({ type: "histogram", x: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }), name: dataLabel }, (typeof binCount === "number" && binCount > 0
|
|
1399
1440
|
? { nbinsx: binCount }
|
|
1400
1441
|
: {}));
|
|
1401
|
-
applyTraceColor(trace, (
|
|
1442
|
+
applyTraceColor(trace, (_59 = series.color) !== null && _59 !== void 0 ? _59 : undefined, {
|
|
1402
1443
|
noFill: series.noFill,
|
|
1403
1444
|
dataPointColors: series.dataPointColors,
|
|
1404
1445
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1448,7 +1489,7 @@ var BasicChart = function (_a) {
|
|
|
1448
1489
|
// default and `showOutliers: true` alike).
|
|
1449
1490
|
boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
|
|
1450
1491
|
}
|
|
1451
|
-
applyTraceColor(trace, (
|
|
1492
|
+
applyTraceColor(trace, (_60 = series.color) !== null && _60 !== void 0 ? _60 : undefined, {
|
|
1452
1493
|
noFill: series.noFill,
|
|
1453
1494
|
dataPointColors: series.dataPointColors,
|
|
1454
1495
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1460,7 +1501,7 @@ var BasicChart = function (_a) {
|
|
|
1460
1501
|
rawValues = "values" in seriesData
|
|
1461
1502
|
? seriesData.values
|
|
1462
1503
|
: seriesData;
|
|
1463
|
-
totalIndices_1 = new Set((
|
|
1504
|
+
totalIndices_1 = new Set((_61 = spec.totalIndices) !== null && _61 !== void 0 ? _61 : []);
|
|
1464
1505
|
trace = {
|
|
1465
1506
|
type: "waterfall",
|
|
1466
1507
|
x: categoriesFor(series),
|
|
@@ -1470,7 +1511,7 @@ var BasicChart = function (_a) {
|
|
|
1470
1511
|
}),
|
|
1471
1512
|
name: dataLabel,
|
|
1472
1513
|
};
|
|
1473
|
-
applyTraceColor(trace, (
|
|
1514
|
+
applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
|
|
1474
1515
|
noFill: series.noFill,
|
|
1475
1516
|
dataPointColors: series.dataPointColors,
|
|
1476
1517
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1488,7 +1529,7 @@ var BasicChart = function (_a) {
|
|
|
1488
1529
|
x: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }),
|
|
1489
1530
|
name: dataLabel,
|
|
1490
1531
|
};
|
|
1491
|
-
applyTraceColor(trace, (
|
|
1532
|
+
applyTraceColor(trace, (_63 = series.color) !== null && _63 !== void 0 ? _63 : undefined, {
|
|
1492
1533
|
noFill: series.noFill,
|
|
1493
1534
|
dataPointColors: series.dataPointColors,
|
|
1494
1535
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1506,10 +1547,10 @@ var BasicChart = function (_a) {
|
|
|
1506
1547
|
return [2 /*return*/, "continue"];
|
|
1507
1548
|
ofPieHandled = true;
|
|
1508
1549
|
pieData = seriesData;
|
|
1509
|
-
|
|
1550
|
+
_81 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
|
|
1510
1551
|
splitType: spec.splitType,
|
|
1511
1552
|
splitPos: spec.splitPos,
|
|
1512
|
-
}), main_1 =
|
|
1553
|
+
}), main_1 = _81.main, secondary = _81.secondary, otherTotal = _81.otherTotal, total = _81.total;
|
|
1513
1554
|
ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
|
|
1514
1555
|
secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
|
|
1515
1556
|
halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
|
|
@@ -1642,7 +1683,7 @@ var BasicChart = function (_a) {
|
|
|
1642
1683
|
trace.meta = {
|
|
1643
1684
|
rncSeriesIndex: currentSeriesIndex,
|
|
1644
1685
|
};
|
|
1645
|
-
applyTraceColor(trace, (
|
|
1686
|
+
applyTraceColor(trace, (_64 = series.color) !== null && _64 !== void 0 ? _64 : undefined, {
|
|
1646
1687
|
noFill: series.noFill,
|
|
1647
1688
|
dataPointColors: series.dataPointColors,
|
|
1648
1689
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1651,13 +1692,13 @@ var BasicChart = function (_a) {
|
|
|
1651
1692
|
traces.push(trace);
|
|
1652
1693
|
}
|
|
1653
1694
|
else if ("values" in seriesData && "labels" in seriesData) {
|
|
1654
|
-
|
|
1695
|
+
_82 = assignCartesianData(categoriesFor(series), seriesData.values), x = _82.x, y = _82.y, orientation_1 = _82.orientation;
|
|
1655
1696
|
trace = tslib_1.__assign(tslib_1.__assign({ type: seriesPlotlyType, x: x, y: y, orientation: orientation_1, name: dataLabel, stackgroup: isStacked ? "one" : undefined }, seriesTraceStyle), lineTraceVariant(series, effectiveChartType, seriesData.values));
|
|
1656
1697
|
// Ties the trace back to spec.series for click selection
|
|
1657
1698
|
trace.meta = {
|
|
1658
1699
|
rncSeriesIndex: currentSeriesIndex,
|
|
1659
1700
|
};
|
|
1660
|
-
applyTraceColor(trace, (
|
|
1701
|
+
applyTraceColor(trace, (_65 = series.color) !== null && _65 !== void 0 ? _65 : undefined, {
|
|
1661
1702
|
noFill: series.noFill,
|
|
1662
1703
|
dataPointColors: series.dataPointColors,
|
|
1663
1704
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1672,13 +1713,13 @@ var BasicChart = function (_a) {
|
|
|
1672
1713
|
}
|
|
1673
1714
|
else {
|
|
1674
1715
|
numericValues = seriesData;
|
|
1675
|
-
|
|
1716
|
+
_83 = assignCartesianData(categoriesFor(series), numericValues), x = _83.x, y = _83.y, orientation_2 = _83.orientation;
|
|
1676
1717
|
trace = tslib_1.__assign(tslib_1.__assign({ type: seriesPlotlyType, x: x, y: y, orientation: orientation_2, name: dataLabel, stackgroup: isStacked ? "one" : undefined }, seriesTraceStyle), lineTraceVariant(series, effectiveChartType, numericValues));
|
|
1677
1718
|
// Ties the trace back to spec.series for click selection
|
|
1678
1719
|
trace.meta = {
|
|
1679
1720
|
rncSeriesIndex: currentSeriesIndex,
|
|
1680
1721
|
};
|
|
1681
|
-
applyTraceColor(trace, (
|
|
1722
|
+
applyTraceColor(trace, (_66 = series.color) !== null && _66 !== void 0 ? _66 : undefined, {
|
|
1682
1723
|
noFill: series.noFill,
|
|
1683
1724
|
dataPointColors: series.dataPointColors,
|
|
1684
1725
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1695,24 +1736,24 @@ var BasicChart = function (_a) {
|
|
|
1695
1736
|
}
|
|
1696
1737
|
});
|
|
1697
1738
|
};
|
|
1698
|
-
|
|
1739
|
+
_77.label = 18;
|
|
1699
1740
|
case 18:
|
|
1700
|
-
|
|
1701
|
-
_j = tslib_1.__values((
|
|
1702
|
-
|
|
1741
|
+
_77.trys.push([18, 23, 24, 25]);
|
|
1742
|
+
_j = tslib_1.__values((_54 = spec.series) !== null && _54 !== void 0 ? _54 : []), _k = _j.next();
|
|
1743
|
+
_77.label = 19;
|
|
1703
1744
|
case 19:
|
|
1704
1745
|
if (!!_k.done) return [3 /*break*/, 22];
|
|
1705
1746
|
series = _k.value;
|
|
1706
1747
|
return [5 /*yield**/, _loop_2(series)];
|
|
1707
1748
|
case 20:
|
|
1708
|
-
|
|
1709
|
-
|
|
1749
|
+
_77.sent();
|
|
1750
|
+
_77.label = 21;
|
|
1710
1751
|
case 21:
|
|
1711
1752
|
_k = _j.next();
|
|
1712
1753
|
return [3 /*break*/, 19];
|
|
1713
1754
|
case 22: return [3 /*break*/, 25];
|
|
1714
1755
|
case 23:
|
|
1715
|
-
e_3_1 =
|
|
1756
|
+
e_3_1 = _77.sent();
|
|
1716
1757
|
e_3 = { error: e_3_1 };
|
|
1717
1758
|
return [3 /*break*/, 25];
|
|
1718
1759
|
case 24:
|
|
@@ -1729,13 +1770,13 @@ var BasicChart = function (_a) {
|
|
|
1729
1770
|
? undefined
|
|
1730
1771
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1731
1772
|
axisOptions: spec.valueAxisOptions,
|
|
1732
|
-
series: ((
|
|
1773
|
+
series: ((_67 = spec.series) !== null && _67 !== void 0 ? _67 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
1733
1774
|
getFormattingFromRange: getFormattingFromRange,
|
|
1734
1775
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1735
1776
|
});
|
|
1736
1777
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1737
1778
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
1738
|
-
series: ((
|
|
1779
|
+
series: ((_68 = spec.series) !== null && _68 !== void 0 ? _68 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
1739
1780
|
getFormattingFromRange: getFormattingFromRange,
|
|
1740
1781
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1741
1782
|
});
|
|
@@ -1754,6 +1795,7 @@ var BasicChart = function (_a) {
|
|
|
1754
1795
|
: (0, axis_number_format_1.valueAxisNameGap)({
|
|
1755
1796
|
values: primaryValues,
|
|
1756
1797
|
pattern: primaryAxisNumberFormat,
|
|
1798
|
+
locale: locale,
|
|
1757
1799
|
fontSize: axisFontSize,
|
|
1758
1800
|
minimum: 0,
|
|
1759
1801
|
}) -
|
|
@@ -1771,6 +1813,7 @@ var BasicChart = function (_a) {
|
|
|
1771
1813
|
: [];
|
|
1772
1814
|
}),
|
|
1773
1815
|
pattern: secondaryAxisNumberFormat,
|
|
1816
|
+
locale: locale,
|
|
1774
1817
|
fontSize: axisFontSize,
|
|
1775
1818
|
minimum: 0,
|
|
1776
1819
|
}) -
|
|
@@ -1781,14 +1824,14 @@ var BasicChart = function (_a) {
|
|
|
1781
1824
|
? VALUE_AXIS_TITLE_STANDOFF
|
|
1782
1825
|
: legend_layout_1.BAND_GAP;
|
|
1783
1826
|
legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
|
|
1784
|
-
position: (
|
|
1827
|
+
position: (_69 = spec.legend) === null || _69 === void 0 ? void 0 : _69.position,
|
|
1785
1828
|
visible: showlegend !== false,
|
|
1786
1829
|
labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
|
|
1787
|
-
legendFontSize: (
|
|
1830
|
+
legendFontSize: (_72 = (_71 = (_70 = spec.legend) === null || _70 === void 0 ? void 0 : _70.textFormat) === null || _71 === void 0 ? void 0 : _71.fontSize) !== null && _72 !== void 0 ? _72 : axisFontSize,
|
|
1788
1831
|
width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
|
|
1789
1832
|
height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
|
|
1790
1833
|
hasTitle: Boolean(title),
|
|
1791
|
-
titleFontSize: (
|
|
1834
|
+
titleFontSize: (_73 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _73 !== void 0 ? _73 : 16,
|
|
1792
1835
|
hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
|
|
1793
1836
|
hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
|
|
1794
1837
|
leftAxisDepth: leftAxisDepth,
|
|
@@ -1800,7 +1843,7 @@ var BasicChart = function (_a) {
|
|
|
1800
1843
|
family: "Untitled Sans, apple-system, sans-serif",
|
|
1801
1844
|
size: 16,
|
|
1802
1845
|
color: textColor,
|
|
1803
|
-
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((
|
|
1846
|
+
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_74 = legendBand.legend) !== null && _74 !== void 0 ? _74 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
|
|
1804
1847
|
spec.stackedType
|
|
1805
1848
|
? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
|
|
1806
1849
|
spec.stackedType === "PERCENT_STACKED"
|
|
@@ -1813,7 +1856,7 @@ var BasicChart = function (_a) {
|
|
|
1813
1856
|
color: textColor,
|
|
1814
1857
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
|
|
1815
1858
|
title: {
|
|
1816
|
-
text: (
|
|
1859
|
+
text: (_75 = spec.horizontalAxisTitle) !== null && _75 !== void 0 ? _75 : "",
|
|
1817
1860
|
font: { color: textColor },
|
|
1818
1861
|
standoff: bottomAxisTitleStandoff,
|
|
1819
1862
|
},
|
|
@@ -1831,7 +1874,7 @@ var BasicChart = function (_a) {
|
|
|
1831
1874
|
isHorizontalBarChart
|
|
1832
1875
|
? spec.valueAxisOptions
|
|
1833
1876
|
: spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
|
|
1834
|
-
title: tslib_1.__assign({ text: (
|
|
1877
|
+
title: tslib_1.__assign({ text: (_76 = spec.verticalAxisTitle) !== null && _76 !== void 0 ? _76 : "", font: { color: textColor } }, (isHorizontalBarChart
|
|
1835
1878
|
? {}
|
|
1836
1879
|
: { standoff: VALUE_AXIS_TITLE_STANDOFF })),
|
|
1837
1880
|
showgrid: !isHorizontalBarChart,
|
|
@@ -1867,6 +1910,21 @@ var BasicChart = function (_a) {
|
|
|
1867
1910
|
_r) : {})), (ofPieExtras
|
|
1868
1911
|
? tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ shapes: ofPieExtras.shapes }, (ofPieExtras.barmode ? { barmode: ofPieExtras.barmode } : {})), (ofPieExtras.xaxis2 ? { xaxis2: ofPieExtras.xaxis2 } : {})), (ofPieExtras.yaxis2 ? { yaxis2: ofPieExtras.yaxis2 } : {})) : {}));
|
|
1869
1912
|
dlOpts = spec.dataLabels;
|
|
1913
|
+
doughnutSeriesOrder = spec.chartType === "doughnut"
|
|
1914
|
+
? traces
|
|
1915
|
+
.filter(function (t) { return (t === null || t === void 0 ? void 0 : t.type) === "pie"; })
|
|
1916
|
+
.map(function (t) { var _a; return (_a = t === null || t === void 0 ? void 0 : t.meta) === null || _a === void 0 ? void 0 : _a.rncSeriesIndex; })
|
|
1917
|
+
.filter(function (i) { return typeof i === "number"; })
|
|
1918
|
+
.sort(function (a, b) { return a - b; })
|
|
1919
|
+
: [];
|
|
1920
|
+
doughnutRingSet = spec.chartType === "doughnut"
|
|
1921
|
+
? (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(spec.doughnutHoleSize), doughnutSeriesOrder.length)
|
|
1922
|
+
: [];
|
|
1923
|
+
traceDataLabels = function (trace) {
|
|
1924
|
+
var _a, _b;
|
|
1925
|
+
var specIndex = (_a = trace === null || trace === void 0 ? void 0 : trace.meta) === null || _a === void 0 ? void 0 : _a.rncSeriesIndex;
|
|
1926
|
+
return (0, overrides_1.resolveSeriesDataLabels)(dlOpts, typeof specIndex === "number" ? (_b = spec.series) === null || _b === void 0 ? void 0 : _b[specIndex] : undefined);
|
|
1927
|
+
};
|
|
1870
1928
|
doughnutHole = spec.doughnutHoleSize;
|
|
1871
1929
|
seriesNumberFormats = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|
|
1872
1930
|
traceNumberFormat = function (trace) {
|
|
@@ -1880,14 +1938,21 @@ var BasicChart = function (_a) {
|
|
|
1880
1938
|
};
|
|
1881
1939
|
piePull = isOfPie ? undefined : (0, pie_explosion_1.explosionToPlotlyPull)((0, pie_explosion_1.resolveExplosion)(spec));
|
|
1882
1940
|
formattedTraces = traces.map(function (trace) {
|
|
1883
|
-
var _a;
|
|
1941
|
+
var _a, _b, _c, _d;
|
|
1884
1942
|
var pattern = traceNumberFormat(trace);
|
|
1885
|
-
var next = applyDataLabelsToTracePlotly(trace,
|
|
1943
|
+
var next = applyDataLabelsToTracePlotly(trace, traceDataLabels(trace), spec.chartType, pattern, locale);
|
|
1886
1944
|
if (next.type === "pie") {
|
|
1945
|
+
// Plotly's pie prints every slice's percentage by default; Excel
|
|
1946
|
+
// draws nothing until data labels are on (#1062).
|
|
1947
|
+
if (!((_a = traceDataLabels(trace)) === null || _a === void 0 ? void 0 : _a.show)) {
|
|
1948
|
+
next = tslib_1.__assign(tslib_1.__assign({}, next), { textinfo: "none" });
|
|
1949
|
+
}
|
|
1887
1950
|
// Hover values format like the slice's source cell.
|
|
1888
1951
|
if (pattern && !next.text) {
|
|
1889
1952
|
var values = Array.isArray(next.values) ? next.values : [];
|
|
1890
|
-
next = tslib_1.__assign(tslib_1.__assign({}, next), { text: values.map(function (v) {
|
|
1953
|
+
next = tslib_1.__assign(tslib_1.__assign({}, next), { text: values.map(function (v) {
|
|
1954
|
+
return (0, axis_number_format_1.formatAxisValue)(pattern, v, locale);
|
|
1955
|
+
}), hoverinfo: "label+text+percent+name" });
|
|
1891
1956
|
}
|
|
1892
1957
|
else if (pattern) {
|
|
1893
1958
|
next = tslib_1.__assign(tslib_1.__assign({}, next), { hoverinfo: "label+text+percent+name" });
|
|
@@ -1898,7 +1963,7 @@ var BasicChart = function (_a) {
|
|
|
1898
1963
|
}
|
|
1899
1964
|
else if (!next.hovertemplate &&
|
|
1900
1965
|
(next.type === "bar" || next.type === "scatter") &&
|
|
1901
|
-
typeof ((
|
|
1966
|
+
typeof ((_b = next.meta) === null || _b === void 0 ? void 0 : _b.rncSeriesIndex) === "number") {
|
|
1902
1967
|
// Hover values read like the series' own cells (Excel's data tip
|
|
1903
1968
|
// shows the cell text) — the series format alone, not the axis
|
|
1904
1969
|
// fallback the labels use, since that resolves to the first series
|
|
@@ -1911,7 +1976,7 @@ var BasicChart = function (_a) {
|
|
|
1911
1976
|
var values = horizontal ? next.x : next.y;
|
|
1912
1977
|
if (seriesPattern_1 && Array.isArray(values)) {
|
|
1913
1978
|
next = tslib_1.__assign(tslib_1.__assign({}, next), { customdata: values.map(function (v) {
|
|
1914
|
-
return (0, axis_number_format_1.formatAxisValue)(seriesPattern_1, v);
|
|
1979
|
+
return (0, axis_number_format_1.formatAxisValue)(seriesPattern_1, v, locale);
|
|
1915
1980
|
}), hovertemplate: "".concat(horizontal ? "%{y}" : "%{x}", "<br>%{customdata}<extra>%{fullData.name}</extra>") });
|
|
1916
1981
|
}
|
|
1917
1982
|
}
|
|
@@ -1920,9 +1985,14 @@ var BasicChart = function (_a) {
|
|
|
1920
1985
|
// (doughnutHoleSize); clamp like the echarts renderer and default
|
|
1921
1986
|
// to 0.5 when unset.
|
|
1922
1987
|
if (spec.chartType === "doughnut" && next.type === "pie") {
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1988
|
+
var rank = doughnutSeriesOrder.indexOf((_c = next.meta) === null || _c === void 0 ? void 0 : _c.rncSeriesIndex);
|
|
1989
|
+
var ring = (_d = doughnutRingSet[rank]) !== null && _d !== void 0 ? _d : (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(doughnutHole), 1)[0];
|
|
1990
|
+
// Plotly's `hole` is a fraction of the trace's own radius.
|
|
1991
|
+
next = tslib_1.__assign(tslib_1.__assign({}, next), { hole: ring.inner / ring.outer });
|
|
1992
|
+
if (doughnutRingSet.length > 1) {
|
|
1993
|
+
var half = ring.outer / 2;
|
|
1994
|
+
next = tslib_1.__assign(tslib_1.__assign({}, next), { domain: { x: [0.5 - half, 0.5 + half], y: [0.5 - half, 0.5 + half] } });
|
|
1995
|
+
}
|
|
1926
1996
|
}
|
|
1927
1997
|
return next;
|
|
1928
1998
|
});
|
|
@@ -1951,6 +2021,7 @@ var BasicChart = function (_a) {
|
|
|
1951
2021
|
getDomainValuesFromRange,
|
|
1952
2022
|
getSeriesValuesFromRange,
|
|
1953
2023
|
getFormattingFromRange,
|
|
2024
|
+
locale,
|
|
1954
2025
|
]);
|
|
1955
2026
|
// Update theme
|
|
1956
2027
|
(0, ui_1.useIsomorphicLayoutEffect)(function () {
|
|
@@ -1984,7 +2055,9 @@ var BasicChart = function (_a) {
|
|
|
1984
2055
|
scrollZoom: false,
|
|
1985
2056
|
doubleClick: false,
|
|
1986
2057
|
};
|
|
1987
|
-
|
|
2058
|
+
// Ticks and hover values plotly formats itself use the sheet's separators.
|
|
2059
|
+
var separators = (0, react_1.useMemo)(function () { return (0, axis_number_format_1.plotlySeparators)(locale); }, [locale]);
|
|
2060
|
+
var plotLayout = (0, react_1.useMemo)(function () { return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, layout), { dragmode: false }), (separators ? { separators: separators } : {}))); }, [layout, separators]);
|
|
1988
2061
|
// Excel's "Rounded Corners" chart frame (`<c:roundedCorners val="1"/>`
|
|
1989
2062
|
// at the chartSpace root). Default per OOXML §21.2.2.183 is square,
|
|
1990
2063
|
// so only opt in when the workbook explicitly set the flag.
|