@rowsncolumns/charts 28.1.2 → 28.1.4
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 +138 -76
- package/dist/cjs/basic-chart/helpers.d.ts +9 -0
- package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/basic-chart/helpers.js +55 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +218 -128
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils/axis-number-format.d.ts +14 -0
- package/dist/cjs/utils/axis-number-format.d.ts.map +1 -1
- package/dist/cjs/utils/axis-number-format.js +41 -1
- package/dist/cjs/utils/empty-cells.d.ts +9 -0
- package/dist/cjs/utils/empty-cells.d.ts.map +1 -1
- package/dist/cjs/utils/empty-cells.js +26 -1
- package/dist/cjs/utils/legend-layout.d.ts +168 -0
- package/dist/cjs/utils/legend-layout.d.ts.map +1 -0
- package/dist/cjs/utils/legend-layout.js +338 -0
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +96 -34
- package/dist/esm/basic-chart/helpers.d.ts +9 -0
- package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/basic-chart/helpers.js +30 -0
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +136 -6
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/axis-number-format.d.ts +14 -0
- package/dist/esm/utils/axis-number-format.d.ts.map +1 -1
- package/dist/esm/utils/axis-number-format.js +36 -0
- package/dist/esm/utils/empty-cells.d.ts +9 -0
- package/dist/esm/utils/empty-cells.d.ts.map +1 -1
- package/dist/esm/utils/empty-cells.js +21 -0
- package/dist/esm/utils/legend-layout.d.ts +168 -0
- package/dist/esm/utils/legend-layout.d.ts.map +1 -0
- package/dist/esm/utils/legend-layout.js +299 -0
- package/package.json +7 -7
|
@@ -21,6 +21,7 @@ var empty_cells_1 = require("../../utils/empty-cells");
|
|
|
21
21
|
var error_bars_1 = require("../../utils/error-bars");
|
|
22
22
|
var category_levels_1 = require("../../utils/category-levels");
|
|
23
23
|
var gradient_1 = require("../../utils/gradient");
|
|
24
|
+
var legend_layout_1 = require("../../utils/legend-layout");
|
|
24
25
|
var plotly_title_1 = require("../../utils/plotly-title");
|
|
25
26
|
var pie_explosion_1 = require("../../utils/pie-explosion");
|
|
26
27
|
var plotly_click_1 = require("../../utils/plotly-click");
|
|
@@ -119,6 +120,16 @@ var applyLegendOverridesPlotly = function (legend, opts) {
|
|
|
119
120
|
next.font = applyTextFormatToFont(next.font, opts.textFormat);
|
|
120
121
|
return { legend: next, showlegend: true };
|
|
121
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* `title.standoff` for a VALUE axis. Without it plotly places the axis title
|
|
125
|
+
* a fixed ~34px from the axis line and only nudges it off the tick labels
|
|
126
|
+
* after measuring them — a currency axis ("$2,000,000.00") is wider than
|
|
127
|
+
* that, and on the first paint (before `automargin` has grown the margin)
|
|
128
|
+
* the title lands on top of its own tick labels. With a standoff plotly
|
|
129
|
+
* positions the title at `tick-label depth + standoff`, so it always clears
|
|
130
|
+
* the labels, and `automargin` grows the margin to fit (#37265 A8).
|
|
131
|
+
*/
|
|
132
|
+
var VALUE_AXIS_TITLE_STANDOFF = 12;
|
|
122
133
|
/**
|
|
123
134
|
* `numberFormatPattern` is the axis' RESOLVED format (explicit pattern or
|
|
124
135
|
* the linked source-cell format). Plotly formats ticks AND hover values
|
|
@@ -443,11 +454,11 @@ var BasicChart = function (_a) {
|
|
|
443
454
|
* Triggers a chart update
|
|
444
455
|
*/
|
|
445
456
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
446
|
-
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, maxR, 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, newLayout, dlOpts, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
|
|
447
|
-
var e_2,
|
|
448
|
-
var
|
|
449
|
-
return tslib_1.__generator(this, function (
|
|
450
|
-
switch (
|
|
457
|
+
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, maxR, 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, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
|
|
458
|
+
var e_2, _m, e_4, _o, e_3, _p, _q, _r;
|
|
459
|
+
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;
|
|
460
|
+
return tslib_1.__generator(this, function (_76) {
|
|
461
|
+
switch (_76.label) {
|
|
451
462
|
case 0:
|
|
452
463
|
(0, utils_1.debug)("Updating chart", chart);
|
|
453
464
|
traces = [];
|
|
@@ -459,41 +470,41 @@ var BasicChart = function (_a) {
|
|
|
459
470
|
theme: 1,
|
|
460
471
|
tint: isDarkMode ? 1 : 0,
|
|
461
472
|
}, theme);
|
|
462
|
-
bgColor = (
|
|
473
|
+
bgColor = (_s = spec.backgroundColor) !== null && _s !== void 0 ? _s : (0, spreadsheet_1.getStringifiedColor)({ theme: 0, tint: isDarkMode ? -1 : 1 }, theme);
|
|
463
474
|
gridColor = isDarkMode ? "rgba(255,255,255,0.3)" : "#CCCCCC";
|
|
464
475
|
if (!isBubble) return [3 /*break*/, 6];
|
|
465
476
|
skipHeaders_1 = spec.useFirstRowAsHeaders !== false;
|
|
466
477
|
labels = flattenChartDataValues(spec.bubbleLabels, getDomainValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1).map(bubble_1.toLabelString);
|
|
467
|
-
perSeriesX = ((
|
|
478
|
+
perSeriesX = ((_t = spec.domains) !== null && _t !== void 0 ? _t : []).map(function (dom) {
|
|
468
479
|
return flattenChartDataValues([dom], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
|
|
469
480
|
});
|
|
470
|
-
perSeriesSize = ((
|
|
481
|
+
perSeriesSize = ((_u = spec.bubbleSizes) !== null && _u !== void 0 ? _u : []).map(function (sz) {
|
|
471
482
|
return flattenChartDataValues([sz], getSeriesValuesFromRange, spec.hiddenDimensionStrategy, skipHeaders_1);
|
|
472
483
|
});
|
|
473
484
|
seriesInputs = [];
|
|
474
485
|
i = 0;
|
|
475
|
-
|
|
486
|
+
_76.label = 1;
|
|
476
487
|
case 1:
|
|
477
488
|
if (!(i < spec.series.length)) return [3 /*break*/, 5];
|
|
478
489
|
seriesEntry = spec.series[i];
|
|
479
|
-
resolvedLabel = (
|
|
490
|
+
resolvedLabel = (_v = seriesEntry.dataLabel) !== null && _v !== void 0 ? _v : "";
|
|
480
491
|
if (!(resolvedLabel && (0, utils_1.isAFormula)(resolvedLabel))) return [3 /*break*/, 3];
|
|
481
492
|
_a = chart_spec_utils_1.coerceCalculatedLabel;
|
|
482
|
-
return [4 /*yield*/, onRequestCalculate(resolvedLabel, (
|
|
493
|
+
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)];
|
|
483
494
|
case 2:
|
|
484
|
-
resolvedLabel = _a.apply(void 0, [
|
|
485
|
-
|
|
495
|
+
resolvedLabel = _a.apply(void 0, [_76.sent()]);
|
|
496
|
+
_76.label = 3;
|
|
486
497
|
case 3:
|
|
487
|
-
xValues = (
|
|
488
|
-
sizeValues_1 = (
|
|
498
|
+
xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
|
|
499
|
+
sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
|
|
489
500
|
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 } : {})));
|
|
490
|
-
|
|
501
|
+
_76.label = 4;
|
|
491
502
|
case 4:
|
|
492
503
|
i++;
|
|
493
504
|
return [3 /*break*/, 1];
|
|
494
505
|
case 5:
|
|
495
|
-
sharedXValues = (
|
|
496
|
-
sharedSizeValues = (
|
|
506
|
+
sharedXValues = (_z = perSeriesX[0]) !== null && _z !== void 0 ? _z : [];
|
|
507
|
+
sharedSizeValues = (_0 = perSeriesSize[0]) !== null && _0 !== void 0 ? _0 : [];
|
|
497
508
|
_b = (0, bubble_1.prepareBubbleSeriesData)({
|
|
498
509
|
xValues: sharedXValues,
|
|
499
510
|
labelValues: labels,
|
|
@@ -511,7 +522,7 @@ var BasicChart = function (_a) {
|
|
|
511
522
|
theme.themeColors.accent6,
|
|
512
523
|
]);
|
|
513
524
|
isScatter_1 = spec.chartType === "scatter";
|
|
514
|
-
scatterStyle_1 = (
|
|
525
|
+
scatterStyle_1 = (_1 = spec.scatterStyle) !== null && _1 !== void 0 ? _1 : (isScatter_1 ? "lineMarker" : undefined);
|
|
515
526
|
plotlyModeForScatterStyle_1 = function (style) {
|
|
516
527
|
switch (style) {
|
|
517
528
|
case "line":
|
|
@@ -590,39 +601,39 @@ var BasicChart = function (_a) {
|
|
|
590
601
|
};
|
|
591
602
|
});
|
|
592
603
|
titleFmt = spec.titleTextFormat;
|
|
593
|
-
xAxisFmt = (
|
|
594
|
-
yAxisFmt = (
|
|
595
|
-
legendFmt = (
|
|
604
|
+
xAxisFmt = (_2 = spec.categoryAxisOptions) === null || _2 === void 0 ? void 0 : _2.textFormat;
|
|
605
|
+
yAxisFmt = (_3 = spec.valueAxisOptions) === null || _3 === void 0 ? void 0 : _3.textFormat;
|
|
606
|
+
legendFmt = (_4 = spec.legend) === null || _4 === void 0 ? void 0 : _4.textFormat;
|
|
596
607
|
bubbleLayout = {
|
|
597
608
|
title: {
|
|
598
609
|
text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
|
|
599
610
|
font: {
|
|
600
|
-
family: (
|
|
601
|
-
size: (
|
|
602
|
-
color: (
|
|
611
|
+
family: (_5 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontFamily) !== null && _5 !== void 0 ? _5 : "Untitled Sans, apple-system, sans-serif",
|
|
612
|
+
size: (_6 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _6 !== void 0 ? _6 : 16,
|
|
613
|
+
color: (_7 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.color) !== null && _7 !== void 0 ? _7 : textColor,
|
|
603
614
|
},
|
|
604
615
|
x: 0.02,
|
|
605
616
|
xanchor: "left",
|
|
606
617
|
},
|
|
607
618
|
xaxis: {
|
|
608
619
|
title: {
|
|
609
|
-
text: (
|
|
610
|
-
font: { color: (
|
|
620
|
+
text: (_8 = spec.horizontalAxisTitle) !== null && _8 !== void 0 ? _8 : "",
|
|
621
|
+
font: { color: (_9 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _9 !== void 0 ? _9 : textColor },
|
|
611
622
|
},
|
|
612
623
|
gridcolor: gridColor,
|
|
613
|
-
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
624
|
+
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_10 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _10 !== void 0 ? _10 : textColor }, ((xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.fontFamily) ? { family: xAxisFmt.fontFamily } : {})), ((xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.fontSize) ? { size: xAxisFmt.fontSize } : {})),
|
|
614
625
|
type: hasStringX_1 ? "category" : "linear",
|
|
615
626
|
},
|
|
616
627
|
yaxis: {
|
|
617
628
|
title: {
|
|
618
|
-
text: (
|
|
619
|
-
font: { color: (
|
|
629
|
+
text: (_11 = spec.verticalAxisTitle) !== null && _11 !== void 0 ? _11 : "",
|
|
630
|
+
font: { color: (_12 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _12 !== void 0 ? _12 : textColor },
|
|
620
631
|
},
|
|
621
632
|
gridcolor: gridColor,
|
|
622
|
-
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
633
|
+
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_13 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _13 !== void 0 ? _13 : textColor }, ((yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.fontFamily) ? { family: yAxisFmt.fontFamily } : {})), ((yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.fontSize) ? { size: yAxisFmt.fontSize } : {})),
|
|
623
634
|
},
|
|
624
635
|
legend: {
|
|
625
|
-
font: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
636
|
+
font: tslib_1.__assign(tslib_1.__assign({ color: (_14 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.color) !== null && _14 !== void 0 ? _14 : textColor }, ((legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontFamily) ? { family: legendFmt.fontFamily } : {})), ((legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontSize) ? { size: legendFmt.fontSize } : {})),
|
|
626
637
|
},
|
|
627
638
|
paper_bgcolor: bgColor,
|
|
628
639
|
plot_bgcolor: bgColor,
|
|
@@ -647,8 +658,8 @@ var BasicChart = function (_a) {
|
|
|
647
658
|
hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
|
|
648
659
|
hierarchyData = (0, hierarchy_1.toPlotlyHierarchy)(hierarchyRows);
|
|
649
660
|
seriesName = hierarchyData.labels.length === 1
|
|
650
|
-
? (
|
|
651
|
-
: (
|
|
661
|
+
? (_15 = hierarchyData.labels[0]) !== null && _15 !== void 0 ? _15 : ""
|
|
662
|
+
: (_16 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _16 !== void 0 ? _16 : "";
|
|
652
663
|
hierarchyTrace = {
|
|
653
664
|
type: chartType,
|
|
654
665
|
labels: hierarchyData.labels,
|
|
@@ -697,7 +708,7 @@ var BasicChart = function (_a) {
|
|
|
697
708
|
// country-name matching and silently skips labels it can't place.
|
|
698
709
|
if ((0, region_map_1.isRegionMapSpec)(spec)) {
|
|
699
710
|
labels = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : "").trim(); });
|
|
700
|
-
seriesEntry = (
|
|
711
|
+
seriesEntry = (_17 = spec.series) === null || _17 === void 0 ? void 0 : _17[0];
|
|
701
712
|
rawValues_1 = seriesEntry
|
|
702
713
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
703
714
|
: [];
|
|
@@ -762,39 +773,39 @@ var BasicChart = function (_a) {
|
|
|
762
773
|
if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
|
|
763
774
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
764
775
|
surfaceSeriesInputs = [];
|
|
765
|
-
|
|
776
|
+
_76.label = 7;
|
|
766
777
|
case 7:
|
|
767
|
-
|
|
768
|
-
_c = tslib_1.__values((
|
|
769
|
-
|
|
778
|
+
_76.trys.push([7, 14, 15, 16]);
|
|
779
|
+
_c = tslib_1.__values((_18 = spec.series) !== null && _18 !== void 0 ? _18 : []), _d = _c.next();
|
|
780
|
+
_76.label = 8;
|
|
770
781
|
case 8:
|
|
771
782
|
if (!!_d.done) return [3 /*break*/, 13];
|
|
772
783
|
seriesEntry = _d.value;
|
|
773
784
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 10];
|
|
774
785
|
_f = chart_spec_utils_1.coerceCalculatedLabel;
|
|
775
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
786
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_19 = position.sheetId) !== null && _19 !== void 0 ? _19 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
776
787
|
case 9:
|
|
777
|
-
_e = _f.apply(void 0, [
|
|
788
|
+
_e = _f.apply(void 0, [_76.sent()]);
|
|
778
789
|
return [3 /*break*/, 11];
|
|
779
790
|
case 10:
|
|
780
|
-
_e = (
|
|
781
|
-
|
|
791
|
+
_e = (_20 = seriesEntry.dataLabel) !== null && _20 !== void 0 ? _20 : "";
|
|
792
|
+
_76.label = 11;
|
|
782
793
|
case 11:
|
|
783
794
|
dataLabel = _e;
|
|
784
795
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
785
796
|
surfaceSeriesInputs.push({ name: dataLabel, values: values });
|
|
786
|
-
|
|
797
|
+
_76.label = 12;
|
|
787
798
|
case 12:
|
|
788
799
|
_d = _c.next();
|
|
789
800
|
return [3 /*break*/, 8];
|
|
790
801
|
case 13: return [3 /*break*/, 16];
|
|
791
802
|
case 14:
|
|
792
|
-
e_2_1 =
|
|
803
|
+
e_2_1 = _76.sent();
|
|
793
804
|
e_2 = { error: e_2_1 };
|
|
794
805
|
return [3 /*break*/, 16];
|
|
795
806
|
case 15:
|
|
796
807
|
try {
|
|
797
|
-
if (_d && !_d.done && (
|
|
808
|
+
if (_d && !_d.done && (_m = _c.return)) _m.call(_c);
|
|
798
809
|
}
|
|
799
810
|
finally { if (e_2) throw e_2.error; }
|
|
800
811
|
return [7 /*endfinally*/];
|
|
@@ -817,21 +828,21 @@ var BasicChart = function (_a) {
|
|
|
817
828
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, margin: { l: 60, r: 20, t: 50, b: 50 } }, (surfaceToken === "SURFACE"
|
|
818
829
|
? {
|
|
819
830
|
xaxis: {
|
|
820
|
-
title: { text: (
|
|
831
|
+
title: { text: (_21 = spec.horizontalAxisTitle) !== null && _21 !== void 0 ? _21 : "" },
|
|
821
832
|
automargin: true,
|
|
822
833
|
color: textColor,
|
|
823
834
|
},
|
|
824
835
|
yaxis: {
|
|
825
|
-
title: { text: (
|
|
836
|
+
title: { text: (_22 = spec.verticalAxisTitle) !== null && _22 !== void 0 ? _22 : "" },
|
|
826
837
|
automargin: true,
|
|
827
838
|
color: textColor,
|
|
828
839
|
},
|
|
829
840
|
}
|
|
830
841
|
: {
|
|
831
842
|
scene: {
|
|
832
|
-
xaxis: { title: { text: (
|
|
843
|
+
xaxis: { title: { text: (_23 = spec.horizontalAxisTitle) !== null && _23 !== void 0 ? _23 : "" } },
|
|
833
844
|
yaxis: { title: { text: "" } },
|
|
834
|
-
zaxis: { title: { text: (
|
|
845
|
+
zaxis: { title: { text: (_24 = spec.verticalAxisTitle) !== null && _24 !== void 0 ? _24 : "" } },
|
|
835
846
|
},
|
|
836
847
|
}));
|
|
837
848
|
setPlotData([surfaceTrace]);
|
|
@@ -843,11 +854,11 @@ var BasicChart = function (_a) {
|
|
|
843
854
|
// theta = the category names (closed by appending the first point).
|
|
844
855
|
if (spec.chartType === "radar") {
|
|
845
856
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
846
|
-
radarStyle = (
|
|
857
|
+
radarStyle = (_25 = spec.radarStyle) !== null && _25 !== void 0 ? _25 : "standard";
|
|
847
858
|
radarTraces = [];
|
|
848
859
|
radarInputs = [];
|
|
849
860
|
try {
|
|
850
|
-
for (_g = tslib_1.__values((
|
|
861
|
+
for (_g = tslib_1.__values((_26 = spec.series) !== null && _26 !== void 0 ? _26 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
851
862
|
seriesEntry = _h.value;
|
|
852
863
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
853
864
|
? seriesEntry.dataLabel
|
|
@@ -859,14 +870,14 @@ var BasicChart = function (_a) {
|
|
|
859
870
|
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
860
871
|
finally {
|
|
861
872
|
try {
|
|
862
|
-
if (_h && !_h.done && (
|
|
873
|
+
if (_h && !_h.done && (_o = _g.return)) _o.call(_g);
|
|
863
874
|
}
|
|
864
875
|
finally { if (e_4) throw e_4.error; }
|
|
865
876
|
}
|
|
866
877
|
indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs);
|
|
867
878
|
_loop_1 = function (i) {
|
|
868
879
|
var input = radarInputs[i];
|
|
869
|
-
var seriesColor = (
|
|
880
|
+
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;
|
|
870
881
|
var r = indicators.map(function (_, idx) { var _a; return (_a = input.values[idx]) !== null && _a !== void 0 ? _a : 0; });
|
|
871
882
|
var theta = indicators.map(function (ind) { return ind.name; });
|
|
872
883
|
radarTraces.push(tslib_1.__assign(tslib_1.__assign({ type: "scatterpolar", r: r.length ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(r), false), [r[0]], false) : r, theta: theta.length ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(theta), false), [theta[0]], false) : theta, name: input.name, mode: radarStyle === "standard" ? "lines" : "lines+markers" }, (radarStyle === "filled" ? { fill: "toself" } : {})), (seriesColor ? { line: { color: seriesColor } } : {})));
|
|
@@ -898,13 +909,13 @@ var BasicChart = function (_a) {
|
|
|
898
909
|
// V-variants additionally get a volume column sub-pane below the
|
|
899
910
|
// price plot.
|
|
900
911
|
if (spec.chartType === "stock") {
|
|
901
|
-
variant = ((
|
|
912
|
+
variant = ((_30 = spec.stockVariant) !== null && _30 !== void 0 ? _30 : "HLC");
|
|
902
913
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
903
|
-
seriesValues = ((
|
|
914
|
+
seriesValues = ((_31 = spec.series) !== null && _31 !== void 0 ? _31 : []).map(function (seriesEntry) {
|
|
904
915
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
905
916
|
});
|
|
906
917
|
volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
|
|
907
|
-
hasVolume = ((
|
|
918
|
+
hasVolume = ((_32 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _32 !== void 0 ? _32 : 0) > 0;
|
|
908
919
|
buildVolumeTrace = function (xs) {
|
|
909
920
|
return ({
|
|
910
921
|
type: "bar",
|
|
@@ -937,25 +948,25 @@ var BasicChart = function (_a) {
|
|
|
937
948
|
roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
|
|
938
949
|
xs_1 = categories.length > 0
|
|
939
950
|
? categories
|
|
940
|
-
: ((
|
|
951
|
+
: ((_33 = roles.close) !== null && _33 !== void 0 ? _33 : []).map(function (_, i) { return i + 1; });
|
|
941
952
|
candleTrace = {
|
|
942
953
|
type: "candlestick",
|
|
943
954
|
x: xs_1,
|
|
944
|
-
open: ((
|
|
945
|
-
high: ((
|
|
946
|
-
low: ((
|
|
947
|
-
close: ((
|
|
955
|
+
open: ((_34 = roles.open) !== null && _34 !== void 0 ? _34 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
956
|
+
high: ((_35 = roles.high) !== null && _35 !== void 0 ? _35 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
957
|
+
low: ((_36 = roles.low) !== null && _36 !== void 0 ? _36 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
958
|
+
close: ((_37 = roles.close) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
948
959
|
increasing: { line: { color: theme.themeColors.accent1 } },
|
|
949
960
|
decreasing: { line: { color: theme.themeColors.accent2 } },
|
|
950
961
|
};
|
|
951
962
|
setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
|
|
952
963
|
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: {
|
|
953
|
-
title: { text: (
|
|
964
|
+
title: { text: (_38 = spec.horizontalAxisTitle) !== null && _38 !== void 0 ? _38 : "" },
|
|
954
965
|
automargin: true,
|
|
955
966
|
showgrid: true,
|
|
956
967
|
gridcolor: gridColor,
|
|
957
968
|
rangeslider: { visible: false },
|
|
958
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
969
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_39 = spec.verticalAxisTitle) !== null && _39 !== void 0 ? _39 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
959
970
|
return [2 /*return*/];
|
|
960
971
|
}
|
|
961
972
|
lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
|
|
@@ -967,7 +978,7 @@ var BasicChart = function (_a) {
|
|
|
967
978
|
]);
|
|
968
979
|
xs_2 = categories.length > 0
|
|
969
980
|
? categories
|
|
970
|
-
: ((
|
|
981
|
+
: ((_41 = (_40 = lineSeries[0]) === null || _40 === void 0 ? void 0 : _40.values) !== null && _41 !== void 0 ? _41 : []).map(function (_, i) { return i + 1; });
|
|
971
982
|
stockTraces = lineSeries.map(function (s, i) { return ({
|
|
972
983
|
type: "scatter",
|
|
973
984
|
mode: "lines",
|
|
@@ -978,16 +989,16 @@ var BasicChart = function (_a) {
|
|
|
978
989
|
}); });
|
|
979
990
|
setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
|
|
980
991
|
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: {
|
|
981
|
-
title: { text: (
|
|
992
|
+
title: { text: (_42 = spec.horizontalAxisTitle) !== null && _42 !== void 0 ? _42 : "" },
|
|
982
993
|
automargin: true,
|
|
983
994
|
showgrid: true,
|
|
984
995
|
gridcolor: gridColor,
|
|
985
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
996
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_43 = spec.verticalAxisTitle) !== null && _43 !== void 0 ? _43 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
986
997
|
return [2 /*return*/];
|
|
987
998
|
}
|
|
988
999
|
isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
|
|
989
1000
|
isHorizontalBarChart = spec.chartType === "bar";
|
|
990
|
-
lineTraceVariant = function (series, effectiveChartType) {
|
|
1001
|
+
lineTraceVariant = function (series, effectiveChartType, values) {
|
|
991
1002
|
var _a, _b;
|
|
992
1003
|
if (effectiveChartType !== "line" && effectiveChartType !== "area") {
|
|
993
1004
|
return {};
|
|
@@ -1009,16 +1020,32 @@ var BasicChart = function (_a) {
|
|
|
1009
1020
|
size: (_b = marker === null || marker === void 0 ? void 0 : marker.size) !== null && _b !== void 0 ? _b : 6,
|
|
1010
1021
|
};
|
|
1011
1022
|
}
|
|
1023
|
+
else {
|
|
1024
|
+
// A marker-less line draws nothing for a point with a gap on both sides (a data
|
|
1025
|
+
// row followed by a blank row — the first row included), so that row vanishes from
|
|
1026
|
+
// the chart. Excel plots an isolated marker there: keep the line and give only those
|
|
1027
|
+
// points a marker (plotly's `marker.size` / `marker.opacity` are per-point arrays;
|
|
1028
|
+
// a 0-size, 0-opacity marker paints nothing on the connected points).
|
|
1029
|
+
var isolated_1 = new Set((0, empty_cells_1.isolatedPointIndexes)(values, (0, empty_cells_1.connectsAcrossEmptyCells)(spec, true)));
|
|
1030
|
+
if (isolated_1.size) {
|
|
1031
|
+
extra.mode = "lines+markers";
|
|
1032
|
+
extra.marker = {
|
|
1033
|
+
symbol: "circle",
|
|
1034
|
+
size: values.map(function (_, i) { return (isolated_1.has(i) ? 6 : 0); }),
|
|
1035
|
+
opacity: values.map(function (_, i) { return (isolated_1.has(i) ? 1 : 0); }),
|
|
1036
|
+
};
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1012
1039
|
}
|
|
1013
1040
|
return extra;
|
|
1014
1041
|
};
|
|
1015
1042
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1016
|
-
primaryDomainSource = (
|
|
1043
|
+
primaryDomainSource = (_46 = (_45 = (_44 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _44 === void 0 ? void 0 : _44[0]) === null || _45 === void 0 ? void 0 : _45.sources) === null || _46 === void 0 ? void 0 : _46[0];
|
|
1017
1044
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1018
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1045
|
+
? (0, aggregation_1.sanitizeDomainValues)((_47 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _47 !== void 0 ? _47 : [])
|
|
1019
1046
|
: [];
|
|
1020
1047
|
domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1021
|
-
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((
|
|
1048
|
+
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_48 = spec.categoryLevels) === null || _48 === void 0 ? void 0 : _48.map(function (level) {
|
|
1022
1049
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1023
1050
|
}));
|
|
1024
1051
|
multicategoryX = categoryLevels
|
|
@@ -1028,7 +1055,7 @@ var BasicChart = function (_a) {
|
|
|
1028
1055
|
domainData = categoryLevels.leaf;
|
|
1029
1056
|
}
|
|
1030
1057
|
aggregateDomainValues = domainData;
|
|
1031
|
-
domainAxisData = (categoryLevels ? [] : (
|
|
1058
|
+
domainAxisData = (categoryLevels ? [] : (_49 = spec.domains) !== null && _49 !== void 0 ? _49 : []).map(function (domain, domainIndex) {
|
|
1032
1059
|
return domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1033
1060
|
var _a;
|
|
1034
1061
|
if (domainIndex === 0 && sourceIndex === 0) {
|
|
@@ -1284,29 +1311,29 @@ var BasicChart = function (_a) {
|
|
|
1284
1311
|
finally { if (e_6) throw e_6.error; }
|
|
1285
1312
|
}
|
|
1286
1313
|
};
|
|
1287
|
-
domainSources = (
|
|
1314
|
+
domainSources = (_52 = (_51 = (_50 = spec.domains) === null || _50 === void 0 ? void 0 : _50[0]) === null || _51 === void 0 ? void 0 : _51.sources) !== null && _52 !== void 0 ? _52 : [];
|
|
1288
1315
|
seriesIndex = 0;
|
|
1289
1316
|
_loop_2 = function (series) {
|
|
1290
|
-
var currentSeriesIndex, dataLabel,
|
|
1291
|
-
return tslib_1.__generator(this, function (
|
|
1292
|
-
switch (
|
|
1317
|
+
var currentSeriesIndex, dataLabel, _77, _78, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, _79, labels, counts, cumulativePercents, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, trace, rawValues, trace, pieData, _80, 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, _81, x, y, orientation_1, trace, numericValues, _82, x, y, orientation_2, trace;
|
|
1318
|
+
return tslib_1.__generator(this, function (_83) {
|
|
1319
|
+
switch (_83.label) {
|
|
1293
1320
|
case 0:
|
|
1294
1321
|
currentSeriesIndex = seriesIndex++;
|
|
1295
1322
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1296
|
-
|
|
1297
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1323
|
+
_78 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1324
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_54 = position.sheetId) !== null && _54 !== void 0 ? _54 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1298
1325
|
case 1:
|
|
1299
|
-
|
|
1326
|
+
_77 = _78.apply(void 0, [_83.sent()]);
|
|
1300
1327
|
return [3 /*break*/, 3];
|
|
1301
1328
|
case 2:
|
|
1302
|
-
|
|
1303
|
-
|
|
1329
|
+
_77 = (_55 = series.dataLabel) !== null && _55 !== void 0 ? _55 : "";
|
|
1330
|
+
_83.label = 3;
|
|
1304
1331
|
case 3:
|
|
1305
|
-
dataLabel =
|
|
1332
|
+
dataLabel = _77;
|
|
1306
1333
|
// A series with no ranges draws nothing.
|
|
1307
1334
|
if (series.sources.length === 0)
|
|
1308
1335
|
return [2 /*return*/, "continue"];
|
|
1309
|
-
effectiveChartType = (
|
|
1336
|
+
effectiveChartType = (_56 = series.seriesChartType) !== null && _56 !== void 0 ? _56 : spec.chartType;
|
|
1310
1337
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1311
1338
|
pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
|
|
1312
1339
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
@@ -1344,14 +1371,14 @@ var BasicChart = function (_a) {
|
|
|
1344
1371
|
: seriesData;
|
|
1345
1372
|
binCount = spec.binCount;
|
|
1346
1373
|
if (isPareto) {
|
|
1347
|
-
|
|
1374
|
+
_79 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _79.labels, counts = _79.counts, cumulativePercents = _79.cumulativePercents;
|
|
1348
1375
|
barTrace = {
|
|
1349
1376
|
type: "bar",
|
|
1350
1377
|
x: labels,
|
|
1351
1378
|
y: counts,
|
|
1352
1379
|
name: dataLabel,
|
|
1353
1380
|
};
|
|
1354
|
-
applyTraceColor(barTrace, (
|
|
1381
|
+
applyTraceColor(barTrace, (_57 = series.color) !== null && _57 !== void 0 ? _57 : undefined, {
|
|
1355
1382
|
noFill: series.noFill,
|
|
1356
1383
|
dataPointColors: series.dataPointColors,
|
|
1357
1384
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1372,7 +1399,7 @@ var BasicChart = function (_a) {
|
|
|
1372
1399
|
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
|
|
1373
1400
|
? { nbinsx: binCount }
|
|
1374
1401
|
: {}));
|
|
1375
|
-
applyTraceColor(trace, (
|
|
1402
|
+
applyTraceColor(trace, (_58 = series.color) !== null && _58 !== void 0 ? _58 : undefined, {
|
|
1376
1403
|
noFill: series.noFill,
|
|
1377
1404
|
dataPointColors: series.dataPointColors,
|
|
1378
1405
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1422,7 +1449,7 @@ var BasicChart = function (_a) {
|
|
|
1422
1449
|
// default and `showOutliers: true` alike).
|
|
1423
1450
|
boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
|
|
1424
1451
|
}
|
|
1425
|
-
applyTraceColor(trace, (
|
|
1452
|
+
applyTraceColor(trace, (_59 = series.color) !== null && _59 !== void 0 ? _59 : undefined, {
|
|
1426
1453
|
noFill: series.noFill,
|
|
1427
1454
|
dataPointColors: series.dataPointColors,
|
|
1428
1455
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1434,7 +1461,7 @@ var BasicChart = function (_a) {
|
|
|
1434
1461
|
rawValues = "values" in seriesData
|
|
1435
1462
|
? seriesData.values
|
|
1436
1463
|
: seriesData;
|
|
1437
|
-
totalIndices_1 = new Set((
|
|
1464
|
+
totalIndices_1 = new Set((_60 = spec.totalIndices) !== null && _60 !== void 0 ? _60 : []);
|
|
1438
1465
|
trace = {
|
|
1439
1466
|
type: "waterfall",
|
|
1440
1467
|
x: categoriesFor(series),
|
|
@@ -1444,7 +1471,7 @@ var BasicChart = function (_a) {
|
|
|
1444
1471
|
}),
|
|
1445
1472
|
name: dataLabel,
|
|
1446
1473
|
};
|
|
1447
|
-
applyTraceColor(trace, (
|
|
1474
|
+
applyTraceColor(trace, (_61 = series.color) !== null && _61 !== void 0 ? _61 : undefined, {
|
|
1448
1475
|
noFill: series.noFill,
|
|
1449
1476
|
dataPointColors: series.dataPointColors,
|
|
1450
1477
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1462,7 +1489,7 @@ var BasicChart = function (_a) {
|
|
|
1462
1489
|
x: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }),
|
|
1463
1490
|
name: dataLabel,
|
|
1464
1491
|
};
|
|
1465
|
-
applyTraceColor(trace, (
|
|
1492
|
+
applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
|
|
1466
1493
|
noFill: series.noFill,
|
|
1467
1494
|
dataPointColors: series.dataPointColors,
|
|
1468
1495
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1480,10 +1507,10 @@ var BasicChart = function (_a) {
|
|
|
1480
1507
|
return [2 /*return*/, "continue"];
|
|
1481
1508
|
ofPieHandled = true;
|
|
1482
1509
|
pieData = seriesData;
|
|
1483
|
-
|
|
1510
|
+
_80 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
|
|
1484
1511
|
splitType: spec.splitType,
|
|
1485
1512
|
splitPos: spec.splitPos,
|
|
1486
|
-
}), main_1 =
|
|
1513
|
+
}), main_1 = _80.main, secondary = _80.secondary, otherTotal = _80.otherTotal, total = _80.total;
|
|
1487
1514
|
ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
|
|
1488
1515
|
secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
|
|
1489
1516
|
halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
|
|
@@ -1614,7 +1641,7 @@ var BasicChart = function (_a) {
|
|
|
1614
1641
|
trace.meta = {
|
|
1615
1642
|
rncSeriesIndex: currentSeriesIndex,
|
|
1616
1643
|
};
|
|
1617
|
-
applyTraceColor(trace, (
|
|
1644
|
+
applyTraceColor(trace, (_63 = series.color) !== null && _63 !== void 0 ? _63 : undefined, {
|
|
1618
1645
|
noFill: series.noFill,
|
|
1619
1646
|
dataPointColors: series.dataPointColors,
|
|
1620
1647
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1623,13 +1650,13 @@ var BasicChart = function (_a) {
|
|
|
1623
1650
|
traces.push(trace);
|
|
1624
1651
|
}
|
|
1625
1652
|
else if ("values" in seriesData && "labels" in seriesData) {
|
|
1626
|
-
|
|
1627
|
-
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));
|
|
1653
|
+
_81 = assignCartesianData(categoriesFor(series), seriesData.values), x = _81.x, y = _81.y, orientation_1 = _81.orientation;
|
|
1654
|
+
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));
|
|
1628
1655
|
// Ties the trace back to spec.series for click selection
|
|
1629
1656
|
trace.meta = {
|
|
1630
1657
|
rncSeriesIndex: currentSeriesIndex,
|
|
1631
1658
|
};
|
|
1632
|
-
applyTraceColor(trace, (
|
|
1659
|
+
applyTraceColor(trace, (_64 = series.color) !== null && _64 !== void 0 ? _64 : undefined, {
|
|
1633
1660
|
noFill: series.noFill,
|
|
1634
1661
|
dataPointColors: series.dataPointColors,
|
|
1635
1662
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1644,13 +1671,13 @@ var BasicChart = function (_a) {
|
|
|
1644
1671
|
}
|
|
1645
1672
|
else {
|
|
1646
1673
|
numericValues = seriesData;
|
|
1647
|
-
|
|
1648
|
-
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));
|
|
1674
|
+
_82 = assignCartesianData(categoriesFor(series), numericValues), x = _82.x, y = _82.y, orientation_2 = _82.orientation;
|
|
1675
|
+
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));
|
|
1649
1676
|
// Ties the trace back to spec.series for click selection
|
|
1650
1677
|
trace.meta = {
|
|
1651
1678
|
rncSeriesIndex: currentSeriesIndex,
|
|
1652
1679
|
};
|
|
1653
|
-
applyTraceColor(trace, (
|
|
1680
|
+
applyTraceColor(trace, (_65 = series.color) !== null && _65 !== void 0 ? _65 : undefined, {
|
|
1654
1681
|
noFill: series.noFill,
|
|
1655
1682
|
dataPointColors: series.dataPointColors,
|
|
1656
1683
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1667,29 +1694,29 @@ var BasicChart = function (_a) {
|
|
|
1667
1694
|
}
|
|
1668
1695
|
});
|
|
1669
1696
|
};
|
|
1670
|
-
|
|
1697
|
+
_76.label = 18;
|
|
1671
1698
|
case 18:
|
|
1672
|
-
|
|
1673
|
-
_j = tslib_1.__values((
|
|
1674
|
-
|
|
1699
|
+
_76.trys.push([18, 23, 24, 25]);
|
|
1700
|
+
_j = tslib_1.__values((_53 = spec.series) !== null && _53 !== void 0 ? _53 : []), _k = _j.next();
|
|
1701
|
+
_76.label = 19;
|
|
1675
1702
|
case 19:
|
|
1676
1703
|
if (!!_k.done) return [3 /*break*/, 22];
|
|
1677
1704
|
series = _k.value;
|
|
1678
1705
|
return [5 /*yield**/, _loop_2(series)];
|
|
1679
1706
|
case 20:
|
|
1680
|
-
|
|
1681
|
-
|
|
1707
|
+
_76.sent();
|
|
1708
|
+
_76.label = 21;
|
|
1682
1709
|
case 21:
|
|
1683
1710
|
_k = _j.next();
|
|
1684
1711
|
return [3 /*break*/, 19];
|
|
1685
1712
|
case 22: return [3 /*break*/, 25];
|
|
1686
1713
|
case 23:
|
|
1687
|
-
e_3_1 =
|
|
1714
|
+
e_3_1 = _76.sent();
|
|
1688
1715
|
e_3 = { error: e_3_1 };
|
|
1689
1716
|
return [3 /*break*/, 25];
|
|
1690
1717
|
case 24:
|
|
1691
1718
|
try {
|
|
1692
|
-
if (_k && !_k.done && (
|
|
1719
|
+
if (_k && !_k.done && (_p = _j.return)) _p.call(_j);
|
|
1693
1720
|
}
|
|
1694
1721
|
finally { if (e_3) throw e_3.error; }
|
|
1695
1722
|
return [7 /*endfinally*/];
|
|
@@ -1701,33 +1728,93 @@ var BasicChart = function (_a) {
|
|
|
1701
1728
|
? undefined
|
|
1702
1729
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1703
1730
|
axisOptions: spec.valueAxisOptions,
|
|
1704
|
-
series: ((
|
|
1731
|
+
series: ((_66 = spec.series) !== null && _66 !== void 0 ? _66 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
1705
1732
|
getFormattingFromRange: getFormattingFromRange,
|
|
1706
1733
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1707
1734
|
});
|
|
1708
1735
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1709
1736
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
1710
|
-
series: ((
|
|
1737
|
+
series: ((_67 = spec.series) !== null && _67 !== void 0 ? _67 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
1711
1738
|
getFormattingFromRange: getFormattingFromRange,
|
|
1712
1739
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1713
1740
|
});
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1741
|
+
_l = applyLegendOverridesPlotly({ font: { color: textColor } }, spec.legend), legendOverrides = _l.legend, showlegend = _l.showlegend;
|
|
1742
|
+
axisFontSize = 12;
|
|
1743
|
+
primaryValues = traces.flatMap(function (trace) {
|
|
1744
|
+
var values = isHorizontalBarChart ? trace === null || trace === void 0 ? void 0 : trace.x : trace === null || trace === void 0 ? void 0 : trace.y;
|
|
1745
|
+
return (trace === null || trace === void 0 ? void 0 : trace[valueAxisKey]) === secondaryValueAxisRef || !Array.isArray(values)
|
|
1746
|
+
? []
|
|
1747
|
+
: values;
|
|
1748
|
+
});
|
|
1749
|
+
leftAxisLabelDepth = isHorizontalBarChart
|
|
1750
|
+
? Math.ceil(Math.max.apply(Math, tslib_1.__spreadArray([0], tslib_1.__read((domainData !== null && domainData !== void 0 ? domainData : []).map(function (label) {
|
|
1751
|
+
return (0, legend_layout_1.measureTextWidth)(String(label !== null && label !== void 0 ? label : ""), axisFontSize);
|
|
1752
|
+
})), false))) + 8
|
|
1753
|
+
: (0, axis_number_format_1.valueAxisNameGap)({
|
|
1754
|
+
values: primaryValues,
|
|
1755
|
+
pattern: primaryAxisNumberFormat,
|
|
1756
|
+
fontSize: axisFontSize,
|
|
1757
|
+
minimum: 0,
|
|
1758
|
+
}) -
|
|
1759
|
+
axisFontSize -
|
|
1760
|
+
6;
|
|
1761
|
+
leftAxisDepth = leftAxisLabelDepth +
|
|
1762
|
+
(spec.verticalAxisTitle
|
|
1763
|
+
? VALUE_AXIS_TITLE_STANDOFF + Math.ceil(axisFontSize * 1.3)
|
|
1764
|
+
: 0);
|
|
1765
|
+
rightAxisDepth = hasSecondaryAxis && !isHorizontalBarChart
|
|
1766
|
+
? (0, axis_number_format_1.valueAxisNameGap)({
|
|
1767
|
+
values: traces.flatMap(function (trace) {
|
|
1768
|
+
return (trace === null || trace === void 0 ? void 0 : trace[valueAxisKey]) === secondaryValueAxisRef && Array.isArray(trace === null || trace === void 0 ? void 0 : trace.y)
|
|
1769
|
+
? trace.y
|
|
1770
|
+
: [];
|
|
1771
|
+
}),
|
|
1772
|
+
pattern: secondaryAxisNumberFormat,
|
|
1773
|
+
fontSize: axisFontSize,
|
|
1774
|
+
minimum: 0,
|
|
1775
|
+
}) -
|
|
1776
|
+
axisFontSize -
|
|
1777
|
+
6
|
|
1778
|
+
: 0;
|
|
1779
|
+
bottomAxisTitleStandoff = isHorizontalBarChart
|
|
1780
|
+
? VALUE_AXIS_TITLE_STANDOFF
|
|
1781
|
+
: legend_layout_1.BAND_GAP;
|
|
1782
|
+
legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
|
|
1783
|
+
position: (_68 = spec.legend) === null || _68 === void 0 ? void 0 : _68.position,
|
|
1784
|
+
visible: showlegend !== false,
|
|
1785
|
+
labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
|
|
1786
|
+
legendFontSize: (_71 = (_70 = (_69 = spec.legend) === null || _69 === void 0 ? void 0 : _69.textFormat) === null || _70 === void 0 ? void 0 : _70.fontSize) !== null && _71 !== void 0 ? _71 : axisFontSize,
|
|
1787
|
+
width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
|
|
1788
|
+
height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
|
|
1789
|
+
hasTitle: Boolean(title),
|
|
1790
|
+
titleFontSize: (_72 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _72 !== void 0 ? _72 : 16,
|
|
1791
|
+
hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
|
|
1792
|
+
hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
|
|
1793
|
+
leftAxisDepth: leftAxisDepth,
|
|
1794
|
+
rightAxisDepth: rightAxisDepth,
|
|
1795
|
+
bottomAxisTitleStandoff: bottomAxisTitleStandoff,
|
|
1796
|
+
axisFontSize: axisFontSize,
|
|
1797
|
+
});
|
|
1798
|
+
newLayout = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ title: tslib_1.__assign({ text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat), font: applyTextFormatToFont({
|
|
1717
1799
|
family: "Untitled Sans, apple-system, sans-serif",
|
|
1718
1800
|
size: 16,
|
|
1719
1801
|
color: textColor,
|
|
1720
|
-
}, authoredTitleFmt),
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1802
|
+
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_73 = legendBand.legend) !== null && _73 !== void 0 ? _73 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
|
|
1803
|
+
spec.stackedType
|
|
1804
|
+
? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
|
|
1805
|
+
spec.stackedType === "PERCENT_STACKED"
|
|
1806
|
+
? "stack"
|
|
1807
|
+
: "group" }, (isPercentStackedBars ? { barnorm: "percent" } : {})) : {})), (typeof spec.gapWidth === "number"
|
|
1808
|
+
? { bargap: Math.max(0, Math.min(0.95, spec.gapWidth / 400)) }
|
|
1809
|
+
: {})), { font: {
|
|
1724
1810
|
family: "Untitled Sans, apple-system, sans-serif",
|
|
1725
1811
|
size: 12,
|
|
1726
1812
|
color: textColor,
|
|
1727
1813
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
|
|
1728
1814
|
title: {
|
|
1729
|
-
text: (
|
|
1815
|
+
text: (_74 = spec.horizontalAxisTitle) !== null && _74 !== void 0 ? _74 : "",
|
|
1730
1816
|
font: { color: textColor },
|
|
1817
|
+
standoff: bottomAxisTitleStandoff,
|
|
1731
1818
|
},
|
|
1732
1819
|
automargin: true,
|
|
1733
1820
|
showgrid: true,
|
|
@@ -1743,10 +1830,9 @@ var BasicChart = function (_a) {
|
|
|
1743
1830
|
isHorizontalBarChart
|
|
1744
1831
|
? spec.valueAxisOptions
|
|
1745
1832
|
: spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
|
|
1746
|
-
title: {
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
},
|
|
1833
|
+
title: tslib_1.__assign({ text: (_75 = spec.verticalAxisTitle) !== null && _75 !== void 0 ? _75 : "", font: { color: textColor } }, (isHorizontalBarChart
|
|
1834
|
+
? {}
|
|
1835
|
+
: { standoff: VALUE_AXIS_TITLE_STANDOFF })),
|
|
1750
1836
|
showgrid: !isHorizontalBarChart,
|
|
1751
1837
|
gridcolor: gridColor,
|
|
1752
1838
|
automargin: true,
|
|
@@ -1757,14 +1843,17 @@ var BasicChart = function (_a) {
|
|
|
1757
1843
|
: undefined,
|
|
1758
1844
|
}, isHorizontalBarChart
|
|
1759
1845
|
? spec.categoryAxisOptions
|
|
1760
|
-
: spec.valueAxisOptions, isHorizontalBarChart ? undefined : primaryAxisNumberFormat) }, (hasSecondaryAxis
|
|
1761
|
-
? (
|
|
1762
|
-
|
|
1846
|
+
: spec.valueAxisOptions, isHorizontalBarChart ? undefined : primaryAxisNumberFormat) }), (hasSecondaryAxis
|
|
1847
|
+
? (_q = {},
|
|
1848
|
+
_q[isHorizontalBarChart ? "xaxis2" : "yaxis2"] = applyAxisOverridesPlotly(tslib_1.__assign({ title: {
|
|
1849
|
+
font: { color: textColor },
|
|
1850
|
+
standoff: VALUE_AXIS_TITLE_STANDOFF,
|
|
1851
|
+
}, overlaying: isHorizontalBarChart ? "x" : "y", side: isHorizontalBarChart ? "top" : "right", showgrid: false, automargin: true }, (isPareto
|
|
1763
1852
|
? { range: [0, 100], ticksuffix: "%" }
|
|
1764
1853
|
: {})), spec.secondaryValueAxisOptions, secondaryAxisNumberFormat),
|
|
1765
|
-
|
|
1766
|
-
? (
|
|
1767
|
-
|
|
1854
|
+
_q) : {})), (hasSecondaryCategoryAxis && secondaryDomainData
|
|
1855
|
+
? (_r = {},
|
|
1856
|
+
_r[isHorizontalBarChart ? "yaxis2" : "xaxis2"] = {
|
|
1768
1857
|
overlaying: isHorizontalBarChart ? "y" : "x",
|
|
1769
1858
|
side: isHorizontalBarChart ? "right" : "top",
|
|
1770
1859
|
type: "category",
|
|
@@ -1774,7 +1863,8 @@ var BasicChart = function (_a) {
|
|
|
1774
1863
|
automargin: true,
|
|
1775
1864
|
visible: (0, helpers_1.showXAxis)(spec === null || spec === void 0 ? void 0 : spec.chartType),
|
|
1776
1865
|
},
|
|
1777
|
-
|
|
1866
|
+
_r) : {})), (ofPieExtras
|
|
1867
|
+
? 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 } : {})) : {}));
|
|
1778
1868
|
dlOpts = spec.dataLabels;
|
|
1779
1869
|
doughnutHole = spec.doughnutHoleSize;
|
|
1780
1870
|
seriesNumberFormats = (0, axis_number_format_1.resolveSeriesNumberFormats)(spec.series, getFormattingFromRange, spec.hiddenDimensionStrategy);
|