@rowsncolumns/charts 28.1.12 → 28.1.14
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 +392 -269
- 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 +166 -144
- package/dist/cjs/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/helpers.js +2 -0
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +191 -82
- 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 +88 -65
- package/dist/esm/plotly/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/helpers.js +2 -0
- package/package.json +3 -3
|
@@ -10,7 +10,6 @@ var utils_1 = require("@rowsncolumns/utils");
|
|
|
10
10
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
11
11
|
var aggregation_1 = require("../../utils/aggregation");
|
|
12
12
|
var axis_number_format_1 = require("../../utils/axis-number-format");
|
|
13
|
-
var boxplot_1 = require("../../utils/boxplot");
|
|
14
13
|
var bubble_1 = require("../../utils/bubble");
|
|
15
14
|
var chart_orientation_1 = require("../../utils/chart-orientation");
|
|
16
15
|
var chart_image_1 = require("../../utils/chart-image");
|
|
@@ -507,11 +506,11 @@ var BasicChart = function (_a) {
|
|
|
507
506
|
* Triggers a chart update
|
|
508
507
|
*/
|
|
509
508
|
var updateChart = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
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;
|
|
509
|
+
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, bubbleLegendOverrides, bubbleBand, 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, radarLegendOverrides, radarBand, 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;
|
|
511
510
|
var e_2, _m, e_4, _o, e_3, _p, _q, _r;
|
|
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, _82, _83, _84, _85;
|
|
513
|
-
return tslib_1.__generator(this, function (
|
|
514
|
-
switch (
|
|
511
|
+
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, _82, _83, _84, _85, _86, _87, _88, _89, _90, _91, _92, _93, _94, _95, _96, _97, _98, _99, _100, _101, _102, _103, _104;
|
|
512
|
+
return tslib_1.__generator(this, function (_105) {
|
|
513
|
+
switch (_105.label) {
|
|
515
514
|
case 0:
|
|
516
515
|
(0, utils_1.debug)("Updating chart", chart);
|
|
517
516
|
traces = [];
|
|
@@ -536,7 +535,7 @@ var BasicChart = function (_a) {
|
|
|
536
535
|
});
|
|
537
536
|
seriesInputs = [];
|
|
538
537
|
i = 0;
|
|
539
|
-
|
|
538
|
+
_105.label = 1;
|
|
540
539
|
case 1:
|
|
541
540
|
if (!(i < spec.series.length)) return [3 /*break*/, 5];
|
|
542
541
|
seriesEntry = spec.series[i];
|
|
@@ -545,13 +544,13 @@ var BasicChart = function (_a) {
|
|
|
545
544
|
_a = chart_spec_utils_1.coerceCalculatedLabel;
|
|
546
545
|
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)];
|
|
547
546
|
case 2:
|
|
548
|
-
resolvedLabel = _a.apply(void 0, [
|
|
549
|
-
|
|
547
|
+
resolvedLabel = _a.apply(void 0, [_105.sent()]);
|
|
548
|
+
_105.label = 3;
|
|
550
549
|
case 3:
|
|
551
550
|
xValues = (_x = perSeriesX[i]) !== null && _x !== void 0 ? _x : perSeriesX[0];
|
|
552
551
|
sizeValues_1 = (_y = perSeriesSize[i]) !== null && _y !== void 0 ? _y : perSeriesSize[0];
|
|
553
552
|
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 } : {})));
|
|
554
|
-
|
|
553
|
+
_105.label = 4;
|
|
555
554
|
case 4:
|
|
556
555
|
i++;
|
|
557
556
|
return [3 /*break*/, 1];
|
|
@@ -750,12 +749,31 @@ var BasicChart = function (_a) {
|
|
|
750
749
|
xAxisFmt = (_3 = spec.categoryAxisOptions) === null || _3 === void 0 ? void 0 : _3.textFormat;
|
|
751
750
|
yAxisFmt = (_4 = spec.valueAxisOptions) === null || _4 === void 0 ? void 0 : _4.textFormat;
|
|
752
751
|
legendFmt = (_5 = spec.legend) === null || _5 === void 0 ? void 0 : _5.textFormat;
|
|
752
|
+
bubbleLegendOverrides = applyLegendOverridesPlotly({
|
|
753
|
+
font: tslib_1.__assign(tslib_1.__assign({ color: (_6 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.color) !== null && _6 !== void 0 ? _6 : 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 } : {})),
|
|
754
|
+
}, spec.legend);
|
|
755
|
+
bubbleBand = (0, legend_layout_1.reservePlotlyLegendBand)({
|
|
756
|
+
position: (_7 = spec.legend) === null || _7 === void 0 ? void 0 : _7.position,
|
|
757
|
+
visible: ((_8 = bubbleLegendOverrides.showlegend) !== null && _8 !== void 0 ? _8 : preparedSeries.length > 1) !==
|
|
758
|
+
false,
|
|
759
|
+
labels: preparedSeries.map(function (entry) { return entry.name; }),
|
|
760
|
+
legendFontSize: (_9 = legendFmt === null || legendFmt === void 0 ? void 0 : legendFmt.fontSize) !== null && _9 !== void 0 ? _9 : 12,
|
|
761
|
+
width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
|
|
762
|
+
height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
|
|
763
|
+
hasTitle: Boolean(title),
|
|
764
|
+
titleFontSize: (_10 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _10 !== void 0 ? _10 : 16,
|
|
765
|
+
hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
|
|
766
|
+
hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
|
|
767
|
+
leftAxisDepth: 60,
|
|
768
|
+
rightAxisDepth: hasBubbleSecondaryAxis ? 60 : 0,
|
|
769
|
+
axisFontSize: 12,
|
|
770
|
+
});
|
|
753
771
|
bubbleLayout = tslib_1.__assign(tslib_1.__assign({ title: {
|
|
754
772
|
text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat),
|
|
755
773
|
font: {
|
|
756
|
-
family: (
|
|
757
|
-
size: (
|
|
758
|
-
color: (
|
|
774
|
+
family: (_11 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontFamily) !== null && _11 !== void 0 ? _11 : "Untitled Sans, apple-system, sans-serif",
|
|
775
|
+
size: (_12 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.fontSize) !== null && _12 !== void 0 ? _12 : 16,
|
|
776
|
+
color: (_13 = titleFmt === null || titleFmt === void 0 ? void 0 : titleFmt.color) !== null && _13 !== void 0 ? _13 : textColor,
|
|
759
777
|
},
|
|
760
778
|
x: 0.02,
|
|
761
779
|
xanchor: "left",
|
|
@@ -765,19 +783,19 @@ var BasicChart = function (_a) {
|
|
|
765
783
|
// renderer).
|
|
766
784
|
xaxis: applyAxisOverridesPlotly({
|
|
767
785
|
title: {
|
|
768
|
-
text: (
|
|
769
|
-
font: { color: (
|
|
786
|
+
text: (_14 = spec.horizontalAxisTitle) !== null && _14 !== void 0 ? _14 : "",
|
|
787
|
+
font: { color: (_15 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _15 !== void 0 ? _15 : textColor },
|
|
770
788
|
},
|
|
771
789
|
gridcolor: gridColor,
|
|
772
|
-
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
790
|
+
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_16 = xAxisFmt === null || xAxisFmt === void 0 ? void 0 : xAxisFmt.color) !== null && _16 !== void 0 ? _16 : 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 } : {})),
|
|
773
791
|
type: hasStringX_1 ? "category" : "linear",
|
|
774
792
|
}, spec.categoryAxisOptions), yaxis: applyAxisOverridesPlotly({
|
|
775
793
|
title: {
|
|
776
|
-
text: (
|
|
777
|
-
font: { color: (
|
|
794
|
+
text: (_17 = spec.verticalAxisTitle) !== null && _17 !== void 0 ? _17 : "",
|
|
795
|
+
font: { color: (_18 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _18 !== void 0 ? _18 : textColor },
|
|
778
796
|
},
|
|
779
797
|
gridcolor: gridColor,
|
|
780
|
-
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (
|
|
798
|
+
tickfont: tslib_1.__assign(tslib_1.__assign({ color: (_19 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _19 !== void 0 ? _19 : 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
799
|
}, spec.valueAxisOptions) }, (hasBubbleSecondaryAxis
|
|
782
800
|
? {
|
|
783
801
|
yaxis2: applyAxisOverridesPlotly({
|
|
@@ -785,12 +803,12 @@ var BasicChart = function (_a) {
|
|
|
785
803
|
side: "right",
|
|
786
804
|
showgrid: false,
|
|
787
805
|
automargin: true,
|
|
788
|
-
tickfont: { color: (
|
|
806
|
+
tickfont: { color: (_20 = yAxisFmt === null || yAxisFmt === void 0 ? void 0 : yAxisFmt.color) !== null && _20 !== void 0 ? _20 : textColor },
|
|
789
807
|
}, spec.secondaryValueAxisOptions),
|
|
790
808
|
}
|
|
791
|
-
: {})), { legend: {
|
|
792
|
-
|
|
793
|
-
|
|
809
|
+
: {})), { legend: tslib_1.__assign(tslib_1.__assign({}, bubbleLegendOverrides.legend), ((_21 = bubbleBand.legend) !== null && _21 !== void 0 ? _21 : {})), paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: (_22 = bubbleLegendOverrides.showlegend) !== null && _22 !== void 0 ? _22 : preparedSeries.length > 1,
|
|
810
|
+
// The plot shrinks to leave the legend its own band (#1089).
|
|
811
|
+
margin: bubbleBand.margin });
|
|
794
812
|
setPlotData(traces_1);
|
|
795
813
|
setLayout(bubbleLayout);
|
|
796
814
|
return [2 /*return*/];
|
|
@@ -809,8 +827,8 @@ var BasicChart = function (_a) {
|
|
|
809
827
|
hierarchyTitleRef.current = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle;
|
|
810
828
|
hierarchyData_1 = (0, hierarchy_1.toPlotlyHierarchy)(hierarchyRows);
|
|
811
829
|
seriesName = hierarchyData_1.labels.length === 1
|
|
812
|
-
? (
|
|
813
|
-
: (
|
|
830
|
+
? (_23 = hierarchyData_1.labels[0]) !== null && _23 !== void 0 ? _23 : ""
|
|
831
|
+
: (_24 = explicitChartTitle !== null && explicitChartTitle !== void 0 ? explicitChartTitle : headerTitle) !== null && _24 !== void 0 ? _24 : "";
|
|
814
832
|
hierarchyPalette = (0, chart_styles_1.getChartPalette)(spec, [
|
|
815
833
|
theme.themeColors.accent1,
|
|
816
834
|
theme.themeColors.accent2,
|
|
@@ -826,7 +844,7 @@ var BasicChart = function (_a) {
|
|
|
826
844
|
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
845
|
? 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,
|
|
828
846
|
// `dataLabels: { show: false }` turns the labels off (#1086).
|
|
829
|
-
textinfo: ((
|
|
847
|
+
textinfo: ((_25 = spec.dataLabels) === null || _25 === void 0 ? void 0 : _25.show) === false ? "none" : "label+value", branchvalues: "total" }, (isSunburst || ((_26 = spec.dataLabels) === null || _26 === void 0 ? void 0 : _26.show) === false
|
|
830
848
|
? {}
|
|
831
849
|
: {
|
|
832
850
|
textposition: "bottom left",
|
|
@@ -884,7 +902,7 @@ var BasicChart = function (_a) {
|
|
|
884
902
|
// country-name matching and silently skips labels it can't place.
|
|
885
903
|
if ((0, region_map_1.isRegionMapSpec)(spec)) {
|
|
886
904
|
labels = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : "").trim(); });
|
|
887
|
-
seriesEntry = (
|
|
905
|
+
seriesEntry = (_27 = spec.series) === null || _27 === void 0 ? void 0 : _27[0];
|
|
888
906
|
rawValues_1 = seriesEntry
|
|
889
907
|
? flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); })
|
|
890
908
|
: [];
|
|
@@ -949,34 +967,34 @@ var BasicChart = function (_a) {
|
|
|
949
967
|
if (!(surfaceToken === "SURFACE" || surfaceToken === "SURFACE_3D")) return [3 /*break*/, 17];
|
|
950
968
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
951
969
|
surfaceSeriesInputs = [];
|
|
952
|
-
|
|
970
|
+
_105.label = 7;
|
|
953
971
|
case 7:
|
|
954
|
-
|
|
955
|
-
_c = tslib_1.__values((
|
|
956
|
-
|
|
972
|
+
_105.trys.push([7, 14, 15, 16]);
|
|
973
|
+
_c = tslib_1.__values((_28 = spec.series) !== null && _28 !== void 0 ? _28 : []), _d = _c.next();
|
|
974
|
+
_105.label = 8;
|
|
957
975
|
case 8:
|
|
958
976
|
if (!!_d.done) return [3 /*break*/, 13];
|
|
959
977
|
seriesEntry = _d.value;
|
|
960
978
|
if (!(!(0, utils_1.isNil)(seriesEntry.dataLabel) && (0, utils_1.isAFormula)(seriesEntry.dataLabel))) return [3 /*break*/, 10];
|
|
961
979
|
_f = chart_spec_utils_1.coerceCalculatedLabel;
|
|
962
|
-
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (
|
|
980
|
+
return [4 /*yield*/, onRequestCalculate(seriesEntry.dataLabel, (_29 = position.sheetId) !== null && _29 !== void 0 ? _29 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
963
981
|
case 9:
|
|
964
|
-
_e = _f.apply(void 0, [
|
|
982
|
+
_e = _f.apply(void 0, [_105.sent()]);
|
|
965
983
|
return [3 /*break*/, 11];
|
|
966
984
|
case 10:
|
|
967
|
-
_e = (
|
|
968
|
-
|
|
985
|
+
_e = (_30 = seriesEntry.dataLabel) !== null && _30 !== void 0 ? _30 : "";
|
|
986
|
+
_105.label = 11;
|
|
969
987
|
case 11:
|
|
970
988
|
dataLabel = _e;
|
|
971
989
|
values = flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
972
990
|
surfaceSeriesInputs.push({ name: dataLabel, values: values });
|
|
973
|
-
|
|
991
|
+
_105.label = 12;
|
|
974
992
|
case 12:
|
|
975
993
|
_d = _c.next();
|
|
976
994
|
return [3 /*break*/, 8];
|
|
977
995
|
case 13: return [3 /*break*/, 16];
|
|
978
996
|
case 14:
|
|
979
|
-
e_2_1 =
|
|
997
|
+
e_2_1 = _105.sent();
|
|
980
998
|
e_2 = { error: e_2_1 };
|
|
981
999
|
return [3 /*break*/, 16];
|
|
982
1000
|
case 15:
|
|
@@ -1004,21 +1022,21 @@ var BasicChart = function (_a) {
|
|
|
1004
1022
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, showlegend: false, margin: { l: 60, r: 20, t: 50, b: 50 } }, (surfaceToken === "SURFACE"
|
|
1005
1023
|
? {
|
|
1006
1024
|
xaxis: {
|
|
1007
|
-
title: { text: (
|
|
1025
|
+
title: { text: (_31 = spec.horizontalAxisTitle) !== null && _31 !== void 0 ? _31 : "" },
|
|
1008
1026
|
automargin: true,
|
|
1009
1027
|
color: textColor,
|
|
1010
1028
|
},
|
|
1011
1029
|
yaxis: {
|
|
1012
|
-
title: { text: (
|
|
1030
|
+
title: { text: (_32 = spec.verticalAxisTitle) !== null && _32 !== void 0 ? _32 : "" },
|
|
1013
1031
|
automargin: true,
|
|
1014
1032
|
color: textColor,
|
|
1015
1033
|
},
|
|
1016
1034
|
}
|
|
1017
1035
|
: {
|
|
1018
1036
|
scene: {
|
|
1019
|
-
xaxis: { title: { text: (
|
|
1037
|
+
xaxis: { title: { text: (_33 = spec.horizontalAxisTitle) !== null && _33 !== void 0 ? _33 : "" } },
|
|
1020
1038
|
yaxis: { title: { text: "" } },
|
|
1021
|
-
zaxis: { title: { text: (
|
|
1039
|
+
zaxis: { title: { text: (_34 = spec.verticalAxisTitle) !== null && _34 !== void 0 ? _34 : "" } },
|
|
1022
1040
|
},
|
|
1023
1041
|
}));
|
|
1024
1042
|
setPlotData([surfaceTrace]);
|
|
@@ -1030,11 +1048,11 @@ var BasicChart = function (_a) {
|
|
|
1030
1048
|
// theta = the category names (closed by appending the first point).
|
|
1031
1049
|
if (spec.chartType === "radar") {
|
|
1032
1050
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1033
|
-
radarStyle = (
|
|
1051
|
+
radarStyle = (_35 = spec.radarStyle) !== null && _35 !== void 0 ? _35 : "standard";
|
|
1034
1052
|
radarTraces = [];
|
|
1035
1053
|
radarInputs = [];
|
|
1036
1054
|
try {
|
|
1037
|
-
for (_g = tslib_1.__values((
|
|
1055
|
+
for (_g = tslib_1.__values((_36 = spec.series) !== null && _36 !== void 0 ? _36 : []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
1038
1056
|
seriesEntry = _h.value;
|
|
1039
1057
|
label = seriesEntry.dataLabel && !(0, utils_1.isAFormula)(seriesEntry.dataLabel)
|
|
1040
1058
|
? seriesEntry.dataLabel
|
|
@@ -1054,7 +1072,7 @@ var BasicChart = function (_a) {
|
|
|
1054
1072
|
indicators = (0, radar_1.buildRadarIndicators)(categories, radarInputs, radarAxisOptions);
|
|
1055
1073
|
_loop_1 = function (i) {
|
|
1056
1074
|
var input = radarInputs[i];
|
|
1057
|
-
var seriesColor = (
|
|
1075
|
+
var seriesColor = (_39 = (_38 = (_37 = spec.series) === null || _37 === void 0 ? void 0 : _37[i]) === null || _38 === void 0 ? void 0 : _38.color) !== null && _39 !== void 0 ? _39 : undefined;
|
|
1058
1076
|
var r = indicators.map(function (_, idx) { var _a; return (_a = input.values[idx]) !== null && _a !== void 0 ? _a : 0; });
|
|
1059
1077
|
var theta = indicators.map(function (ind) { return ind.name; });
|
|
1060
1078
|
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 } } : {})));
|
|
@@ -1062,21 +1080,43 @@ var BasicChart = function (_a) {
|
|
|
1062
1080
|
for (i = 0; i < radarInputs.length; i++) {
|
|
1063
1081
|
_loop_1(i);
|
|
1064
1082
|
}
|
|
1065
|
-
radarScale = (
|
|
1083
|
+
radarScale = (_40 = indicators[0]) !== null && _40 !== void 0 ? _40 : { min: 0, max: 1 };
|
|
1084
|
+
radarLegendOverrides = applyLegendOverridesPlotly({ font: { color: textColor } }, spec.legend);
|
|
1085
|
+
radarBand = (0, legend_layout_1.reservePlotlyLegendBand)({
|
|
1086
|
+
position: (_41 = spec.legend) === null || _41 === void 0 ? void 0 : _41.position,
|
|
1087
|
+
visible: ((_42 = radarLegendOverrides.showlegend) !== null && _42 !== void 0 ? _42 : radarTraces.length > 1) !== false,
|
|
1088
|
+
labels: radarInputs.map(function (input) { return input.name; }),
|
|
1089
|
+
legendFontSize: (_45 = (_44 = (_43 = spec.legend) === null || _43 === void 0 ? void 0 : _43.textFormat) === null || _44 === void 0 ? void 0 : _44.fontSize) !== null && _45 !== void 0 ? _45 : 12,
|
|
1090
|
+
width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
|
|
1091
|
+
height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
|
|
1092
|
+
hasTitle: Boolean(title),
|
|
1093
|
+
titleFontSize: (_47 = (_46 = spec.titleTextFormat) === null || _46 === void 0 ? void 0 : _46.fontSize) !== null && _47 !== void 0 ? _47 : 16,
|
|
1094
|
+
hasBottomAxisTitle: false,
|
|
1095
|
+
hasLeftAxisTitle: false,
|
|
1096
|
+
leftAxisDepth: 50,
|
|
1097
|
+
rightAxisDepth: 50,
|
|
1098
|
+
axisFontSize: 12,
|
|
1099
|
+
});
|
|
1066
1100
|
setPlotData(radarTraces);
|
|
1067
1101
|
setLayout({
|
|
1068
1102
|
title: { text: (0, plotly_title_1.plotlyTitleText)(title, spec.titleTextFormat) },
|
|
1069
1103
|
font: { color: textColor },
|
|
1070
1104
|
paper_bgcolor: bgColor,
|
|
1071
1105
|
plot_bgcolor: bgColor,
|
|
1072
|
-
showlegend: radarTraces.length > 1,
|
|
1106
|
+
showlegend: (_48 = radarLegendOverrides.showlegend) !== null && _48 !== void 0 ? _48 : radarTraces.length > 1,
|
|
1107
|
+
legend: tslib_1.__assign(tslib_1.__assign({}, radarLegendOverrides.legend), ((_49 = radarBand.legend) !== null && _49 !== void 0 ? _49 : {})),
|
|
1073
1108
|
polar: {
|
|
1074
1109
|
radialaxis: {
|
|
1075
1110
|
visible: (radarAxisOptions === null || radarAxisOptions === void 0 ? void 0 : radarAxisOptions.visible) !== false,
|
|
1076
1111
|
range: [radarScale.min, radarScale.max],
|
|
1077
1112
|
},
|
|
1078
1113
|
},
|
|
1079
|
-
margin: {
|
|
1114
|
+
margin: {
|
|
1115
|
+
l: Math.max(50, radarBand.margin.l),
|
|
1116
|
+
r: Math.max(50, radarBand.margin.r),
|
|
1117
|
+
t: Math.max(50, radarBand.margin.t),
|
|
1118
|
+
b: Math.max(50, radarBand.margin.b),
|
|
1119
|
+
},
|
|
1080
1120
|
autosize: true,
|
|
1081
1121
|
});
|
|
1082
1122
|
return [2 /*return*/];
|
|
@@ -1086,13 +1126,13 @@ var BasicChart = function (_a) {
|
|
|
1086
1126
|
// V-variants additionally get a volume column sub-pane below the
|
|
1087
1127
|
// price plot.
|
|
1088
1128
|
if (spec.chartType === "stock") {
|
|
1089
|
-
variant = ((
|
|
1129
|
+
variant = ((_50 = spec.stockVariant) !== null && _50 !== void 0 ? _50 : "HLC");
|
|
1090
1130
|
categories = flattenChartDataValues(spec.domains, getDomainValuesFromRange, spec.hiddenDimensionStrategy, false).map(function (v) { return String(v !== null && v !== void 0 ? v : ""); });
|
|
1091
|
-
seriesValues = ((
|
|
1131
|
+
seriesValues = ((_51 = spec.series) !== null && _51 !== void 0 ? _51 : []).map(function (seriesEntry) {
|
|
1092
1132
|
return flattenChartDataValues([seriesEntry], getSeriesValuesFromRange, spec.hiddenDimensionStrategy).map(function (v) { return (typeof v === "number" ? v : Number(v)); });
|
|
1093
1133
|
});
|
|
1094
1134
|
volumePoints_1 = (0, stock_1.toVolumeSeries)(seriesValues, variant);
|
|
1095
|
-
hasVolume = ((
|
|
1135
|
+
hasVolume = ((_52 = volumePoints_1 === null || volumePoints_1 === void 0 ? void 0 : volumePoints_1.length) !== null && _52 !== void 0 ? _52 : 0) > 0;
|
|
1096
1136
|
buildVolumeTrace = function (xs) {
|
|
1097
1137
|
return ({
|
|
1098
1138
|
type: "bar",
|
|
@@ -1125,25 +1165,25 @@ var BasicChart = function (_a) {
|
|
|
1125
1165
|
roles = (0, stock_1.assignStockRoles)(seriesValues, variant);
|
|
1126
1166
|
xs_1 = categories.length > 0
|
|
1127
1167
|
? categories
|
|
1128
|
-
: ((
|
|
1168
|
+
: ((_53 = roles.close) !== null && _53 !== void 0 ? _53 : []).map(function (_, i) { return i + 1; });
|
|
1129
1169
|
candleTrace = {
|
|
1130
1170
|
type: "candlestick",
|
|
1131
1171
|
x: xs_1,
|
|
1132
|
-
open: ((
|
|
1133
|
-
high: ((
|
|
1134
|
-
low: ((
|
|
1135
|
-
close: ((
|
|
1172
|
+
open: ((_54 = roles.open) !== null && _54 !== void 0 ? _54 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1173
|
+
high: ((_55 = roles.high) !== null && _55 !== void 0 ? _55 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1174
|
+
low: ((_56 = roles.low) !== null && _56 !== void 0 ? _56 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1175
|
+
close: ((_57 = roles.close) !== null && _57 !== void 0 ? _57 : []).map(function (v) { return v !== null && v !== void 0 ? v : null; }),
|
|
1136
1176
|
increasing: { line: { color: theme.themeColors.accent1 } },
|
|
1137
1177
|
decreasing: { line: { color: theme.themeColors.accent2 } },
|
|
1138
1178
|
};
|
|
1139
1179
|
setPlotData(hasVolume ? [candleTrace, buildVolumeTrace(xs_1)] : [candleTrace]);
|
|
1140
1180
|
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: {
|
|
1141
|
-
title: { text: (
|
|
1181
|
+
title: { text: (_58 = spec.horizontalAxisTitle) !== null && _58 !== void 0 ? _58 : "" },
|
|
1142
1182
|
automargin: true,
|
|
1143
1183
|
showgrid: true,
|
|
1144
1184
|
gridcolor: gridColor,
|
|
1145
1185
|
rangeslider: { visible: false },
|
|
1146
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
1186
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_59 = spec.verticalAxisTitle) !== null && _59 !== void 0 ? _59 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
1147
1187
|
return [2 /*return*/];
|
|
1148
1188
|
}
|
|
1149
1189
|
lineSeries = (0, stock_1.toLineSeries)(seriesValues, variant);
|
|
@@ -1155,7 +1195,7 @@ var BasicChart = function (_a) {
|
|
|
1155
1195
|
]);
|
|
1156
1196
|
xs_2 = categories.length > 0
|
|
1157
1197
|
? categories
|
|
1158
|
-
: ((
|
|
1198
|
+
: ((_61 = (_60 = lineSeries[0]) === null || _60 === void 0 ? void 0 : _60.values) !== null && _61 !== void 0 ? _61 : []).map(function (_, i) { return i + 1; });
|
|
1159
1199
|
stockTraces = lineSeries.map(function (s, i) { return ({
|
|
1160
1200
|
type: "scatter",
|
|
1161
1201
|
mode: "lines",
|
|
@@ -1166,11 +1206,11 @@ var BasicChart = function (_a) {
|
|
|
1166
1206
|
}); });
|
|
1167
1207
|
setPlotData(hasVolume ? tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(stockTraces), false), [buildVolumeTrace(xs_2)], false) : stockTraces);
|
|
1168
1208
|
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: {
|
|
1169
|
-
title: { text: (
|
|
1209
|
+
title: { text: (_62 = spec.horizontalAxisTitle) !== null && _62 !== void 0 ? _62 : "" },
|
|
1170
1210
|
automargin: true,
|
|
1171
1211
|
showgrid: true,
|
|
1172
1212
|
gridcolor: gridColor,
|
|
1173
|
-
}, yaxis: tslib_1.__assign({ title: { text: (
|
|
1213
|
+
}, yaxis: tslib_1.__assign({ title: { text: (_63 = spec.verticalAxisTitle) !== null && _63 !== void 0 ? _63 : "" }, automargin: true, showgrid: true, gridcolor: gridColor }, priceYAxisDomain) }, volumeLayout), { margin: { l: 50, r: 50, t: 50, b: 50 }, autosize: true }));
|
|
1174
1214
|
return [2 /*return*/];
|
|
1175
1215
|
}
|
|
1176
1216
|
isStacked = spec.stackedType && spec.stackedType !== "UNSTACKED";
|
|
@@ -1217,12 +1257,12 @@ var BasicChart = function (_a) {
|
|
|
1217
1257
|
return extra;
|
|
1218
1258
|
};
|
|
1219
1259
|
shouldAggregate = (0, aggregation_1.shouldAggregateSeries)(spec.series);
|
|
1220
|
-
primaryDomainSource = (
|
|
1260
|
+
primaryDomainSource = (_66 = (_65 = (_64 = spec === null || spec === void 0 ? void 0 : spec.domains) === null || _64 === void 0 ? void 0 : _64[0]) === null || _65 === void 0 ? void 0 : _65.sources) === null || _66 === void 0 ? void 0 : _66[0];
|
|
1221
1261
|
rawPrimaryDomainValues = primaryDomainSource
|
|
1222
|
-
? (0, aggregation_1.sanitizeDomainValues)((
|
|
1262
|
+
? (0, aggregation_1.sanitizeDomainValues)((_67 = getDomainValuesFromRange(primaryDomainSource, spec.hiddenDimensionStrategy)) !== null && _67 !== void 0 ? _67 : [])
|
|
1223
1263
|
: [];
|
|
1224
1264
|
domainData = (0, aggregation_1.getDomainValuesForAxis)(rawPrimaryDomainValues, shouldAggregate);
|
|
1225
|
-
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((
|
|
1265
|
+
categoryLevels = (0, category_levels_1.resolveCategoryLevels)((_68 = spec.categoryLevels) === null || _68 === void 0 ? void 0 : _68.map(function (level) {
|
|
1226
1266
|
return flattenChartDataValues([level], getDomainValuesFromRange, spec.hiddenDimensionStrategy, false);
|
|
1227
1267
|
}));
|
|
1228
1268
|
multicategoryX = categoryLevels
|
|
@@ -1232,7 +1272,7 @@ var BasicChart = function (_a) {
|
|
|
1232
1272
|
domainData = categoryLevels.leaf;
|
|
1233
1273
|
}
|
|
1234
1274
|
aggregateDomainValues = domainData;
|
|
1235
|
-
domainAxisData = (categoryLevels ? [] : (
|
|
1275
|
+
domainAxisData = (categoryLevels ? [] : (_69 = spec.domains) !== null && _69 !== void 0 ? _69 : []).map(function (domain, domainIndex) {
|
|
1236
1276
|
return domain.sources.flatMap(function (sheetRange, sourceIndex) {
|
|
1237
1277
|
var _a;
|
|
1238
1278
|
if (domainIndex === 0 && sourceIndex === 0) {
|
|
@@ -1489,29 +1529,29 @@ var BasicChart = function (_a) {
|
|
|
1489
1529
|
finally { if (e_8) throw e_8.error; }
|
|
1490
1530
|
}
|
|
1491
1531
|
};
|
|
1492
|
-
domainSources = (
|
|
1532
|
+
domainSources = (_72 = (_71 = (_70 = spec.domains) === null || _70 === void 0 ? void 0 : _70[0]) === null || _71 === void 0 ? void 0 : _71.sources) !== null && _72 !== void 0 ? _72 : [];
|
|
1493
1533
|
seriesIndex = 0;
|
|
1494
1534
|
_loop_2 = function (series) {
|
|
1495
|
-
var currentSeriesIndex, dataLabel,
|
|
1496
|
-
return tslib_1.__generator(this, function (
|
|
1497
|
-
switch (
|
|
1535
|
+
var currentSeriesIndex, dataLabel, _106, _107, effectiveChartType, lineLike, pieDomainLabels, piePointOffset, seriesData, seriesPlotlyType, seriesTraceStyle, rawValues, binCount, binningOptions, categories, prebinned, _108, labels, counts, cumulativePercents, barTrace, paretoLineColor, barTrace, trace, rawValues, quartileMethod, showOutliers, showMeanMarker, showInnerPoints, showMeanLine, boxDomainSource, boxCategories_1, grouped, values, trace, rawValues, totalIndices_1, increaseColor, trace, rawValues, trace, pieData, _109, 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, _110, x, y, orientation_1, trace, numericValues, _111, x, y, orientation_2, trace;
|
|
1536
|
+
return tslib_1.__generator(this, function (_112) {
|
|
1537
|
+
switch (_112.label) {
|
|
1498
1538
|
case 0:
|
|
1499
1539
|
currentSeriesIndex = seriesIndex++;
|
|
1500
1540
|
if (!(!(0, utils_1.isNil)(series.dataLabel) && (0, utils_1.isAFormula)(series.dataLabel))) return [3 /*break*/, 2];
|
|
1501
|
-
|
|
1502
|
-
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (
|
|
1541
|
+
_107 = chart_spec_utils_1.coerceCalculatedLabel;
|
|
1542
|
+
return [4 /*yield*/, onRequestCalculate(series.dataLabel, (_74 = position.sheetId) !== null && _74 !== void 0 ? _74 : sheetId, position.overlayPosition.anchorCell.rowIndex, position.overlayPosition.anchorCell.columnIndex)];
|
|
1503
1543
|
case 1:
|
|
1504
|
-
|
|
1544
|
+
_106 = _107.apply(void 0, [_112.sent()]);
|
|
1505
1545
|
return [3 /*break*/, 3];
|
|
1506
1546
|
case 2:
|
|
1507
|
-
|
|
1508
|
-
|
|
1547
|
+
_106 = (_75 = series.dataLabel) !== null && _75 !== void 0 ? _75 : "";
|
|
1548
|
+
_112.label = 3;
|
|
1509
1549
|
case 3:
|
|
1510
|
-
dataLabel =
|
|
1550
|
+
dataLabel = _106;
|
|
1511
1551
|
// A series with no ranges draws nothing.
|
|
1512
1552
|
if (series.sources.length === 0)
|
|
1513
1553
|
return [2 /*return*/, "continue"];
|
|
1514
|
-
effectiveChartType = (
|
|
1554
|
+
effectiveChartType = (_76 = series.seriesChartType) !== null && _76 !== void 0 ? _76 : spec.chartType;
|
|
1515
1555
|
lineLike = (0, empty_cells_1.isLineLikeChartType)(effectiveChartType);
|
|
1516
1556
|
pieDomainLabels = (spec.chartType === "pie" || spec.chartType === "doughnut") &&
|
|
1517
1557
|
(domainSources.length > 1 || series.sources.length > 1)
|
|
@@ -1554,19 +1594,19 @@ var BasicChart = function (_a) {
|
|
|
1554
1594
|
};
|
|
1555
1595
|
categories = domainData;
|
|
1556
1596
|
prebinned = categories.length
|
|
1557
|
-
? (0, histogram_1.aggregateByCategory)(categories, rawValues, (
|
|
1597
|
+
? (0, histogram_1.aggregateByCategory)(categories, rawValues, (_77 = series.aggregateType) !== null && _77 !== void 0 ? _77 : "SUM")
|
|
1558
1598
|
: (0, histogram_1.hasExcelBinning)(binningOptions)
|
|
1559
1599
|
? (0, histogram_1.binHistogram)(rawValues, binCount, binningOptions)
|
|
1560
1600
|
: null;
|
|
1561
1601
|
if (isPareto) {
|
|
1562
|
-
|
|
1602
|
+
_108 = (0, histogram_1.computePareto)(prebinned !== null && prebinned !== void 0 ? prebinned : (0, histogram_1.binHistogram)(rawValues, binCount)), labels = _108.labels, counts = _108.counts, cumulativePercents = _108.cumulativePercents;
|
|
1563
1603
|
barTrace = {
|
|
1564
1604
|
type: "bar",
|
|
1565
1605
|
x: labels,
|
|
1566
1606
|
y: counts,
|
|
1567
1607
|
name: dataLabel,
|
|
1568
1608
|
};
|
|
1569
|
-
applyTraceColor(barTrace, (
|
|
1609
|
+
applyTraceColor(barTrace, (_78 = series.color) !== null && _78 !== void 0 ? _78 : undefined, {
|
|
1570
1610
|
noFill: series.noFill,
|
|
1571
1611
|
dataPointColors: series.dataPointColors,
|
|
1572
1612
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1585,7 +1625,7 @@ var BasicChart = function (_a) {
|
|
|
1585
1625
|
y: prebinned.counts,
|
|
1586
1626
|
name: dataLabel,
|
|
1587
1627
|
};
|
|
1588
|
-
applyTraceColor(barTrace, (
|
|
1628
|
+
applyTraceColor(barTrace, (_79 = series.color) !== null && _79 !== void 0 ? _79 : undefined, {
|
|
1589
1629
|
noFill: series.noFill,
|
|
1590
1630
|
dataPointColors: series.dataPointColors,
|
|
1591
1631
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1597,7 +1637,7 @@ var BasicChart = function (_a) {
|
|
|
1597
1637
|
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
|
|
1598
1638
|
? { nbinsx: binCount }
|
|
1599
1639
|
: {}));
|
|
1600
|
-
applyTraceColor(trace, (
|
|
1640
|
+
applyTraceColor(trace, (_80 = series.color) !== null && _80 !== void 0 ? _80 : undefined, {
|
|
1601
1641
|
noFill: series.noFill,
|
|
1602
1642
|
dataPointColors: series.dataPointColors,
|
|
1603
1643
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1609,43 +1649,20 @@ var BasicChart = function (_a) {
|
|
|
1609
1649
|
else if (effectiveChartType === "boxplot") {
|
|
1610
1650
|
rawValues = seriesValuesOf(seriesData);
|
|
1611
1651
|
quartileMethod = spec.quartileMethod;
|
|
1612
|
-
showOutliers = spec.showOutliers;
|
|
1652
|
+
showOutliers = spec.showOutliers !== false;
|
|
1613
1653
|
showMeanMarker = spec.showMeanMarker === true;
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
// the trace name).
|
|
1627
|
-
x: [dataLabel || "trace ".concat(currentSeriesIndex)], q1: [summary.q1], median: [summary.median], q3: [summary.q3],
|
|
1628
|
-
// Excel: hiding outlier points extends the whiskers to
|
|
1629
|
-
// the full min/max; with outliers shown they stop at the
|
|
1630
|
-
// most extreme points inside the 1.5×IQR fences.
|
|
1631
|
-
lowerfence: [hideOutliers ? summary.min : summary.lowerWhisker], upperfence: [hideOutliers ? summary.max : summary.upperWhisker] }, (hideOutliers
|
|
1632
|
-
? { boxpoints: false }
|
|
1633
|
-
: {
|
|
1634
|
-
// Sample points ride along so plotly can still draw
|
|
1635
|
-
// the outlier dots against the precomputed fences.
|
|
1636
|
-
y: [rawValues.filter(function (v) { return v != null; })],
|
|
1637
|
-
boxpoints: "outliers",
|
|
1638
|
-
})), (showMeanMarker
|
|
1639
|
-
? { mean: [summary.mean], boxmean: true }
|
|
1640
|
-
: {}));
|
|
1641
|
-
}
|
|
1642
|
-
else {
|
|
1643
|
-
trace = tslib_1.__assign({ type: "box", y: rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); }), name: dataLabel,
|
|
1644
|
-
// Raw mode is used when outliers are visible (today's
|
|
1645
|
-
// default and `showOutliers: true` alike).
|
|
1646
|
-
boxpoints: "outliers" }, (showMeanMarker ? { boxmean: true } : {}));
|
|
1647
|
-
}
|
|
1648
|
-
applyTraceColor(trace, (_66 = series.color) !== null && _66 !== void 0 ? _66 : undefined, {
|
|
1654
|
+
showInnerPoints = spec.showInnerPoints === true;
|
|
1655
|
+
showMeanLine = spec.showMeanLine === true;
|
|
1656
|
+
boxDomainSource = (_83 = (_82 = (_81 = spec.domains) === null || _81 === void 0 ? void 0 : _81[0]) === null || _82 === void 0 ? void 0 : _82.sources) === null || _83 === void 0 ? void 0 : _83[0];
|
|
1657
|
+
boxCategories_1 = boxDomainSource
|
|
1658
|
+
? ((_84 = getDomainValuesFromRange(boxDomainSource, spec.hiddenDimensionStrategy)) !== null && _84 !== void 0 ? _84 : []).map(function (v) { return (v === null || v === undefined ? "" : "".concat(v).trim()); })
|
|
1659
|
+
: [];
|
|
1660
|
+
grouped = boxCategories_1.some(function (c) { return c !== ""; });
|
|
1661
|
+
values = rawValues.map(function (v) { return (v !== null && v !== void 0 ? v : null); });
|
|
1662
|
+
trace = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "box", name: dataLabel, y: values }, (grouped
|
|
1663
|
+
? { x: values.map(function (_, i) { var _a; return (_a = boxCategories_1[i]) !== null && _a !== void 0 ? _a : ""; }) }
|
|
1664
|
+
: {})), (quartileMethod ? { quartilemethod: quartileMethod } : {})), { boxpoints: showInnerPoints ? "all" : showOutliers ? "outliers" : false }), (showInnerPoints ? { jitter: 0, pointpos: 0 } : {})), (showMeanMarker || showMeanLine ? { boxmean: true } : {}));
|
|
1665
|
+
applyTraceColor(trace, (_85 = series.color) !== null && _85 !== void 0 ? _85 : undefined, {
|
|
1649
1666
|
noFill: series.noFill,
|
|
1650
1667
|
dataPointColors: series.dataPointColors,
|
|
1651
1668
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1655,8 +1672,8 @@ var BasicChart = function (_a) {
|
|
|
1655
1672
|
}
|
|
1656
1673
|
else if (effectiveChartType === "waterfall") {
|
|
1657
1674
|
rawValues = seriesValuesOf(seriesData);
|
|
1658
|
-
totalIndices_1 = new Set((
|
|
1659
|
-
increaseColor = (
|
|
1675
|
+
totalIndices_1 = new Set((_86 = spec.totalIndices) !== null && _86 !== void 0 ? _86 : []);
|
|
1676
|
+
increaseColor = (_87 = series.color) !== null && _87 !== void 0 ? _87 : (0, utils_1.chartPaletteColorAt)(themeColorPalette, currentSeriesIndex);
|
|
1660
1677
|
trace = {
|
|
1661
1678
|
type: "waterfall",
|
|
1662
1679
|
x: categoriesFor(series),
|
|
@@ -1668,10 +1685,10 @@ var BasicChart = function (_a) {
|
|
|
1668
1685
|
increasing: { marker: { color: increaseColor } },
|
|
1669
1686
|
decreasing: {
|
|
1670
1687
|
marker: {
|
|
1671
|
-
color: (
|
|
1688
|
+
color: (_89 = (_88 = series.negativeColor) !== null && _88 !== void 0 ? _88 : theme.themeColors.accent2) !== null && _89 !== void 0 ? _89 : increaseColor,
|
|
1672
1689
|
},
|
|
1673
1690
|
},
|
|
1674
|
-
totals: { marker: { color: (
|
|
1691
|
+
totals: { marker: { color: (_90 = theme.themeColors.accent3) !== null && _90 !== void 0 ? _90 : increaseColor } },
|
|
1675
1692
|
connector: {
|
|
1676
1693
|
line: {
|
|
1677
1694
|
color: isDarkMode ? "rgba(255,255,255,0.45)" : "#999999",
|
|
@@ -1691,7 +1708,7 @@ var BasicChart = function (_a) {
|
|
|
1691
1708
|
name: dataLabel,
|
|
1692
1709
|
textinfo: "none",
|
|
1693
1710
|
};
|
|
1694
|
-
applyTraceColor(trace, (
|
|
1711
|
+
applyTraceColor(trace, (_91 = series.color) !== null && _91 !== void 0 ? _91 : undefined, {
|
|
1695
1712
|
noFill: series.noFill,
|
|
1696
1713
|
dataPointColors: series.dataPointColors,
|
|
1697
1714
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1709,10 +1726,10 @@ var BasicChart = function (_a) {
|
|
|
1709
1726
|
return [2 /*return*/, "continue"];
|
|
1710
1727
|
ofPieHandled = true;
|
|
1711
1728
|
pieData = seriesData;
|
|
1712
|
-
|
|
1729
|
+
_109 = (0, of_pie_1.splitOfPie)(pieData.values, pieData.labels, {
|
|
1713
1730
|
splitType: spec.splitType,
|
|
1714
1731
|
splitPos: spec.splitPos,
|
|
1715
|
-
}), main_1 =
|
|
1732
|
+
}), main_1 = _109.main, secondary = _109.secondary, otherTotal = _109.otherTotal, total = _109.total;
|
|
1716
1733
|
ofPieType = (0, of_pie_1.resolveOfPieType)(spec.ofPieType);
|
|
1717
1734
|
secondScale = (0, of_pie_1.clampSecondPieSize)(spec.secondPieSize) / 100;
|
|
1718
1735
|
halfAngle = (0, of_pie_1.otherSliceHalfAngle)(otherTotal, total);
|
|
@@ -1845,7 +1862,7 @@ var BasicChart = function (_a) {
|
|
|
1845
1862
|
trace.meta = {
|
|
1846
1863
|
rncSeriesIndex: currentSeriesIndex,
|
|
1847
1864
|
};
|
|
1848
|
-
applyTraceColor(trace, (
|
|
1865
|
+
applyTraceColor(trace, (_92 = series.color) !== null && _92 !== void 0 ? _92 : undefined, {
|
|
1849
1866
|
noFill: series.noFill,
|
|
1850
1867
|
dataPointColors: series.dataPointColors,
|
|
1851
1868
|
seriesIndex: currentSeriesIndex,
|
|
@@ -1854,13 +1871,13 @@ var BasicChart = function (_a) {
|
|
|
1854
1871
|
traces.push(trace);
|
|
1855
1872
|
}
|
|
1856
1873
|
else if ("values" in seriesData && "labels" in seriesData) {
|
|
1857
|
-
|
|
1874
|
+
_110 = assignCartesianData(categoriesFor(series), seriesData.values), x = _110.x, y = _110.y, orientation_1 = _110.orientation;
|
|
1858
1875
|
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));
|
|
1859
1876
|
// Ties the trace back to spec.series for click selection
|
|
1860
1877
|
trace.meta = {
|
|
1861
1878
|
rncSeriesIndex: currentSeriesIndex,
|
|
1862
1879
|
};
|
|
1863
|
-
applyTraceColor(trace, (
|
|
1880
|
+
applyTraceColor(trace, (_93 = series.color) !== null && _93 !== void 0 ? _93 : undefined, {
|
|
1864
1881
|
noFill: series.noFill,
|
|
1865
1882
|
dataPointColors: series.dataPointColors,
|
|
1866
1883
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1875,13 +1892,13 @@ var BasicChart = function (_a) {
|
|
|
1875
1892
|
}
|
|
1876
1893
|
else {
|
|
1877
1894
|
numericValues = seriesData;
|
|
1878
|
-
|
|
1895
|
+
_111 = assignCartesianData(categoriesFor(series), numericValues), x = _111.x, y = _111.y, orientation_2 = _111.orientation;
|
|
1879
1896
|
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));
|
|
1880
1897
|
// Ties the trace back to spec.series for click selection
|
|
1881
1898
|
trace.meta = {
|
|
1882
1899
|
rncSeriesIndex: currentSeriesIndex,
|
|
1883
1900
|
};
|
|
1884
|
-
applyTraceColor(trace, (
|
|
1901
|
+
applyTraceColor(trace, (_94 = series.color) !== null && _94 !== void 0 ? _94 : undefined, {
|
|
1885
1902
|
noFill: series.noFill,
|
|
1886
1903
|
dataPointColors: series.dataPointColors,
|
|
1887
1904
|
invertIfNegative: series.invertIfNegative,
|
|
@@ -1898,24 +1915,24 @@ var BasicChart = function (_a) {
|
|
|
1898
1915
|
}
|
|
1899
1916
|
});
|
|
1900
1917
|
};
|
|
1901
|
-
|
|
1918
|
+
_105.label = 18;
|
|
1902
1919
|
case 18:
|
|
1903
|
-
|
|
1904
|
-
_j = tslib_1.__values((
|
|
1905
|
-
|
|
1920
|
+
_105.trys.push([18, 23, 24, 25]);
|
|
1921
|
+
_j = tslib_1.__values((_73 = spec.series) !== null && _73 !== void 0 ? _73 : []), _k = _j.next();
|
|
1922
|
+
_105.label = 19;
|
|
1906
1923
|
case 19:
|
|
1907
1924
|
if (!!_k.done) return [3 /*break*/, 22];
|
|
1908
1925
|
series = _k.value;
|
|
1909
1926
|
return [5 /*yield**/, _loop_2(series)];
|
|
1910
1927
|
case 20:
|
|
1911
|
-
|
|
1912
|
-
|
|
1928
|
+
_105.sent();
|
|
1929
|
+
_105.label = 21;
|
|
1913
1930
|
case 21:
|
|
1914
1931
|
_k = _j.next();
|
|
1915
1932
|
return [3 /*break*/, 19];
|
|
1916
1933
|
case 22: return [3 /*break*/, 25];
|
|
1917
1934
|
case 23:
|
|
1918
|
-
e_3_1 =
|
|
1935
|
+
e_3_1 = _105.sent();
|
|
1919
1936
|
e_3 = { error: e_3_1 };
|
|
1920
1937
|
return [3 /*break*/, 25];
|
|
1921
1938
|
case 24:
|
|
@@ -1932,13 +1949,13 @@ var BasicChart = function (_a) {
|
|
|
1932
1949
|
? undefined
|
|
1933
1950
|
: (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1934
1951
|
axisOptions: spec.valueAxisOptions,
|
|
1935
|
-
series: ((
|
|
1952
|
+
series: ((_95 = spec.series) !== null && _95 !== void 0 ? _95 : []).filter(function (s) { return !s.useSecondaryAxis; }),
|
|
1936
1953
|
getFormattingFromRange: getFormattingFromRange,
|
|
1937
1954
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1938
1955
|
});
|
|
1939
1956
|
secondaryAxisNumberFormat = (0, axis_number_format_1.resolveValueAxisNumberFormat)({
|
|
1940
1957
|
axisOptions: spec.secondaryValueAxisOptions,
|
|
1941
|
-
series: ((
|
|
1958
|
+
series: ((_96 = spec.series) !== null && _96 !== void 0 ? _96 : []).filter(function (s) { return s.useSecondaryAxis; }),
|
|
1942
1959
|
getFormattingFromRange: getFormattingFromRange,
|
|
1943
1960
|
hiddenDimensionStrategy: spec.hiddenDimensionStrategy,
|
|
1944
1961
|
});
|
|
@@ -1986,14 +2003,14 @@ var BasicChart = function (_a) {
|
|
|
1986
2003
|
? VALUE_AXIS_TITLE_STANDOFF
|
|
1987
2004
|
: legend_layout_1.BAND_GAP;
|
|
1988
2005
|
legendBand = (0, legend_layout_1.reservePlotlyLegendBand)({
|
|
1989
|
-
position: (
|
|
2006
|
+
position: (_97 = spec.legend) === null || _97 === void 0 ? void 0 : _97.position,
|
|
1990
2007
|
visible: showlegend !== false,
|
|
1991
2008
|
labels: (0, legend_layout_1.legendLabelsFrom)(undefined, traces.map(function (trace) { return trace === null || trace === void 0 ? void 0 : trace.name; })),
|
|
1992
|
-
legendFontSize: (
|
|
2009
|
+
legendFontSize: (_100 = (_99 = (_98 = spec.legend) === null || _98 === void 0 ? void 0 : _98.textFormat) === null || _99 === void 0 ? void 0 : _99.fontSize) !== null && _100 !== void 0 ? _100 : axisFontSize,
|
|
1993
2010
|
width: Math.max(0, (width !== null && width !== void 0 ? width : 0) - 2),
|
|
1994
2011
|
height: Math.max(0, (height !== null && height !== void 0 ? height : 0) - 2),
|
|
1995
2012
|
hasTitle: Boolean(title),
|
|
1996
|
-
titleFontSize: (
|
|
2013
|
+
titleFontSize: (_101 = authoredTitleFmt === null || authoredTitleFmt === void 0 ? void 0 : authoredTitleFmt.fontSize) !== null && _101 !== void 0 ? _101 : 16,
|
|
1997
2014
|
hasBottomAxisTitle: Boolean(spec.horizontalAxisTitle),
|
|
1998
2015
|
hasLeftAxisTitle: Boolean(spec.verticalAxisTitle),
|
|
1999
2016
|
leftAxisDepth: leftAxisDepth,
|
|
@@ -2001,11 +2018,11 @@ var BasicChart = function (_a) {
|
|
|
2001
2018
|
bottomAxisTitleStandoff: bottomAxisTitleStandoff,
|
|
2002
2019
|
axisFontSize: axisFontSize,
|
|
2003
2020
|
});
|
|
2004
|
-
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({
|
|
2021
|
+
newLayout = tslib_1.__assign(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({
|
|
2005
2022
|
family: "Untitled Sans, apple-system, sans-serif",
|
|
2006
2023
|
size: 16,
|
|
2007
2024
|
color: textColor,
|
|
2008
|
-
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((
|
|
2025
|
+
}, authoredTitleFmt), x: 0.02, xanchor: "left" }, legendBand.title), showlegend: showlegend === undefined ? true : showlegend, legend: tslib_1.__assign(tslib_1.__assign({}, legendOverrides), ((_102 = legendBand.legend) !== null && _102 !== void 0 ? _102 : {})), margin: legendBand.margin, autosize: true }, ((spec.chartType === "bar" || spec.chartType === "column") &&
|
|
2009
2026
|
spec.stackedType
|
|
2010
2027
|
? tslib_1.__assign({ barmode: spec.stackedType === "STACKED" ||
|
|
2011
2028
|
spec.stackedType === "PERCENT_STACKED"
|
|
@@ -2015,13 +2032,18 @@ var BasicChart = function (_a) {
|
|
|
2015
2032
|
: spec.chartType === "histogram"
|
|
2016
2033
|
? // Excel's histogram columns touch by default (#1087).
|
|
2017
2034
|
{ bargap: 0 }
|
|
2018
|
-
: {})),
|
|
2035
|
+
: {})), (spec.chartType === "boxplot"
|
|
2036
|
+
? {
|
|
2037
|
+
boxmode: "group",
|
|
2038
|
+
boxgap: Math.max(0, Math.min(0.95, (typeof spec.gapWidth === "number" ? spec.gapWidth : 150) / 400)),
|
|
2039
|
+
}
|
|
2040
|
+
: {})), { font: {
|
|
2019
2041
|
family: "Untitled Sans, apple-system, sans-serif",
|
|
2020
2042
|
size: 12,
|
|
2021
2043
|
color: textColor,
|
|
2022
2044
|
}, paper_bgcolor: bgColor, plot_bgcolor: bgColor, xaxis: applyAxisOverridesPlotly({
|
|
2023
2045
|
title: {
|
|
2024
|
-
text: (
|
|
2046
|
+
text: (_103 = spec.horizontalAxisTitle) !== null && _103 !== void 0 ? _103 : "",
|
|
2025
2047
|
font: { color: textColor },
|
|
2026
2048
|
standoff: bottomAxisTitleStandoff,
|
|
2027
2049
|
},
|
|
@@ -2039,7 +2061,7 @@ var BasicChart = function (_a) {
|
|
|
2039
2061
|
isHorizontalBarChart
|
|
2040
2062
|
? spec.valueAxisOptions
|
|
2041
2063
|
: spec.categoryAxisOptions, isHorizontalBarChart ? primaryAxisNumberFormat : undefined), yaxis: applyAxisOverridesPlotly({
|
|
2042
|
-
title: tslib_1.__assign({ text: (
|
|
2064
|
+
title: tslib_1.__assign({ text: (_104 = spec.verticalAxisTitle) !== null && _104 !== void 0 ? _104 : "", font: { color: textColor } }, (isHorizontalBarChart
|
|
2043
2065
|
? {}
|
|
2044
2066
|
: { standoff: VALUE_AXIS_TITLE_STANDOFF })),
|
|
2045
2067
|
showgrid: !isHorizontalBarChart,
|