@rowsncolumns/charts 28.1.17 → 28.1.19
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/Readme.md +18 -1
- package/dist/cjs/basic-chart/basic-chart.d.ts +1 -1
- package/dist/cjs/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/cjs/basic-chart/basic-chart.js +371 -242
- package/dist/cjs/basic-chart/helpers.d.ts +7 -3
- package/dist/cjs/basic-chart/helpers.d.ts.map +1 -1
- package/dist/cjs/basic-chart/helpers.js +30 -4
- package/dist/cjs/basic-chart/index.d.ts +7 -0
- package/dist/cjs/basic-chart/index.d.ts.map +1 -1
- package/dist/cjs/basic-chart/index.js +19 -2
- package/dist/cjs/components/editors/chart-editor.d.ts +7 -1
- package/dist/cjs/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/cjs/components/editors/chart-editor.js +24 -14
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts +6 -3
- package/dist/cjs/components/editors/fields/axis-options-fields.d.ts.map +1 -1
- package/dist/cjs/components/editors/fields/axis-options-fields.js +69 -7
- package/dist/cjs/components/editors/fields/chart-elements-fields.d.ts +15 -0
- package/dist/cjs/components/editors/fields/chart-elements-fields.d.ts.map +1 -0
- package/dist/cjs/components/editors/fields/chart-elements-fields.js +23 -0
- package/dist/cjs/components/editors/fields/series-format-fields.d.ts.map +1 -1
- package/dist/cjs/components/editors/fields/series-format-fields.js +16 -2
- package/dist/cjs/config.d.ts +10 -0
- package/dist/cjs/config.d.ts.map +1 -1
- package/dist/cjs/config.js +45 -10
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/cjs/types.d.ts +10 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/utils/chart-lines.d.ts +36 -0
- package/dist/cjs/utils/chart-lines.d.ts.map +1 -0
- package/dist/cjs/utils/chart-lines.js +111 -0
- package/dist/cjs/utils/data-table.d.ts +31 -0
- package/dist/cjs/utils/data-table.d.ts.map +1 -0
- package/dist/cjs/utils/data-table.js +61 -0
- package/dist/cjs/utils/echarts-gl-loader.d.ts +6 -0
- package/dist/cjs/utils/echarts-gl-loader.d.ts.map +1 -1
- package/dist/cjs/utils/echarts-gl-loader.js +42 -1
- package/dist/cjs/utils/excel-axis-scale.d.ts +35 -0
- package/dist/cjs/utils/excel-axis-scale.d.ts.map +1 -0
- package/dist/cjs/utils/excel-axis-scale.js +210 -0
- package/dist/cjs/utils/overrides.d.ts +24 -3
- package/dist/cjs/utils/overrides.d.ts.map +1 -1
- package/dist/cjs/utils/overrides.js +119 -14
- package/dist/cjs/utils/three-d.d.ts +12 -1
- package/dist/cjs/utils/three-d.d.ts.map +1 -1
- package/dist/cjs/utils/three-d.js +4 -1
- package/dist/esm/basic-chart/basic-chart.d.ts +1 -1
- package/dist/esm/basic-chart/basic-chart.d.ts.map +1 -1
- package/dist/esm/basic-chart/basic-chart.js +237 -73
- package/dist/esm/basic-chart/helpers.d.ts +7 -3
- package/dist/esm/basic-chart/helpers.d.ts.map +1 -1
- package/dist/esm/basic-chart/helpers.js +26 -3
- package/dist/esm/basic-chart/index.d.ts +7 -0
- package/dist/esm/basic-chart/index.d.ts.map +1 -1
- package/dist/esm/basic-chart/index.js +15 -1
- package/dist/esm/components/editors/chart-editor.d.ts +7 -1
- package/dist/esm/components/editors/chart-editor.d.ts.map +1 -1
- package/dist/esm/components/editors/chart-editor.js +16 -4
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts +6 -3
- package/dist/esm/components/editors/fields/axis-options-fields.d.ts.map +1 -1
- package/dist/esm/components/editors/fields/axis-options-fields.js +56 -5
- package/dist/esm/components/editors/fields/chart-elements-fields.d.ts +15 -0
- package/dist/esm/components/editors/fields/chart-elements-fields.d.ts.map +1 -0
- package/dist/esm/components/editors/fields/chart-elements-fields.js +17 -0
- package/dist/esm/components/editors/fields/series-format-fields.d.ts.map +1 -1
- package/dist/esm/components/editors/fields/series-format-fields.js +9 -1
- package/dist/esm/config.d.ts +10 -0
- package/dist/esm/config.d.ts.map +1 -1
- package/dist/esm/config.js +20 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types.d.ts +10 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils/chart-lines.d.ts +36 -0
- package/dist/esm/utils/chart-lines.d.ts.map +1 -0
- package/dist/esm/utils/chart-lines.js +121 -0
- package/dist/esm/utils/data-table.d.ts +31 -0
- package/dist/esm/utils/data-table.d.ts.map +1 -0
- package/dist/esm/utils/data-table.js +48 -0
- package/dist/esm/utils/echarts-gl-loader.d.ts +6 -0
- package/dist/esm/utils/echarts-gl-loader.d.ts.map +1 -1
- package/dist/esm/utils/echarts-gl-loader.js +40 -0
- package/dist/esm/utils/excel-axis-scale.d.ts +35 -0
- package/dist/esm/utils/excel-axis-scale.d.ts.map +1 -0
- package/dist/esm/utils/excel-axis-scale.js +122 -0
- package/dist/esm/utils/overrides.d.ts +24 -3
- package/dist/esm/utils/overrides.d.ts.map +1 -1
- package/dist/esm/utils/overrides.js +111 -10
- package/dist/esm/utils/three-d.d.ts +12 -1
- package/dist/esm/utils/three-d.d.ts.map +1 -1
- package/dist/esm/utils/three-d.js +4 -1
- package/package.json +7 -7
package/dist/cjs/config.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getChartPresetLabel = exports.isDoughnutSpec = exports.CHART_TYPES = void 0;
|
|
3
|
+
exports.getChartPresetLabel = exports.isDoughnutSpec = exports.getChartTypes = exports.CHART_TYPES = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var pie_explosion_1 = require("./utils/pie-explosion");
|
|
6
|
+
var three_d_1 = require("./utils/three-d");
|
|
6
7
|
// Excel's 3-D chart classes degrade to a 2-D chartType with the authored
|
|
7
8
|
// class kept as `sourceChartType` (BAR_3D, LINE_3D, PIE_3D, AREA_3D,
|
|
8
9
|
// SURFACE, SURFACE_3D). The renderer draws BAR_3D / LINE_3D / AREA_3D /
|
|
@@ -277,6 +278,40 @@ exports.CHART_TYPES = [
|
|
|
277
278
|
["Stock", STOCK_CHART_TYPES],
|
|
278
279
|
["Combo", COMBO_CHART_TYPES],
|
|
279
280
|
];
|
|
281
|
+
/**
|
|
282
|
+
* The Chart editor's preset list. With `enable3D: false` the presets the
|
|
283
|
+
* renderer would draw through echarts-gl (3-D Column / Bar / Line / Area,
|
|
284
|
+
* their stacked variants and 3-D Surface) are left out; 3-D Pie and
|
|
285
|
+
* Contour stay since they never render in WebGL. A spec that already
|
|
286
|
+
* carries a 3-D `sourceChartType` is not rewritten — only the picker
|
|
287
|
+
* changes (rowsncolumns/spreadsheet#1187).
|
|
288
|
+
*/
|
|
289
|
+
var getChartTypes = function (options) {
|
|
290
|
+
var e_1, _a;
|
|
291
|
+
if ((options === null || options === void 0 ? void 0 : options.enable3D) !== false)
|
|
292
|
+
return exports.CHART_TYPES;
|
|
293
|
+
var groups = [];
|
|
294
|
+
try {
|
|
295
|
+
for (var CHART_TYPES_1 = tslib_1.__values(exports.CHART_TYPES), CHART_TYPES_1_1 = CHART_TYPES_1.next(); !CHART_TYPES_1_1.done; CHART_TYPES_1_1 = CHART_TYPES_1.next()) {
|
|
296
|
+
var _b = tslib_1.__read(CHART_TYPES_1_1.value, 2), category = _b[0], presets = _b[1];
|
|
297
|
+
var kept = presets.filter(function (_a) {
|
|
298
|
+
var _b = tslib_1.__read(_a, 2), preset = _b[1];
|
|
299
|
+
return (0, three_d_1.resolve3DRenderKind)(preset.sourceChartType) === null;
|
|
300
|
+
});
|
|
301
|
+
if (kept.length > 0)
|
|
302
|
+
groups.push([category, kept]);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
306
|
+
finally {
|
|
307
|
+
try {
|
|
308
|
+
if (CHART_TYPES_1_1 && !CHART_TYPES_1_1.done && (_a = CHART_TYPES_1.return)) _a.call(CHART_TYPES_1);
|
|
309
|
+
}
|
|
310
|
+
finally { if (e_1) throw e_1.error; }
|
|
311
|
+
}
|
|
312
|
+
return groups;
|
|
313
|
+
};
|
|
314
|
+
exports.getChartTypes = getChartTypes;
|
|
280
315
|
/** Parse a radius entry ("40%" | 40 | 0) into a number, NaN-safe. */
|
|
281
316
|
var parseRadiusValue = function (value) {
|
|
282
317
|
if (typeof value === "number")
|
|
@@ -333,7 +368,7 @@ var PRESET_DISCRIMINATORS = [
|
|
|
333
368
|
* Falls back to the capitalized chartType when no preset matches.
|
|
334
369
|
*/
|
|
335
370
|
var getChartPresetLabel = function (spec) {
|
|
336
|
-
var
|
|
371
|
+
var e_2, _a, e_3, _b;
|
|
337
372
|
var _c;
|
|
338
373
|
var loose = spec;
|
|
339
374
|
// Doughnut first — it has several encodings (see isDoughnutSpec) and
|
|
@@ -345,8 +380,8 @@ var getChartPresetLabel = function (spec) {
|
|
|
345
380
|
: "Doughnut";
|
|
346
381
|
}
|
|
347
382
|
try {
|
|
348
|
-
for (var
|
|
349
|
-
var _d = tslib_1.__read(
|
|
383
|
+
for (var CHART_TYPES_2 = tslib_1.__values(exports.CHART_TYPES), CHART_TYPES_2_1 = CHART_TYPES_2.next(); !CHART_TYPES_2_1.done; CHART_TYPES_2_1 = CHART_TYPES_2.next()) {
|
|
384
|
+
var _d = tslib_1.__read(CHART_TYPES_2_1.value, 2), presets = _d[1];
|
|
350
385
|
var _loop_1 = function (name_1, config) {
|
|
351
386
|
if (config.chartType !== spec.chartType)
|
|
352
387
|
return "continue";
|
|
@@ -364,28 +399,28 @@ var getChartPresetLabel = function (spec) {
|
|
|
364
399
|
return { value: name_1 };
|
|
365
400
|
};
|
|
366
401
|
try {
|
|
367
|
-
for (var presets_1 = (
|
|
402
|
+
for (var presets_1 = (e_3 = void 0, tslib_1.__values(presets)), presets_1_1 = presets_1.next(); !presets_1_1.done; presets_1_1 = presets_1.next()) {
|
|
368
403
|
var _e = tslib_1.__read(presets_1_1.value, 2), name_1 = _e[0], config = _e[1];
|
|
369
404
|
var state_1 = _loop_1(name_1, config);
|
|
370
405
|
if (typeof state_1 === "object")
|
|
371
406
|
return state_1.value;
|
|
372
407
|
}
|
|
373
408
|
}
|
|
374
|
-
catch (
|
|
409
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
375
410
|
finally {
|
|
376
411
|
try {
|
|
377
412
|
if (presets_1_1 && !presets_1_1.done && (_b = presets_1.return)) _b.call(presets_1);
|
|
378
413
|
}
|
|
379
|
-
finally { if (
|
|
414
|
+
finally { if (e_3) throw e_3.error; }
|
|
380
415
|
}
|
|
381
416
|
}
|
|
382
417
|
}
|
|
383
|
-
catch (
|
|
418
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
384
419
|
finally {
|
|
385
420
|
try {
|
|
386
|
-
if (
|
|
421
|
+
if (CHART_TYPES_2_1 && !CHART_TYPES_2_1.done && (_a = CHART_TYPES_2.return)) _a.call(CHART_TYPES_2);
|
|
387
422
|
}
|
|
388
|
-
finally { if (
|
|
423
|
+
finally { if (e_2) throw e_2.error; }
|
|
389
424
|
}
|
|
390
425
|
var chartType = (_c = spec.chartType) !== null && _c !== void 0 ? _c : "";
|
|
391
426
|
return chartType.charAt(0).toUpperCase() + chartType.slice(1);
|
|
@@ -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-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
|
+
{"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-elements-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-lines.ts","../../utils/chart-orientation.ts","../../utils/chart-spec-utils.ts","../../utils/chart-styles.ts","../../utils/data-table.ts","../../utils/doughnut.ts","../../utils/echarts-gl-loader.ts","../../utils/echarts-overlays.ts","../../utils/empty-cells.ts","../../utils/error-bars.ts","../../utils/excel-axis-scale.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"}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -21,6 +21,16 @@ export type EChartComponentProps = ChartComponentProps & {
|
|
|
21
21
|
* honored.
|
|
22
22
|
*/
|
|
23
23
|
getFormattingFromRange?: ReturnType<typeof useSpreadsheetState>["getFormattingFromRange"];
|
|
24
|
+
/**
|
|
25
|
+
* Draw BAR_3D / LINE_3D / AREA_3D / SURFACE_3D specs through echarts-gl
|
|
26
|
+
* (WebGL). `false` keeps them on their 2-D fallback and never loads
|
|
27
|
+
* echarts-gl — for a page whose Content-Security-Policy has no
|
|
28
|
+
* `'unsafe-eval'`, which claygl needs. The spec keeps its
|
|
29
|
+
* `sourceChartType`, so the xlsx export still writes the 3-D chart. Pass
|
|
30
|
+
* the same value to `ChartEditor` so it hides the 3-D presets. Default
|
|
31
|
+
* `true`.
|
|
32
|
+
*/
|
|
33
|
+
enable3D?: boolean;
|
|
24
34
|
/**
|
|
25
35
|
* Request edit chart
|
|
26
36
|
* @param chart
|
package/dist/cjs/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,UAAU,CACjC,OAAO,mBAAmB,CAC3B,CAAC,wBAAwB,CAAC,CAAC;IAC5B;;;OAGG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3C;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,oBAAoB,CAAC,CAAC;CAC7E,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,oBAAoB,GAAG,mBAAmB,GAAG;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;OAEG;IACH,wBAAwB,EAAE,UAAU,CAClC,OAAO,mBAAmB,CAC3B,CAAC,0BAA0B,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,UAAU,CACjC,OAAO,mBAAmB,CAC3B,CAAC,wBAAwB,CAAC,CAAC;IAC5B;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3C;;OAEG;IACH,kBAAkB,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,oBAAoB,CAAC,CAAC;CAC7E,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's line-chart analysis elements (Chart Design → Add Chart Element →
|
|
3
|
+
* Lines / Up/Down Bars, demo-app-monorepo#49969 FT-08) as echarts bar series
|
|
4
|
+
* over the category axis:
|
|
5
|
+
*
|
|
6
|
+
* - High-low lines — a thin vertical line per category from the lowest to the
|
|
7
|
+
* highest value of all the line series (`<c:hiLowLines/>`).
|
|
8
|
+
* - Up/down bars — a bar per category from the first line series' value to
|
|
9
|
+
* the last one's: an up bar (white) where the last is higher, a down bar
|
|
10
|
+
* (dark) where it is lower (`<c:upDownBars>`).
|
|
11
|
+
* - Drop lines — a thin vertical line per category from the axis to the
|
|
12
|
+
* highest point (`<c:dropLines/>`).
|
|
13
|
+
*
|
|
14
|
+
* Each is a stack of an invisible base plus a visible span, so the bars can
|
|
15
|
+
* start anywhere on the value axis; `barGap: "-100%"` lays every one of them
|
|
16
|
+
* over the category's centre instead of side by side.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CHART_LINE_SERIES_PREFIX = "rnc-chart-lines-";
|
|
19
|
+
export type ChartLineOptions = {
|
|
20
|
+
hiLowLines?: boolean | null;
|
|
21
|
+
dropLines?: boolean | null;
|
|
22
|
+
upDownBars?: {
|
|
23
|
+
gapWidth?: number | null;
|
|
24
|
+
upColor?: string | null;
|
|
25
|
+
downColor?: string | null;
|
|
26
|
+
} | null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The extra series for `options`, given the data of the chart's line series
|
|
30
|
+
* on one value axis, in spec order.
|
|
31
|
+
*/
|
|
32
|
+
export declare const buildChartLineSeries: (options: ChartLineOptions, lines: ReadonlyArray<ReadonlyArray<unknown>>, { isDarkMode, yAxisIndex }?: {
|
|
33
|
+
isDarkMode?: boolean;
|
|
34
|
+
yAxisIndex?: number;
|
|
35
|
+
}) => Record<string, unknown>[];
|
|
36
|
+
//# sourceMappingURL=chart-lines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-lines.d.ts","sourceRoot":"","sources":["../../../utils/chart-lines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE;QACX,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,GAAG,IAAI,CAAC;CACV,CAAC;AAqDF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,gBAAgB,EACzB,OAAO,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAC5C,6BAA4B;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,KAC7E,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAuEzB,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Excel's line-chart analysis elements (Chart Design → Add Chart Element →
|
|
4
|
+
* Lines / Up/Down Bars, demo-app-monorepo#49969 FT-08) as echarts bar series
|
|
5
|
+
* over the category axis:
|
|
6
|
+
*
|
|
7
|
+
* - High-low lines — a thin vertical line per category from the lowest to the
|
|
8
|
+
* highest value of all the line series (`<c:hiLowLines/>`).
|
|
9
|
+
* - Up/down bars — a bar per category from the first line series' value to
|
|
10
|
+
* the last one's: an up bar (white) where the last is higher, a down bar
|
|
11
|
+
* (dark) where it is lower (`<c:upDownBars>`).
|
|
12
|
+
* - Drop lines — a thin vertical line per category from the axis to the
|
|
13
|
+
* highest point (`<c:dropLines/>`).
|
|
14
|
+
*
|
|
15
|
+
* Each is a stack of an invisible base plus a visible span, so the bars can
|
|
16
|
+
* start anywhere on the value axis; `barGap: "-100%"` lays every one of them
|
|
17
|
+
* over the category's centre instead of side by side.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.buildChartLineSeries = exports.CHART_LINE_SERIES_PREFIX = void 0;
|
|
21
|
+
var tslib_1 = require("tslib");
|
|
22
|
+
exports.CHART_LINE_SERIES_PREFIX = "rnc-chart-lines-";
|
|
23
|
+
var finite = function (item) {
|
|
24
|
+
var raw = item !== null && typeof item === "object" && "value" in item
|
|
25
|
+
? item.value
|
|
26
|
+
: item;
|
|
27
|
+
return typeof raw === "number" && Number.isFinite(raw) ? raw : undefined;
|
|
28
|
+
};
|
|
29
|
+
/** Excel's line colour for these elements: Text 1 at 75% (#404040). */
|
|
30
|
+
var LINE_COLOR = "#404040";
|
|
31
|
+
var spanSeries = function (_a) {
|
|
32
|
+
var id = _a.id, base = _a.base, span = _a.span, barWidth = _a.barWidth, itemStyle = _a.itemStyle, yAxisIndex = _a.yAxisIndex;
|
|
33
|
+
var common = tslib_1.__assign({ type: "bar", stack: "".concat(exports.CHART_LINE_SERIES_PREFIX).concat(id), stackStrategy: "all", barWidth: barWidth, barGap: "-100%", silent: true, legendHoverLink: false, tooltip: { show: false }, emphasis: { disabled: true }, label: { show: false }, z: 1 }, (yAxisIndex ? { yAxisIndex: yAxisIndex } : {}));
|
|
34
|
+
return [
|
|
35
|
+
tslib_1.__assign(tslib_1.__assign({}, common), { id: "".concat(exports.CHART_LINE_SERIES_PREFIX).concat(id, "-base"), data: base, itemStyle: { color: "transparent" } }),
|
|
36
|
+
tslib_1.__assign(tslib_1.__assign({}, common), { id: "".concat(exports.CHART_LINE_SERIES_PREFIX).concat(id), data: span, itemStyle: itemStyle }),
|
|
37
|
+
];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The extra series for `options`, given the data of the chart's line series
|
|
41
|
+
* on one value axis, in spec order.
|
|
42
|
+
*/
|
|
43
|
+
var buildChartLineSeries = function (options, lines, _a) {
|
|
44
|
+
var _b, _c, _d;
|
|
45
|
+
var _e = _a === void 0 ? {} : _a, isDarkMode = _e.isDarkMode, yAxisIndex = _e.yAxisIndex;
|
|
46
|
+
var color = isDarkMode ? "rgba(255,255,255,0.65)" : LINE_COLOR;
|
|
47
|
+
var length = lines.reduce(function (n, data) { return Math.max(n, data.length); }, 0);
|
|
48
|
+
var out = [];
|
|
49
|
+
var extent = function (i) {
|
|
50
|
+
var values = lines.map(function (data) { return finite(data[i]); }).filter(function (v) { return v !== undefined; });
|
|
51
|
+
return values.length
|
|
52
|
+
? { low: Math.min.apply(Math, tslib_1.__spreadArray([], tslib_1.__read(values), false)), high: Math.max.apply(Math, tslib_1.__spreadArray([], tslib_1.__read(values), false)), count: values.length }
|
|
53
|
+
: undefined;
|
|
54
|
+
};
|
|
55
|
+
if (options.dropLines && lines.length) {
|
|
56
|
+
var base = [];
|
|
57
|
+
var span = [];
|
|
58
|
+
for (var i = 0; i < length; i++) {
|
|
59
|
+
var e = extent(i);
|
|
60
|
+
base.push(e ? 0 : null);
|
|
61
|
+
span.push(e ? e.high : null);
|
|
62
|
+
}
|
|
63
|
+
out.push.apply(out, tslib_1.__spreadArray([], tslib_1.__read(spanSeries({ id: "drop", base: base, span: span, barWidth: 1, itemStyle: { color: color }, yAxisIndex: yAxisIndex })), false));
|
|
64
|
+
}
|
|
65
|
+
if (options.hiLowLines && lines.length > 1) {
|
|
66
|
+
var base = [];
|
|
67
|
+
var span = [];
|
|
68
|
+
for (var i = 0; i < length; i++) {
|
|
69
|
+
var e = extent(i);
|
|
70
|
+
var drawn = e && e.count > 1;
|
|
71
|
+
base.push(drawn ? e.low : null);
|
|
72
|
+
span.push(drawn ? e.high - e.low : null);
|
|
73
|
+
}
|
|
74
|
+
out.push.apply(out, tslib_1.__spreadArray([], tslib_1.__read(spanSeries({ id: "hilow", base: base, span: span, barWidth: 1, itemStyle: { color: color }, yAxisIndex: yAxisIndex })), false));
|
|
75
|
+
}
|
|
76
|
+
if (options.upDownBars && lines.length > 1) {
|
|
77
|
+
var first = lines[0];
|
|
78
|
+
var last = lines[lines.length - 1];
|
|
79
|
+
var up = (_b = options.upDownBars.upColor) !== null && _b !== void 0 ? _b : "#FFFFFF";
|
|
80
|
+
var down = (_c = options.upDownBars.downColor) !== null && _c !== void 0 ? _c : (isDarkMode ? "#A6A6A6" : "#595959");
|
|
81
|
+
var base = [];
|
|
82
|
+
var span = [];
|
|
83
|
+
for (var i = 0; i < length; i++) {
|
|
84
|
+
var open_1 = finite(first[i]);
|
|
85
|
+
var close_1 = finite(last[i]);
|
|
86
|
+
if (open_1 === undefined || close_1 === undefined) {
|
|
87
|
+
base.push(null);
|
|
88
|
+
span.push(null);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
base.push(Math.min(open_1, close_1));
|
|
92
|
+
span.push({
|
|
93
|
+
value: Math.abs(close_1 - open_1),
|
|
94
|
+
itemStyle: { color: close_1 >= open_1 ? up : down },
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// `<c:gapWidth>` is the gap as a % of the bar: the bar is 1 / (1 + gap) of the category.
|
|
98
|
+
var gap = (_d = options.upDownBars.gapWidth) !== null && _d !== void 0 ? _d : 150;
|
|
99
|
+
var barWidth = "".concat(Math.round(100 / (1 + Math.max(0, gap) / 100)), "%");
|
|
100
|
+
out.push.apply(out, tslib_1.__spreadArray([], tslib_1.__read(spanSeries({
|
|
101
|
+
id: "updown",
|
|
102
|
+
base: base,
|
|
103
|
+
span: span,
|
|
104
|
+
barWidth: barWidth,
|
|
105
|
+
itemStyle: { borderColor: color, borderWidth: 1 },
|
|
106
|
+
yAxisIndex: yAxisIndex,
|
|
107
|
+
})), false));
|
|
108
|
+
}
|
|
109
|
+
return out;
|
|
110
|
+
};
|
|
111
|
+
exports.buildChartLineSeries = buildChartLineSeries;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's chart data table (Add Chart Element → Data Table,
|
|
3
|
+
* demo-app-monorepo#49969 FT-08): one row per series under the category
|
|
4
|
+
* axis, each cell under its category, the series name (with its legend key)
|
|
5
|
+
* at the row's start. Drawn as extra category axes stacked below the plot:
|
|
6
|
+
* their labels are the formatted values, their axis line the horizontal
|
|
7
|
+
* border and their ticks — between categories — the vertical borders.
|
|
8
|
+
*/
|
|
9
|
+
export type DataTableOptions = {
|
|
10
|
+
showHorizontalBorder?: boolean | null;
|
|
11
|
+
showVerticalBorder?: boolean | null;
|
|
12
|
+
showOutline?: boolean | null;
|
|
13
|
+
showLegendKeys?: boolean | null;
|
|
14
|
+
};
|
|
15
|
+
export type DataTableRow = {
|
|
16
|
+
name: string;
|
|
17
|
+
color?: string;
|
|
18
|
+
values: string[];
|
|
19
|
+
};
|
|
20
|
+
/** Row height in pixels: 9 pt text plus padding. */
|
|
21
|
+
export declare const DATA_TABLE_ROW_HEIGHT = 20;
|
|
22
|
+
export declare const dataTableAxes: (rows: ReadonlyArray<DataTableRow>, options: DataTableOptions, { textColor, fontSize, borderColor, firstOffset, }: {
|
|
23
|
+
textColor: string;
|
|
24
|
+
fontSize: number;
|
|
25
|
+
borderColor?: string;
|
|
26
|
+
/** Below the category labels (the table's header row). */
|
|
27
|
+
firstOffset?: number;
|
|
28
|
+
}) => Record<string, unknown>[];
|
|
29
|
+
/** Room the row names need left of the plot (approximate glyph width). */
|
|
30
|
+
export declare const dataTableNameWidth: (rows: ReadonlyArray<DataTableRow>, fontSize: number, legendKeys: boolean) => number;
|
|
31
|
+
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-table.d.ts","sourceRoot":"","sources":["../../../utils/data-table.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,kBAAkB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,aAAa,GACxB,MAAM,aAAa,CAAC,YAAY,CAAC,EACjC,SAAS,gBAAgB,EACzB,oDAKG;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,KACA,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAqCtB,CAAC;AAEL,0EAA0E;AAC1E,eAAO,MAAM,kBAAkB,GAC7B,MAAM,aAAa,CAAC,YAAY,CAAC,EACjC,UAAU,MAAM,EAChB,YAAY,OAAO,WAQb,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Excel's chart data table (Add Chart Element → Data Table,
|
|
4
|
+
* demo-app-monorepo#49969 FT-08): one row per series under the category
|
|
5
|
+
* axis, each cell under its category, the series name (with its legend key)
|
|
6
|
+
* at the row's start. Drawn as extra category axes stacked below the plot:
|
|
7
|
+
* their labels are the formatted values, their axis line the horizontal
|
|
8
|
+
* border and their ticks — between categories — the vertical borders.
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.dataTableNameWidth = exports.dataTableAxes = exports.DATA_TABLE_ROW_HEIGHT = void 0;
|
|
12
|
+
/** Row height in pixels: 9 pt text plus padding. */
|
|
13
|
+
exports.DATA_TABLE_ROW_HEIGHT = 20;
|
|
14
|
+
var dataTableAxes = function (rows, options, _a) {
|
|
15
|
+
var textColor = _a.textColor, fontSize = _a.fontSize, _b = _a.borderColor, borderColor = _b === void 0 ? "#D9D9D9" : _b, _c = _a.firstOffset, firstOffset = _c === void 0 ? 22 : _c;
|
|
16
|
+
return rows.map(function (row, index) {
|
|
17
|
+
var _a;
|
|
18
|
+
var keys = options.showLegendKeys !== false;
|
|
19
|
+
return {
|
|
20
|
+
type: "category",
|
|
21
|
+
position: "bottom",
|
|
22
|
+
gridIndex: 0,
|
|
23
|
+
offset: firstOffset + index * exports.DATA_TABLE_ROW_HEIGHT,
|
|
24
|
+
data: row.values,
|
|
25
|
+
silent: true,
|
|
26
|
+
axisLine: {
|
|
27
|
+
show: options.showHorizontalBorder !== false ||
|
|
28
|
+
(options.showOutline !== false && index === rows.length - 1),
|
|
29
|
+
onZero: false,
|
|
30
|
+
lineStyle: { color: borderColor },
|
|
31
|
+
},
|
|
32
|
+
axisTick: {
|
|
33
|
+
show: options.showVerticalBorder !== false,
|
|
34
|
+
interval: 0,
|
|
35
|
+
length: exports.DATA_TABLE_ROW_HEIGHT,
|
|
36
|
+
lineStyle: { color: borderColor },
|
|
37
|
+
},
|
|
38
|
+
axisLabel: { interval: 0, color: textColor, fontSize: fontSize, margin: 6 },
|
|
39
|
+
splitLine: { show: false },
|
|
40
|
+
name: keys ? "{key|\u25A0} ".concat(row.name) : row.name,
|
|
41
|
+
nameLocation: "start",
|
|
42
|
+
nameGap: 8,
|
|
43
|
+
nameTextStyle: {
|
|
44
|
+
color: textColor,
|
|
45
|
+
fontSize: fontSize,
|
|
46
|
+
align: "right",
|
|
47
|
+
verticalAlign: "top",
|
|
48
|
+
padding: [6, 0, 0, 0],
|
|
49
|
+
rich: { key: { color: (_a = row.color) !== null && _a !== void 0 ? _a : textColor, fontSize: fontSize } },
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
exports.dataTableAxes = dataTableAxes;
|
|
55
|
+
/** Room the row names need left of the plot (approximate glyph width). */
|
|
56
|
+
var dataTableNameWidth = function (rows, fontSize, legendKeys) {
|
|
57
|
+
return Math.ceil(rows.reduce(function (width, row) {
|
|
58
|
+
return Math.max(width, (row.name.length + (legendKeys ? 2 : 0)) * fontSize * 0.6);
|
|
59
|
+
}, 0)) + 12;
|
|
60
|
+
};
|
|
61
|
+
exports.dataTableNameWidth = dataTableNameWidth;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type EchartsGlLoadState = "unloaded" | "loading" | "ready" | "failed";
|
|
2
2
|
export declare const getEchartsGlState: () => EchartsGlLoadState;
|
|
3
|
+
/**
|
|
4
|
+
* Record that the loaded module failed at render time (echarts-gl threw
|
|
5
|
+
* from `setOption`), so the renderer keeps the 2-D fallback and never
|
|
6
|
+
* retries 3-D for the rest of the page's lifetime. Warns once per page.
|
|
7
|
+
*/
|
|
8
|
+
export declare const markEchartsGlFailed: (error?: unknown) => void;
|
|
3
9
|
/**
|
|
4
10
|
* Kick off (or join) the echarts-gl dynamic import and register the 3-D
|
|
5
11
|
* charts/components the renderer uses. Resolves true when 3-D rendering is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echarts-gl-loader.d.ts","sourceRoot":"","sources":["../../../utils/echarts-gl-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"echarts-gl-loader.d.ts","sourceRoot":"","sources":["../../../utils/echarts-gl-loader.ts"],"names":[],"mappings":"AAqBA,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAK7E,eAAO,MAAM,iBAAiB,QAAO,kBAA2B,CAAC;AAgBjE;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,OAAO,KAAG,IAUrD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAO,OAAO,CAAC,OAAO,CA8B/C,CAAC;AAEF,sDAAsD;AACtD,eAAO,MAAM,8BAA8B,QAAO,IAGjD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.__resetEchartsGlLoaderForTests = exports.loadEchartsGl = exports.getEchartsGlState = void 0;
|
|
3
|
+
exports.__resetEchartsGlLoaderForTests = exports.loadEchartsGl = exports.markEchartsGlFailed = exports.getEchartsGlState = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
/**
|
|
6
6
|
* Lazy loader for echarts-gl.
|
|
@@ -11,6 +11,14 @@ var tslib_1 = require("tslib");
|
|
|
11
11
|
* draws the 2-D fallback immediately, and upgrades to 3-D when the module
|
|
12
12
|
* resolves. A failed import latches the "failed" state so the renderer
|
|
13
13
|
* keeps the 2-D fallback without retrying on every update.
|
|
14
|
+
*
|
|
15
|
+
* A page whose Content-Security-Policy has no `'unsafe-eval'` is treated
|
|
16
|
+
* the same way: echarts-gl's `EffectCompositor` makes claygl compile its
|
|
17
|
+
* size expressions with `new Function`, which the browser blocks there
|
|
18
|
+
* (`EvalError`, surfaced by claygl as "Invalid expression."). The import
|
|
19
|
+
* itself still succeeds, so the loader probes `new Function` once before
|
|
20
|
+
* importing and latches "failed" instead of letting `setOption` throw
|
|
21
|
+
* later (rowsncolumns/spreadsheet#1187).
|
|
14
22
|
*/
|
|
15
23
|
var components_1 = require("echarts/components");
|
|
16
24
|
var echarts = tslib_1.__importStar(require("echarts/core"));
|
|
@@ -18,6 +26,34 @@ var state = "unloaded";
|
|
|
18
26
|
var loadPromise = null;
|
|
19
27
|
var getEchartsGlState = function () { return state; };
|
|
20
28
|
exports.getEchartsGlState = getEchartsGlState;
|
|
29
|
+
/**
|
|
30
|
+
* True when the page lets scripts construct functions from source — what
|
|
31
|
+
* claygl needs for every GL chart. False under a CSP whose `script-src`
|
|
32
|
+
* lacks `'unsafe-eval'`.
|
|
33
|
+
*/
|
|
34
|
+
var canEvaluateCode = function () {
|
|
35
|
+
try {
|
|
36
|
+
new Function("");
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch (_a) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Record that the loaded module failed at render time (echarts-gl threw
|
|
45
|
+
* from `setOption`), so the renderer keeps the 2-D fallback and never
|
|
46
|
+
* retries 3-D for the rest of the page's lifetime. Warns once per page.
|
|
47
|
+
*/
|
|
48
|
+
var markEchartsGlFailed = function (error) {
|
|
49
|
+
if (state !== "failed") {
|
|
50
|
+
// eslint-disable-next-line no-console
|
|
51
|
+
console.warn("echarts-gl failed to render a 3-D chart; 3-D charts render as their 2-D fallback on this page.", error);
|
|
52
|
+
}
|
|
53
|
+
state = "failed";
|
|
54
|
+
loadPromise = Promise.resolve(false);
|
|
55
|
+
};
|
|
56
|
+
exports.markEchartsGlFailed = markEchartsGlFailed;
|
|
21
57
|
/**
|
|
22
58
|
* Kick off (or join) the echarts-gl dynamic import and register the 3-D
|
|
23
59
|
* charts/components the renderer uses. Resolves true when 3-D rendering is
|
|
@@ -25,6 +61,11 @@ exports.getEchartsGlState = getEchartsGlState;
|
|
|
25
61
|
*/
|
|
26
62
|
var loadEchartsGl = function () {
|
|
27
63
|
if (!loadPromise) {
|
|
64
|
+
if (!canEvaluateCode()) {
|
|
65
|
+
state = "failed";
|
|
66
|
+
loadPromise = Promise.resolve(false);
|
|
67
|
+
return loadPromise;
|
|
68
|
+
}
|
|
28
69
|
state = "loading";
|
|
29
70
|
loadPromise = Promise.all([
|
|
30
71
|
Promise.resolve().then(function () { return tslib_1.__importStar(require("echarts-gl/charts")); }),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Excel's automatic value-axis scale (Format Axis → Bounds / Units left on
|
|
3
|
+
* "Auto"). Excel does not publish the rule; this is the behaviour Jon Peltier
|
|
4
|
+
* measured ("How Excel Calculates Automatic Chart Axis Limits",
|
|
5
|
+
* peltiertech.com) and that LV-05 of demo-app-monorepo#49969 compared:
|
|
6
|
+
*
|
|
7
|
+
* - The minimum is 0 when every value is ≥ 0 and the data spans more than a
|
|
8
|
+
* sixth of the maximum (the mirror rule pins the maximum to 0 for an
|
|
9
|
+
* all-negative series); a narrower positive range starts half its span
|
|
10
|
+
* below the smallest value.
|
|
11
|
+
* - The maximum is the largest value plus 5% of the range, rounded up to the
|
|
12
|
+
* next major unit (so data ending at 17 gets an 18 ceiling, 100 gets 120).
|
|
13
|
+
* - The major unit is the smallest 1-2-5 step that splits the range into at
|
|
14
|
+
* most ten intervals.
|
|
15
|
+
*
|
|
16
|
+
* echarts' own nicing (1-2-3-5 steps aimed at five intervals) gives steps of
|
|
17
|
+
* 3 or 25 Excel never draws, so the renderer hands echarts these bounds.
|
|
18
|
+
*/
|
|
19
|
+
export type ExcelAxisScale = {
|
|
20
|
+
min: number;
|
|
21
|
+
max: number;
|
|
22
|
+
interval: number;
|
|
23
|
+
};
|
|
24
|
+
export declare const excelAutoAxisScale: (values: Iterable<number>, fixed?: {
|
|
25
|
+
min?: number | null;
|
|
26
|
+
max?: number | null;
|
|
27
|
+
majorUnit?: number | null;
|
|
28
|
+
}) => ExcelAxisScale | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The values a cartesian value axis has to fit: every point of the bar / line
|
|
31
|
+
* series plotted against `axisIndex`, with stacked series summed per category
|
|
32
|
+
* (positives and negatives apart, as Excel stacks them).
|
|
33
|
+
*/
|
|
34
|
+
export declare const valueAxisExtentValues: (series: ReadonlyArray<any>, axisIndex: number, axisKey?: "yAxisIndex" | "xAxisIndex") => number[];
|
|
35
|
+
//# sourceMappingURL=excel-axis-scale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"excel-axis-scale.d.ts","sourceRoot":"","sources":["../../../utils/excel-axis-scale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,cAAc,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAiB5E,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,QAAQ,CAAC,MAAM,CAAC,EACxB,QAAO;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,KAClF,cAAc,GAAG,SA6CnB,CAAC;AAYF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,QAAQ,aAAa,CAAC,GAAG,CAAC,EAC1B,WAAW,MAAM,EACjB,UAAS,YAAY,GAAG,YAA2B,KAClD,MAAM,EA6BR,CAAC"}
|