@pixerate/editor 0.52.0 → 0.53.0
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/agent/index.cjs +23 -23
- package/dist/agent/index.js +4 -4
- package/dist/chart/index.cjs +174 -131
- package/dist/chart/index.cjs.map +1 -1
- package/dist/chart/index.d.cts +68 -21
- package/dist/chart/index.d.ts +68 -21
- package/dist/chart/index.js +64 -21
- package/dist/chart/index.js.map +1 -1
- package/dist/{chunk-UAW5FEMD.js → chunk-3S72F46R.js} +66 -8
- package/dist/chunk-3S72F46R.js.map +1 -0
- package/dist/{chunk-5TWIN7ZJ.js → chunk-47WWV3LI.js} +34 -4
- package/dist/chunk-47WWV3LI.js.map +1 -0
- package/dist/{chunk-OV7UAKIY.js → chunk-633QC34G.js} +172 -1
- package/dist/chunk-633QC34G.js.map +1 -0
- package/dist/{chunk-5N6AQCVB.js → chunk-BQQZ6MOI.js} +3 -3
- package/dist/{chunk-M5Z77GFH.cjs → chunk-C3JHII3M.cjs} +53 -53
- package/dist/{chunk-M5Z77GFH.cjs.map → chunk-C3JHII3M.cjs.map} +1 -1
- package/dist/{chunk-JOX6MJW4.cjs → chunk-CKRNELPO.cjs} +176 -5
- package/dist/chunk-CKRNELPO.cjs.map +1 -0
- package/dist/{chunk-TGBCBQFV.cjs → chunk-DK6QBGCS.cjs} +45 -15
- package/dist/chunk-DK6QBGCS.cjs.map +1 -0
- package/dist/{chunk-GTZXF4BI.cjs → chunk-NK3WL5TJ.cjs} +298 -133
- package/dist/chunk-NK3WL5TJ.cjs.map +1 -0
- package/dist/{chunk-3ZBAXET6.cjs → chunk-NN3JGUSX.cjs} +80 -22
- package/dist/chunk-NN3JGUSX.cjs.map +1 -0
- package/dist/{chunk-YMKPMXZ4.js → chunk-OIKYP7XC.js} +4 -4
- package/dist/{chunk-FEMIVHN3.cjs → chunk-P43HUQRX.cjs} +16 -16
- package/dist/{chunk-FEMIVHN3.cjs.map → chunk-P43HUQRX.cjs.map} +1 -1
- package/dist/{chunk-QFTVLEVN.js → chunk-RIXTW3C4.js} +3 -3
- package/dist/{chunk-WBOAXDKD.js → chunk-VODBAO32.js} +222 -57
- package/dist/chunk-VODBAO32.js.map +1 -0
- package/dist/{chunk-2DEBI6KU.cjs → chunk-YZZMX6V7.cjs} +10 -10
- package/dist/{chunk-2DEBI6KU.cjs.map → chunk-YZZMX6V7.cjs.map} +1 -1
- package/dist/{controller-DS3drIvy.d.cts → controller-CX0QfSv0.d.cts} +53 -2
- package/dist/{controller-BdKzaxs2.d.ts → controller-DscWQbjO.d.ts} +53 -2
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +6 -6
- package/dist/extensions/index.d.cts +2 -2
- package/dist/extensions/index.d.ts +2 -2
- package/dist/extensions/index.js +5 -5
- package/dist/{index-Dt9lzydb.d.ts → index-CALDD35B.d.ts} +1 -1
- package/dist/{index-DOy9HzfC.d.cts → index-DIWB6xMf.d.cts} +1 -1
- package/dist/index.cjs +13 -13
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-3ZBAXET6.cjs.map +0 -1
- package/dist/chunk-5TWIN7ZJ.js.map +0 -1
- package/dist/chunk-GTZXF4BI.cjs.map +0 -1
- package/dist/chunk-JOX6MJW4.cjs.map +0 -1
- package/dist/chunk-OV7UAKIY.js.map +0 -1
- package/dist/chunk-TGBCBQFV.cjs.map +0 -1
- package/dist/chunk-UAW5FEMD.js.map +0 -1
- package/dist/chunk-WBOAXDKD.js.map +0 -1
- /package/dist/{chunk-5N6AQCVB.js.map → chunk-BQQZ6MOI.js.map} +0 -0
- /package/dist/{chunk-YMKPMXZ4.js.map → chunk-OIKYP7XC.js.map} +0 -0
- /package/dist/{chunk-QFTVLEVN.js.map → chunk-RIXTW3C4.js.map} +0 -0
package/dist/chart/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export {
|
|
1
|
+
import { C as ChartValueScale, a as ChartNumberFormat, b as ChartValue, c as ChartRect, d as ChartErrorBars, e as ChartErrorBarType, f as ChartScene, g as ChartSpec, h as ChartLayoutOptions, i as ChartTheme, j as ChartWarning, k as ChartAxis, l as ChartLegend, m as ChartType, n as ChartStacking, o as ChartSeries, p as ChartIssue, q as ChartController, r as ChartSelection, s as ChartSpecPatch } from '../controller-CX0QfSv0.cjs';
|
|
2
|
+
export { t as CHART_AXIS_KINDS, u as CHART_AXIS_SCALES, v as CHART_CURVES, w as CHART_LABEL_POSITIONS, x as CHART_LEGEND_POSITIONS, y as CHART_MARKERS, z as CHART_NUMBER_STYLES, A as CHART_ORIENTATIONS, B as CHART_SERIES_TYPES, D as CHART_STACKINGS, E as CHART_TRENDLINE_TYPES, F as CHART_TYPES, G as CHART_TYPE_LABELS, H as CSS_VARIABLE_CHART_THEME, I as ChartActionResult, J as ChartCircleMark, K as ChartControllerOptions, L as ChartCurve, M as ChartDomSpec, N as ChartEditOptions, O as ChartFamily, P as ChartLabelPosition, Q as ChartLegendPosition, R as ChartLineMark, S as ChartMark, T as ChartMarkRole, U as ChartMarker, V as ChartOrientation, W as ChartPathMark, X as ChartRectMark, Y as ChartSeriesInput, Z as ChartSeriesPatch, _ as ChartSeriesType, $ as ChartSparklineKind, a0 as ChartSparklineOptions, a1 as ChartState, a2 as ChartSvgOptions, a3 as ChartTableData, a4 as ChartTableOptions, a5 as ChartTextMark, a6 as ChartTextMeasure, a7 as ChartTrendFit, a8 as ChartTrendline, a9 as ChartTrendlineType, aa as DEFAULT_CHART_PALETTE, ab as DEFAULT_CHART_THEME, ac as chartColorInputValue, ad as chartColorsByCategory, ae as chartDataFromTable, af as chartDataToTable, ag as chartFamily, ah as chartMovingAverage, ai as chartPointColor, aj as chartSceneToDomSpec, ak as chartSceneToSvg, al as chartSeriesColor, am as chartSeriesType, an as chartSliceColor, ao as chartSupportsTrendlines, ap as chartTextBaseline, aq as chartTextTransform, ar as chartToSvg, as as chartTrendlineName, at as cloneChartSeries, au as cloneChartSpec, av as contrastingTextColor, aw as createChartController, ax as createChartSpec, ay as defaultChartAxis, az as estimateChartTextWidth, aA as fitChartTrendline, aB as isCartesianChart, aC as isXyChart, aD as layoutSparkline, aE as normalizeChartAxis, aF as normalizeChartErrorBars, aG as normalizeChartSpec, aH as normalizeChartTrendline, aI as normalizeChartValues, aJ as parseChartValue, aK as sameChartSelection, aL as sparklineToSvg, aM as trendNumberText, aN as uniqueChartSeriesId } from '../controller-CX0QfSv0.cjs';
|
|
3
3
|
import { C as CommandSpec } from '../registry-CaR7LC6W.cjs';
|
|
4
4
|
import { A as AgentToolProvider } from '../registry-B4l-lYts.cjs';
|
|
5
5
|
import { Z as ZipReadOptions } from '../zip-4nG0YAH7.cjs';
|
|
@@ -31,6 +31,20 @@ declare function stepDecimals(step: number): number;
|
|
|
31
31
|
declare function formatChartNumber(value: number | null | undefined, format?: ChartNumberFormat, fallbackDecimals?: number): string;
|
|
32
32
|
/** Linear map from `domain` to `range`. */
|
|
33
33
|
declare function linearMap(value: number, domain: readonly [number, number], range: readonly [number, number]): number;
|
|
34
|
+
/**
|
|
35
|
+
* A logarithmic scale over `[lo, hi]` (only positive values count): the ends extend to whole
|
|
36
|
+
* powers of `base` unless fixed, and ticks sit on the powers, thinned to about `count`, or, in
|
|
37
|
+
* base 10 over a few decades, on the 1-2-5 steps between them. `step` is the base. Non-positive
|
|
38
|
+
* or non-finite ends fall back to the data, and no positive data at all gives 1 to `base`.
|
|
39
|
+
*/
|
|
40
|
+
declare function niceLogScale(lo: number, hi: number, count?: number, base?: number, fixedMin?: number | null, fixedMax?: number | null): NiceScale;
|
|
41
|
+
/**
|
|
42
|
+
* A data value's pixel on a value scale: linear, or by logarithm when `scale.logBase` is set
|
|
43
|
+
* (values of 0 or less have no pixel there and give NaN).
|
|
44
|
+
*/
|
|
45
|
+
declare function chartScaleToPixel(value: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
|
|
46
|
+
/** The data value at a pixel on a value scale (the inverse of `chartScaleToPixel`). */
|
|
47
|
+
declare function chartScaleFromPixel(px: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
|
|
34
48
|
|
|
35
49
|
/**
|
|
36
50
|
* A compiled spreadsheet number format code for chart labels, e.g. `#,##0.00`, `0.0%`,
|
|
@@ -256,6 +270,39 @@ declare function summarizeChartSeries(series: {
|
|
|
256
270
|
values: readonly ChartValue[];
|
|
257
271
|
}, categories: readonly string[]): ChartSeriesSummary;
|
|
258
272
|
|
|
273
|
+
declare const CHART_ERROR_BAR_TYPES: readonly ChartErrorBarType[];
|
|
274
|
+
declare const CHART_ERROR_BAR_DIRECTIONS: readonly NonNullable<ChartErrorBars['direction']>[];
|
|
275
|
+
/** Labels for pickers, shared by the React and Svelte components. */
|
|
276
|
+
declare const CHART_ERROR_BAR_LABELS: Readonly<Record<ChartErrorBarType, string>>;
|
|
277
|
+
/** The default `value` per type (`fixed` 1, `percent` 5, `stddev` 1). */
|
|
278
|
+
declare function defaultChartErrorBarValue(type: ChartErrorBarType): number | undefined;
|
|
279
|
+
/** One point's error bar: where it is centred and how far it reaches each way (both 0 or more). */
|
|
280
|
+
interface ChartErrorAmount {
|
|
281
|
+
/** The point's value, or the series mean for `stddev` (as Excel draws it). */
|
|
282
|
+
center: number;
|
|
283
|
+
plus: number;
|
|
284
|
+
minus: number;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The error bar at each point of `values` (a series' values, or its x values for x error
|
|
288
|
+
* bars), following Excel's error amount types: `fixed` and `percent` from `value`, `stddev`
|
|
289
|
+
* around the series mean, `stderr` (sample standard deviation / √n) and `custom` amounts from
|
|
290
|
+
* `plus` / `minus`. Gaps (and custom points without an amount) give `null`.
|
|
291
|
+
*/
|
|
292
|
+
declare function chartErrorAmounts(bars: ChartErrorBars, values: readonly ChartValue[]): (ChartErrorAmount | null)[];
|
|
293
|
+
/** A one-line description of error bars ("±5% error bars", "±1 standard deviation error bars"). */
|
|
294
|
+
declare function describeChartErrorBars(bars: ChartErrorBars): string;
|
|
295
|
+
/**
|
|
296
|
+
* Error bars for a picker change: `null` for none, else bars of `type` that keep the current
|
|
297
|
+
* direction and caps. Switching to `custom` starts from the amounts the current bars (or ±1)
|
|
298
|
+
* draw, so the picture does not jump. Shared by the React and Svelte inspectors.
|
|
299
|
+
*/
|
|
300
|
+
declare function chartErrorBarsOfType(type: ChartErrorBarType | '' | null, current: ChartErrorBars | undefined, values: readonly ChartValue[]): ChartErrorBars | null;
|
|
301
|
+
/** Custom amounts as text for an input: "1, 2, -, 0.5" (`-` is a point without a bar). */
|
|
302
|
+
declare function formatChartAmountList(values: readonly ChartValue[] | undefined): string;
|
|
303
|
+
/** Reads amounts typed as "1, 2, -, 0.5" (commas, semicolons or spaces; `-` or blank for none). */
|
|
304
|
+
declare function parseChartAmountList(text: string): (string | null)[];
|
|
305
|
+
|
|
259
306
|
/**
|
|
260
307
|
* Lays a chart out as drawing primitives (rects, paths, circles, lines and text) in a
|
|
261
308
|
* `width × height` box. Pure and DOM-free: the React and Svelte canvases render the marks
|
|
@@ -267,7 +314,7 @@ declare function layoutChart(spec: ChartSpec, options: ChartLayoutOptions): Char
|
|
|
267
314
|
/**
|
|
268
315
|
* The data value at a scene point along the value axis (for dragging a bar or point), or
|
|
269
316
|
* `undefined` when the scene has no value scale or is percent-stacked. `secondary` reads the
|
|
270
|
-
* secondary axis.
|
|
317
|
+
* secondary axis. Reversed and logarithmic axes are mapped as drawn.
|
|
271
318
|
*/
|
|
272
319
|
declare function chartValueAtPoint(scene: ChartScene, point: {
|
|
273
320
|
x: number;
|
|
@@ -278,8 +325,12 @@ declare function chartXAtPoint(scene: ChartScene, point: {
|
|
|
278
325
|
x: number;
|
|
279
326
|
y: number;
|
|
280
327
|
}): number | undefined;
|
|
281
|
-
/**
|
|
282
|
-
|
|
328
|
+
/**
|
|
329
|
+
* The value a drag should store: snapped to a tenth of the tick step (or `step`) and kept
|
|
330
|
+
* finite. On a logarithmic axis (`logBase`, without a `step`) ticks are not evenly spaced, so
|
|
331
|
+
* the value is rounded to two significant digits instead.
|
|
332
|
+
*/
|
|
333
|
+
declare function snapChartValue(scene: ChartScene, value: number, step?: number, ticks?: readonly number[], logBase?: number): number;
|
|
283
334
|
|
|
284
335
|
/** Data labels are skipped on series with more points than this. */
|
|
285
336
|
declare const MAX_CHART_DATA_LABELS = 200;
|
|
@@ -368,27 +419,23 @@ declare function downloadChartPng(spec: ChartSpec, options?: DownloadChartPngOpt
|
|
|
368
419
|
filename: string;
|
|
369
420
|
}>;
|
|
370
421
|
|
|
422
|
+
/** An axis as drawn. `logBase` is set on a logarithmic axis, `reversed` when it runs the other way. */
|
|
423
|
+
interface ChartAxisSummary {
|
|
424
|
+
min: number;
|
|
425
|
+
max: number;
|
|
426
|
+
ticks: number[];
|
|
427
|
+
logBase?: number;
|
|
428
|
+
reversed?: boolean;
|
|
429
|
+
}
|
|
371
430
|
interface ChartSummary {
|
|
372
431
|
type: ChartSpec['type'];
|
|
373
432
|
title: string;
|
|
374
433
|
categories: number;
|
|
375
434
|
series: ChartSeriesSummary[];
|
|
376
435
|
/** The value axis as drawn: range and ticks (absent for pies and treemaps). */
|
|
377
|
-
valueAxis?:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
ticks: number[];
|
|
381
|
-
};
|
|
382
|
-
secondaryAxis?: {
|
|
383
|
-
min: number;
|
|
384
|
-
max: number;
|
|
385
|
-
ticks: number[];
|
|
386
|
-
};
|
|
387
|
-
xAxis?: {
|
|
388
|
-
min: number;
|
|
389
|
-
max: number;
|
|
390
|
-
ticks: number[];
|
|
391
|
-
};
|
|
436
|
+
valueAxis?: ChartAxisSummary;
|
|
437
|
+
secondaryAxis?: ChartAxisSummary;
|
|
438
|
+
xAxis?: ChartAxisSummary;
|
|
392
439
|
/** What the layout left out at this size (hidden labels, thinned lines, …). */
|
|
393
440
|
warnings: ChartWarning[];
|
|
394
441
|
/** Whether the series colours can be told apart (also with colour-blindness). */
|
|
@@ -1064,4 +1111,4 @@ interface OfficeChartToolProviderOptions {
|
|
|
1064
1111
|
*/
|
|
1065
1112
|
declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
|
|
1066
1113
|
|
|
1067
|
-
export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
|
|
1114
|
+
export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_ERROR_BAR_DIRECTIONS, CHART_ERROR_BAR_LABELS, CHART_ERROR_BAR_TYPES, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartAxisSummary, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartErrorAmount, ChartErrorBarType, ChartErrorBars, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartErrorAmounts, chartErrorBarsOfType, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartScaleFromPixel, chartScaleToPixel, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, defaultChartErrorBarValue, describeChart, describeChartErrorBars, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartAmountList, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceLogScale, niceScale, niceStep, parseChartAmountList, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
|
package/dist/chart/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
export {
|
|
1
|
+
import { C as ChartValueScale, a as ChartNumberFormat, b as ChartValue, c as ChartRect, d as ChartErrorBars, e as ChartErrorBarType, f as ChartScene, g as ChartSpec, h as ChartLayoutOptions, i as ChartTheme, j as ChartWarning, k as ChartAxis, l as ChartLegend, m as ChartType, n as ChartStacking, o as ChartSeries, p as ChartIssue, q as ChartController, r as ChartSelection, s as ChartSpecPatch } from '../controller-DscWQbjO.js';
|
|
2
|
+
export { t as CHART_AXIS_KINDS, u as CHART_AXIS_SCALES, v as CHART_CURVES, w as CHART_LABEL_POSITIONS, x as CHART_LEGEND_POSITIONS, y as CHART_MARKERS, z as CHART_NUMBER_STYLES, A as CHART_ORIENTATIONS, B as CHART_SERIES_TYPES, D as CHART_STACKINGS, E as CHART_TRENDLINE_TYPES, F as CHART_TYPES, G as CHART_TYPE_LABELS, H as CSS_VARIABLE_CHART_THEME, I as ChartActionResult, J as ChartCircleMark, K as ChartControllerOptions, L as ChartCurve, M as ChartDomSpec, N as ChartEditOptions, O as ChartFamily, P as ChartLabelPosition, Q as ChartLegendPosition, R as ChartLineMark, S as ChartMark, T as ChartMarkRole, U as ChartMarker, V as ChartOrientation, W as ChartPathMark, X as ChartRectMark, Y as ChartSeriesInput, Z as ChartSeriesPatch, _ as ChartSeriesType, $ as ChartSparklineKind, a0 as ChartSparklineOptions, a1 as ChartState, a2 as ChartSvgOptions, a3 as ChartTableData, a4 as ChartTableOptions, a5 as ChartTextMark, a6 as ChartTextMeasure, a7 as ChartTrendFit, a8 as ChartTrendline, a9 as ChartTrendlineType, aa as DEFAULT_CHART_PALETTE, ab as DEFAULT_CHART_THEME, ac as chartColorInputValue, ad as chartColorsByCategory, ae as chartDataFromTable, af as chartDataToTable, ag as chartFamily, ah as chartMovingAverage, ai as chartPointColor, aj as chartSceneToDomSpec, ak as chartSceneToSvg, al as chartSeriesColor, am as chartSeriesType, an as chartSliceColor, ao as chartSupportsTrendlines, ap as chartTextBaseline, aq as chartTextTransform, ar as chartToSvg, as as chartTrendlineName, at as cloneChartSeries, au as cloneChartSpec, av as contrastingTextColor, aw as createChartController, ax as createChartSpec, ay as defaultChartAxis, az as estimateChartTextWidth, aA as fitChartTrendline, aB as isCartesianChart, aC as isXyChart, aD as layoutSparkline, aE as normalizeChartAxis, aF as normalizeChartErrorBars, aG as normalizeChartSpec, aH as normalizeChartTrendline, aI as normalizeChartValues, aJ as parseChartValue, aK as sameChartSelection, aL as sparklineToSvg, aM as trendNumberText, aN as uniqueChartSeriesId } from '../controller-DscWQbjO.js';
|
|
3
3
|
import { C as CommandSpec } from '../registry-rVtFJjRM.js';
|
|
4
4
|
import { A as AgentToolProvider } from '../registry-CSlH4iUn.js';
|
|
5
5
|
import { Z as ZipReadOptions } from '../zip-4nG0YAH7.js';
|
|
@@ -31,6 +31,20 @@ declare function stepDecimals(step: number): number;
|
|
|
31
31
|
declare function formatChartNumber(value: number | null | undefined, format?: ChartNumberFormat, fallbackDecimals?: number): string;
|
|
32
32
|
/** Linear map from `domain` to `range`. */
|
|
33
33
|
declare function linearMap(value: number, domain: readonly [number, number], range: readonly [number, number]): number;
|
|
34
|
+
/**
|
|
35
|
+
* A logarithmic scale over `[lo, hi]` (only positive values count): the ends extend to whole
|
|
36
|
+
* powers of `base` unless fixed, and ticks sit on the powers, thinned to about `count`, or, in
|
|
37
|
+
* base 10 over a few decades, on the 1-2-5 steps between them. `step` is the base. Non-positive
|
|
38
|
+
* or non-finite ends fall back to the data, and no positive data at all gives 1 to `base`.
|
|
39
|
+
*/
|
|
40
|
+
declare function niceLogScale(lo: number, hi: number, count?: number, base?: number, fixedMin?: number | null, fixedMax?: number | null): NiceScale;
|
|
41
|
+
/**
|
|
42
|
+
* A data value's pixel on a value scale: linear, or by logarithm when `scale.logBase` is set
|
|
43
|
+
* (values of 0 or less have no pixel there and give NaN).
|
|
44
|
+
*/
|
|
45
|
+
declare function chartScaleToPixel(value: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
|
|
46
|
+
/** The data value at a pixel on a value scale (the inverse of `chartScaleToPixel`). */
|
|
47
|
+
declare function chartScaleFromPixel(px: number, scale: Pick<ChartValueScale, 'domain' | 'range' | 'logBase'>): number;
|
|
34
48
|
|
|
35
49
|
/**
|
|
36
50
|
* A compiled spreadsheet number format code for chart labels, e.g. `#,##0.00`, `0.0%`,
|
|
@@ -256,6 +270,39 @@ declare function summarizeChartSeries(series: {
|
|
|
256
270
|
values: readonly ChartValue[];
|
|
257
271
|
}, categories: readonly string[]): ChartSeriesSummary;
|
|
258
272
|
|
|
273
|
+
declare const CHART_ERROR_BAR_TYPES: readonly ChartErrorBarType[];
|
|
274
|
+
declare const CHART_ERROR_BAR_DIRECTIONS: readonly NonNullable<ChartErrorBars['direction']>[];
|
|
275
|
+
/** Labels for pickers, shared by the React and Svelte components. */
|
|
276
|
+
declare const CHART_ERROR_BAR_LABELS: Readonly<Record<ChartErrorBarType, string>>;
|
|
277
|
+
/** The default `value` per type (`fixed` 1, `percent` 5, `stddev` 1). */
|
|
278
|
+
declare function defaultChartErrorBarValue(type: ChartErrorBarType): number | undefined;
|
|
279
|
+
/** One point's error bar: where it is centred and how far it reaches each way (both 0 or more). */
|
|
280
|
+
interface ChartErrorAmount {
|
|
281
|
+
/** The point's value, or the series mean for `stddev` (as Excel draws it). */
|
|
282
|
+
center: number;
|
|
283
|
+
plus: number;
|
|
284
|
+
minus: number;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* The error bar at each point of `values` (a series' values, or its x values for x error
|
|
288
|
+
* bars), following Excel's error amount types: `fixed` and `percent` from `value`, `stddev`
|
|
289
|
+
* around the series mean, `stderr` (sample standard deviation / √n) and `custom` amounts from
|
|
290
|
+
* `plus` / `minus`. Gaps (and custom points without an amount) give `null`.
|
|
291
|
+
*/
|
|
292
|
+
declare function chartErrorAmounts(bars: ChartErrorBars, values: readonly ChartValue[]): (ChartErrorAmount | null)[];
|
|
293
|
+
/** A one-line description of error bars ("±5% error bars", "±1 standard deviation error bars"). */
|
|
294
|
+
declare function describeChartErrorBars(bars: ChartErrorBars): string;
|
|
295
|
+
/**
|
|
296
|
+
* Error bars for a picker change: `null` for none, else bars of `type` that keep the current
|
|
297
|
+
* direction and caps. Switching to `custom` starts from the amounts the current bars (or ±1)
|
|
298
|
+
* draw, so the picture does not jump. Shared by the React and Svelte inspectors.
|
|
299
|
+
*/
|
|
300
|
+
declare function chartErrorBarsOfType(type: ChartErrorBarType | '' | null, current: ChartErrorBars | undefined, values: readonly ChartValue[]): ChartErrorBars | null;
|
|
301
|
+
/** Custom amounts as text for an input: "1, 2, -, 0.5" (`-` is a point without a bar). */
|
|
302
|
+
declare function formatChartAmountList(values: readonly ChartValue[] | undefined): string;
|
|
303
|
+
/** Reads amounts typed as "1, 2, -, 0.5" (commas, semicolons or spaces; `-` or blank for none). */
|
|
304
|
+
declare function parseChartAmountList(text: string): (string | null)[];
|
|
305
|
+
|
|
259
306
|
/**
|
|
260
307
|
* Lays a chart out as drawing primitives (rects, paths, circles, lines and text) in a
|
|
261
308
|
* `width × height` box. Pure and DOM-free: the React and Svelte canvases render the marks
|
|
@@ -267,7 +314,7 @@ declare function layoutChart(spec: ChartSpec, options: ChartLayoutOptions): Char
|
|
|
267
314
|
/**
|
|
268
315
|
* The data value at a scene point along the value axis (for dragging a bar or point), or
|
|
269
316
|
* `undefined` when the scene has no value scale or is percent-stacked. `secondary` reads the
|
|
270
|
-
* secondary axis.
|
|
317
|
+
* secondary axis. Reversed and logarithmic axes are mapped as drawn.
|
|
271
318
|
*/
|
|
272
319
|
declare function chartValueAtPoint(scene: ChartScene, point: {
|
|
273
320
|
x: number;
|
|
@@ -278,8 +325,12 @@ declare function chartXAtPoint(scene: ChartScene, point: {
|
|
|
278
325
|
x: number;
|
|
279
326
|
y: number;
|
|
280
327
|
}): number | undefined;
|
|
281
|
-
/**
|
|
282
|
-
|
|
328
|
+
/**
|
|
329
|
+
* The value a drag should store: snapped to a tenth of the tick step (or `step`) and kept
|
|
330
|
+
* finite. On a logarithmic axis (`logBase`, without a `step`) ticks are not evenly spaced, so
|
|
331
|
+
* the value is rounded to two significant digits instead.
|
|
332
|
+
*/
|
|
333
|
+
declare function snapChartValue(scene: ChartScene, value: number, step?: number, ticks?: readonly number[], logBase?: number): number;
|
|
283
334
|
|
|
284
335
|
/** Data labels are skipped on series with more points than this. */
|
|
285
336
|
declare const MAX_CHART_DATA_LABELS = 200;
|
|
@@ -368,27 +419,23 @@ declare function downloadChartPng(spec: ChartSpec, options?: DownloadChartPngOpt
|
|
|
368
419
|
filename: string;
|
|
369
420
|
}>;
|
|
370
421
|
|
|
422
|
+
/** An axis as drawn. `logBase` is set on a logarithmic axis, `reversed` when it runs the other way. */
|
|
423
|
+
interface ChartAxisSummary {
|
|
424
|
+
min: number;
|
|
425
|
+
max: number;
|
|
426
|
+
ticks: number[];
|
|
427
|
+
logBase?: number;
|
|
428
|
+
reversed?: boolean;
|
|
429
|
+
}
|
|
371
430
|
interface ChartSummary {
|
|
372
431
|
type: ChartSpec['type'];
|
|
373
432
|
title: string;
|
|
374
433
|
categories: number;
|
|
375
434
|
series: ChartSeriesSummary[];
|
|
376
435
|
/** The value axis as drawn: range and ticks (absent for pies and treemaps). */
|
|
377
|
-
valueAxis?:
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
ticks: number[];
|
|
381
|
-
};
|
|
382
|
-
secondaryAxis?: {
|
|
383
|
-
min: number;
|
|
384
|
-
max: number;
|
|
385
|
-
ticks: number[];
|
|
386
|
-
};
|
|
387
|
-
xAxis?: {
|
|
388
|
-
min: number;
|
|
389
|
-
max: number;
|
|
390
|
-
ticks: number[];
|
|
391
|
-
};
|
|
436
|
+
valueAxis?: ChartAxisSummary;
|
|
437
|
+
secondaryAxis?: ChartAxisSummary;
|
|
438
|
+
xAxis?: ChartAxisSummary;
|
|
392
439
|
/** What the layout left out at this size (hidden labels, thinned lines, …). */
|
|
393
440
|
warnings: ChartWarning[];
|
|
394
441
|
/** Whether the series colours can be told apart (also with colour-blindness). */
|
|
@@ -1064,4 +1111,4 @@ interface OfficeChartToolProviderOptions {
|
|
|
1064
1111
|
*/
|
|
1065
1112
|
declare function createOfficeChartToolProvider(options?: OfficeChartToolProviderOptions): AgentToolProvider;
|
|
1066
1113
|
|
|
1067
|
-
export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, describeChart, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceScale, niceStep, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
|
|
1114
|
+
export { CHART_COLOR_SCHEMES, CHART_DATE_STEPS, CHART_ERROR_BAR_DIRECTIONS, CHART_ERROR_BAR_LABELS, CHART_ERROR_BAR_TYPES, CHART_LAYOUT_PRESETS, CHART_MERMAID_META_PREFIX, CHART_OOXML_CONTENT_TYPE, CHART_OOXML_NS, CHART_OOXML_RELATIONSHIP, CHART_PALETTE_SHADES, CHART_PRESENCE_COLORS, CHART_RASTER_MAX_SIZE, type ChartAgentCommand, ChartAxis, type ChartAxisSummary, type ChartBoxStats, type ChartClock, type ChartColorCheck, type ChartColorCheckOptions, type ChartColorPair, type ChartColorScheme, type ChartCommandOptions, ChartController, type ChartDateLabels, type ChartDateStep, ChartDirector, type ChartDirectorActor, type ChartDirectorOptions, type ChartDragMoveOptions, type ChartErrorAmount, ChartErrorBarType, ChartErrorBars, type ChartFormatCode, type ChartFromTable, type ChartHistogramBin, ChartIssue, type ChartKeyInput, ChartLayoutOptions, type ChartLayoutPreset, ChartLegend, type ChartMermaidFamily, type ChartMermaidOptions, type ChartMermaidParseOptions, type ChartMermaidResult, ChartNumberFormat, type ChartOoxmlReadOptions, type ChartOoxmlReadResult, type ChartOoxmlWriteResult, type ChartPaintScope, type ChartPerformanceResult, type ChartPerformanceStep, type ChartPointDrag, ChartPresence, type ChartPresenceActor, type ChartPresenceState, type ChartPresetPatch, type ChartRasterImage, type ChartRecommendation, ChartRect, type ChartRgb, ChartScene, ChartSelection, ChartSeries, type ChartSeriesSummary, type ChartSnapOptions, ChartSpec, ChartSpecPatch, ChartStacking, ChartStream, type ChartStreamFormat, type ChartStreamResult, type ChartSummary, type ChartTableShape, ChartTheme, type ChartToolProviderOptions, ChartType, ChartValue, ChartValueScale, type ChartVision, ChartWarning, type DownloadChartPngOptions, type FoundChartMermaid, MAX_CHART_DATA_LABELS, MAX_CHART_LINE_POINTS, MAX_CHART_MARKERS, type NiceScale, type OfficeChartFile, type OfficeChartFileFormat, type OfficeChartToolProviderOptions, OfficeChartsError, type OfficeChartsReadOptions, type OfficeChartsResult, type OfficeFileChart, RENDER_CHART_INSTRUCTIONS, type RasterizeChartOptions, analyzeChartTable, blendChartScenes, canDragChartPoint, chartBoxStats, chartClientToScene, chartColorDistance, chartContrastRatio, chartDateLabels, chartDateToSerial, chartErrorAmounts, chartErrorBarsOfType, chartFileName, chartFormatToCode, chartFromMermaid, chartFromOoxml, chartFromTable, chartHistogram, chartHitTest, chartLuminance, chartMermaidFamily, chartPointAnchor, chartPresetPatch, chartQuantile, chartRasterSize, chartRgbToHex, chartRgbToOklab, chartScaleFromPixel, chartScaleToPixel, chartSerialToDate, chartSquarify, chartTextOn, chartToMermaid, chartToOoxml, chartValueAtPoint, chartXAtPoint, checkChartColors, compileChartFormatCode, createChartCommands, createChartRasterizer, createChartToolProvider, createInstantChartClock, createOfficeChartToolProvider, cyclePaletteColor, decimateChartPoints, defaultChartErrorBarValue, describeChart, describeChartErrorBars, describeChartSelection, describeOfficeChartPlace, downloadChartPng, easeChartTween, extractDocxCharts, extractOfficeCharts, extractPptxCharts, extractXlsxCharts, findMermaidCharts, formatChartAmountList, formatChartDate, formatChartNumber, formatChartValueWithCode, handleChartKey, layoutChart, linearMap, monochromeChartPalette, niceLogScale, niceScale, niceStep, parseChartAmountList, parseChartColor, parseChartDate, parsePartialChartJson, planChartCommand, rasterizeChartSvg, realChartClock, recommendChartTypes, recommendForShape, resolveChartSvgPaints, shadeChartColor, simulateChartVision, snapChartDragValue, snapChartValue, startChartPointDrag, stepDecimals, summarizeChart, summarizeChartSeries };
|
package/dist/chart/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TRENDLINE_PROPS,
|
|
8
8
|
VALUE,
|
|
9
9
|
WIDTH
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-47WWV3LI.js";
|
|
11
11
|
import {
|
|
12
12
|
CHART_OOXML_CONTENT_TYPE,
|
|
13
13
|
CHART_OOXML_NS,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
chartFromOoxml,
|
|
17
17
|
chartToOoxml,
|
|
18
18
|
readZip
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-3S72F46R.js";
|
|
20
20
|
import {
|
|
21
21
|
CHART_COLOR_SCHEMES,
|
|
22
22
|
CHART_DATE_STEPS,
|
|
@@ -35,6 +35,8 @@ import {
|
|
|
35
35
|
chartMovingAverage,
|
|
36
36
|
chartPresetPatch,
|
|
37
37
|
chartQuantile,
|
|
38
|
+
chartScaleFromPixel,
|
|
39
|
+
chartScaleToPixel,
|
|
38
40
|
chartSceneToDomSpec,
|
|
39
41
|
chartSceneToSvg,
|
|
40
42
|
chartSerialToDate,
|
|
@@ -62,6 +64,7 @@ import {
|
|
|
62
64
|
layoutSparkline,
|
|
63
65
|
linearMap,
|
|
64
66
|
monochromeChartPalette,
|
|
67
|
+
niceLogScale,
|
|
65
68
|
niceScale,
|
|
66
69
|
niceStep,
|
|
67
70
|
parseChartDate,
|
|
@@ -72,10 +75,14 @@ import {
|
|
|
72
75
|
summarizeChart,
|
|
73
76
|
summarizeChartSeries,
|
|
74
77
|
trendNumberText
|
|
75
|
-
} from "../chunk-
|
|
78
|
+
} from "../chunk-VODBAO32.js";
|
|
76
79
|
import {
|
|
77
80
|
CHART_AXIS_KINDS,
|
|
81
|
+
CHART_AXIS_SCALES,
|
|
78
82
|
CHART_CURVES,
|
|
83
|
+
CHART_ERROR_BAR_DIRECTIONS,
|
|
84
|
+
CHART_ERROR_BAR_LABELS,
|
|
85
|
+
CHART_ERROR_BAR_TYPES,
|
|
79
86
|
CHART_LABEL_POSITIONS,
|
|
80
87
|
CHART_LEGEND_POSITIONS,
|
|
81
88
|
CHART_MARKERS,
|
|
@@ -96,6 +103,8 @@ import {
|
|
|
96
103
|
chartContrastRatio,
|
|
97
104
|
chartDataFromTable,
|
|
98
105
|
chartDataToTable,
|
|
106
|
+
chartErrorAmounts,
|
|
107
|
+
chartErrorBarsOfType,
|
|
99
108
|
chartFamily,
|
|
100
109
|
chartLuminance,
|
|
101
110
|
chartPointColor,
|
|
@@ -111,18 +120,23 @@ import {
|
|
|
111
120
|
createChartSpec,
|
|
112
121
|
cyclePaletteColor,
|
|
113
122
|
defaultChartAxis,
|
|
123
|
+
defaultChartErrorBarValue,
|
|
124
|
+
describeChartErrorBars,
|
|
125
|
+
formatChartAmountList,
|
|
114
126
|
isCartesianChart,
|
|
115
127
|
isXyChart,
|
|
116
128
|
normalizeChartAxis,
|
|
129
|
+
normalizeChartErrorBars,
|
|
117
130
|
normalizeChartSpec,
|
|
118
131
|
normalizeChartTrendline,
|
|
119
132
|
normalizeChartValues,
|
|
133
|
+
parseChartAmountList,
|
|
120
134
|
parseChartColor,
|
|
121
135
|
parseChartValue,
|
|
122
136
|
shadeChartColor,
|
|
123
137
|
simulateChartVision,
|
|
124
138
|
uniqueChartSeriesId
|
|
125
|
-
} from "../chunk-
|
|
139
|
+
} from "../chunk-633QC34G.js";
|
|
126
140
|
import "../chunk-EKYHKQPG.js";
|
|
127
141
|
import {
|
|
128
142
|
parseCsv
|
|
@@ -413,7 +427,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
413
427
|
id: `${prefix}update`,
|
|
414
428
|
label: "Change Chart\u2026",
|
|
415
429
|
keywords: ["chart", "title", "axis", "legend", "stack", "style", "format", "type"],
|
|
416
|
-
description:
|
|
430
|
+
description: 'Changes chart presentation as one undo step: type, titles, axes (xAxis = categories, yAxis = values, yAxis2 = secondary values; reverse, and scale "log" on value axes), legend, stacking, orientation, curve, points, data labels, palette, donut hole, bar spacing, histogram bins or waterfall total. Invalid values change nothing and return why.',
|
|
417
431
|
params: object(CHART_UPDATE_PROPERTIES),
|
|
418
432
|
run: (_ctx, params) => {
|
|
419
433
|
check(controller.update(params));
|
|
@@ -467,7 +481,7 @@ function createChartCommands(controller, options = {}) {
|
|
|
467
481
|
id: `${prefix}updateSeries`,
|
|
468
482
|
label: "Change Series\u2026",
|
|
469
483
|
keywords: ["chart", "series", "rename", "colour", "color", "hide", "axis", "marker"],
|
|
470
|
-
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (null resets a field).",
|
|
484
|
+
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn, including error bars (null resets a field).",
|
|
471
485
|
params: object({ series: SERIES_REF, ...Object.fromEntries(Object.entries(SERIES_PROPS).filter(([k]) => k !== "values")) }, ["series"]),
|
|
472
486
|
run: (_ctx, params) => {
|
|
473
487
|
const { series, ...patch } = params;
|
|
@@ -690,13 +704,14 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
690
704
|
const scale = options.scale ?? scene.valueScale;
|
|
691
705
|
const tolerance = options.tolerancePx ?? 6;
|
|
692
706
|
if (scale) {
|
|
693
|
-
const px = (v) =>
|
|
707
|
+
const px = (v) => chartScaleToPixel(v, scale);
|
|
694
708
|
const at = px(value);
|
|
695
709
|
let best = null;
|
|
696
710
|
let bestDist = tolerance;
|
|
697
711
|
for (const c of [...options.candidates ?? [], ...scale.ticks]) {
|
|
698
712
|
if (!Number.isFinite(c)) continue;
|
|
699
713
|
const d = Math.abs(px(c) - at);
|
|
714
|
+
if (!Number.isFinite(d)) continue;
|
|
700
715
|
if (d <= bestDist) {
|
|
701
716
|
best = c;
|
|
702
717
|
bestDist = d;
|
|
@@ -704,7 +719,7 @@ function snapChartDragValue(scene, value, options = {}) {
|
|
|
704
719
|
}
|
|
705
720
|
if (best !== null) return best;
|
|
706
721
|
}
|
|
707
|
-
return snapChartValue(scene, value, options.step, scale?.ticks);
|
|
722
|
+
return snapChartValue(scene, value, options.step, scale?.ticks, scale?.logBase);
|
|
708
723
|
}
|
|
709
724
|
function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
710
725
|
if (!canDragChartPoint(controller, scene, target)) return null;
|
|
@@ -738,27 +753,31 @@ function startChartPointDrag(controller, scene, target, start, options = {}) {
|
|
|
738
753
|
const at = chartValueAtPoint(scene, point, secondary);
|
|
739
754
|
if (at === void 0) return;
|
|
740
755
|
const factor = moveOptions.fine ? 0.1 : 1;
|
|
741
|
-
|
|
742
|
-
let
|
|
756
|
+
const moved = (from, to, s, value) => s.logBase && value > 0 && from > 0 && to > 0 ? value * Math.pow(to / from, factor) : value + (to - from) * factor;
|
|
757
|
+
let moveY = true;
|
|
758
|
+
let moveX = false;
|
|
759
|
+
let atX;
|
|
743
760
|
if (xy && startX !== null && startAtX !== void 0) {
|
|
744
|
-
|
|
745
|
-
|
|
761
|
+
atX = chartXAtPoint(scene, point);
|
|
762
|
+
moveX = atX !== void 0;
|
|
746
763
|
if (moveOptions.lockAxis) {
|
|
747
|
-
if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y))
|
|
748
|
-
else
|
|
764
|
+
if (Math.abs(point.x - start.x) >= Math.abs(point.y - start.y)) moveY = false;
|
|
765
|
+
else moveX = false;
|
|
749
766
|
}
|
|
750
767
|
}
|
|
751
768
|
const snap = (v, s, c) => {
|
|
752
769
|
if (moveOptions.noSnap) return Number(v.toPrecision(12));
|
|
753
770
|
if (moveOptions.fine) {
|
|
771
|
+
if (s.logBase && !options.step) return v > 0 ? Number(v.toPrecision(3)) : v;
|
|
754
772
|
const unit = options.step ? options.step / 10 : s.ticks.length > 1 ? (s.ticks[1] - s.ticks[0]) / 100 : void 0;
|
|
755
773
|
return snapChartValue(scene, v, unit, s.ticks);
|
|
756
774
|
}
|
|
757
775
|
return snapChartDragValue(scene, v, { candidates: c, tolerancePx: options.tolerancePx, step: options.step, scale: s });
|
|
758
776
|
};
|
|
759
|
-
const y = snap(
|
|
777
|
+
const y = moveY ? snap(moved(startAt, at, scale, startValue), scale, candidates) : startValue;
|
|
760
778
|
if (xy && startX !== null) {
|
|
761
|
-
const
|
|
779
|
+
const nextX = moveX ? moved(startAtX, atX, scene.xScale, startX) : startX;
|
|
780
|
+
const x = nextX !== startX ? snap(nextX, scene.xScale, [0, startX]) : startX;
|
|
762
781
|
const xs = [...series.x ?? []];
|
|
763
782
|
xs[index] = x;
|
|
764
783
|
controller.setValue(seriesId, index, y, { label });
|
|
@@ -805,11 +824,21 @@ function handleChartKey(controller, scene, event) {
|
|
|
805
824
|
case "ArrowUp":
|
|
806
825
|
case "ArrowDown": {
|
|
807
826
|
if (selection?.kind !== "point" || scene?.percent) return false;
|
|
808
|
-
const
|
|
809
|
-
const
|
|
827
|
+
const series = controller.getSeries(selection.seriesId);
|
|
828
|
+
const secondary = series?.axis === "secondary";
|
|
829
|
+
const scale = (secondary ? scene?.valueScale2 : null) ?? scene?.valueScale;
|
|
830
|
+
const ticks = scale?.ticks ?? [];
|
|
831
|
+
const up = event.key === "ArrowUp";
|
|
832
|
+
const current = series?.values[selection.index] ?? null;
|
|
833
|
+
if (scale?.logBase && current !== null && current > 0) {
|
|
834
|
+
const power = event.shiftKey ? 1 : event.altKey ? 0.01 : 0.1;
|
|
835
|
+
const next = Number((current * Math.pow(scale.logBase, up ? power : -power)).toPrecision(event.altKey ? 4 : 3));
|
|
836
|
+
controller.nudgeValue(selection.seriesId, selection.index, next - current);
|
|
837
|
+
return true;
|
|
838
|
+
}
|
|
810
839
|
const step = ticks.length > 1 ? ticks[1] - ticks[0] : 1;
|
|
811
840
|
const amount = event.shiftKey ? step : event.altKey ? step / 100 : step / 10;
|
|
812
|
-
controller.nudgeValue(selection.seriesId, selection.index, amount * (
|
|
841
|
+
controller.nudgeValue(selection.seriesId, selection.index, amount * (up ? 1 : -1));
|
|
813
842
|
return true;
|
|
814
843
|
}
|
|
815
844
|
default:
|
|
@@ -1056,7 +1085,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1056
1085
|
const updateChart = {
|
|
1057
1086
|
name: "update_chart",
|
|
1058
1087
|
title: "Change chart presentation",
|
|
1059
|
-
description:
|
|
1088
|
+
description: 'Changes how the chart looks, as one undo step: type, titles, axes (xAxis = categories or numeric x, yAxis = values, yAxis2 = secondary values; each can be reversed, and value axes can be logarithmic with scale "log"), legend, stacking, orientation, curve, points, data labels and their position, palette, donut hole, bar spacing, histogram bins, waterfall total. All-or-nothing: invalid values change nothing and come back as sentences. Returns the new spec.',
|
|
1060
1089
|
inputSchema: {
|
|
1061
1090
|
type: "object",
|
|
1062
1091
|
properties: CHART_UPDATE_PROPERTIES,
|
|
@@ -1144,7 +1173,7 @@ function createChartToolProvider(controller, options = {}) {
|
|
|
1144
1173
|
const updateSeries = {
|
|
1145
1174
|
name: "update_chart_series",
|
|
1146
1175
|
title: "Change a series",
|
|
1147
|
-
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (marker, curve, labels, format, x values, bubble sizes, point colours). null resets a field. Values change with set_chart_values. Returns the series.",
|
|
1176
|
+
description: "Renames, recolours, hides, moves to the secondary axis or changes how a series is drawn (marker, curve, labels, format, x values, bubble sizes, point colours, error bars). null resets a field. Values change with set_chart_values. Returns the series.",
|
|
1148
1177
|
inputSchema: {
|
|
1149
1178
|
type: "object",
|
|
1150
1179
|
properties: { series: SERIES_REF, ...Object.fromEntries(Object.entries(SERIES_PROPS).filter(([k]) => k !== "values")) },
|
|
@@ -2106,9 +2135,13 @@ function createOfficeChartToolProvider(options = {}) {
|
|
|
2106
2135
|
}
|
|
2107
2136
|
export {
|
|
2108
2137
|
CHART_AXIS_KINDS,
|
|
2138
|
+
CHART_AXIS_SCALES,
|
|
2109
2139
|
CHART_COLOR_SCHEMES,
|
|
2110
2140
|
CHART_CURVES,
|
|
2111
2141
|
CHART_DATE_STEPS,
|
|
2142
|
+
CHART_ERROR_BAR_DIRECTIONS,
|
|
2143
|
+
CHART_ERROR_BAR_LABELS,
|
|
2144
|
+
CHART_ERROR_BAR_TYPES,
|
|
2112
2145
|
CHART_LABEL_POSITIONS,
|
|
2113
2146
|
CHART_LAYOUT_PRESETS,
|
|
2114
2147
|
CHART_LEGEND_POSITIONS,
|
|
@@ -2152,6 +2185,8 @@ export {
|
|
|
2152
2185
|
chartDataToTable,
|
|
2153
2186
|
chartDateLabels,
|
|
2154
2187
|
chartDateToSerial,
|
|
2188
|
+
chartErrorAmounts,
|
|
2189
|
+
chartErrorBarsOfType,
|
|
2155
2190
|
chartFamily,
|
|
2156
2191
|
chartFileName,
|
|
2157
2192
|
chartFormatToCode,
|
|
@@ -2170,6 +2205,8 @@ export {
|
|
|
2170
2205
|
chartRasterSize,
|
|
2171
2206
|
chartRgbToHex,
|
|
2172
2207
|
chartRgbToOklab,
|
|
2208
|
+
chartScaleFromPixel,
|
|
2209
|
+
chartScaleToPixel,
|
|
2173
2210
|
chartSceneToDomSpec,
|
|
2174
2211
|
chartSceneToSvg,
|
|
2175
2212
|
chartSerialToDate,
|
|
@@ -2202,7 +2239,9 @@ export {
|
|
|
2202
2239
|
cyclePaletteColor,
|
|
2203
2240
|
decimateChartPoints,
|
|
2204
2241
|
defaultChartAxis,
|
|
2242
|
+
defaultChartErrorBarValue,
|
|
2205
2243
|
describeChart,
|
|
2244
|
+
describeChartErrorBars,
|
|
2206
2245
|
describeChartSelection,
|
|
2207
2246
|
describeOfficeChartPlace,
|
|
2208
2247
|
downloadChartPng,
|
|
@@ -2214,6 +2253,7 @@ export {
|
|
|
2214
2253
|
extractXlsxCharts,
|
|
2215
2254
|
findMermaidCharts,
|
|
2216
2255
|
fitChartTrendline,
|
|
2256
|
+
formatChartAmountList,
|
|
2217
2257
|
formatChartDate,
|
|
2218
2258
|
formatChartNumber,
|
|
2219
2259
|
formatChartValueWithCode,
|
|
@@ -2224,12 +2264,15 @@ export {
|
|
|
2224
2264
|
layoutSparkline,
|
|
2225
2265
|
linearMap,
|
|
2226
2266
|
monochromeChartPalette,
|
|
2267
|
+
niceLogScale,
|
|
2227
2268
|
niceScale,
|
|
2228
2269
|
niceStep,
|
|
2229
2270
|
normalizeChartAxis,
|
|
2271
|
+
normalizeChartErrorBars,
|
|
2230
2272
|
normalizeChartSpec,
|
|
2231
2273
|
normalizeChartTrendline,
|
|
2232
2274
|
normalizeChartValues,
|
|
2275
|
+
parseChartAmountList,
|
|
2233
2276
|
parseChartColor,
|
|
2234
2277
|
parseChartDate,
|
|
2235
2278
|
parseChartValue,
|