@rowsncolumns/charts 28.1.8 → 28.1.10
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 +483 -417
- package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/basic-chart/helpers.js +2 -0
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +315 -184
- package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/helpers.js +2 -0
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils/bubble.d.ts +34 -1
- package/dist/cjs/utils/bubble.d.ts.map +1 -1
- package/dist/cjs/utils/bubble.js +39 -13
- package/dist/cjs/utils/echarts-overlays.d.ts +46 -0
- package/dist/cjs/utils/echarts-overlays.d.ts.map +1 -0
- package/dist/cjs/utils/echarts-overlays.js +134 -0
- package/dist/cjs/utils/hierarchy.d.ts +23 -1
- package/dist/cjs/utils/hierarchy.d.ts.map +1 -1
- package/dist/cjs/utils/hierarchy.js +179 -55
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +9 -2
- package/dist/cjs/utils/trendline.d.ts +7 -1
- package/dist/cjs/utils/trendline.d.ts.map +1 -1
- package/dist/cjs/utils/trendline.js +82 -18
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +320 -239
- package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/basic-chart/helpers.js +2 -0
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +235 -58
- package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/helpers.js +2 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/bubble.d.ts +34 -1
- package/dist/esm/utils/bubble.d.ts.map +1 -1
- package/dist/esm/utils/bubble.js +35 -11
- package/dist/esm/utils/echarts-overlays.d.ts +46 -0
- package/dist/esm/utils/echarts-overlays.d.ts.map +1 -0
- package/dist/esm/utils/echarts-overlays.js +135 -0
- package/dist/esm/utils/hierarchy.d.ts +23 -1
- package/dist/esm/utils/hierarchy.d.ts.map +1 -1
- package/dist/esm/utils/hierarchy.js +168 -50
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +9 -2
- package/dist/esm/utils/trendline.d.ts +7 -1
- package/dist/esm/utils/trendline.d.ts.map +1 -1
- package/dist/esm/utils/trendline.js +67 -14
- package/package.json +3 -3
|
@@ -354,6 +354,15 @@ var sanitizeChartValue = function (value) {
|
|
|
354
354
|
* (Excel): every range's points in sequence. A single range passes through
|
|
355
355
|
* untouched so the common path renders exactly as before.
|
|
356
356
|
*/
|
|
357
|
+
/**
|
|
358
|
+
* The plain value array of a series' data. (`"values" in seriesData` is
|
|
359
|
+
* true for an ARRAY too — `Array.prototype.values` — which handed the
|
|
360
|
+
* waterfall / funnel / histogram / boxplot branches that method instead
|
|
361
|
+
* of the numbers.)
|
|
362
|
+
*/
|
|
363
|
+
var seriesValuesOf = function (seriesData) {
|
|
364
|
+
return Array.isArray(seriesData) ? seriesData : seriesData.values;
|
|
365
|
+
};
|
|
357
366
|
var mergeSeriesData = function (parts) {
|
|
358
367
|
var e_1, _a;
|
|
359
368
|
if (parts.length === 1)
|
|
@@ -417,6 +426,11 @@ var BasicChart = function (_a) {
|
|
|
417
426
|
// The plotted `<div>` plotly hands back on init — what `Plotly.toImage`
|
|
418
427
|
// rasterises for Copy as Picture and the print preview.
|
|
419
428
|
var graphDivRef = (0, react_1.useRef)(null);
|
|
429
|
+
// Plotly zooms a treemap / sunburst into the clicked branch by default;
|
|
430
|
+
// Excel has no drill-down, so the click handler cancels it unless the
|
|
431
|
+
// spec opts in (`drillDown`).
|
|
432
|
+
var drillDownRef = (0, react_1.useRef)(false);
|
|
433
|
+
drillDownRef.current = Boolean(spec.drillDown);
|
|
420
434
|
var focusSheet = (0, spreadsheet_1.useFocusSheet)();
|
|
421
435
|
// Excel selects a data series (or one data point) when it is clicked
|
|
422
436
|
// inside the chart and the grid highlights its source cells. The plot
|
|
@@ -493,11 +507,11 @@ var BasicChart = function (_a) {
|
|
|
493
507
|
* Triggers a chart update
|
|
494
508
|
*/
|
|
495
509
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
496
|
-
var traces, chartType, position, isBubble, isHierarchy, textColor, bgColor, gridColor, skipHeaders_1, labels, perSeriesX, perSeriesSize, seriesInputs, i, seriesEntry, resolvedLabel, _a, xValues, sizeValues_1, sharedXValues, sharedSizeValues, _b, categories_1, preparedSeries, sizeValues, sizeScale_1, hasStringX_1, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLayout, hierarchyRows, headerTitle,
|
|
510
|
+
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, hasBubbleSecondaryAxis, palette_1, isScatter_1, scatterStyle_1, plotlyModeForScatterStyle_1, lineShapeFor_1, traces_1, titleFmt, xAxisFmt, yAxisFmt, legendFmt, bubbleLayout, hierarchyRows, headerTitle, hierarchyData_1, seriesName, hierarchyPalette, nodeColors, isSunburst, SUNBURST_ROOT_ID_1, rootTotal, hierarchyTrace, layoutForHierarchy, labels, seriesEntry, rawValues_1, locations_1, z_1, ramp_1, colorscale, geoScope, regionTrace, surfaceToken, categories, surfaceSeriesInputs, _c, _d, seriesEntry, dataLabel, _e, _f, values, e_2_1, seriesNames, surfaceTrace, surfaceLayout, categories, radarStyle, radarTraces, radarInputs, _g, _h, seriesEntry, label, values, radarAxisOptions, indicators, _loop_1, i, radarScale, variant, categories, seriesValues, volumePoints_1, hasVolume, buildVolumeTrace, volumeLayout, priceYAxisDomain, roles, xs_1, candleTrace, lineSeries, stockPalette_1, xs_2, stockTraces, isStacked, isHorizontalBarChart, lineTraceVariant, shouldAggregate, primaryDomainSource, rawPrimaryDomainValues, domainData, categoryLevels, multicategoryX, aggregateDomainValues, domainAxisData, secondaryDomainData, categoriesFor, assignCartesianData, themeColorPalette, applyTraceColor, hasSecondaryAxis, hasSecondaryCategoryAxis, valueAxisKey, categoryAxisKey, secondaryValueAxisRef, secondaryCategoryAxisRef, isPareto, isOfPie, ofPieHandled, ofPieExtras, decorateCartesianTrace, domainSources, seriesIndex, _loop_2, _j, _k, series, e_3_1, authoredTitleFmt, isPercentStackedBars, primaryAxisNumberFormat, secondaryAxisNumberFormat, _l, legendOverrides, showlegend, axisFontSize, primaryValues, leftAxisLabelDepth, leftAxisDepth, rightAxisDepth, bottomAxisTitleStandoff, legendBand, newLayout, dlOpts, doughnutSeriesOrder, doughnutRingSet, traceDataLabels, doughnutHole, seriesNumberFormats, traceNumberFormat, piePull, formattedTraces, sortedTraces;
|
|
497
511
|
var e_2, _m, e_4, _o, e_3, _p, _q, _r;
|
|
498
|
-
var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76;
|
|
499
|
-
return tslib_1.__generator(this, function (
|
|
500
|
-
switch (
|
|
512
|
+
var _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76, _77, _78, _79, _80, _81;
|
|
513
|
+
return tslib_1.__generator(this, function (_82) {
|
|
514
|
+
switch (_82.label) {
|
|
501
515
|
case 0:
|
|
502
516
|
(0, utils_1.debug)("Updating chart", chart);
|
|
503
517
|
traces = [];
|
|
@@ -522,7 +536,7 @@ var BasicChart = function (_a) {
|
|
|
522
536
|
});
|
|
523
537
|
seriesInputs = [];
|
|
524
538
|
i = 0;
|
|
525
|
-
|
|
539
|
+
_82.label = 1;
|
|
526
540
|
case 1:
|
|
527
541
|
if (!(i < spec.series.length)) return [3 /*break*/, 5];
|
|
528
542
|
seriesEntry = spec.series[i];
|
|
@@ -531,13 +545,13 @@ var BasicChart = function (_a) {
|
|
|
531
545
|
_a = chart_spec_utils_1.coerceCalculatedLabel;
|
|
532
546
|
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)];
|
|
533
547
|
case 2:
|
|
534
|
-
resolvedLabel = _a.apply(void 0, [
|
|
535
|
-
|
|
548
|
+
resolvedLabel = _a.apply(void 0, [_82.sent()]);
|
|
549
|
+
_82.label = 3;
|
|
536
550
|
case 3:
|
|
537
551
|
xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
|
|
538
552
|
sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
|
|
539
553
|
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 } : {})));
|
|
540
|
-
|
|
554
|
+
_82.label = 4;
|
|
541
555
|
case 4:
|
|
542
556
|
i++;
|
|
543
557
|
return [3 /*break*/, 1];
|
|
@@ -550,8 +564,13 @@ var BasicChart = function (_a) {
|
|
|
550
564
|
sizeValues: sharedSizeValues,
|
|
551
565
|
series: seriesInputs,
|
|
552
566
|
}), categories_1 = _b.categories, preparedSeries = _b.series, sizeValues = _b.sizeValues;
|
|
553
|
-
sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues
|
|
567
|
+
sizeScale_1 = (0, bubble_1.createBubbleSizeScale)(sizeValues, {
|
|
568
|
+
sizeRepresents: spec.sizeRepresents,
|
|
569
|
+
bubbleScale: spec.bubbleScale,
|
|
570
|
+
plotMinSide: Math.min((width !== null && width !== void 0 ? width : 0) - 80, (height !== null && height !== void 0 ? height : 0) - 100),
|
|
571
|
+
});
|
|
554
572
|
hasStringX_1 = categories_1.length > 0;
|
|
573
|
+
hasBubbleSecondaryAxis = ((_1 = spec.series) !== null && _1 !== void 0 ? _1 : []).some(function (seriesEntry) { return seriesEntry === null || seriesEntry === void 0 ? void 0 : seriesEntry.useSecondaryAxis; });
|
|
555
574
|
palette_1 = (0, chart_styles_1.getChartPalette)(spec, [
|
|
556
575
|
theme.themeColors.accent1,
|
|
557
576
|
theme.themeColors.accent2,
|
|
@@ -561,7 +580,7 @@ var BasicChart = function (_a) {
|
|
|
561
580
|
theme.themeColors.accent6,
|
|
562
581
|
]);
|
|
563
582
|
isScatter_1 = spec.chartType === "scatter";
|
|
564
|
-
scatterStyle_1 = (
|
|
583
|
+
scatterStyle_1 = (_2 = spec.scatterStyle) !== null && _2 !== void 0 ? _2 : (isScatter_1 ? "lineMarker" : undefined);
|
|
565
584
|
plotlyModeForScatterStyle_1 = function (style) {
|
|
566
585
|
switch (style) {
|
|
567
586
|
case "line":
|
|
@@ -582,8 +601,10 @@ var BasicChart = function (_a) {
|
|
|
582
601
|
? "spline"
|
|
583
602
|
: "linear";
|
|
584
603
|
};
|
|
585
|
-
traces_1 =
|
|
586
|
-
|
|
604
|
+
traces_1 = [];
|
|
605
|
+
preparedSeries.forEach(function (entry, index) {
|
|
606
|
+
var e_5, _a, e_6, _b;
|
|
607
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
587
608
|
var xValues = entry.points.map(function (point) {
|
|
588
609
|
var _a, _b;
|
|
589
610
|
return hasStringX_1
|
|
@@ -591,9 +612,57 @@ var BasicChart = function (_a) {
|
|
|
591
612
|
: point.value[0];
|
|
592
613
|
});
|
|
593
614
|
var yValues = entry.points.map(function (point) { return point.value[1]; });
|
|
594
|
-
var
|
|
595
|
-
var
|
|
596
|
-
var
|
|
615
|
+
var rawSizes = entry.points.map(function (point) { return point.value[2]; });
|
|
616
|
+
var seriesSpec = spec.series[index];
|
|
617
|
+
var seriesColor = (_c = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.color) !== null && _c !== void 0 ? _c : (0, utils_1.chartPaletteColorAt)(palette_1, index);
|
|
618
|
+
var perSeriesMarker = (_d = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.marker) !== null && _d !== void 0 ? _d : undefined;
|
|
619
|
+
// Per-point colours (`<c:dPt>`) key on the point's source row
|
|
620
|
+
// (`BubbleSeriesPoint.index` — points without a Y are skipped).
|
|
621
|
+
var pointColorOverrides = new Map();
|
|
622
|
+
try {
|
|
623
|
+
for (var _r = tslib_1.__values((_e = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.dataPointColors) !== null && _e !== void 0 ? _e : []), _s = _r.next(); !_s.done; _s = _r.next()) {
|
|
624
|
+
var dp = _s.value;
|
|
625
|
+
if (typeof (dp === null || dp === void 0 ? void 0 : dp.idx) === "number" && typeof (dp === null || dp === void 0 ? void 0 : dp.color) === "string") {
|
|
626
|
+
pointColorOverrides.set(dp.idx, dp.color);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
631
|
+
finally {
|
|
632
|
+
try {
|
|
633
|
+
if (_s && !_s.done && (_a = _r.return)) _a.call(_r);
|
|
634
|
+
}
|
|
635
|
+
finally { if (e_5) throw e_5.error; }
|
|
636
|
+
}
|
|
637
|
+
var pointColors = function (base) {
|
|
638
|
+
return pointColorOverrides.size
|
|
639
|
+
? entry.points.map(function (point) { var _a; return (_a = pointColorOverrides.get(point.index)) !== null && _a !== void 0 ? _a : base; })
|
|
640
|
+
: base;
|
|
641
|
+
};
|
|
642
|
+
// Hover reads the bubble label and size from `customdata`, leaving
|
|
643
|
+
// `text` to the data labels.
|
|
644
|
+
var customdata = entry.points.map(function (point) { return [point.name, point.value[2]]; });
|
|
645
|
+
var onSecondary = (seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.useSecondaryAxis) ? { yaxis: "y2" } : {};
|
|
646
|
+
// This series' data labels: Y value by default, the bubble's size
|
|
647
|
+
// with `showBubbleSize`, the bubble label with `showCategoryName`.
|
|
648
|
+
var labelOpts = (0, overrides_1.resolveSeriesDataLabels)(spec.dataLabels, seriesSpec);
|
|
649
|
+
var labelText = (labelOpts === null || labelOpts === void 0 ? void 0 : labelOpts.show)
|
|
650
|
+
? entry.points.map(function (point) {
|
|
651
|
+
return (0, overrides_1.dataLabelFormatter)(labelOpts, locale)({
|
|
652
|
+
value: point.value,
|
|
653
|
+
name: point.name,
|
|
654
|
+
seriesName: entry.name,
|
|
655
|
+
data: point,
|
|
656
|
+
});
|
|
657
|
+
})
|
|
658
|
+
: undefined;
|
|
659
|
+
var labelPosition = (labelOpts === null || labelOpts === void 0 ? void 0 : labelOpts.show)
|
|
660
|
+
? (_f = (labelOpts.position && PLOTLY_DLBL_POS_POINT[labelOpts.position])) !== null && _f !== void 0 ? _f : "top center"
|
|
661
|
+
: undefined;
|
|
662
|
+
var withLabels = function (trace) {
|
|
663
|
+
return labelText
|
|
664
|
+
? tslib_1.__assign(tslib_1.__assign({}, trace), { mode: withTextMode(trace.mode), text: labelText, textposition: labelPosition }) : trace;
|
|
665
|
+
};
|
|
597
666
|
if (isScatter_1) {
|
|
598
667
|
// Per-series marker.symbol = "none" → pure line (no markers).
|
|
599
668
|
// Per-series marker.size overrides the default. Falls back to
|
|
@@ -603,9 +672,9 @@ var BasicChart = function (_a) {
|
|
|
603
672
|
var mode = noMarkers
|
|
604
673
|
? "lines"
|
|
605
674
|
: plotlyModeForScatterStyle_1(scatterStyle_1);
|
|
606
|
-
var markerSize = (
|
|
607
|
-
var markerColor = (
|
|
608
|
-
|
|
675
|
+
var markerSize = (_g = perSeriesMarker === null || perSeriesMarker === void 0 ? void 0 : perSeriesMarker.size) !== null && _g !== void 0 ? _g : 6;
|
|
676
|
+
var markerColor = (_h = perSeriesMarker === null || perSeriesMarker === void 0 ? void 0 : perSeriesMarker.color) !== null && _h !== void 0 ? _h : seriesColor;
|
|
677
|
+
traces_1.push(withLabels(tslib_1.__assign(tslib_1.__assign({ type: "scatter", mode: mode, x: xValues, y: yValues, customdata: customdata, name: entry.name, hovertemplate: "%{customdata[0]}<br>X: %{x}<br>Y: %{y}<extra></extra>", line: {
|
|
609
678
|
shape: lineShapeFor_1(scatterStyle_1),
|
|
610
679
|
color: seriesColor,
|
|
611
680
|
width: 2,
|
|
@@ -614,71 +683,114 @@ var BasicChart = function (_a) {
|
|
|
614
683
|
: {
|
|
615
684
|
marker: {
|
|
616
685
|
size: markerSize,
|
|
617
|
-
color: markerColor,
|
|
686
|
+
color: pointColors(markerColor),
|
|
618
687
|
symbol: (0, helpers_1.mapMarkerSymbolToPlotly)(symbol),
|
|
619
688
|
},
|
|
620
|
-
}));
|
|
689
|
+
})), onSecondary)));
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
// Bubble — third dimension scaled into marker diameter.
|
|
693
|
+
var scaledSizes = rawSizes.map(function (value) { return sizeScale_1(value); });
|
|
694
|
+
traces_1.push(withLabels(tslib_1.__assign({ type: "scatter", mode: "markers", x: xValues, y: yValues, customdata: customdata, name: entry.name, hovertemplate: "%{customdata[0]}<br>X: %{x}<br>Y: %{y}<br>Size: %{customdata[1]}<extra></extra>", marker: {
|
|
695
|
+
size: scaledSizes,
|
|
696
|
+
sizemode: "diameter",
|
|
697
|
+
color: pointColors(seriesColor),
|
|
698
|
+
opacity: 0.7,
|
|
699
|
+
} }, onSecondary)));
|
|
700
|
+
}
|
|
701
|
+
// Trendlines on the real (x, y) points — a regression of Y on X,
|
|
702
|
+
// not on the point index — and native error bars (#1067).
|
|
703
|
+
var numericX = entry.points.map(function (point) { return point.value[0]; });
|
|
704
|
+
try {
|
|
705
|
+
for (var _t = tslib_1.__values((_j = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.trendlines) !== null && _j !== void 0 ? _j : []), _u = _t.next(); !_u.done; _u = _t.next()) {
|
|
706
|
+
var tl = _u.value;
|
|
707
|
+
var result = (0, trendline_1.computeTrendline)(yValues, {
|
|
708
|
+
type: tl.type,
|
|
709
|
+
order: tl.order,
|
|
710
|
+
period: tl.period,
|
|
711
|
+
forecastForward: tl.forecastForward,
|
|
712
|
+
forecastBackward: tl.forecastBackward,
|
|
713
|
+
}, numericX);
|
|
714
|
+
if (!result || result.points.length < 2)
|
|
715
|
+
continue;
|
|
716
|
+
var tlName = (_k = tl.name) !== null && _k !== void 0 ? _k : "".concat(entry.name ? entry.name + " " : "").concat((_l = tl.type) !== null && _l !== void 0 ? _l : "linear", " trend");
|
|
717
|
+
traces_1.push(tslib_1.__assign({ type: "scatter", mode: "lines", name: tlName, x: result.points.map(function (p) {
|
|
718
|
+
var _a;
|
|
719
|
+
return hasStringX_1
|
|
720
|
+
? (_a = categories_1[Math.round(p.x)]) !== null && _a !== void 0 ? _a : p.x
|
|
721
|
+
: p.x;
|
|
722
|
+
}), y: result.points.map(function (p) { return p.y; }), line: { color: (_m = tl.color) !== null && _m !== void 0 ? _m : seriesColor, dash: "dash", width: 2 }, hoverinfo: "skip" }, onSecondary));
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
726
|
+
finally {
|
|
727
|
+
try {
|
|
728
|
+
if (_u && !_u.done && (_b = _t.return)) _b.call(_t);
|
|
729
|
+
}
|
|
730
|
+
finally { if (e_6) throw e_6.error; }
|
|
731
|
+
}
|
|
732
|
+
if (seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.errorBars) {
|
|
733
|
+
var direction = (_o = seriesSpec.errorBars.direction) !== null && _o !== void 0 ? _o : "y";
|
|
734
|
+
// An X error bar sizes from the X values (a percentage or
|
|
735
|
+
// deviation of X).
|
|
736
|
+
var magnitudes_1 = (0, error_bars_1.computeErrorBars)(direction === "x" ? numericX : yValues, (0, error_bars_1.resolveCustomErrorBarValues)(seriesSpec.errorBars, function (range) {
|
|
737
|
+
return getSeriesValuesFromRange(range, spec.hiddenDimensionStrategy);
|
|
738
|
+
}));
|
|
739
|
+
if (magnitudes_1) {
|
|
740
|
+
var symmetric = magnitudes_1.plus.every(function (plus, i) { return plus === magnitudes_1.minus[i]; });
|
|
741
|
+
var errorConfig = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "data", symmetric: symmetric, array: magnitudes_1.plus }, (symmetric ? {} : { arrayminus: magnitudes_1.minus })), { color: seriesColor }), (seriesSpec.errorBars.noEndCap ? { width: 0 } : {}));
|
|
742
|
+
var target = traces_1[traces_1.length - 1 - ((_q = (_p = seriesSpec.trendlines) === null || _p === void 0 ? void 0 : _p.length) !== null && _q !== void 0 ? _q : 0)];
|
|
743
|
+
if (target) {
|
|
744
|
+
target[direction === "x" ? "error_x" : "error_y"] = errorConfig;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
621
747
|
}
|
|
622
|
-
// Bubble — third dimension scaled into marker diameter.
|
|
623
|
-
var rawSizes = entry.points.map(function (point) { return point.value[2]; });
|
|
624
|
-
var scaledSizes = rawSizes.map(function (value) { return sizeScale_1(value); });
|
|
625
|
-
return {
|
|
626
|
-
type: "scatter",
|
|
627
|
-
mode: "markers",
|
|
628
|
-
x: xValues,
|
|
629
|
-
y: yValues,
|
|
630
|
-
text: labelValuesForSeries,
|
|
631
|
-
customdata: rawSizes,
|
|
632
|
-
name: entry.name,
|
|
633
|
-
hovertemplate: "%{text}<br>X: %{x}<br>Y: %{y}<br>Size: %{customdata}<extra></extra>",
|
|
634
|
-
marker: {
|
|
635
|
-
size: scaledSizes,
|
|
636
|
-
sizemode: "diameter",
|
|
637
|
-
color: seriesColor,
|
|
638
|
-
opacity: 0.7,
|
|
639
|
-
},
|
|
640
|
-
};
|
|
641
748
|
});
|
|
642
749
|
titleFmt = spec.titleTextFormat;
|
|
643
|
-
xAxisFmt = (
|
|
644
|
-
yAxisFmt = (
|
|
645
|
-
legendFmt = (
|
|
646
|
-
bubbleLayout = {
|
|
647
|
-
title: {
|
|
750
|
+
xAxisFmt = (_3 = spec.categoryAxisOptions) === null || _3 === void 0 ? void 0 : _3.textFormat;
|
|
751
|
+
yAxisFmt = (_4 = spec.valueAxisOptions) === null || _4 === void 0 ? void 0 : _4.textFormat;
|
|
752
|
+
legendFmt = (_5 = spec.legend) === null || _5 === void 0 ? void 0 : _5.textFormat;
|
|
753
|
+
bubbleLayout = tslib_1.__assign(tslib_1.__assign({ title: {
|
|
648
754
|
text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
|
|
649
755
|
font: {
|
|
650
|
-
family: (
|
|
651
|
-
size: (
|
|
652
|
-
color: (
|
|
756
|
+
family: (_6 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontFamily) !== null && _6 !== void 0 ? _6 : "Untitled Sans, apple-system, sans-serif",
|
|
757
|
+
size: (_7 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _7 !== void 0 ? _7 : 16,
|
|
758
|
+
color: (_8 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.color) !== null && _8 !== void 0 ? _8 : textColor,
|
|
653
759
|
},
|
|
654
760
|
x: 0.02,
|
|
655
761
|
xanchor: "left",
|
|
656
|
-
},
|
|
657
|
-
|
|
762
|
+
},
|
|
763
|
+
// Axis min / max / reverse / log / visibility from the spec
|
|
764
|
+
// (`categoryAxisOptions` is the X axis, as in the echarts
|
|
765
|
+
// renderer).
|
|
766
|
+
xaxis: applyAxisOverridesPlotly({
|
|
658
767
|
title: {
|
|
659
|
-
text: (
|
|
660
|
-
font: { color: (
|
|
768
|
+
text: (_9 = spec.horizontalAxisTitle) !== null && _9 !== void 0 ? _9 : "",
|
|
769
|
+
font: { color: (_10 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _10 !== void 0 ? _10 : textColor },
|
|
661
770
|
},
|
|
662
771
|
gridcolor: gridColor,
|
|
663
|
-
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
772
|
+
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_11 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _11 !== void 0 ? _11 : 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 } : {})),
|
|
664
773
|
type: hasStringX_1 ? "category" : "linear",
|
|
665
|
-
},
|
|
666
|
-
yaxis: {
|
|
774
|
+
}, spec.categoryAxisOptions), yaxis: applyAxisOverridesPlotly({
|
|
667
775
|
title: {
|
|
668
|
-
text: (
|
|
669
|
-
font: { color: (
|
|
776
|
+
text: (_12 = spec.verticalAxisTitle) !== null && _12 !== void 0 ? _12 : "",
|
|
777
|
+
font: { color: (_13 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _13 !== void 0 ? _13 : textColor },
|
|
670
778
|
},
|
|
671
779
|
gridcolor: gridColor,
|
|
672
|
-
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
673
|
-
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
780
|
+
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_14 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _14 !== void 0 ? _14 : 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 } : {})),
|
|
781
|
+
}, spec.valueAxisOptions) }, (hasBubbleSecondaryAxis
|
|
782
|
+
? {
|
|
783
|
+
yaxis2: applyAxisOverridesPlotly({
|
|
784
|
+
overlaying: "y",
|
|
785
|
+
side: "right",
|
|
786
|
+
showgrid: false,
|
|
787
|
+
automargin: true,
|
|
788
|
+
tickfont: { color: (_15 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _15 !== void 0 ? _15 : textColor },
|
|
789
|
+
}, spec.secondaryValueAxisOptions),
|
|
790
|
+
}
|
|
791
|
+
: {})), { legend: {
|
|
792
|
+
font: tslib_1.__assign(tslib_1.__assign({ color: (_16 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.color) !== null && _16 !== void 0 ? _16 : 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 } : {})),
|
|
793
|
+
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: preparedSeries.length > 1, margin: { l: 60, r: hasBubbleSecondaryAxis ? 60 : 20, t: 50, b: 50 } });
|
|
682
794
|
setPlotData(traces_1);
|
|
683
795
|
setLayout(bubbleLayout);
|
|
684
796
|
return [2 /*return*/];
|
|
@@ -695,19 +807,24 @@ var BasicChart = function (_a) {
|
|
|
695
807
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
696
808
|
});
|
|
697
809
|
hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
|
|
698
|
-
|
|
699
|
-
seriesName =
|
|
700
|
-
? (
|
|
701
|
-
: (
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
810
|
+
hierarchyData_1 = (0, hierarchy_1.toPlotlyHierarchy)(hierarchyRows);
|
|
811
|
+
seriesName = hierarchyData_1.labels.length === 1
|
|
812
|
+
? (_17 = hierarchyData_1.labels[0]) !== null && _17 !== void 0 ? _17 : ""
|
|
813
|
+
: (_18 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _18 !== void 0 ? _18 : "";
|
|
814
|
+
hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
|
|
815
|
+
theme.themeColors.accent1,
|
|
816
|
+
theme.themeColors.accent2,
|
|
817
|
+
theme.themeColors.accent3,
|
|
818
|
+
theme.themeColors.accent4,
|
|
819
|
+
theme.themeColors.accent5,
|
|
820
|
+
theme.themeColors.accent6,
|
|
821
|
+
]);
|
|
822
|
+
nodeColors = (0, hierarchy_1.hierarchyNodeColors)(hierarchyData_1, hierarchyPalette);
|
|
823
|
+
isSunburst = spec.chartType === "sunburst";
|
|
824
|
+
SUNBURST_ROOT_ID_1 = "__rnc_sunburst_root__";
|
|
825
|
+
rootTotal = hierarchyData_1.values.reduce(function (sum, value, i) { return (hierarchyData_1.parents[i] === "" ? sum + value : sum); }, 0);
|
|
826
|
+
hierarchyTrace = tslib_1.__assign({ type: chartType, labels: isSunburst ? tslib_1.__spreadArray([""], tslib_1.__read(hierarchyData_1.labels), false) : hierarchyData_1.labels, ids: isSunburst ? tslib_1.__spreadArray([SUNBURST_ROOT_ID_1], tslib_1.__read(hierarchyData_1.ids), false) : hierarchyData_1.ids, parents: isSunburst
|
|
827
|
+
? tslib_1.__spreadArray([""], tslib_1.__read(hierarchyData_1.parents.map(function (parent) { return parent || SUNBURST_ROOT_ID_1; })), false) : hierarchyData_1.parents, values: isSunburst ? tslib_1.__spreadArray([rootTotal], tslib_1.__read(hierarchyData_1.values), false) : hierarchyData_1.values, marker: tslib_1.__assign({ colors: isSunburst ? tslib_1.__spreadArray(["rgba(0,0,0,0)"], tslib_1.__read(nodeColors), false) : nodeColors }, (isSunburst ? { line: { width: 1 } } : {})), name: seriesName, textinfo: "label+value", branchvalues: "total" }, (isSunburst ? {} : { textposition: "bottom left" }));
|
|
711
828
|
layoutForHierarchy = {
|
|
712
829
|
title: {
|
|
713
830
|
text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
|
|
@@ -747,7 +864,7 @@ var BasicChart = function (_a) {
|
|
|
747
864
|
// country-name matching and silently skips labels it can't place.
|
|
748
865
|
if ((0, region_map_1.isRegionMapSpec)(spec)) {
|
|
749
866
|
labels = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : "").trim(); });
|
|
750
|
-
seriesEntry = (
|
|
867
|
+
seriesEntry = (_19 = spec.series) === null || _19 === void 0 ? void 0 : _19[0];
|
|
751
868
|
rawValues_1 = seriesEntry
|
|
752
869
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
753
870
|
: [];
|
|
@@ -812,34 +929,34 @@ var BasicChart = function (_a) {
|
|
|
812
929
|
if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
|
|
813
930
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
814
931
|
surfaceSeriesInputs = [];
|
|
815
|
-
|
|
932
|
+
_82.label = 7;
|
|
816
933
|
case 7:
|
|
817
|
-
|
|
818
|
-
_c = tslib_1.__values((
|
|
819
|
-
|
|
934
|
+
_82.trys.push([7, 14, 15, 16]);
|
|
935
|
+
_c = tslib_1.__values((_20 = spec.series) !== null && _20 !== void 0 ? _20 : []), _d = _c.next();
|
|
936
|
+
_82.label = 8;
|
|
820
937
|
case 8:
|
|
821
938
|
if (!!_d.done) return [3 /*break*/, 13];
|
|
822
939
|
seriesEntry = _d.value;
|
|
823
940
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 10];
|
|
824
941
|
_f = chart_spec_utils_1.coerceCalculatedLabel;
|
|
825
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
942
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_21 = position.sheetId) !== null && _21 !== void 0 ? _21 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
826
943
|
case 9:
|
|
827
|
-
_e = _f.apply(void 0, [
|
|
944
|
+
_e = _f.apply(void 0, [_82.sent()]);
|
|
828
945
|
return [3 /*break*/, 11];
|
|
829
946
|
case 10:
|
|
830
|
-
_e = (
|
|
831
|
-
|
|
947
|
+
_e = (_22 = seriesEntry.dataLabel) !== null && _22 !== void 0 ? _22 : "";
|
|
948
|
+
_82.label = 11;
|
|
832
949
|
case 11:
|
|
833
950
|
dataLabel = _e;
|
|
834
951
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
835
952
|
surfaceSeriesInputs.push({ name: dataLabel, values: values });
|
|
836
|
-
|
|
953
|
+
_82.label = 12;
|
|
837
954
|
case 12:
|
|
838
955
|
_d = _c.next();
|
|
839
956
|
return [3 /*break*/, 8];
|
|
840
957
|
case 13: return [3 /*break*/, 16];
|
|
841
958
|
case 14:
|
|
842
|
-
e_2_1 =
|
|
959
|
+
e_2_1 = _82.sent();
|
|
843
960
|
e_2 = { error: e_2_1 };
|
|
844
961
|
return [3 /*break*/, 16];
|
|
845
962
|
case 15:
|
|
@@ -867,21 +984,21 @@ var BasicChart = function (_a) {
|
|
|
867
984
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, margin: { l: 60, r: 20, t: 50, b: 50 } }, (surfaceToken === "SURFACE"
|
|
868
985
|
? {
|
|
869
986
|
xaxis: {
|
|
870
|
-
title: { text: (
|
|
987
|
+
title: { text: (_23 = spec.horizontalAxisTitle) !== null && _23 !== void 0 ? _23 : "" },
|
|
871
988
|
automargin: true,
|
|
872
989
|
color: textColor,
|
|
873
990
|
},
|
|
874
991
|
yaxis: {
|
|
875
|
-
title: { text: (
|
|
992
|
+
title: { text: (_24 = spec.verticalAxisTitle) !== null && _24 !== void 0 ? _24 : "" },
|
|
876
993
|
automargin: true,
|
|
877
994
|
color: textColor,
|
|
878
995
|
},
|
|
879
996
|
}
|
|
880
997
|
: {
|
|
881
998
|
scene: {
|
|
882
|
-
xaxis: { title: { text: (
|
|
999
|
+
xaxis: { title: { text: (_25 = spec.horizontalAxisTitle) !== null && _25 !== void 0 ? _25 : "" } },
|
|
883
1000
|
yaxis: { title: { text: "" } },
|
|
884
|
-
zaxis: { title: { text: (
|
|
1001
|
+
zaxis: { title: { text: (_26 = spec.verticalAxisTitle) !== null && _26 !== void 0 ? _26 : "" } },
|
|
885
1002
|
},
|
|
886
1003
|
}));
|
|
887
1004
|
setPlotData([surfaceTrace]);
|
|
@@ -893,11 +1010,11 @@ var BasicChart = function (_a) {
|
|
|
893
1010
|
// theta = the category names (closed by appending the first point).
|
|
894
1011
|
if (spec.chartType === "radar") {
|
|
895
1012
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
896
|
-
radarStyle = (
|
|
1013
|
+
radarStyle = (_27 = spec.radarStyle) !== null && _27 !== void 0 ? _27 : "standard";
|
|
897
1014
|
radarTraces = [];
|
|
898
1015
|
radarInputs = [];
|
|
899
1016
|
try {
|
|
900
|
-
for (_g = tslib_1.__values((
|
|
1017
|
+
for (_g = tslib_1.__values((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
901
1018
|
seriesEntry = _h.value;
|
|
902
1019
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
903
1020
|
? seriesEntry.dataLabel
|
|
@@ -917,7 +1034,7 @@ var BasicChart = function (_a) {
|
|
|
917
1034
|
indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
|
|
918
1035
|
_loop_1 = function (i) {
|
|
919
1036
|
var input = radarInputs[i];
|
|
920
|
-
var seriesColor = (
|
|
1037
|
+
var seriesColor = (_31 = (_30 = (_29 = spec.series) === null || _29 === void 0 ? void 0 : _29[i]) === null || _30 === void 0 ? void 0 : _30.color) !== null && _31 !== void 0 ? _31 : undefined;
|
|
921
1038
|
var r = indicators.map(function (_, idx) { var _a; return (_a = input.values[idx]) !== null && _a !== void 0 ? _a : 0; });
|
|
922
1039
|
var theta = indicators.map(function (ind) { return ind.name; });
|
|
923
1040
|
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 } } : {})));
|
|
@@ -925,7 +1042,7 @@ var BasicChart = function (_a) {
|
|
|
925
1042
|
for (i = 0; i < radarInputs.length; i++) {
|
|
926
1043
|
_loop_1(i);
|
|
927
1044
|
}
|
|
928
|
-
radarScale = (
|
|
1045
|
+
radarScale = (_32 = indicators[0]) !== null && _32 !== void 0 ? _32 : { min: 0, max: 1 };
|
|
929
1046
|
setPlotData(radarTraces);
|
|
930
1047
|
setLayout({
|
|
931
1048
|
title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) },
|
|
@@ -949,13 +1066,13 @@ var BasicChart = function (_a) {
|
|
|
949
1066
|
// V-variants additionally get a volume column sub-pane below the
|
|
950
1067
|
// price plot.
|
|
951
1068
|
if (spec.chartType === "stock") {
|
|
952
|
-
variant = ((
|
|
1069
|
+
variant = ((_33 = spec.stockVariant) !== null && _33 !== void 0 ? _33 : "HLC");
|
|
953
1070
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
954
|
-
seriesValues = ((
|
|
1071
|
+
seriesValues = ((_34 = spec.series) !== null && _34 !== void 0 ? _34 : []).map(function (seriesEntry) {
|
|
955
1072
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
956
1073
|
});
|
|
957
1074
|
volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
|
|
958
|
-
hasVolume = ((
|
|
1075
|
+
hasVolume = ((_35 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _35 !== void 0 ? _35 : 0) > 0;
|
|
959
1076
|
buildVolumeTrace = function (xs) {
|
|
960
1077
|
return ({
|
|
961
1078
|
type: "bar",
|
|
@@ -988,25 +1105,25 @@ var BasicChart = function (_a) {
|
|
|
988
1105
|
roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
|
|
989
1106
|
xs_1 = categories.length > 0
|
|
990
1107
|
? categories
|
|
991
|
-
: ((
|
|
1108
|
+
: ((_36 = roles.close) !== null && _36 !== void 0 ? _36 : []).map(function (_, i) { return i + 1; });
|
|
992
1109
|
candleTrace = {
|
|
993
1110
|
type: "candlestick",
|
|
994
1111
|
x: xs_1,
|
|
995
|
-
open: ((
|
|
996
|
-
high: ((
|
|
997
|
-
low: ((
|
|
998
|
-
close: ((
|
|
1112
|
+
open: ((_37 = roles.open) !== null && _37 !== void 0 ? _37 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1113
|
+
high: ((_38 = roles.high) !== null && _38 !== void 0 ? _38 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1114
|
+
low: ((_39 = roles.low) !== null && _39 !== void 0 ? _39 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1115
|
+
close: ((_40 = roles.close) !== null && _40 !== void 0 ? _40 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
999
1116
|
increasing: { line: { color: theme.themeColors.accent1 } },
|
|
1000
1117
|
decreasing: { line: { color: theme.themeColors.accent2 } },
|
|
1001
1118
|
};
|
|
1002
1119
|
setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
|
|
1003
1120
|
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: {
|
|
1004
|
-
title: { text: (
|
|
1121
|
+
title: { text: (_41 = spec.horizontalAxisTitle) !== null && _41 !== void 0 ? _41 : "" },
|
|
1005
1122
|
automargin: true,
|
|
1006
1123
|
showgrid: true,
|
|
1007
1124
|
gridcolor: gridColor,
|
|
1008
1125
|
rangeslider: { visible: false },
|
|
1009
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
1126
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_42 = spec.verticalAxisTitle) !== null && _42 !== void 0 ? _42 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
1010
1127
|
return [2 /*return*/];
|
|
1011
1128
|
}
|
|
1012
1129
|
lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
|
|
@@ -1018,7 +1135,7 @@ var BasicChart = function (_a) {
|
|
|
1018
1135
|
]);
|
|
1019
1136
|
xs_2 = categories.length > 0
|
|
1020
1137
|
? categories
|
|
1021
|
-
: ((
|
|
1138
|
+
: ((_44 = (_43 = lineSeries[0]) === null || _43 === void 0 ? void 0 : _43.values) !== null && _44 !== void 0 ? _44 : []).map(function (_, i) { return i + 1; });
|
|
1022
1139
|
stockTraces = lineSeries.map(function (s, i) { return ({
|
|
1023
1140
|
type: "scatter",
|
|
1024
1141
|
mode: "lines",
|
|
@@ -1029,11 +1146,11 @@ var BasicChart = function (_a) {
|
|
|
1029
1146
|
}); });
|
|
1030
1147
|
setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
|
|
1031
1148
|
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: {
|
|
1032
|
-
title: { text: (
|
|
1149
|
+
title: { text: (_45 = spec.horizontalAxisTitle) !== null && _45 !== void 0 ? _45 : "" },
|
|
1033
1150
|
automargin: true,
|
|
1034
1151
|
showgrid: true,
|
|
1035
1152
|
gridcolor: gridColor,
|
|
1036
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
1153
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_46 = spec.verticalAxisTitle) !== null && _46 !== void 0 ? _46 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
1037
1154
|
return [2 /*return*/];
|
|
1038
1155
|
}
|
|
1039
1156
|
isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
|
|
@@ -1080,12 +1197,12 @@ var BasicChart = function (_a) {
|
|
|
1080
1197
|
return extra;
|
|
1081
1198
|
};
|
|
1082
1199
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1083
|
-
primaryDomainSource = (
|
|
1200
|
+
primaryDomainSource = (_49 = (_48 = (_47 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _47 === void 0 ? void 0 : _47[0]) === null || _48 === void 0 ? void 0 : _48.sources) === null || _49 === void 0 ? void 0 : _49[0];
|
|
1084
1201
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1085
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1202
|
+
? (0, aggregation_1.sanitizeDomainValues)((_50 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _50 !== void 0 ? _50 : [])
|
|
1086
1203
|
: [];
|
|
1087
1204
|
domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1088
|
-
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((
|
|
1205
|
+
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_51 = spec.categoryLevels) === null || _51 === void 0 ? void 0 : _51.map(function (level) {
|
|
1089
1206
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1090
1207
|
}));
|
|
1091
1208
|
multicategoryX = categoryLevels
|
|
@@ -1095,7 +1212,7 @@ var BasicChart = function (_a) {
|
|
|
1095
1212
|
domainData = categoryLevels.leaf;
|
|
1096
1213
|
}
|
|
1097
1214
|
aggregateDomainValues = domainData;
|
|
1098
|
-
domainAxisData = (categoryLevels ? [] : (
|
|
1215
|
+
domainAxisData = (categoryLevels ? [] : (_52 = spec.domains) !== null && _52 !== void 0 ? _52 : []).map(function (domain, domainIndex) {
|
|
1099
1216
|
return domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1100
1217
|
var _a;
|
|
1101
1218
|
if (domainIndex === 0 && sourceIndex === 0) {
|
|
@@ -1139,7 +1256,7 @@ var BasicChart = function (_a) {
|
|
|
1139
1256
|
theme.themeColors.accent6,
|
|
1140
1257
|
]);
|
|
1141
1258
|
applyTraceColor = function (trace, seriesColor, options) {
|
|
1142
|
-
var
|
|
1259
|
+
var e_7, _a;
|
|
1143
1260
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
1144
1261
|
var target = trace;
|
|
1145
1262
|
var chartTypeForStyling = (_b = options === null || options === void 0 ? void 0 : options.effectiveChartType) !== null && _b !== void 0 ? _b : spec.chartType;
|
|
@@ -1161,7 +1278,8 @@ var BasicChart = function (_a) {
|
|
|
1161
1278
|
// by category index, falling back to the series color for points
|
|
1162
1279
|
// without an override.
|
|
1163
1280
|
var isPie = chartTypeForStyling === "pie";
|
|
1164
|
-
|
|
1281
|
+
var isFunnel = chartTypeForStyling === "funnel";
|
|
1282
|
+
if ((isBarOrColumn || isPie || isFunnel) &&
|
|
1165
1283
|
Array.isArray(options === null || options === void 0 ? void 0 : options.dataPointColors) &&
|
|
1166
1284
|
(options === null || options === void 0 ? void 0 : options.dataPointColors.length)) {
|
|
1167
1285
|
var overrides_2 = new Map();
|
|
@@ -1173,12 +1291,12 @@ var BasicChart = function (_a) {
|
|
|
1173
1291
|
}
|
|
1174
1292
|
}
|
|
1175
1293
|
}
|
|
1176
|
-
catch (
|
|
1294
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1177
1295
|
finally {
|
|
1178
1296
|
try {
|
|
1179
1297
|
if (_v && !_v.done && (_a = _u.return)) _a.call(_u);
|
|
1180
1298
|
}
|
|
1181
|
-
finally { if (
|
|
1299
|
+
finally { if (e_7) throw e_7.error; }
|
|
1182
1300
|
}
|
|
1183
1301
|
if (isPie) {
|
|
1184
1302
|
// Per-slice colours (`<c:dPt>`): an authored slice colour wins,
|
|
@@ -1264,7 +1382,7 @@ var BasicChart = function (_a) {
|
|
|
1264
1382
|
ofPieHandled = false;
|
|
1265
1383
|
ofPieExtras = null;
|
|
1266
1384
|
decorateCartesianTrace = function (trace, series, values, dataLabel) {
|
|
1267
|
-
var
|
|
1385
|
+
var e_8, _a;
|
|
1268
1386
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1269
1387
|
var target = trace;
|
|
1270
1388
|
// Secondary value axis. Plotly overlays a second value axis ("y2",
|
|
@@ -1343,37 +1461,37 @@ var BasicChart = function (_a) {
|
|
|
1343
1461
|
_loop_3(tl);
|
|
1344
1462
|
}
|
|
1345
1463
|
}
|
|
1346
|
-
catch (
|
|
1464
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1347
1465
|
finally {
|
|
1348
1466
|
try {
|
|
1349
1467
|
if (_o && !_o.done && (_a = _m.return)) _a.call(_m);
|
|
1350
1468
|
}
|
|
1351
|
-
finally { if (
|
|
1469
|
+
finally { if (e_8) throw e_8.error; }
|
|
1352
1470
|
}
|
|
1353
1471
|
};
|
|
1354
|
-
domainSources = (
|
|
1472
|
+
domainSources = (_55 = (_54 = (_53 = spec.domains) === null || _53 === void 0 ? void 0 : _53[0]) === null || _54 === void 0 ? void 0 : _54.sources) !== null && _55 !== void 0 ? _55 : [];
|
|
1355
1473
|
seriesIndex = 0;
|
|
1356
1474
|
_loop_2 = function (series) {
|
|
1357
|
-
var currentSeriesIndex, dataLabel,
|
|
1358
|
-
return tslib_1.__generator(this, function (
|
|
1359
|
-
switch (
|
|
1475
|
+
var currentSeriesIndex, dataLabel, _83, _84, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, _85, labels, counts, cumulativePercents, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, usePrecomputed, trace, summary, hideOutliers, rawValues, totalIndices_1, increaseColor, trace, rawValues, trace, pieData, _86, 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, _87, x, y, orientation_1, trace, numericValues, _88, x, y, orientation_2, trace;
|
|
1476
|
+
return tslib_1.__generator(this, function (_89) {
|
|
1477
|
+
switch (_89.label) {
|
|
1360
1478
|
case 0:
|
|
1361
1479
|
currentSeriesIndex = seriesIndex++;
|
|
1362
1480
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1363
|
-
|
|
1364
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1481
|
+
_84 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1482
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_57 = position.sheetId) !== null && _57 !== void 0 ? _57 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1365
1483
|
case 1:
|
|
1366
|
-
|
|
1484
|
+
_83 = _84.apply(void 0, [_89.sent()]);
|
|
1367
1485
|
return [3 /*break*/, 3];
|
|
1368
1486
|
case 2:
|
|
1369
|
-
|
|
1370
|
-
|
|
1487
|
+
_83 = (_58 = series.dataLabel) !== null && _58 !== void 0 ? _58 : "";
|
|
1488
|
+
_89.label = 3;
|
|
1371
1489
|
case 3:
|
|
1372
|
-
dataLabel =
|
|
1490
|
+
dataLabel = _83;
|
|
1373
1491
|
// A series with no ranges draws nothing.
|
|
1374
1492
|
if (series.sources.length === 0)
|
|
1375
1493
|
return [2 /*return*/, "continue"];
|
|
1376
|
-
effectiveChartType = (
|
|
1494
|
+
effectiveChartType = (_59 = series.seriesChartType) !== null && _59 !== void 0 ? _59 : spec.chartType;
|
|
1377
1495
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1378
1496
|
pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
|
|
1379
1497
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
@@ -1406,19 +1524,17 @@ var BasicChart = function (_a) {
|
|
|
1406
1524
|
? { connectgaps: true }
|
|
1407
1525
|
: {}));
|
|
1408
1526
|
if (effectiveChartType === "histogram") {
|
|
1409
|
-
rawValues =
|
|
1410
|
-
? seriesData.values
|
|
1411
|
-
: seriesData;
|
|
1527
|
+
rawValues = seriesValuesOf(seriesData);
|
|
1412
1528
|
binCount = spec.binCount;
|
|
1413
1529
|
if (isPareto) {
|
|
1414
|
-
|
|
1530
|
+
_85 = (0, histogram_1.computePareto)((0, histogram_1.binHistogram)(rawValues, binCount)), labels = _85.labels, counts = _85.counts, cumulativePercents = _85.cumulativePercents;
|
|
1415
1531
|
barTrace = {
|
|
1416
1532
|
type: "bar",
|
|
1417
1533
|
x: labels,
|
|
1418
1534
|
y: counts,
|
|
1419
1535
|
name: dataLabel,
|
|
1420
1536
|
};
|
|
1421
|
-
applyTraceColor(barTrace, (
|
|
1537
|
+
applyTraceColor(barTrace, (_60 = series.color) !== null && _60 !== void 0 ? _60 : undefined, {
|
|
1422
1538
|
noFill: series.noFill,
|
|
1423
1539
|
dataPointColors: series.dataPointColors,
|
|
1424
1540
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1439,7 +1555,7 @@ var BasicChart = function (_a) {
|
|
|
1439
1555
|
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
|
|
1440
1556
|
? { nbinsx: binCount }
|
|
1441
1557
|
: {}));
|
|
1442
|
-
applyTraceColor(trace, (
|
|
1558
|
+
applyTraceColor(trace, (_61 = series.color) !== null && _61 !== void 0 ? _61 : undefined, {
|
|
1443
1559
|
noFill: series.noFill,
|
|
1444
1560
|
dataPointColors: series.dataPointColors,
|
|
1445
1561
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1449,9 +1565,7 @@ var BasicChart = function (_a) {
|
|
|
1449
1565
|
}
|
|
1450
1566
|
}
|
|
1451
1567
|
else if (effectiveChartType === "boxplot") {
|
|
1452
|
-
rawValues =
|
|
1453
|
-
? seriesData.values
|
|
1454
|
-
: seriesData;
|
|
1568
|
+
rawValues = seriesValuesOf(seriesData);
|
|
1455
1569
|
quartileMethod = spec.quartileMethod;
|
|
1456
1570
|
showOutliers = spec.showOutliers;
|
|
1457
1571
|
showMeanMarker = spec.showMeanMarker === true;
|
|
@@ -1489,7 +1603,7 @@ var BasicChart = function (_a) {
|
|
|
1489
1603
|
// default and `showOutliers: true` alike).
|
|
1490
1604
|
boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
|
|
1491
1605
|
}
|
|
1492
|
-
applyTraceColor(trace, (
|
|
1606
|
+
applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
|
|
1493
1607
|
noFill: series.noFill,
|
|
1494
1608
|
dataPointColors: series.dataPointColors,
|
|
1495
1609
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1498,10 +1612,9 @@ var BasicChart = function (_a) {
|
|
|
1498
1612
|
traces.push(trace);
|
|
1499
1613
|
}
|
|
1500
1614
|
else if (effectiveChartType === "waterfall") {
|
|
1501
|
-
rawValues =
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
totalIndices_1 = new Set((_61 = spec.totalIndices) !== null && _61 !== void 0 ? _61 : []);
|
|
1615
|
+
rawValues = seriesValuesOf(seriesData);
|
|
1616
|
+
totalIndices_1 = new Set((_63 = spec.totalIndices) !== null && _63 !== void 0 ? _63 : []);
|
|
1617
|
+
increaseColor = (_64 = series.color) !== null && _64 !== void 0 ? _64 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
|
|
1505
1618
|
trace = {
|
|
1506
1619
|
type: "waterfall",
|
|
1507
1620
|
x: categoriesFor(series),
|
|
@@ -1510,26 +1623,33 @@ var BasicChart = function (_a) {
|
|
|
1510
1623
|
return totalIndices_1.has(i) ? "total" : "relative";
|
|
1511
1624
|
}),
|
|
1512
1625
|
name: dataLabel,
|
|
1626
|
+
increasing: { marker: { color: increaseColor } },
|
|
1627
|
+
decreasing: {
|
|
1628
|
+
marker: {
|
|
1629
|
+
color: (_66 = (_65 = series.negativeColor) !== null && _65 !== void 0 ? _65 : theme.themeColors.accent2) !== null && _66 !== void 0 ? _66 : increaseColor,
|
|
1630
|
+
},
|
|
1631
|
+
},
|
|
1632
|
+
totals: { marker: { color: (_67 = theme.themeColors.accent3) !== null && _67 !== void 0 ? _67 : increaseColor } },
|
|
1633
|
+
connector: {
|
|
1634
|
+
line: {
|
|
1635
|
+
color: isDarkMode ? "rgba(255,255,255,0.45)" : "#999999",
|
|
1636
|
+
width: 1,
|
|
1637
|
+
},
|
|
1638
|
+
},
|
|
1513
1639
|
};
|
|
1514
|
-
applyTraceColor(trace, (_62 = series.color) !== null && _62 !== void 0 ? _62 : undefined, {
|
|
1515
|
-
noFill: series.noFill,
|
|
1516
|
-
dataPointColors: series.dataPointColors,
|
|
1517
|
-
seriesIndex: currentSeriesIndex,
|
|
1518
|
-
effectiveChartType: effectiveChartType,
|
|
1519
|
-
});
|
|
1520
1640
|
traces.push(trace);
|
|
1521
1641
|
}
|
|
1522
1642
|
else if (effectiveChartType === "funnel") {
|
|
1523
|
-
rawValues =
|
|
1524
|
-
? seriesData.values
|
|
1525
|
-
: seriesData;
|
|
1643
|
+
rawValues = seriesValuesOf(seriesData);
|
|
1526
1644
|
trace = {
|
|
1527
1645
|
type: "funnel",
|
|
1646
|
+
orientation: "h",
|
|
1528
1647
|
y: categoriesFor(series),
|
|
1529
1648
|
x: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }),
|
|
1530
1649
|
name: dataLabel,
|
|
1650
|
+
textinfo: "none",
|
|
1531
1651
|
};
|
|
1532
|
-
applyTraceColor(trace, (
|
|
1652
|
+
applyTraceColor(trace, (_68 = series.color) !== null && _68 !== void 0 ? _68 : undefined, {
|
|
1533
1653
|
noFill: series.noFill,
|
|
1534
1654
|
dataPointColors: series.dataPointColors,
|
|
1535
1655
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1547,10 +1667,10 @@ var BasicChart = function (_a) {
|
|
|
1547
1667
|
return [2 /*return*/, "continue"];
|
|
1548
1668
|
ofPieHandled = true;
|
|
1549
1669
|
pieData = seriesData;
|
|
1550
|
-
|
|
1670
|
+
_86 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
|
|
1551
1671
|
splitType: spec.splitType,
|
|
1552
1672
|
splitPos: spec.splitPos,
|
|
1553
|
-
}), main_1 =
|
|
1673
|
+
}), main_1 = _86.main, secondary = _86.secondary, otherTotal = _86.otherTotal, total = _86.total;
|
|
1554
1674
|
ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
|
|
1555
1675
|
secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
|
|
1556
1676
|
halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
|
|
@@ -1683,7 +1803,7 @@ var BasicChart = function (_a) {
|
|
|
1683
1803
|
trace.meta = {
|
|
1684
1804
|
rncSeriesIndex: currentSeriesIndex,
|
|
1685
1805
|
};
|
|
1686
|
-
applyTraceColor(trace, (
|
|
1806
|
+
applyTraceColor(trace, (_69 = series.color) !== null && _69 !== void 0 ? _69 : undefined, {
|
|
1687
1807
|
noFill: series.noFill,
|
|
1688
1808
|
dataPointColors: series.dataPointColors,
|
|
1689
1809
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1692,13 +1812,13 @@ var BasicChart = function (_a) {
|
|
|
1692
1812
|
traces.push(trace);
|
|
1693
1813
|
}
|
|
1694
1814
|
else if ("values" in seriesData && "labels" in seriesData) {
|
|
1695
|
-
|
|
1815
|
+
_87 = assignCartesianData(categoriesFor(series), seriesData.values), x = _87.x, y = _87.y, orientation_1 = _87.orientation;
|
|
1696
1816
|
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));
|
|
1697
1817
|
// Ties the trace back to spec.series for click selection
|
|
1698
1818
|
trace.meta = {
|
|
1699
1819
|
rncSeriesIndex: currentSeriesIndex,
|
|
1700
1820
|
};
|
|
1701
|
-
applyTraceColor(trace, (
|
|
1821
|
+
applyTraceColor(trace, (_70 = series.color) !== null && _70 !== void 0 ? _70 : undefined, {
|
|
1702
1822
|
noFill: series.noFill,
|
|
1703
1823
|
dataPointColors: series.dataPointColors,
|
|
1704
1824
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1713,13 +1833,13 @@ var BasicChart = function (_a) {
|
|
|
1713
1833
|
}
|
|
1714
1834
|
else {
|
|
1715
1835
|
numericValues = seriesData;
|
|
1716
|
-
|
|
1836
|
+
_88 = assignCartesianData(categoriesFor(series), numericValues), x = _88.x, y = _88.y, orientation_2 = _88.orientation;
|
|
1717
1837
|
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));
|
|
1718
1838
|
// Ties the trace back to spec.series for click selection
|
|
1719
1839
|
trace.meta = {
|
|
1720
1840
|
rncSeriesIndex: currentSeriesIndex,
|
|
1721
1841
|
};
|
|
1722
|
-
applyTraceColor(trace, (
|
|
1842
|
+
applyTraceColor(trace, (_71 = series.color) !== null && _71 !== void 0 ? _71 : undefined, {
|
|
1723
1843
|
noFill: series.noFill,
|
|
1724
1844
|
dataPointColors: series.dataPointColors,
|
|
1725
1845
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1736,24 +1856,24 @@ var BasicChart = function (_a) {
|
|
|
1736
1856
|
}
|
|
1737
1857
|
});
|
|
1738
1858
|
};
|
|
1739
|
-
|
|
1859
|
+
_82.label = 18;
|
|
1740
1860
|
case 18:
|
|
1741
|
-
|
|
1742
|
-
_j = tslib_1.__values((
|
|
1743
|
-
|
|
1861
|
+
_82.trys.push([18, 23, 24, 25]);
|
|
1862
|
+
_j = tslib_1.__values((_56 = spec.series) !== null && _56 !== void 0 ? _56 : []), _k = _j.next();
|
|
1863
|
+
_82.label = 19;
|
|
1744
1864
|
case 19:
|
|
1745
1865
|
if (!!_k.done) return [3 /*break*/, 22];
|
|
1746
1866
|
series = _k.value;
|
|
1747
1867
|
return [5 /*yield**/, _loop_2(series)];
|
|
1748
1868
|
case 20:
|
|
1749
|
-
|
|
1750
|
-
|
|
1869
|
+
_82.sent();
|
|
1870
|
+
_82.label = 21;
|
|
1751
1871
|
case 21:
|
|
1752
1872
|
_k = _j.next();
|
|
1753
1873
|
return [3 /*break*/, 19];
|
|
1754
1874
|
case 22: return [3 /*break*/, 25];
|
|
1755
1875
|
case 23:
|
|
1756
|
-
e_3_1 =
|
|
1876
|
+
e_3_1 = _82.sent();
|
|
1757
1877
|
e_3 = { error: e_3_1 };
|
|
1758
1878
|
return [3 /*break*/, 25];
|
|
1759
1879
|
case 24:
|
|
@@ -1770,13 +1890,13 @@ var BasicChart = function (_a) {
|
|
|
1770
1890
|
? undefined
|
|
1771
1891
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1772
1892
|
axisOptions: spec.valueAxisOptions,
|
|
1773
|
-
series: ((
|
|
1893
|
+
series: ((_72 = spec.series) !== null && _72 !== void 0 ? _72 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
1774
1894
|
getFormattingFromRange: getFormattingFromRange,
|
|
1775
1895
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1776
1896
|
});
|
|
1777
1897
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1778
1898
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
1779
|
-
series: ((
|
|
1899
|
+
series: ((_73 = spec.series) !== null && _73 !== void 0 ? _73 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
1780
1900
|
getFormattingFromRange: getFormattingFromRange,
|
|
1781
1901
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1782
1902
|
});
|
|
@@ -1824,14 +1944,14 @@ var BasicChart = function (_a) {
|
|
|
1824
1944
|
? VALUE_AXIS_TITLE_STANDOFF
|
|
1825
1945
|
: legend_layout_1.BAND_GAP;
|
|
1826
1946
|
legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
|
|
1827
|
-
position: (
|
|
1947
|
+
position: (_74 = spec.legend) === null || _74 === void 0 ? void 0 : _74.position,
|
|
1828
1948
|
visible: showlegend !== false,
|
|
1829
1949
|
labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
|
|
1830
|
-
legendFontSize: (
|
|
1950
|
+
legendFontSize: (_77 = (_76 = (_75 = spec.legend) === null || _75 === void 0 ? void 0 : _75.textFormat) === null || _76 === void 0 ? void 0 : _76.fontSize) !== null && _77 !== void 0 ? _77 : axisFontSize,
|
|
1831
1951
|
width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
|
|
1832
1952
|
height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
|
|
1833
1953
|
hasTitle: Boolean(title),
|
|
1834
|
-
titleFontSize: (
|
|
1954
|
+
titleFontSize: (_78 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _78 !== void 0 ? _78 : 16,
|
|
1835
1955
|
hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
|
|
1836
1956
|
hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
|
|
1837
1957
|
leftAxisDepth: leftAxisDepth,
|
|
@@ -1843,7 +1963,7 @@ var BasicChart = function (_a) {
|
|
|
1843
1963
|
family: "Untitled Sans, apple-system, sans-serif",
|
|
1844
1964
|
size: 16,
|
|
1845
1965
|
color: textColor,
|
|
1846
|
-
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((
|
|
1966
|
+
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_79 = legendBand.legend) !== null && _79 !== void 0 ? _79 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
|
|
1847
1967
|
spec.stackedType
|
|
1848
1968
|
? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
|
|
1849
1969
|
spec.stackedType === "PERCENT_STACKED"
|
|
@@ -1856,7 +1976,7 @@ var BasicChart = function (_a) {
|
|
|
1856
1976
|
color: textColor,
|
|
1857
1977
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
|
|
1858
1978
|
title: {
|
|
1859
|
-
text: (
|
|
1979
|
+
text: (_80 = spec.horizontalAxisTitle) !== null && _80 !== void 0 ? _80 : "",
|
|
1860
1980
|
font: { color: textColor },
|
|
1861
1981
|
standoff: bottomAxisTitleStandoff,
|
|
1862
1982
|
},
|
|
@@ -1874,7 +1994,7 @@ var BasicChart = function (_a) {
|
|
|
1874
1994
|
isHorizontalBarChart
|
|
1875
1995
|
? spec.valueAxisOptions
|
|
1876
1996
|
: spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
|
|
1877
|
-
title: tslib_1.__assign({ text: (
|
|
1997
|
+
title: tslib_1.__assign({ text: (_81 = spec.verticalAxisTitle) !== null && _81 !== void 0 ? _81 : "", font: { color: textColor } }, (isHorizontalBarChart
|
|
1878
1998
|
? {}
|
|
1879
1999
|
: { standoff: VALUE_AXIS_TITLE_STANDOFF })),
|
|
1880
2000
|
showgrid: !isHorizontalBarChart,
|
|
@@ -1938,13 +2058,18 @@ var BasicChart = function (_a) {
|
|
|
1938
2058
|
};
|
|
1939
2059
|
piePull = isOfPie ? undefined : (0, pie_explosion_1.explosionToPlotlyPull)((0, pie_explosion_1.resolveExplosion)(spec));
|
|
1940
2060
|
formattedTraces = traces.map(function (trace) {
|
|
1941
|
-
var _a, _b, _c, _d;
|
|
2061
|
+
var _a, _b, _c, _d, _e;
|
|
1942
2062
|
var pattern = traceNumberFormat(trace);
|
|
1943
2063
|
var next = applyDataLabelsToTracePlotly(trace, traceDataLabels(trace), spec.chartType, pattern, locale);
|
|
2064
|
+
if (next.type === "funnel") {
|
|
2065
|
+
// The formatted values ride on `text`; a funnel prints its own
|
|
2066
|
+
// `value` unless told to draw the text (or nothing).
|
|
2067
|
+
next = tslib_1.__assign(tslib_1.__assign({}, next), { textinfo: ((_a = traceDataLabels(trace)) === null || _a === void 0 ? void 0 : _a.show) ? "text" : "none" });
|
|
2068
|
+
}
|
|
1944
2069
|
if (next.type === "pie") {
|
|
1945
2070
|
// Plotly's pie prints every slice's percentage by default; Excel
|
|
1946
2071
|
// draws nothing until data labels are on (#1062).
|
|
1947
|
-
if (!((
|
|
2072
|
+
if (!((_b = traceDataLabels(trace)) === null || _b === void 0 ? void 0 : _b.show)) {
|
|
1948
2073
|
next = tslib_1.__assign(tslib_1.__assign({}, next), { textinfo: "none" });
|
|
1949
2074
|
}
|
|
1950
2075
|
// Hover values format like the slice's source cell.
|
|
@@ -1963,7 +2088,7 @@ var BasicChart = function (_a) {
|
|
|
1963
2088
|
}
|
|
1964
2089
|
else if (!next.hovertemplate &&
|
|
1965
2090
|
(next.type === "bar" || next.type === "scatter") &&
|
|
1966
|
-
typeof ((
|
|
2091
|
+
typeof ((_c = next.meta) === null || _c === void 0 ? void 0 : _c.rncSeriesIndex) === "number") {
|
|
1967
2092
|
// Hover values read like the series' own cells (Excel's data tip
|
|
1968
2093
|
// shows the cell text) — the series format alone, not the axis
|
|
1969
2094
|
// fallback the labels use, since that resolves to the first series
|
|
@@ -1985,8 +2110,8 @@ var BasicChart = function (_a) {
|
|
|
1985
2110
|
// (doughnutHoleSize); clamp like the echarts renderer and default
|
|
1986
2111
|
// to 0.5 when unset.
|
|
1987
2112
|
if (spec.chartType === "doughnut" && next.type === "pie") {
|
|
1988
|
-
var rank = doughnutSeriesOrder.indexOf((
|
|
1989
|
-
var ring = (
|
|
2113
|
+
var rank = doughnutSeriesOrder.indexOf((_d = next.meta) === null || _d === void 0 ? void 0 : _d.rncSeriesIndex);
|
|
2114
|
+
var ring = (_e = doughnutRingSet[rank]) !== null && _e !== void 0 ? _e : (0, doughnut_1.doughnutRings)((0, doughnut_1.clampDoughnutHole)(doughnutHole), 1)[0];
|
|
1990
2115
|
// Plotly's `hole` is a fraction of the trace's own radius.
|
|
1991
2116
|
next = tslib_1.__assign(tslib_1.__assign({}, next), { hole: ring.inner / ring.outer });
|
|
1992
2117
|
if (doughnutRingSet.length > 1) {
|
|
@@ -2125,7 +2250,13 @@ var BasicChart = function (_a) {
|
|
|
2125
2250
|
} }, "Delete chart")))))) : null,
|
|
2126
2251
|
react_1.default.createElement("div", { className: "flex-1 rnc-plotly-chart-container", onPointerDownCapture: handlePointerDownCapture },
|
|
2127
2252
|
react_1.default.createElement(plot_1.Plot, { data: plotData, layout: plotLayout, config: config, onClick: handlePlotClick, onInitialized: function (_figure, graphDiv) {
|
|
2253
|
+
var _a, _b;
|
|
2128
2254
|
graphDivRef.current = graphDiv;
|
|
2255
|
+
var plotDiv = graphDiv;
|
|
2256
|
+
// Returning false from these handlers keeps the clicked branch
|
|
2257
|
+
// from becoming the new root.
|
|
2258
|
+
(_a = plotDiv.on) === null || _a === void 0 ? void 0 : _a.call(plotDiv, "plotly_treemapclick", function () { return drillDownRef.current; });
|
|
2259
|
+
(_b = plotDiv.on) === null || _b === void 0 ? void 0 : _b.call(plotDiv, "plotly_sunburstclick", function () { return drillDownRef.current; });
|
|
2129
2260
|
}, style: { width: "100%", height: "100%" } }))));
|
|
2130
2261
|
};
|
|
2131
2262
|
exports.BasicChart = BasicChart;
|