@rowsncolumns/charts 28.1.14 → 28.1.16
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 +312 -271
- package/dist/cjs/components/editors/chart-editor-capabilities.d.ts +48 -0
- package/dist/cjs/components/editors/chart-editor-capabilities.d.ts.map +1 -0
- package/dist/cjs/components/editors/chart-editor-capabilities.js +62 -0
- package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +200 -534
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts +16 -0
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/axis-options-fields.js +31 -0
- package/dist/cjs/components/editors/fields/chart-type-options.d.ts +25 -0
- package/dist/cjs/components/editors/fields/chart-type-options.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/chart-type-options.js +170 -0
- package/dist/cjs/components/editors/fields/data-labels-fields.d.ts +15 -0
- package/dist/cjs/components/editors/fields/data-labels-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/data-labels-fields.js +57 -0
- package/dist/cjs/components/editors/fields/primitives.d.ts +54 -0
- package/dist/cjs/components/editors/fields/primitives.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/primitives.js +52 -0
- package/dist/cjs/components/editors/fields/series-format-fields.d.ts +17 -0
- package/dist/cjs/components/editors/fields/series-format-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/series-format-fields.js +165 -0
- package/dist/cjs/components/editors/fields/series-name-field.d.ts +16 -0
- package/dist/cjs/components/editors/fields/series-name-field.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/series-name-field.js +36 -0
- package/dist/cjs/components/editors/fields/text-format-fields.d.ts +20 -0
- package/dist/cjs/components/editors/fields/text-format-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/text-format-fields.js +46 -0
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +3 -0
- package/dist/cjs/interface/create-chart.d.ts +3 -2
- package/dist/cjs/interface/create-chart.d.ts.map +1 -1
- package/dist/cjs/interface/create-chart.js +7 -0
- package/dist/cjs/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/plotly/basic-chart/basic-chart.js +255 -218
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/utils/chart-orientation.d.ts.map +1 -1
- package/dist/cjs/utils/chart-orientation.js +24 -12
- package/dist/cjs/utils/chart-spec-utils.d.ts.map +1 -1
- package/dist/cjs/utils/chart-spec-utils.js +120 -21
- package/dist/cjs/utils/echarts-overlays.d.ts +2 -0
- package/dist/cjs/utils/echarts-overlays.d.ts.map +1 -1
- package/dist/cjs/utils/echarts-overlays.js +25 -12
- package/dist/cjs/utils/series-name.d.ts +12 -0
- package/dist/cjs/utils/series-name.d.ts.map +1 -0
- package/dist/cjs/utils/series-name.js +26 -0
- package/dist/cjs/utils/trendline.d.ts +9 -0
- package/dist/cjs/utils/trendline.d.ts.map +1 -1
- package/dist/cjs/utils/trendline.js +16 -1
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +80 -38
- package/dist/esm/components/editors/chart-editor-capabilities.d.ts +48 -0
- package/dist/esm/components/editors/chart-editor-capabilities.d.ts.map +1 -0
- package/dist/esm/components/editors/chart-editor-capabilities.js +58 -0
- package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +166 -448
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts +16 -0
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/axis-options-fields.js +22 -0
- package/dist/esm/components/editors/fields/chart-type-options.d.ts +25 -0
- package/dist/esm/components/editors/fields/chart-type-options.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/chart-type-options.js +151 -0
- package/dist/esm/components/editors/fields/data-labels-fields.d.ts +15 -0
- package/dist/esm/components/editors/fields/data-labels-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/data-labels-fields.js +47 -0
- package/dist/esm/components/editors/fields/primitives.d.ts +54 -0
- package/dist/esm/components/editors/fields/primitives.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/primitives.js +26 -0
- package/dist/esm/components/editors/fields/series-format-fields.d.ts +17 -0
- package/dist/esm/components/editors/fields/series-format-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/series-format-fields.js +143 -0
- package/dist/esm/components/editors/fields/series-name-field.d.ts +16 -0
- package/dist/esm/components/editors/fields/series-name-field.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/series-name-field.js +31 -0
- package/dist/esm/components/editors/fields/text-format-fields.d.ts +20 -0
- package/dist/esm/components/editors/fields/text-format-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/text-format-fields.js +34 -0
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +3 -0
- package/dist/esm/interface/create-chart.d.ts +3 -2
- package/dist/esm/interface/create-chart.d.ts.map +1 -1
- package/dist/esm/interface/create-chart.js +8 -1
- package/dist/esm/plotly/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/plotly/basic-chart/basic-chart.js +52 -30
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/utils/chart-orientation.d.ts.map +1 -1
- package/dist/esm/utils/chart-orientation.js +20 -0
- package/dist/esm/utils/chart-spec-utils.d.ts.map +1 -1
- package/dist/esm/utils/chart-spec-utils.js +95 -8
- package/dist/esm/utils/echarts-overlays.d.ts +2 -0
- package/dist/esm/utils/echarts-overlays.d.ts.map +1 -1
- package/dist/esm/utils/echarts-overlays.js +15 -1
- package/dist/esm/utils/series-name.d.ts +12 -0
- package/dist/esm/utils/series-name.d.ts.map +1 -0
- package/dist/esm/utils/series-name.js +24 -0
- package/dist/esm/utils/trendline.d.ts +9 -0
- package/dist/esm/utils/trendline.d.ts.map +1 -1
- package/dist/esm/utils/trendline.js +14 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/plot.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/doughnut.ts","../../utils/echarts-gl-loader.ts","../../utils/echarts-overlays.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/legend-layout.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
|
|
1
|
+
{"root":["../../config.ts","../../echarts-gl.d.ts","../../geo-modules.d.ts","../../index.ts","../../plotly-dist.d.ts","../../types.ts","../../vitest.config.ts","../../atoms/editing-chart.atom.ts","../../atoms/pivot-chart.atom.ts","../../basic-chart/basic-chart.tsx","../../basic-chart/helpers.ts","../../basic-chart/index.tsx","../../components/dialogs/chart-editor-dialog.tsx","../../components/dialogs/pivot-chart-dialog.tsx","../../components/editors/chart-editor-capabilities.ts","../../components/editors/chart-editor.tsx","../../components/editors/chart-range-input.tsx","../../components/editors/fields/axis-options-fields.tsx","../../components/editors/fields/chart-type-options.tsx","../../components/editors/fields/data-labels-fields.tsx","../../components/editors/fields/primitives.tsx","../../components/editors/fields/series-format-fields.tsx","../../components/editors/fields/series-name-field.tsx","../../components/editors/fields/text-format-fields.tsx","../../hooks/use-chart-editor.ts","../../hooks/use-charts.ts","../../hooks/use-on-create-chart.ts","../../hooks/use-on-delete-chart.ts","../../hooks/use-on-move-chart-to-sheet.ts","../../hooks/use-on-move-chart.ts","../../hooks/use-on-resize-chart.ts","../../hooks/use-on-update-chart.ts","../../interface/create-chart.ts","../../interface/delete-chart.ts","../../interface/move-chart-to-sheet.ts","../../interface/move-chart.ts","../../interface/resize-chart.ts","../../interface/shift-chart-ranges.ts","../../interface/update-chart.ts","../../plotly/plot.ts","../../plotly/basic-chart/basic-chart.tsx","../../plotly/basic-chart/helpers.ts","../../plotly/basic-chart/index.tsx","../../utils/aggregation.ts","../../utils/axis-number-format.ts","../../utils/bar-layout.ts","../../utils/boxplot.ts","../../utils/bubble.ts","../../utils/category-levels.ts","../../utils/chart-image.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/doughnut.ts","../../utils/echarts-gl-loader.ts","../../utils/echarts-overlays.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/gradient.ts","../../utils/hierarchy.ts","../../utils/histogram.ts","../../utils/legend-layout.ts","../../utils/of-pie.ts","../../utils/overrides.ts","../../utils/pie-explosion.ts","../../utils/plotly-click.ts","../../utils/plotly-surface.ts","../../utils/plotly-title.ts","../../utils/radar.ts","../../utils/region-map-loader.ts","../../utils/region-map.ts","../../utils/series-click.ts","../../utils/series-name.ts","../../utils/stock.ts","../../utils/three-d.ts","../../utils/trendline.ts","../../utils/waterfall.ts","../../utils/webgl.ts"],"version":"5.8.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-orientation.d.ts","sourceRoot":"","sources":["../../../utils/chart-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,UAAU,EACX,MAAM,2BAA2B,CAAC;AAInC,KAAK,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"chart-orientation.d.ts","sourceRoot":"","sources":["../../../utils/chart-orientation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,aAAa,EACb,yBAAyB,EACzB,UAAU,EACX,MAAM,2BAA2B,CAAC;AAInC,KAAK,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAevC,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAE5E,4EAA4E;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,KAChB,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,8BAA8B,GAEvC,WAAW,CACT,KAAK,EAAE,UAAU,EACjB,cAAc,CAAC,EAAE,yBAAyB,GAAG,IAAI,KAC9C,SAAS,OAAO,EAAE,KACtB,oBAaF,CAAC;AAOJ;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,MAAM,SAAS,KAAG,iBAQxD,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,aAAa,iBAAiB,KAC7B,iBAAkE,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,6BAA6B,GACxC,OAAO,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,KACjC,iBAIY,CAAC;AAEhB;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B,GAAI,4CAIxC;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,iBAAiB,CAAC,EAAE,oBAAoB,CAAC;CAC1C,KAAG;IAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAAC,MAAM,EAAE,SAAS,EAAE,CAAA;CA8D9C,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAClC,MAAM,SAAS,EACf,aAAa,iBAAiB,KAC7B,UAAU,GAAG,SAsCf,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS,KAAG,OAIrC,CAAC;AAEjB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,SAAS,EACf,wBAAuB;IAAE,iBAAiB,CAAC,EAAE,oBAAoB,CAAA;CAAO,KACvE,SAAS,GAAG,SAgGd,CAAC"}
|
|
@@ -3,6 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.switchRowColumn = exports.canSwitchRowColumn = exports.rectangularSeriesBounds = exports.deriveChartSeriesFromRange = exports.pickSeriesOrientationForRange = exports.flipSeriesOrientation = exports.inferSeriesOrientation = exports.cellLabelGetterFromRangeReader = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var chart_spec_utils_1 = require("./chart-spec-utils");
|
|
6
|
+
/** The single-cell range a series name is linked to (its header cell). */
|
|
7
|
+
var cellRange = function (sheetId, rowIndex, columnIndex) { return ({
|
|
8
|
+
sheetId: sheetId,
|
|
9
|
+
startRowIndex: rowIndex,
|
|
10
|
+
endRowIndex: rowIndex,
|
|
11
|
+
startColumnIndex: columnIndex,
|
|
12
|
+
endColumnIndex: columnIndex,
|
|
13
|
+
}); };
|
|
6
14
|
/**
|
|
7
15
|
* Adapt a range reader (the renderers' `getDomainValuesFromRange`) into
|
|
8
16
|
* the single-cell label getter the orientation helpers take.
|
|
@@ -85,6 +93,7 @@ var deriveChartSeriesFromRange = function (_a) {
|
|
|
85
93
|
for (var rowIndex = startRowIndex + 1; rowIndex <= endRowIndex; rowIndex++) {
|
|
86
94
|
series_1.push({
|
|
87
95
|
dataLabel: label(rowIndex, startColumnIndex),
|
|
96
|
+
dataLabelSource: cellRange(sheetId, rowIndex, startColumnIndex),
|
|
88
97
|
sources: [
|
|
89
98
|
{
|
|
90
99
|
sheetId: sheetId,
|
|
@@ -109,6 +118,7 @@ var deriveChartSeriesFromRange = function (_a) {
|
|
|
109
118
|
for (var columnIndex = startColumnIndex + 1; columnIndex <= endColumnIndex; columnIndex++) {
|
|
110
119
|
series.push({
|
|
111
120
|
dataLabel: label(startRowIndex, columnIndex),
|
|
121
|
+
dataLabelSource: cellRange(sheetId, startRowIndex, columnIndex),
|
|
112
122
|
sources: [
|
|
113
123
|
{
|
|
114
124
|
sheetId: sheetId,
|
|
@@ -224,11 +234,13 @@ var switchRowColumn = function (spec, _a) {
|
|
|
224
234
|
if (next === "rows") {
|
|
225
235
|
for (var rowIndex = block.startRowIndex; rowIndex <= block.endRowIndex; rowIndex++) {
|
|
226
236
|
var offset = rowIndex - block.startRowIndex;
|
|
227
|
-
series.push({
|
|
228
|
-
dataLabel: categorySource && getFormattedValue
|
|
237
|
+
series.push(tslib_1.__assign(tslib_1.__assign({ dataLabel: categorySource && getFormattedValue
|
|
229
238
|
? (_e = getFormattedValue(categorySource.sheetId, categorySource.startRowIndex + offset, categorySource.startColumnIndex)) !== null && _e !== void 0 ? _e : undefined
|
|
230
|
-
: undefined,
|
|
231
|
-
|
|
239
|
+
: undefined }, (categorySource
|
|
240
|
+
? {
|
|
241
|
+
dataLabelSource: cellRange(categorySource.sheetId, categorySource.startRowIndex + offset, categorySource.startColumnIndex),
|
|
242
|
+
}
|
|
243
|
+
: {})), { sources: [
|
|
232
244
|
{
|
|
233
245
|
sheetId: block.sheetId,
|
|
234
246
|
startRowIndex: rowIndex,
|
|
@@ -236,18 +248,19 @@ var switchRowColumn = function (spec, _a) {
|
|
|
236
248
|
startColumnIndex: block.startColumnIndex,
|
|
237
249
|
endColumnIndex: block.endColumnIndex,
|
|
238
250
|
},
|
|
239
|
-
]
|
|
240
|
-
});
|
|
251
|
+
] }));
|
|
241
252
|
}
|
|
242
253
|
}
|
|
243
254
|
else {
|
|
244
255
|
for (var columnIndex = block.startColumnIndex; columnIndex <= block.endColumnIndex; columnIndex++) {
|
|
245
256
|
var offset = columnIndex - block.startColumnIndex;
|
|
246
|
-
series.push({
|
|
247
|
-
dataLabel: categorySource && getFormattedValue
|
|
257
|
+
series.push(tslib_1.__assign(tslib_1.__assign({ dataLabel: categorySource && getFormattedValue
|
|
248
258
|
? (_f = getFormattedValue(categorySource.sheetId, categorySource.startRowIndex, categorySource.startColumnIndex + offset)) !== null && _f !== void 0 ? _f : undefined
|
|
249
|
-
: undefined,
|
|
250
|
-
|
|
259
|
+
: undefined }, (categorySource
|
|
260
|
+
? {
|
|
261
|
+
dataLabelSource: cellRange(categorySource.sheetId, categorySource.startRowIndex, categorySource.startColumnIndex + offset),
|
|
262
|
+
}
|
|
263
|
+
: {})), { sources: [
|
|
251
264
|
{
|
|
252
265
|
sheetId: block.sheetId,
|
|
253
266
|
startRowIndex: block.startRowIndex,
|
|
@@ -255,8 +268,7 @@ var switchRowColumn = function (spec, _a) {
|
|
|
255
268
|
startColumnIndex: columnIndex,
|
|
256
269
|
endColumnIndex: columnIndex,
|
|
257
270
|
},
|
|
258
|
-
]
|
|
259
|
-
});
|
|
271
|
+
] }));
|
|
260
272
|
}
|
|
261
273
|
}
|
|
262
274
|
var categories = spec.series.map(function (entry, index) { var _a; return (_a = entry.dataLabel) !== null && _a !== void 0 ? _a : "Series ".concat(index + 1); });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chart-spec-utils.d.ts","sourceRoot":"","sources":["../../../utils/chart-spec-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACb,MAAM,2BAA2B,CAAC;AAEnC,KAAK,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;AACpD,KAAK,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AACtD,KAAK,SAAS,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAEvC,eAAO,MAAM,iBAAiB,6MAe5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,6MAA4C,CAAC;AAE5E,eAAO,MAAM,qBAAqB,6MAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,WAAW,SAAS,KAAG,aAKvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,SAAS,KACd,IAAI,IAAI,SAAS,GAAG,cAAuD,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,QAAQ,GAAG,SAAS,CAAC;IAChC,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,yEAAyE;IACzE,YAAY,CAAC,EACT,MAA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Q,OAAO,KAAG,MAQvD,CAAC"}
|
|
@@ -115,7 +115,25 @@ var BASIC_CHART_TYPE_PROPERTIES = {
|
|
|
115
115
|
],
|
|
116
116
|
doughnut: ["doughnutHoleSize", "explosion"],
|
|
117
117
|
waterfall: ["totalIndices"],
|
|
118
|
-
boxplot: [
|
|
118
|
+
boxplot: [
|
|
119
|
+
"quartileMethod",
|
|
120
|
+
"showOutliers",
|
|
121
|
+
"showMeanMarker",
|
|
122
|
+
"showInnerPoints",
|
|
123
|
+
"showMeanLine",
|
|
124
|
+
],
|
|
125
|
+
histogram: [
|
|
126
|
+
"binCount",
|
|
127
|
+
"binSize",
|
|
128
|
+
"intervalClosed",
|
|
129
|
+
"overflow",
|
|
130
|
+
"underflow",
|
|
131
|
+
"paretoLineColor",
|
|
132
|
+
// A Pareto is a histogram variant (`sourceChartType: "PARETO"`).
|
|
133
|
+
"sourceChartType",
|
|
134
|
+
],
|
|
135
|
+
radar: ["radarStyle"],
|
|
136
|
+
stock: ["stockVariant"],
|
|
119
137
|
// Region map (filled map / choropleth) — the geo scope and the
|
|
120
138
|
// authored-class marker are meaningless on any other chart type.
|
|
121
139
|
regionMap: ["sourceChartType", "geoScope"],
|
|
@@ -141,6 +159,19 @@ var CATEGORY_SPECIFIC_PROPERTIES = {
|
|
|
141
159
|
"quartileMethod",
|
|
142
160
|
"showOutliers",
|
|
143
161
|
"showMeanMarker",
|
|
162
|
+
"showInnerPoints",
|
|
163
|
+
"showMeanLine",
|
|
164
|
+
"binCount",
|
|
165
|
+
"binSize",
|
|
166
|
+
"intervalClosed",
|
|
167
|
+
"overflow",
|
|
168
|
+
"underflow",
|
|
169
|
+
"paretoLineColor",
|
|
170
|
+
"radarStyle",
|
|
171
|
+
"stockVariant",
|
|
172
|
+
"overlap",
|
|
173
|
+
"gapWidth",
|
|
174
|
+
"categoryLevels",
|
|
144
175
|
"geoScope",
|
|
145
176
|
],
|
|
146
177
|
bubble: [
|
|
@@ -148,14 +179,24 @@ var CATEGORY_SPECIFIC_PROPERTIES = {
|
|
|
148
179
|
"bubbleSizes",
|
|
149
180
|
"useFirstRowAsHeaders",
|
|
150
181
|
"scatterStyle",
|
|
182
|
+
"bubbleScale",
|
|
183
|
+
"sizeRepresents",
|
|
184
|
+
],
|
|
185
|
+
hierarchy: [
|
|
186
|
+
"labels",
|
|
187
|
+
"parentLabels",
|
|
188
|
+
"sizeData",
|
|
189
|
+
"useFirstRowAsHeaders",
|
|
190
|
+
"drillDown",
|
|
191
|
+
"parentLabelLayout",
|
|
151
192
|
],
|
|
152
|
-
hierarchy: ["labels", "parentLabels", "sizeData", "useFirstRowAsHeaders"],
|
|
153
193
|
};
|
|
154
194
|
/**
|
|
155
|
-
* `sourceChartType` tokens the picker's presets author (3-D classes
|
|
156
|
-
*
|
|
157
|
-
* resets the variant, so "Clustered Column" after
|
|
158
|
-
*
|
|
195
|
+
* `sourceChartType` tokens the picker's presets author (3-D classes, the
|
|
196
|
+
* of-pie composite and the Pareto histogram). Picking a chart type that
|
|
197
|
+
* carries none of them resets the variant, so "Clustered Column" after
|
|
198
|
+
* "3-D Column" is 2-D again and "Histogram" after "Pareto" is a plain
|
|
199
|
+
* histogram — unlike `REGION_MAP`, which only an import sets.
|
|
159
200
|
*/
|
|
160
201
|
var PICKER_VARIANT_TOKENS = new Set([
|
|
161
202
|
"BAR_3D",
|
|
@@ -165,6 +206,7 @@ var PICKER_VARIANT_TOKENS = new Set([
|
|
|
165
206
|
"SURFACE",
|
|
166
207
|
"SURFACE_3D",
|
|
167
208
|
"OF_PIE",
|
|
209
|
+
"PARETO",
|
|
168
210
|
]);
|
|
169
211
|
/** Of-pie split fields; meaningless once the spec is no longer an of-pie. */
|
|
170
212
|
var OF_PIE_FIELDS = ["ofPieType", "splitType", "splitPos", "secondPieSize"];
|
|
@@ -234,8 +276,8 @@ var CATEGORY_DATA_FIELDS = {
|
|
|
234
276
|
* Also handles special merging for chart data arrays.
|
|
235
277
|
*/
|
|
236
278
|
var mergeChartSpec = function (existingSpec, incomingSpec) {
|
|
237
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
238
|
-
var
|
|
279
|
+
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, e_5, _e;
|
|
280
|
+
var _f, _g;
|
|
239
281
|
var incomingChartType = incomingSpec.chartType;
|
|
240
282
|
var existingChartType = existingSpec.chartType;
|
|
241
283
|
var existingCategory = (0, exports.getChartCategory)(existingChartType);
|
|
@@ -262,7 +304,9 @@ var mergeChartSpec = function (existingSpec, incomingSpec) {
|
|
|
262
304
|
finally { if (e_1) throw e_1.error; }
|
|
263
305
|
}
|
|
264
306
|
}
|
|
265
|
-
// When switching categories, remove data fields from old category
|
|
307
|
+
// When switching categories, remove data fields from old category. The
|
|
308
|
+
// data itself is carried over below (`carryChartDataAcrossCategories`),
|
|
309
|
+
// as Excel keeps the selected cells when the chart type changes.
|
|
266
310
|
if (isCategoryChange) {
|
|
267
311
|
var oldCategoryDataFields = CATEGORY_DATA_FIELDS[existingCategory];
|
|
268
312
|
try {
|
|
@@ -283,8 +327,8 @@ var mergeChartSpec = function (existingSpec, incomingSpec) {
|
|
|
283
327
|
// no incoming sourceChartType clears a 3-D / of-pie token, and leaving
|
|
284
328
|
// the of-pie composite drops its split fields (even for "3-D Pie").
|
|
285
329
|
if (incomingChartType) {
|
|
286
|
-
var existingToken = String((
|
|
287
|
-
var incomingToken = String((
|
|
330
|
+
var existingToken = String((_f = existingSpec.sourceChartType) !== null && _f !== void 0 ? _f : "").toUpperCase();
|
|
331
|
+
var incomingToken = String((_g = incomingSpec.sourceChartType) !== null && _g !== void 0 ? _g : "").toUpperCase();
|
|
288
332
|
if (PICKER_VARIANT_TOKENS.has(existingToken) &&
|
|
289
333
|
!("sourceChartType" in incomingSpec)) {
|
|
290
334
|
delete merged.sourceChartType;
|
|
@@ -313,10 +357,15 @@ var mergeChartSpec = function (existingSpec, incomingSpec) {
|
|
|
313
357
|
var existingWithData = existingSpec;
|
|
314
358
|
var incomingWithData = incomingSpec;
|
|
315
359
|
var targetDataFields = CATEGORY_DATA_FIELDS[targetCategory];
|
|
360
|
+
var carried = isCategoryChange
|
|
361
|
+
? carryChartDataAcrossCategories(existingWithData, existingCategory, targetCategory)
|
|
362
|
+
: undefined;
|
|
316
363
|
try {
|
|
317
364
|
for (var targetDataFields_1 = tslib_1.__values(targetDataFields), targetDataFields_1_1 = targetDataFields_1.next(); !targetDataFields_1_1.done; targetDataFields_1_1 = targetDataFields_1.next()) {
|
|
318
365
|
var field = targetDataFields_1_1.value;
|
|
319
|
-
var existingData = isCategoryChange
|
|
366
|
+
var existingData = isCategoryChange
|
|
367
|
+
? carried === null || carried === void 0 ? void 0 : carried[field]
|
|
368
|
+
: existingWithData[field];
|
|
320
369
|
var incomingData = incomingWithData[field];
|
|
321
370
|
if (existingData !== undefined || incomingData !== undefined) {
|
|
322
371
|
merged[field] = (0, exports.mergeChartDataArray)(existingData, incomingData);
|
|
@@ -330,15 +379,65 @@ var mergeChartSpec = function (existingSpec, incomingSpec) {
|
|
|
330
379
|
}
|
|
331
380
|
finally { if (e_4) throw e_4.error; }
|
|
332
381
|
}
|
|
382
|
+
try {
|
|
383
|
+
// Every data array of the target category exists on the result — the
|
|
384
|
+
// editor maps over them, and a chart type switched from another category
|
|
385
|
+
// (line → bubble) used to leave `series` / `domains` undefined and crash
|
|
386
|
+
// the editor on `series.some` (rowsncolumns/spreadsheet#1101).
|
|
387
|
+
for (var _h = tslib_1.__values(REQUIRED_DATA_FIELDS[targetCategory]), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
388
|
+
var field = _j.value;
|
|
389
|
+
if (!Array.isArray(merged[field]))
|
|
390
|
+
merged[field] = [];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
394
|
+
finally {
|
|
395
|
+
try {
|
|
396
|
+
if (_j && !_j.done && (_e = _h.return)) _e.call(_h);
|
|
397
|
+
}
|
|
398
|
+
finally { if (e_5) throw e_5.error; }
|
|
399
|
+
}
|
|
333
400
|
return merged;
|
|
334
401
|
};
|
|
335
402
|
exports.mergeChartSpec = mergeChartSpec;
|
|
403
|
+
/**
|
|
404
|
+
* The data arrays a category's spec type declares as required (the editor
|
|
405
|
+
* and the renderers map over them without a guard).
|
|
406
|
+
*/
|
|
407
|
+
var REQUIRED_DATA_FIELDS = {
|
|
408
|
+
basic: ["domains", "series"],
|
|
409
|
+
bubble: ["domains", "series", "bubbleLabels"],
|
|
410
|
+
hierarchy: ["labels", "parentLabels", "sizeData"],
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* The selected cells survive a chart type change across categories, as in
|
|
414
|
+
* Excel: a column chart's categories become a scatter's X values and its
|
|
415
|
+
* series the Y values (and back); a treemap's labels become the categories
|
|
416
|
+
* and its sizes the first series (and back, with no parent levels).
|
|
417
|
+
*/
|
|
418
|
+
var carryChartDataAcrossCategories = function (existing, from, to) {
|
|
419
|
+
var clone = function (data) {
|
|
420
|
+
return data === null || data === void 0 ? void 0 : data.map(function (entry) { var _a; return (tslib_1.__assign(tslib_1.__assign({}, entry), { sources: tslib_1.__spreadArray([], tslib_1.__read(((_a = entry.sources) !== null && _a !== void 0 ? _a : [])), false) })); });
|
|
421
|
+
};
|
|
422
|
+
var categories = from === "hierarchy" ? clone(existing.labels) : clone(existing.domains);
|
|
423
|
+
var series = from === "hierarchy" ? clone(existing.sizeData) : clone(existing.series);
|
|
424
|
+
if (to === "hierarchy") {
|
|
425
|
+
return {
|
|
426
|
+
labels: categories !== null && categories !== void 0 ? categories : [],
|
|
427
|
+
parentLabels: [],
|
|
428
|
+
sizeData: (series === null || series === void 0 ? void 0 : series.length) ? [series[0]] : [],
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
// A bubble's labels and sizes cannot be guessed — the user picks them
|
|
432
|
+
// in the editor (the preset's placeholder entry is kept).
|
|
433
|
+
return { domains: categories !== null && categories !== void 0 ? categories : [], series: series !== null && series !== void 0 ? series : [] };
|
|
434
|
+
};
|
|
336
435
|
/**
|
|
337
436
|
* Extracts all SheetRange objects from a ChartSpec.
|
|
338
437
|
* Useful for subscribing to data changes across all chart data sources.
|
|
339
438
|
*/
|
|
340
439
|
var getChartDataRanges = function (spec) {
|
|
341
|
-
var
|
|
440
|
+
var e_6, _a, e_7, _b, e_8, _c;
|
|
342
441
|
var ranges = [];
|
|
343
442
|
var category = (0, exports.getChartCategory)(spec.chartType);
|
|
344
443
|
var dataFields = CATEGORY_DATA_FIELDS[category];
|
|
@@ -349,43 +448,43 @@ var getChartDataRanges = function (spec) {
|
|
|
349
448
|
var chartDataArray = specWithData[field];
|
|
350
449
|
if (chartDataArray) {
|
|
351
450
|
try {
|
|
352
|
-
for (var chartDataArray_1 = (
|
|
451
|
+
for (var chartDataArray_1 = (e_7 = void 0, tslib_1.__values(chartDataArray)), chartDataArray_1_1 = chartDataArray_1.next(); !chartDataArray_1_1.done; chartDataArray_1_1 = chartDataArray_1.next()) {
|
|
353
452
|
var chartData = chartDataArray_1_1.value;
|
|
354
453
|
if (chartData === null || chartData === void 0 ? void 0 : chartData.sources) {
|
|
355
454
|
try {
|
|
356
|
-
for (var _d = (
|
|
455
|
+
for (var _d = (e_8 = void 0, tslib_1.__values(chartData.sources)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
357
456
|
var source = _e.value;
|
|
358
457
|
if (source) {
|
|
359
458
|
ranges.push(source);
|
|
360
459
|
}
|
|
361
460
|
}
|
|
362
461
|
}
|
|
363
|
-
catch (
|
|
462
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
364
463
|
finally {
|
|
365
464
|
try {
|
|
366
465
|
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
367
466
|
}
|
|
368
|
-
finally { if (
|
|
467
|
+
finally { if (e_8) throw e_8.error; }
|
|
369
468
|
}
|
|
370
469
|
}
|
|
371
470
|
}
|
|
372
471
|
}
|
|
373
|
-
catch (
|
|
472
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
374
473
|
finally {
|
|
375
474
|
try {
|
|
376
475
|
if (chartDataArray_1_1 && !chartDataArray_1_1.done && (_b = chartDataArray_1.return)) _b.call(chartDataArray_1);
|
|
377
476
|
}
|
|
378
|
-
finally { if (
|
|
477
|
+
finally { if (e_7) throw e_7.error; }
|
|
379
478
|
}
|
|
380
479
|
}
|
|
381
480
|
}
|
|
382
481
|
}
|
|
383
|
-
catch (
|
|
482
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
384
483
|
finally {
|
|
385
484
|
try {
|
|
386
485
|
if (dataFields_1_1 && !dataFields_1_1.done && (_a = dataFields_1.return)) _a.call(dataFields_1);
|
|
387
486
|
}
|
|
388
|
-
finally { if (
|
|
487
|
+
finally { if (e_6) throw e_6.error; }
|
|
389
488
|
}
|
|
390
489
|
return ranges;
|
|
391
490
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echarts-overlays.d.ts","sourceRoot":"","sources":["../../../utils/echarts-overlays.ts"],"names":[],"mappings":"AAkBA,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EACP,KAAK,CAAC;QACJ,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"echarts-overlays.d.ts","sourceRoot":"","sources":["../../../utils/echarts-overlays.ts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CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC;IAC/C,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;CAC/D,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GAAI,MAAM,GAAG,OAAO,EAAE,gFAQzD,qBAAqB,CAAC,MAAM,CAAC,KAAG,GAAG,EA0IrC,CAAC"}
|
|
@@ -26,8 +26,8 @@ var ERROR_BAR_CAP_HALF = 5;
|
|
|
26
26
|
*/
|
|
27
27
|
var buildEchartsOverlaySeries = function (_a) {
|
|
28
28
|
var e_1, _b;
|
|
29
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
30
|
-
var series = _a.series, values = _a.values, xValues = _a.xValues,
|
|
29
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
30
|
+
var series = _a.series, values = _a.values, xValues = _a.xValues, _o = _a.horizontal, horizontal = _o === void 0 ? false : _o, dataLabel = _a.dataLabel, seriesColor = _a.seriesColor, resolveRange = _a.resolveRange;
|
|
31
31
|
if (values.length === 0)
|
|
32
32
|
return [];
|
|
33
33
|
var overlays = [];
|
|
@@ -35,8 +35,8 @@ var buildEchartsOverlaySeries = function (_a) {
|
|
|
35
35
|
var useSecondary = series.useSecondaryAxis ? { yAxisIndex: 1 } : {};
|
|
36
36
|
try {
|
|
37
37
|
// Trendlines — one overlay line series per spec.
|
|
38
|
-
for (var
|
|
39
|
-
var tl =
|
|
38
|
+
for (var _p = tslib_1.__values((_c = series.trendlines) !== null && _c !== void 0 ? _c : []), _q = _p.next(); !_q.done; _q = _p.next()) {
|
|
39
|
+
var tl = _q.value;
|
|
40
40
|
var result = (0, trendline_1.computeTrendline)(values, {
|
|
41
41
|
type: tl.type,
|
|
42
42
|
order: tl.order,
|
|
@@ -47,21 +47,34 @@ var buildEchartsOverlaySeries = function (_a) {
|
|
|
47
47
|
if (!result || result.points.length < 2)
|
|
48
48
|
continue;
|
|
49
49
|
var tlName = (_d = tl.name) !== null && _d !== void 0 ? _d : "".concat(dataLabel ? dataLabel + " " : "").concat((_e = tl.type) !== null && _e !== void 0 ? _e : "linear", " trend");
|
|
50
|
-
|
|
50
|
+
// Excel's "Display Equation" / "Display R-squared" sit at the line's end.
|
|
51
|
+
var label = (0, trendline_1.trendlineLabel)(tl, result);
|
|
52
|
+
overlays.push(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ type: "line", name: tlName }, (label
|
|
53
|
+
? {
|
|
54
|
+
endLabel: {
|
|
55
|
+
show: true,
|
|
56
|
+
formatter: label,
|
|
57
|
+
color: (_f = tl.color) !== null && _f !== void 0 ? _f : seriesColor,
|
|
58
|
+
fontSize: 11,
|
|
59
|
+
offset: [4, 0],
|
|
60
|
+
},
|
|
61
|
+
labelLayout: { moveOverlap: "shiftY" },
|
|
62
|
+
}
|
|
63
|
+
: {})), {
|
|
51
64
|
// On a category chart the index x overlays the category axis even
|
|
52
65
|
// when forecasting extends beyond the data range; a horizontal bar
|
|
53
66
|
// keeps its categories on y.
|
|
54
67
|
data: result.points.map(function (p) { return (horizontal ? [p.y, p.x] : [p.x, p.y]); }), showSymbol: false, smooth: tl.type === "poly", lineStyle: {
|
|
55
|
-
color: (
|
|
68
|
+
color: (_g = tl.color) !== null && _g !== void 0 ? _g : seriesColor,
|
|
56
69
|
type: "dashed",
|
|
57
70
|
width: 2,
|
|
58
|
-
}, itemStyle: { color: (
|
|
71
|
+
}, itemStyle: { color: (_h = tl.color) !== null && _h !== void 0 ? _h : seriesColor }, tooltip: { show: false }, z: 5 }), useSecondary));
|
|
59
72
|
}
|
|
60
73
|
}
|
|
61
74
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
62
75
|
finally {
|
|
63
76
|
try {
|
|
64
|
-
if (
|
|
77
|
+
if (_q && !_q.done && (_b = _p.return)) _b.call(_p);
|
|
65
78
|
}
|
|
66
79
|
finally { if (e_1) throw e_1.error; }
|
|
67
80
|
}
|
|
@@ -69,7 +82,7 @@ var buildEchartsOverlaySeries = function (_a) {
|
|
|
69
82
|
// per-point magnitudes from the spec's plus/minus ranges, resolved
|
|
70
83
|
// through the same extractor the series values use.
|
|
71
84
|
if (series.errorBars) {
|
|
72
|
-
var direction = (
|
|
85
|
+
var direction = (_j = series.errorBars.direction) !== null && _j !== void 0 ? _j : "y";
|
|
73
86
|
// An X error bar on an XY chart sizes from the X values (a percentage
|
|
74
87
|
// or deviation of X); a category chart has only value-axis bars, so a
|
|
75
88
|
// horizontal bar's whisker runs along x whatever the direction says.
|
|
@@ -77,7 +90,7 @@ var buildEchartsOverlaySeries = function (_a) {
|
|
|
77
90
|
var magnitudeSource = isXY && alongX_1 ? xValues : values;
|
|
78
91
|
var magnitudes = (0, error_bars_1.computeErrorBars)(magnitudeSource, (0, error_bars_1.resolveCustomErrorBarValues)(series.errorBars, resolveRange));
|
|
79
92
|
if (magnitudes) {
|
|
80
|
-
var noEndCap_1 = (
|
|
93
|
+
var noEndCap_1 = (_k = series.errorBars.noEndCap) !== null && _k !== void 0 ? _k : false;
|
|
81
94
|
var errorData = [];
|
|
82
95
|
for (var i = 0; i < values.length; i++) {
|
|
83
96
|
var v = values[i];
|
|
@@ -88,8 +101,8 @@ var buildEchartsOverlaySeries = function (_a) {
|
|
|
88
101
|
}
|
|
89
102
|
// [a, b] is the point's (x, y) data coordinate; a horizontal bar
|
|
90
103
|
// keeps its value on x and its category on y.
|
|
91
|
-
var
|
|
92
|
-
errorData.push([a, b, (
|
|
104
|
+
var _r = tslib_1.__read(!isXY && horizontal ? [y, x] : [x, y], 2), a = _r[0], b = _r[1];
|
|
105
|
+
errorData.push([a, b, (_l = magnitudes.plus[i]) !== null && _l !== void 0 ? _l : 0, (_m = magnitudes.minus[i]) !== null && _m !== void 0 ? _m : 0]);
|
|
93
106
|
}
|
|
94
107
|
overlays.push(tslib_1.__assign(tslib_1.__assign({ type: "custom", name: "".concat(dataLabel ? dataLabel + " " : "", "error"), data: errorData, z: 6, tooltip: { show: false } }, useSecondary), { renderItem: function (_params, api) {
|
|
95
108
|
var a = api.value(0);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartData, SheetRange } from "@rowsncolumns/spreadsheet";
|
|
2
|
+
/**
|
|
3
|
+
* A series' name as Excel shows it: the current text of its header cell
|
|
4
|
+
* when the name is linked to one (`dataLabelSource`), else `undefined` so
|
|
5
|
+
* the caller falls back to the literal / formula `dataLabel`.
|
|
6
|
+
*
|
|
7
|
+
* The cell is read with the hidden rows and columns included — Excel keeps
|
|
8
|
+
* a series' name when its header row is hidden — and a blank cell yields
|
|
9
|
+
* the cached `dataLabel`, which is what Excel's `<c:strCache>` is for.
|
|
10
|
+
*/
|
|
11
|
+
export declare const linkedSeriesName: (entry: Pick<ChartData, "dataLabel" | "dataLabelSource"> | undefined, getDomainValuesFromRange: (range: SheetRange, hiddenDimensionStrategy?: "SHOW_ALL" | "SKIP_HIDDEN_ROWS_AND_COLUMNS" | null) => (string | number | null | undefined)[] | undefined) => string | undefined;
|
|
12
|
+
//# sourceMappingURL=series-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"series-name.d.ts","sourceRoot":"","sources":["../../../utils/series-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvE;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,iBAAiB,CAAC,GAAG,SAAS,EACnE,0BAA0B,CACxB,KAAK,EAAE,UAAU,EACjB,uBAAuB,CAAC,EAAE,UAAU,GAAG,8BAA8B,GAAG,IAAI,KACzE,CAAC,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,SAAS,KACtD,MAAM,GAAG,SAaX,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.linkedSeriesName = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
/**
|
|
6
|
+
* A series' name as Excel shows it: the current text of its header cell
|
|
7
|
+
* when the name is linked to one (`dataLabelSource`), else `undefined` so
|
|
8
|
+
* the caller falls back to the literal / formula `dataLabel`.
|
|
9
|
+
*
|
|
10
|
+
* The cell is read with the hidden rows and columns included — Excel keeps
|
|
11
|
+
* a series' name when its header row is hidden — and a blank cell yields
|
|
12
|
+
* the cached `dataLabel`, which is what Excel's `<c:strCache>` is for.
|
|
13
|
+
*/
|
|
14
|
+
var linkedSeriesName = function (entry, getDomainValuesFromRange) {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
var source = entry === null || entry === void 0 ? void 0 : entry.dataLabelSource;
|
|
17
|
+
if (!source)
|
|
18
|
+
return undefined;
|
|
19
|
+
var cell = tslib_1.__assign(tslib_1.__assign({}, source), { endRowIndex: source.startRowIndex, endColumnIndex: source.startColumnIndex });
|
|
20
|
+
var value = (_a = getDomainValuesFromRange(cell, "SHOW_ALL")) === null || _a === void 0 ? void 0 : _a[0];
|
|
21
|
+
if (value === null || value === undefined || value === "") {
|
|
22
|
+
return (_b = entry === null || entry === void 0 ? void 0 : entry.dataLabel) !== null && _b !== void 0 ? _b : "";
|
|
23
|
+
}
|
|
24
|
+
return String(value);
|
|
25
|
+
};
|
|
26
|
+
exports.linkedSeriesName = linkedSeriesName;
|
|
@@ -57,4 +57,13 @@ export declare const computeTrendline: (values: (number | null | undefined)[], s
|
|
|
57
57
|
forecastForward?: number | null;
|
|
58
58
|
forecastBackward?: number | null;
|
|
59
59
|
}, xValues?: (number | null | undefined)[] | null) => TrendlineResult | null;
|
|
60
|
+
/**
|
|
61
|
+
* The label Excel prints next to a trendline when "Display Equation on
|
|
62
|
+
* chart" / "Display R-squared value on chart" are on — one line each, or
|
|
63
|
+
* `undefined` when neither is requested or the fit has no equation.
|
|
64
|
+
*/
|
|
65
|
+
export declare const trendlineLabel: (spec: {
|
|
66
|
+
showEquation?: boolean | null;
|
|
67
|
+
showRSquared?: boolean | null;
|
|
68
|
+
}, result: Pick<TrendlineResult, "equation" | "rSquared">) => string | undefined;
|
|
60
69
|
//# sourceMappingURL=trendline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trendline.d.ts","sourceRoot":"","sources":["../../../utils/trendline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,MAAM,aAAa,GACrB,QAAQ,GACR,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,WAAW,CAAC;AAEhB,6FAA6F;AAC7F,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,sEAAsE;IACtE,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,uEAAuE;IACvE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAkKF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,EACrC,OAAM;IACJ,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CA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G,IA+HpB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM;IAAE,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CAAE,EACtE,QAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,UAAU,CAAC,KACrD,MAAM,GAAG,SAOX,CAAC"}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* emitted for every x in range.
|
|
26
26
|
*/
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.computeTrendline = void 0;
|
|
28
|
+
exports.trendlineLabel = exports.computeTrendline = void 0;
|
|
29
29
|
var tslib_1 = require("tslib");
|
|
30
30
|
var isFiniteNum = function (v) {
|
|
31
31
|
return typeof v === "number" && Number.isFinite(v);
|
|
@@ -387,3 +387,18 @@ var computeTrendline = function (values, spec, xValues) {
|
|
|
387
387
|
};
|
|
388
388
|
};
|
|
389
389
|
exports.computeTrendline = computeTrendline;
|
|
390
|
+
/**
|
|
391
|
+
* The label Excel prints next to a trendline when "Display Equation on
|
|
392
|
+
* chart" / "Display R-squared value on chart" are on — one line each, or
|
|
393
|
+
* `undefined` when neither is requested or the fit has no equation.
|
|
394
|
+
*/
|
|
395
|
+
var trendlineLabel = function (spec, result) {
|
|
396
|
+
var lines = [];
|
|
397
|
+
if (spec.showEquation && result.equation)
|
|
398
|
+
lines.push(result.equation);
|
|
399
|
+
if (spec.showRSquared && result.rSquared !== null) {
|
|
400
|
+
lines.push("R\u00B2 = ".concat(result.rSquared.toFixed(4)));
|
|
401
|
+
}
|
|
402
|
+
return lines.length ? lines.join("\n") : undefined;
|
|
403
|
+
};
|
|
404
|
+
exports.trendlineLabel = trendlineLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-chart.d.ts","sourceRoot":"","sources":["../../../basic-chart/basic-chart.tsx"],"names":[],"mappings":"AAkEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"basic-chart.d.ts","sourceRoot":"","sources":["../../../basic-chart/basic-chart.tsx"],"names":[],"mappings":"AAkEA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAuTrD,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC;AAiGnD,eAAO,MAAM,UAAU,GAAI,gPAkBxB,eAAe,sBAsvHjB,CAAC"}
|