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