@pixerate/editor 0.162.1 → 0.164.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/README.md +1 -1
- package/dist/agent/index.cjs +34 -34
- package/dist/agent/index.js +5 -5
- package/dist/canvas/displacement.d.cts +34 -2
- package/dist/canvas/displacement.d.ts +34 -2
- package/dist/canvas/explosion-tools.d.cts +43 -0
- package/dist/canvas/explosion-tools.d.ts +43 -0
- package/dist/canvas/explosionLayout.d.cts +50 -0
- package/dist/canvas/explosionLayout.d.ts +50 -0
- package/dist/canvas/explosionState.d.cts +52 -0
- package/dist/canvas/explosionState.d.ts +52 -0
- package/dist/canvas/index.cjs +430 -88
- package/dist/canvas/index.d.cts +3 -0
- package/dist/canvas/index.d.ts +3 -0
- package/dist/canvas/index.js +425 -83
- package/dist/canvas/types.d.cts +27 -2
- package/dist/canvas/types.d.ts +27 -2
- package/dist/chart/commands.d.cts +2 -1
- package/dist/chart/commands.d.ts +2 -1
- package/dist/chart/controller.d.cts +109 -1
- package/dist/chart/controller.d.ts +109 -1
- package/dist/chart/index.cjs +605 -130
- package/dist/chart/index.d.cts +1 -0
- package/dist/chart/index.d.ts +1 -0
- package/dist/chart/index.js +490 -15
- package/dist/chart/layout-annotations.d.cts +29 -0
- package/dist/chart/layout-annotations.d.ts +29 -0
- package/dist/chart/layout-families.d.cts +23 -0
- package/dist/chart/layout-families.d.ts +23 -0
- package/dist/chart/mermaid.d.cts +2 -1
- package/dist/chart/mermaid.d.ts +2 -1
- package/dist/chart/schemas.d.cts +13 -0
- package/dist/chart/schemas.d.ts +13 -0
- package/dist/chart/spec.d.cts +30 -5
- package/dist/chart/spec.d.ts +30 -5
- package/dist/chart/stats.d.cts +9 -1
- package/dist/chart/stats.d.ts +9 -1
- package/dist/chart/tools.d.cts +1 -1
- package/dist/chart/tools.d.ts +1 -1
- package/dist/chart/tree.d.cts +62 -0
- package/dist/chart/tree.d.ts +62 -0
- package/dist/chart/types.d.cts +77 -3
- package/dist/chart/types.d.ts +77 -3
- package/dist/{chunk-7YBDRJXT.cjs → chunk-22KLZZGH.cjs} +8 -8
- package/dist/{chunk-HLOKB7WW.js → chunk-3NEZJCBY.js} +366 -6
- package/dist/{chunk-EVPZ5IKN.js → chunk-5FNGLV2D.js} +65 -3
- package/dist/{chunk-EQ46F75O.cjs → chunk-D54JHQK2.cjs} +51 -51
- package/dist/{chunk-NO5QQDHZ.js → chunk-DAPQGA55.js} +2 -2
- package/dist/{chunk-3IHNXRUV.cjs → chunk-GKNEJ6EN.cjs} +399 -67
- package/dist/{chunk-4NGVHHJB.cjs → chunk-NZD2MZJC.cjs} +80 -18
- package/dist/{chunk-CX6JLDFC.js → chunk-OXERWBKE.js} +3 -3
- package/dist/{chunk-7CKPUUN4.js → chunk-POR54B55.js} +61 -10
- package/dist/{chunk-LL3H5XUH.cjs → chunk-R3P2M7HU.cjs} +367 -7
- package/dist/{chunk-HDGBM7EA.cjs → chunk-SBQVEBSU.cjs} +580 -53
- package/dist/{chunk-XDCFJEU7.js → chunk-SZA42R4N.js} +346 -14
- package/dist/{chunk-GLMP22FT.js → chunk-TALQONZ5.js} +3 -3
- package/dist/{chunk-NA4UVVJ4.cjs → chunk-YGG7WDWT.cjs} +76 -25
- package/dist/{chunk-EY22AY6R.cjs → chunk-YSAGBIRW.cjs} +16 -16
- package/dist/{chunk-DTSTNRPH.js → chunk-Z4P2RBMJ.js} +536 -9
- package/dist/export/index.cjs +4 -4
- package/dist/export/index.js +3 -3
- package/dist/extensions/index.cjs +7 -7
- package/dist/extensions/index.js +6 -6
- package/dist/index.cjs +13 -13
- package/dist/index.js +7 -7
- package/dist/paint-editor/index.cjs +0 -20
- package/dist/paint-editor/index.js +0 -20
- package/package.json +1 -1
- package/skills/README.md +12 -0
- package/skills/pixerate-agent-tools/SKILL.md +34 -1
- package/skills/pixerate-canvas/SKILL.md +16 -0
- package/skills/pixerate-chart/SKILL.md +41 -9
- package/skills/pixerate-image-editor/SKILL.md +2 -0
- package/skills/pixerate-paint-editor/SKILL.md +2 -0
- package/skills/pixerate-tokens/SKILL.md +5 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type LayoutCtx } from './layout-shared.cjs';
|
|
2
|
+
import type { ScaleInfo } from './layout-cartesian.cjs';
|
|
3
|
+
import type { ChartRect, ChartReferenceAxis, ChartSpec } from './types.cjs';
|
|
4
|
+
/** Chart families that draw reference lines, bands and callouts. */
|
|
5
|
+
export declare const chartAnnotationFamily: (family: string) => family is "cartesian" | "xy";
|
|
6
|
+
/** Values the reference lines and bands on `axis` need the axis to reach. */
|
|
7
|
+
export declare function referenceValues(spec: Pick<ChartSpec, 'referenceLines' | 'referenceBands'>, axis: ChartReferenceAxis): number[];
|
|
8
|
+
/** One axis the references can be drawn on: its scale, and whether values run up the screen (`vertical`). */
|
|
9
|
+
export interface ReferenceAxis {
|
|
10
|
+
info: ScaleInfo;
|
|
11
|
+
vertical: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Draws the reference bands (`layer` `bands`, under the data) or lines (`lines`, over it) on
|
|
15
|
+
* the axes given. References on an axis the chart does not have are skipped with a warning.
|
|
16
|
+
*/
|
|
17
|
+
export declare function drawReferences(ctx: LayoutCtx, plot: ChartRect, axes: Partial<Record<ChartReferenceAxis, ReferenceAxis>>, layer: 'bands' | 'lines'): void;
|
|
18
|
+
/** Draws each series' callouts: a boxed label with a leader line to its bar or point, kept inside the plot and clear of the other callouts. */
|
|
19
|
+
export declare function drawCallouts(ctx: LayoutCtx, plot: ChartRect): void;
|
|
20
|
+
/**
|
|
21
|
+
* Mutes every data mark that `spec.highlight` does not name. A point stays bright when its
|
|
22
|
+
* category or its series is named; a whole series (line, area, legend entry) when it is named
|
|
23
|
+
* or no series is; a category when it is named or no category is.
|
|
24
|
+
*/
|
|
25
|
+
export declare function applyHighlight(ctx: LayoutCtx): void;
|
|
26
|
+
/** Height the note takes at the bottom of the chart (0 without one). */
|
|
27
|
+
export declare const noteHeight: (spec: ChartSpec, fs: number) => number;
|
|
28
|
+
/** Writes the note along the bottom left, shortened to the width. */
|
|
29
|
+
export declare function drawNote(ctx: LayoutCtx, pad: number): void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type LayoutCtx } from './layout-shared.js';
|
|
2
|
+
import type { ScaleInfo } from './layout-cartesian.js';
|
|
3
|
+
import type { ChartRect, ChartReferenceAxis, ChartSpec } from './types.js';
|
|
4
|
+
/** Chart families that draw reference lines, bands and callouts. */
|
|
5
|
+
export declare const chartAnnotationFamily: (family: string) => family is "cartesian" | "xy";
|
|
6
|
+
/** Values the reference lines and bands on `axis` need the axis to reach. */
|
|
7
|
+
export declare function referenceValues(spec: Pick<ChartSpec, 'referenceLines' | 'referenceBands'>, axis: ChartReferenceAxis): number[];
|
|
8
|
+
/** One axis the references can be drawn on: its scale, and whether values run up the screen (`vertical`). */
|
|
9
|
+
export interface ReferenceAxis {
|
|
10
|
+
info: ScaleInfo;
|
|
11
|
+
vertical: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Draws the reference bands (`layer` `bands`, under the data) or lines (`lines`, over it) on
|
|
15
|
+
* the axes given. References on an axis the chart does not have are skipped with a warning.
|
|
16
|
+
*/
|
|
17
|
+
export declare function drawReferences(ctx: LayoutCtx, plot: ChartRect, axes: Partial<Record<ChartReferenceAxis, ReferenceAxis>>, layer: 'bands' | 'lines'): void;
|
|
18
|
+
/** Draws each series' callouts: a boxed label with a leader line to its bar or point, kept inside the plot and clear of the other callouts. */
|
|
19
|
+
export declare function drawCallouts(ctx: LayoutCtx, plot: ChartRect): void;
|
|
20
|
+
/**
|
|
21
|
+
* Mutes every data mark that `spec.highlight` does not name. A point stays bright when its
|
|
22
|
+
* category or its series is named; a whole series (line, area, legend entry) when it is named
|
|
23
|
+
* or no series is; a category when it is named or no category is.
|
|
24
|
+
*/
|
|
25
|
+
export declare function applyHighlight(ctx: LayoutCtx): void;
|
|
26
|
+
/** Height the note takes at the bottom of the chart (0 without one). */
|
|
27
|
+
export declare const noteHeight: (spec: ChartSpec, fs: number) => number;
|
|
28
|
+
/** Writes the note along the bottom left, shortened to the width. */
|
|
29
|
+
export declare function drawNote(ctx: LayoutCtx, pad: number): void;
|
|
@@ -15,3 +15,26 @@ export declare function layoutFunnel(ctx: LayoutCtx, area: ChartRect, series: Ch
|
|
|
15
15
|
/** Treemap: the first series' positive values as nested rectangles (squarified), labelled where they fit. */
|
|
16
16
|
export declare function layoutTreemap(ctx: LayoutCtx, area: ChartRect, series: ChartSeries): FamilyResult;
|
|
17
17
|
export type { ChartMark };
|
|
18
|
+
/** Slope: each category's value in the first series (left) joined to the second (right), labelled at both ends. */
|
|
19
|
+
export declare function layoutSlope(ctx: LayoutCtx, area: ChartRect, visible: ChartSeries[]): FamilyResult;
|
|
20
|
+
/**
|
|
21
|
+
* Likert: one diverging bar per category (a question), the series (answers) from most negative
|
|
22
|
+
* to most positive, as shares of the question's total. Negative answers run left of the centre
|
|
23
|
+
* line, positive ones right; with an odd number of answers the middle one straddles the centre
|
|
24
|
+
* (`likertNeutral: 'split'`) or is drawn in its own column (`separate`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function layoutLikert(ctx: LayoutCtx, area: ChartRect, visible: ChartSeries[]): FamilyResult;
|
|
27
|
+
/** Parliament: the first series as seats in a hemicycle (rows of dots), one colour per category, with the majority line and the total. */
|
|
28
|
+
export declare function layoutParliament(ctx: LayoutCtx, area: ChartRect, series: ChartSeries): FamilyResult;
|
|
29
|
+
/**
|
|
30
|
+
* Treemap of `spec.tree`: each group a rectangle sized by its total, its children squarified
|
|
31
|
+
* inside under a header with its name, down to the leaves. Everything in a top-level group is
|
|
32
|
+
* drawn in its colour (leaves in lighter and darker shades) and selects that category.
|
|
33
|
+
*/
|
|
34
|
+
export declare function layoutTreemapTree(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
35
|
+
/**
|
|
36
|
+
* Sunburst: `spec.tree` as rings from the centre out, each node an arc sized by its total
|
|
37
|
+
* inside its parent's arc (without a tree, the first series as one ring). Labels go on arcs
|
|
38
|
+
* wide enough for them; the total and `sunburstLabel` sit in the centre.
|
|
39
|
+
*/
|
|
40
|
+
export declare function layoutSunburst(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
@@ -15,3 +15,26 @@ export declare function layoutFunnel(ctx: LayoutCtx, area: ChartRect, series: Ch
|
|
|
15
15
|
/** Treemap: the first series' positive values as nested rectangles (squarified), labelled where they fit. */
|
|
16
16
|
export declare function layoutTreemap(ctx: LayoutCtx, area: ChartRect, series: ChartSeries): FamilyResult;
|
|
17
17
|
export type { ChartMark };
|
|
18
|
+
/** Slope: each category's value in the first series (left) joined to the second (right), labelled at both ends. */
|
|
19
|
+
export declare function layoutSlope(ctx: LayoutCtx, area: ChartRect, visible: ChartSeries[]): FamilyResult;
|
|
20
|
+
/**
|
|
21
|
+
* Likert: one diverging bar per category (a question), the series (answers) from most negative
|
|
22
|
+
* to most positive, as shares of the question's total. Negative answers run left of the centre
|
|
23
|
+
* line, positive ones right; with an odd number of answers the middle one straddles the centre
|
|
24
|
+
* (`likertNeutral: 'split'`) or is drawn in its own column (`separate`).
|
|
25
|
+
*/
|
|
26
|
+
export declare function layoutLikert(ctx: LayoutCtx, area: ChartRect, visible: ChartSeries[]): FamilyResult;
|
|
27
|
+
/** Parliament: the first series as seats in a hemicycle (rows of dots), one colour per category, with the majority line and the total. */
|
|
28
|
+
export declare function layoutParliament(ctx: LayoutCtx, area: ChartRect, series: ChartSeries): FamilyResult;
|
|
29
|
+
/**
|
|
30
|
+
* Treemap of `spec.tree`: each group a rectangle sized by its total, its children squarified
|
|
31
|
+
* inside under a header with its name, down to the leaves. Everything in a top-level group is
|
|
32
|
+
* drawn in its colour (leaves in lighter and darker shades) and selects that category.
|
|
33
|
+
*/
|
|
34
|
+
export declare function layoutTreemapTree(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
|
35
|
+
/**
|
|
36
|
+
* Sunburst: `spec.tree` as rings from the centre out, each node an arc sized by its total
|
|
37
|
+
* inside its parent's arc (without a tree, the first series as one ring). Labels go on arcs
|
|
38
|
+
* wide enough for them; the total and `sunburstLabel` sit in the centre.
|
|
39
|
+
*/
|
|
40
|
+
export declare function layoutSunburst(ctx: LayoutCtx, area: ChartRect, series: ChartSeries | undefined): FamilyResult;
|
package/dist/chart/mermaid.d.cts
CHANGED
|
@@ -12,7 +12,8 @@ export interface ChartMermaidOptions {
|
|
|
12
12
|
export declare function chartMermaidFamily(spec: Pick<ChartSpec, 'type' | 'series'>): ChartMermaidFamily;
|
|
13
13
|
/**
|
|
14
14
|
* Writes a chart as Mermaid: `xychart-beta` for bar, line, area and scatter charts (areas and
|
|
15
|
-
* scatters drawn as lines), `pie` for pies, donuts,
|
|
15
|
+
* scatters drawn as lines; slopes and Likert charts as lines and bars), `pie` for pies, donuts,
|
|
16
|
+
* funnels, treemaps and parliaments, `radar-beta` for
|
|
16
17
|
* radars. Anything Mermaid cannot hold (stacking, colours, formats, gaps, trendlines, other
|
|
17
18
|
* chart types) goes into one `%% @pixerate {…}` comment so `chartFromMermaid` gets the chart
|
|
18
19
|
* back exactly, while any Mermaid renderer still draws the basic chart.
|
package/dist/chart/mermaid.d.ts
CHANGED
|
@@ -12,7 +12,8 @@ export interface ChartMermaidOptions {
|
|
|
12
12
|
export declare function chartMermaidFamily(spec: Pick<ChartSpec, 'type' | 'series'>): ChartMermaidFamily;
|
|
13
13
|
/**
|
|
14
14
|
* Writes a chart as Mermaid: `xychart-beta` for bar, line, area and scatter charts (areas and
|
|
15
|
-
* scatters drawn as lines), `pie` for pies, donuts,
|
|
15
|
+
* scatters drawn as lines; slopes and Likert charts as lines and bars), `pie` for pies, donuts,
|
|
16
|
+
* funnels, treemaps and parliaments, `radar-beta` for
|
|
16
17
|
* radars. Anything Mermaid cannot hold (stacking, colours, formats, gaps, trendlines, other
|
|
17
18
|
* chart types) goes into one `%% @pixerate {…}` comment so `chartFromMermaid` gets the chart
|
|
18
19
|
* back exactly, while any Mermaid renderer still draws the basic chart.
|
package/dist/chart/schemas.d.cts
CHANGED
|
@@ -7,6 +7,19 @@ export declare const HEIGHT: JsonSchema;
|
|
|
7
7
|
export declare const FORMAT: JsonSchema;
|
|
8
8
|
export declare const AXIS: (what: string) => JsonSchema;
|
|
9
9
|
export declare const TRENDLINE_PROPS: Record<string, JsonSchema>;
|
|
10
|
+
/** A reference line's fields; `value` is required when adding. */
|
|
11
|
+
export declare const REFERENCE_LINE_PROPS: Record<string, JsonSchema>;
|
|
12
|
+
/** A reference band's fields; `from` and `to` are required when adding. */
|
|
13
|
+
export declare const REFERENCE_BAND_PROPS: Record<string, JsonSchema>;
|
|
14
|
+
export declare const REFERENCE_LINE_PATCH: Record<string, JsonSchema>;
|
|
15
|
+
export declare const REFERENCE_BAND_PATCH: Record<string, JsonSchema>;
|
|
16
|
+
export declare const REFERENCE_INDEX: (what: string) => JsonSchema;
|
|
17
|
+
/** A tree node, recursive through `#/$defs/chartTreeNode` (tool schemas that use it carry `TREE_DEFS`). */
|
|
18
|
+
export declare const TREE_NODE: JsonSchema;
|
|
19
|
+
export declare const TREE_DEFS: {
|
|
20
|
+
chartTreeNode: JsonSchema;
|
|
21
|
+
};
|
|
22
|
+
export declare const TREE_PATH: JsonSchema;
|
|
10
23
|
export declare const ERROR_BARS: (what: string) => JsonSchema;
|
|
11
24
|
export declare const SERIES_PROPS: Record<string, JsonSchema>;
|
|
12
25
|
export declare const CHART_UPDATE_PROPERTIES: Record<string, JsonSchema>;
|
package/dist/chart/schemas.d.ts
CHANGED
|
@@ -7,6 +7,19 @@ export declare const HEIGHT: JsonSchema;
|
|
|
7
7
|
export declare const FORMAT: JsonSchema;
|
|
8
8
|
export declare const AXIS: (what: string) => JsonSchema;
|
|
9
9
|
export declare const TRENDLINE_PROPS: Record<string, JsonSchema>;
|
|
10
|
+
/** A reference line's fields; `value` is required when adding. */
|
|
11
|
+
export declare const REFERENCE_LINE_PROPS: Record<string, JsonSchema>;
|
|
12
|
+
/** A reference band's fields; `from` and `to` are required when adding. */
|
|
13
|
+
export declare const REFERENCE_BAND_PROPS: Record<string, JsonSchema>;
|
|
14
|
+
export declare const REFERENCE_LINE_PATCH: Record<string, JsonSchema>;
|
|
15
|
+
export declare const REFERENCE_BAND_PATCH: Record<string, JsonSchema>;
|
|
16
|
+
export declare const REFERENCE_INDEX: (what: string) => JsonSchema;
|
|
17
|
+
/** A tree node, recursive through `#/$defs/chartTreeNode` (tool schemas that use it carry `TREE_DEFS`). */
|
|
18
|
+
export declare const TREE_NODE: JsonSchema;
|
|
19
|
+
export declare const TREE_DEFS: {
|
|
20
|
+
chartTreeNode: JsonSchema;
|
|
21
|
+
};
|
|
22
|
+
export declare const TREE_PATH: JsonSchema;
|
|
10
23
|
export declare const ERROR_BARS: (what: string) => JsonSchema;
|
|
11
24
|
export declare const SERIES_PROPS: Record<string, JsonSchema>;
|
|
12
25
|
export declare const CHART_UPDATE_PROPERTIES: Record<string, JsonSchema>;
|
package/dist/chart/spec.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.cjs';
|
|
1
|
+
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartLikertNeutral, ChartLikertSort, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartReferenceAxis, ChartReferenceBand, ChartReferenceLine, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.cjs';
|
|
2
2
|
export declare const CHART_TYPES: readonly ChartType[];
|
|
3
3
|
export declare const CHART_MARKERS: readonly ChartMarker[];
|
|
4
4
|
export declare const CHART_TRENDLINE_TYPES: readonly ChartTrendlineType[];
|
|
@@ -9,13 +9,16 @@ export declare const CHART_SERIES_TYPES: readonly ChartSeriesType[];
|
|
|
9
9
|
export declare const CHART_STACKINGS: readonly ChartStacking[];
|
|
10
10
|
export declare const CHART_CURVES: readonly ChartCurve[];
|
|
11
11
|
export declare const CHART_RADAR_GRATICULES: readonly ChartRadarGraticule[];
|
|
12
|
+
export declare const CHART_LIKERT_NEUTRALS: readonly ChartLikertNeutral[];
|
|
13
|
+
export declare const CHART_LIKERT_SORTS: readonly ChartLikertSort[];
|
|
14
|
+
export declare const CHART_REFERENCE_AXES: readonly ChartReferenceAxis[];
|
|
12
15
|
export declare const CHART_ORIENTATIONS: readonly ChartOrientation[];
|
|
13
16
|
export declare const CHART_LEGEND_POSITIONS: readonly ChartLegendPosition[];
|
|
14
17
|
export declare const CHART_NUMBER_STYLES: readonly NonNullable<ChartNumberFormat['style']>[];
|
|
15
18
|
/** Labels for pickers, shared by the React and Svelte components. */
|
|
16
19
|
export declare const CHART_TYPE_LABELS: Readonly<Record<ChartType, string>>;
|
|
17
20
|
/** How a chart type is laid out. */
|
|
18
|
-
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap';
|
|
21
|
+
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst';
|
|
19
22
|
/** A colour-blind-friendly categorical palette (Okabe–Ito order, tuned for light and dark backgrounds). */
|
|
20
23
|
export declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
21
24
|
export declare const DEFAULT_CHART_THEME: ChartTheme;
|
|
@@ -33,15 +36,33 @@ export declare function isXyChart(spec: Pick<ChartSpec, 'type' | 'series'>): boo
|
|
|
33
36
|
export declare function chartFamily(spec: Pick<ChartSpec, 'type' | 'series'>): ChartFamily;
|
|
34
37
|
/** Chart types whose legend lists categories (one colour per category) rather than series. */
|
|
35
38
|
export declare function chartColorsByCategory(type: ChartType): boolean;
|
|
39
|
+
/** Whether this chart colours by category: a pie-like type, or `varyColors` on a one-series chart. */
|
|
40
|
+
export declare function chartSpecColorsByCategory(spec: Pick<ChartSpec, 'type' | 'series'> & {
|
|
41
|
+
varyColors?: boolean;
|
|
42
|
+
}): boolean;
|
|
36
43
|
export declare function defaultChartAxis(value: boolean): ChartAxis;
|
|
37
44
|
/** A complete spec with every default filled in. */
|
|
38
45
|
export declare function createChartSpec(partial?: Partial<ChartSpec>): ChartSpec;
|
|
39
46
|
/** The colour a series is drawn with. */
|
|
40
|
-
export declare function chartSeriesColor(spec: Pick<ChartSpec, 'palette' | 'series'
|
|
47
|
+
export declare function chartSeriesColor(spec: Pick<ChartSpec, 'palette' | 'series'> & {
|
|
48
|
+
type?: ChartType;
|
|
49
|
+
}, seriesIndex: number): string;
|
|
50
|
+
/**
|
|
51
|
+
* The colour of answer `index` of `count` on a Likert chart: oranges for the negative half
|
|
52
|
+
* (darkest first), grey for a middle answer, purples for the positive half (darkest last).
|
|
53
|
+
*/
|
|
54
|
+
export declare function chartLikertColor(count: number, index: number): string;
|
|
41
55
|
/** The colour a pie slice is drawn with (by category). */
|
|
42
56
|
export declare function chartSliceColor(spec: Pick<ChartSpec, 'palette'>, index: number): string;
|
|
43
|
-
/**
|
|
44
|
-
export declare function
|
|
57
|
+
/** Whether `varyColors` applies: a bar, line, area or scatter chart with one visible series. */
|
|
58
|
+
export declare function chartVariesColors(spec: Pick<ChartSpec, 'type' | 'series'> & {
|
|
59
|
+
varyColors?: boolean;
|
|
60
|
+
}): boolean;
|
|
61
|
+
/** The colour of one bar or point: its override, else the palette colour of its category (`varyColors`), else the series colour. */
|
|
62
|
+
export declare function chartPointColor(spec: Pick<ChartSpec, 'palette' | 'series'> & {
|
|
63
|
+
type?: ChartType;
|
|
64
|
+
varyColors?: boolean;
|
|
65
|
+
}, seriesIndex: number, index: number): string;
|
|
45
66
|
/** How a series is drawn in a cartesian chart. */
|
|
46
67
|
export declare function chartSeriesType(spec: Pick<ChartSpec, 'type'>, series: ChartSeries): ChartSeriesType;
|
|
47
68
|
/** An id not used by any series (`series-1`, `series-2`, …). */
|
|
@@ -54,6 +75,10 @@ export declare function parseChartValue(input: unknown): ChartValue | undefined;
|
|
|
54
75
|
export declare function normalizeChartAxis(value: unknown, fallback: ChartAxis, path: string, issues?: ChartIssue[]): ChartAxis;
|
|
55
76
|
/** Values as numbers or nulls; bad entries become null and are reported. */
|
|
56
77
|
export declare function normalizeChartValues(value: unknown, length: number | undefined, path: string, issues?: ChartIssue[]): ChartValue[];
|
|
78
|
+
/** Checks one reference line; `null` (reported) when it has no usable value. */
|
|
79
|
+
export declare function normalizeChartReferenceLine(value: unknown, path: string, issues?: ChartIssue[]): ChartReferenceLine | null;
|
|
80
|
+
/** Checks one reference band; `null` (reported) when its ends are not numbers. Ends are put in order. */
|
|
81
|
+
export declare function normalizeChartReferenceBand(value: unknown, path: string, issues?: ChartIssue[]): ChartReferenceBand | null;
|
|
57
82
|
/** Checks one set of error bars; `null` (reported) when it is unusable. Custom amounts are padded to `length`. */
|
|
58
83
|
export declare function normalizeChartErrorBars(value: unknown, length: number, path: string, issues?: ChartIssue[]): ChartErrorBars | null;
|
|
59
84
|
/** Checks one trendline; `null` (reported) when it is unusable. */
|
package/dist/chart/spec.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.js';
|
|
1
|
+
import type { ChartAxis, ChartCurve, ChartErrorBars, ChartIssue, ChartLabelPosition, ChartLegendPosition, ChartLikertNeutral, ChartLikertSort, ChartMarker, ChartNumberFormat, ChartOrientation, ChartRadarGraticule, ChartReferenceAxis, ChartReferenceBand, ChartReferenceLine, ChartSeries, ChartSeriesType, ChartSpec, ChartStacking, ChartTheme, ChartTrendline, ChartTrendlineType, ChartType, ChartValue } from './types.js';
|
|
2
2
|
export declare const CHART_TYPES: readonly ChartType[];
|
|
3
3
|
export declare const CHART_MARKERS: readonly ChartMarker[];
|
|
4
4
|
export declare const CHART_TRENDLINE_TYPES: readonly ChartTrendlineType[];
|
|
@@ -9,13 +9,16 @@ export declare const CHART_SERIES_TYPES: readonly ChartSeriesType[];
|
|
|
9
9
|
export declare const CHART_STACKINGS: readonly ChartStacking[];
|
|
10
10
|
export declare const CHART_CURVES: readonly ChartCurve[];
|
|
11
11
|
export declare const CHART_RADAR_GRATICULES: readonly ChartRadarGraticule[];
|
|
12
|
+
export declare const CHART_LIKERT_NEUTRALS: readonly ChartLikertNeutral[];
|
|
13
|
+
export declare const CHART_LIKERT_SORTS: readonly ChartLikertSort[];
|
|
14
|
+
export declare const CHART_REFERENCE_AXES: readonly ChartReferenceAxis[];
|
|
12
15
|
export declare const CHART_ORIENTATIONS: readonly ChartOrientation[];
|
|
13
16
|
export declare const CHART_LEGEND_POSITIONS: readonly ChartLegendPosition[];
|
|
14
17
|
export declare const CHART_NUMBER_STYLES: readonly NonNullable<ChartNumberFormat['style']>[];
|
|
15
18
|
/** Labels for pickers, shared by the React and Svelte components. */
|
|
16
19
|
export declare const CHART_TYPE_LABELS: Readonly<Record<ChartType, string>>;
|
|
17
20
|
/** How a chart type is laid out. */
|
|
18
|
-
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap';
|
|
21
|
+
export type ChartFamily = 'cartesian' | 'xy' | 'pie' | 'radar' | 'waterfall' | 'histogram' | 'box' | 'funnel' | 'treemap' | 'slope' | 'likert' | 'parliament' | 'sunburst';
|
|
19
22
|
/** A colour-blind-friendly categorical palette (Okabe–Ito order, tuned for light and dark backgrounds). */
|
|
20
23
|
export declare const DEFAULT_CHART_PALETTE: readonly string[];
|
|
21
24
|
export declare const DEFAULT_CHART_THEME: ChartTheme;
|
|
@@ -33,15 +36,33 @@ export declare function isXyChart(spec: Pick<ChartSpec, 'type' | 'series'>): boo
|
|
|
33
36
|
export declare function chartFamily(spec: Pick<ChartSpec, 'type' | 'series'>): ChartFamily;
|
|
34
37
|
/** Chart types whose legend lists categories (one colour per category) rather than series. */
|
|
35
38
|
export declare function chartColorsByCategory(type: ChartType): boolean;
|
|
39
|
+
/** Whether this chart colours by category: a pie-like type, or `varyColors` on a one-series chart. */
|
|
40
|
+
export declare function chartSpecColorsByCategory(spec: Pick<ChartSpec, 'type' | 'series'> & {
|
|
41
|
+
varyColors?: boolean;
|
|
42
|
+
}): boolean;
|
|
36
43
|
export declare function defaultChartAxis(value: boolean): ChartAxis;
|
|
37
44
|
/** A complete spec with every default filled in. */
|
|
38
45
|
export declare function createChartSpec(partial?: Partial<ChartSpec>): ChartSpec;
|
|
39
46
|
/** The colour a series is drawn with. */
|
|
40
|
-
export declare function chartSeriesColor(spec: Pick<ChartSpec, 'palette' | 'series'
|
|
47
|
+
export declare function chartSeriesColor(spec: Pick<ChartSpec, 'palette' | 'series'> & {
|
|
48
|
+
type?: ChartType;
|
|
49
|
+
}, seriesIndex: number): string;
|
|
50
|
+
/**
|
|
51
|
+
* The colour of answer `index` of `count` on a Likert chart: oranges for the negative half
|
|
52
|
+
* (darkest first), grey for a middle answer, purples for the positive half (darkest last).
|
|
53
|
+
*/
|
|
54
|
+
export declare function chartLikertColor(count: number, index: number): string;
|
|
41
55
|
/** The colour a pie slice is drawn with (by category). */
|
|
42
56
|
export declare function chartSliceColor(spec: Pick<ChartSpec, 'palette'>, index: number): string;
|
|
43
|
-
/**
|
|
44
|
-
export declare function
|
|
57
|
+
/** Whether `varyColors` applies: a bar, line, area or scatter chart with one visible series. */
|
|
58
|
+
export declare function chartVariesColors(spec: Pick<ChartSpec, 'type' | 'series'> & {
|
|
59
|
+
varyColors?: boolean;
|
|
60
|
+
}): boolean;
|
|
61
|
+
/** The colour of one bar or point: its override, else the palette colour of its category (`varyColors`), else the series colour. */
|
|
62
|
+
export declare function chartPointColor(spec: Pick<ChartSpec, 'palette' | 'series'> & {
|
|
63
|
+
type?: ChartType;
|
|
64
|
+
varyColors?: boolean;
|
|
65
|
+
}, seriesIndex: number, index: number): string;
|
|
45
66
|
/** How a series is drawn in a cartesian chart. */
|
|
46
67
|
export declare function chartSeriesType(spec: Pick<ChartSpec, 'type'>, series: ChartSeries): ChartSeriesType;
|
|
47
68
|
/** An id not used by any series (`series-1`, `series-2`, …). */
|
|
@@ -54,6 +75,10 @@ export declare function parseChartValue(input: unknown): ChartValue | undefined;
|
|
|
54
75
|
export declare function normalizeChartAxis(value: unknown, fallback: ChartAxis, path: string, issues?: ChartIssue[]): ChartAxis;
|
|
55
76
|
/** Values as numbers or nulls; bad entries become null and are reported. */
|
|
56
77
|
export declare function normalizeChartValues(value: unknown, length: number | undefined, path: string, issues?: ChartIssue[]): ChartValue[];
|
|
78
|
+
/** Checks one reference line; `null` (reported) when it has no usable value. */
|
|
79
|
+
export declare function normalizeChartReferenceLine(value: unknown, path: string, issues?: ChartIssue[]): ChartReferenceLine | null;
|
|
80
|
+
/** Checks one reference band; `null` (reported) when its ends are not numbers. Ends are put in order. */
|
|
81
|
+
export declare function normalizeChartReferenceBand(value: unknown, path: string, issues?: ChartIssue[]): ChartReferenceBand | null;
|
|
57
82
|
/** Checks one set of error bars; `null` (reported) when it is unusable. Custom amounts are padded to `length`. */
|
|
58
83
|
export declare function normalizeChartErrorBars(value: unknown, length: number, path: string, issues?: ChartIssue[]): ChartErrorBars | null;
|
|
59
84
|
/** Checks one trendline; `null` (reported) when it is unusable. */
|
package/dist/chart/stats.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartRect, ChartValue } from './types.cjs';
|
|
1
|
+
import type { ChartRect, ChartReferenceBand, ChartReferenceLine, ChartSpec, ChartValue } from './types.cjs';
|
|
2
2
|
export interface ChartHistogramBin {
|
|
3
3
|
/** Lower edge (exclusive, except for the first bin). */
|
|
4
4
|
from: number;
|
|
@@ -14,6 +14,14 @@ export interface ChartHistogramBin {
|
|
|
14
14
|
export declare function chartHistogram(values: readonly ChartValue[], bins?: number | null): ChartHistogramBin[];
|
|
15
15
|
/** The `q` quantile (0–1) of sorted values, interpolating linearly between ranks (`q·(n-1)`). */
|
|
16
16
|
export declare function chartQuantile(sorted: readonly number[], q: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Starting points for a new reference line and band, from the visible values on the primary
|
|
19
|
+
* axis: a line at their average and a band over their middle half (first to third quartile).
|
|
20
|
+
*/
|
|
21
|
+
export declare function suggestChartReferences(spec: Pick<ChartSpec, 'series'>): {
|
|
22
|
+
line: ChartReferenceLine;
|
|
23
|
+
band: ChartReferenceBand;
|
|
24
|
+
};
|
|
17
25
|
export interface ChartBoxStats {
|
|
18
26
|
min: number;
|
|
19
27
|
max: number;
|
package/dist/chart/stats.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChartRect, ChartValue } from './types.js';
|
|
1
|
+
import type { ChartRect, ChartReferenceBand, ChartReferenceLine, ChartSpec, ChartValue } from './types.js';
|
|
2
2
|
export interface ChartHistogramBin {
|
|
3
3
|
/** Lower edge (exclusive, except for the first bin). */
|
|
4
4
|
from: number;
|
|
@@ -14,6 +14,14 @@ export interface ChartHistogramBin {
|
|
|
14
14
|
export declare function chartHistogram(values: readonly ChartValue[], bins?: number | null): ChartHistogramBin[];
|
|
15
15
|
/** The `q` quantile (0–1) of sorted values, interpolating linearly between ranks (`q·(n-1)`). */
|
|
16
16
|
export declare function chartQuantile(sorted: readonly number[], q: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Starting points for a new reference line and band, from the visible values on the primary
|
|
19
|
+
* axis: a line at their average and a band over their middle half (first to third quartile).
|
|
20
|
+
*/
|
|
21
|
+
export declare function suggestChartReferences(spec: Pick<ChartSpec, 'series'>): {
|
|
22
|
+
line: ChartReferenceLine;
|
|
23
|
+
band: ChartReferenceBand;
|
|
24
|
+
};
|
|
17
25
|
export interface ChartBoxStats {
|
|
18
26
|
min: number;
|
|
19
27
|
max: number;
|
package/dist/chart/tools.d.cts
CHANGED
|
@@ -54,7 +54,7 @@ export declare const RENDER_CHART_INSTRUCTIONS = "Draws the chart without changi
|
|
|
54
54
|
* Agent tools for a chart editor, for a `ToolRegistry`: one tool per operation with strict
|
|
55
55
|
* schemas. Reads (`get_chart`, `render_chart`, `check_chart_colors`, `recommend_chart`,
|
|
56
56
|
* `get_chart_trendline`, `list_chart_presets`, `export_chart_mermaid`, `export_chart_ooxml`)
|
|
57
|
-
* are always there; writes (data, series, categories, presentation, trendlines, presets,
|
|
57
|
+
* are always there; writes (data, series, categories, presentation, trendlines, reference lines and bands, callouts, highlight, presets,
|
|
58
58
|
* imports, selection, pointer and key input, undo / redo) are hidden while the chart is
|
|
59
59
|
* read-only. Every write is one undo step and returns what it changed.
|
|
60
60
|
*/
|
package/dist/chart/tools.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ export declare const RENDER_CHART_INSTRUCTIONS = "Draws the chart without changi
|
|
|
54
54
|
* Agent tools for a chart editor, for a `ToolRegistry`: one tool per operation with strict
|
|
55
55
|
* schemas. Reads (`get_chart`, `render_chart`, `check_chart_colors`, `recommend_chart`,
|
|
56
56
|
* `get_chart_trendline`, `list_chart_presets`, `export_chart_mermaid`, `export_chart_ooxml`)
|
|
57
|
-
* are always there; writes (data, series, categories, presentation, trendlines, presets,
|
|
57
|
+
* are always there; writes (data, series, categories, presentation, trendlines, reference lines and bands, callouts, highlight, presets,
|
|
58
58
|
* imports, selection, pointer and key input, undo / redo) are hidden while the chart is
|
|
59
59
|
* read-only. Every write is one undo step and returns what it changed.
|
|
60
60
|
*/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ChartIssue, ChartTreeNode } from './types.cjs';
|
|
2
|
+
/** Deepest tree the editor keeps (a sunburst draws one ring per level). */
|
|
3
|
+
export declare const MAX_CHART_TREE_DEPTH = 6;
|
|
4
|
+
/** Most nodes a tree may have. */
|
|
5
|
+
export declare const MAX_CHART_TREE_NODES = 5000;
|
|
6
|
+
/**
|
|
7
|
+
* Checks a tree: every node has a name unique among its siblings, leaves have a value of 0 or
|
|
8
|
+
* more, groups have children. Problems are reported with the node's path and the node is
|
|
9
|
+
* dropped (or its value set to 0), so the rest of the tree is kept.
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeChartTree(value: unknown, issues?: ChartIssue[], path?: string): ChartTreeNode[];
|
|
12
|
+
/** The value of a node: its own, or the sum of its leaves. */
|
|
13
|
+
export declare function chartTreeTotal(node: ChartTreeNode): number;
|
|
14
|
+
/** Levels in the tree (1 for a flat list of leaves, 0 for none). */
|
|
15
|
+
export declare function chartTreeDepth(tree: readonly ChartTreeNode[]): number;
|
|
16
|
+
/** The node at a path of names from the top, or undefined. */
|
|
17
|
+
export declare function findChartTreeNode(tree: readonly ChartTreeNode[], path: readonly string[]): ChartTreeNode | undefined;
|
|
18
|
+
/** One leaf as a row: the names from the top down to it, and its value. */
|
|
19
|
+
export interface ChartTreeRow {
|
|
20
|
+
path: string[];
|
|
21
|
+
value: number;
|
|
22
|
+
}
|
|
23
|
+
/** Every leaf of the tree as a row, in order (the tree as a table: group, …, name, value). */
|
|
24
|
+
export declare function chartTreeToRows(tree: readonly ChartTreeNode[]): ChartTreeRow[];
|
|
25
|
+
/**
|
|
26
|
+
* Builds a tree from rows of names and a value: rows that share leading names share those
|
|
27
|
+
* groups, in the order they first appear. Empty names end a path. A name that is both a leaf
|
|
28
|
+
* and a group, or a repeated path, is reported; the first wins.
|
|
29
|
+
*/
|
|
30
|
+
export declare function chartTreeFromRows(rows: readonly {
|
|
31
|
+
path: readonly unknown[];
|
|
32
|
+
value: unknown;
|
|
33
|
+
}[], issues?: ChartIssue[]): ChartTreeNode[];
|
|
34
|
+
/**
|
|
35
|
+
* Reads a table as a tree: every column but the last holds names (group, subgroup, …, item),
|
|
36
|
+
* the last holds the value. Blank names repeat the name above (as spreadsheets lay out groups).
|
|
37
|
+
* With `header` (default `auto`: when the first row's last cell is not a number) the first row
|
|
38
|
+
* is skipped.
|
|
39
|
+
*/
|
|
40
|
+
export declare function chartTreeFromTable(rows: ReadonlyArray<ReadonlyArray<unknown>>, options?: {
|
|
41
|
+
header?: boolean | 'auto';
|
|
42
|
+
}, issues?: ChartIssue[]): ChartTreeNode[];
|
|
43
|
+
/** A flat tree (one leaf per category) from labels and values, for starting to group a table. */
|
|
44
|
+
export declare function chartTreeFromSeries(categories: readonly string[], values: readonly (number | null)[]): ChartTreeNode[];
|
|
45
|
+
/** A deep copy. */
|
|
46
|
+
export declare function cloneChartTree(tree: readonly ChartTreeNode[]): ChartTreeNode[];
|
|
47
|
+
/** Column headings for a tree table `depth` levels deep: Group, Level 2, …, Item. */
|
|
48
|
+
export declare function chartTreeColumnLabels(depth: number): string[];
|
|
49
|
+
/** Rows with the name at `level` of row `row` set (shorter paths are padded with blanks; a blank name ends the path there). */
|
|
50
|
+
export declare function setChartTreeRowName(rows: readonly ChartTreeRow[], row: number, level: number, name: string): {
|
|
51
|
+
path: string[];
|
|
52
|
+
value: unknown;
|
|
53
|
+
}[];
|
|
54
|
+
/** Rows with row `row`'s value set (text is parsed by `setTreeRows`). */
|
|
55
|
+
export declare function setChartTreeRowValue(rows: readonly ChartTreeRow[], row: number, value: unknown): {
|
|
56
|
+
path: string[];
|
|
57
|
+
value: unknown;
|
|
58
|
+
}[];
|
|
59
|
+
/** Rows with a new item after the last row, in the same group, named "Item n" (unique there), value 0. */
|
|
60
|
+
export declare function addChartTreeRow(rows: readonly ChartTreeRow[]): ChartTreeRow[];
|
|
61
|
+
/** Rows without row `row`. */
|
|
62
|
+
export declare function removeChartTreeRow(rows: readonly ChartTreeRow[], row: number): ChartTreeRow[];
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ChartIssue, ChartTreeNode } from './types.js';
|
|
2
|
+
/** Deepest tree the editor keeps (a sunburst draws one ring per level). */
|
|
3
|
+
export declare const MAX_CHART_TREE_DEPTH = 6;
|
|
4
|
+
/** Most nodes a tree may have. */
|
|
5
|
+
export declare const MAX_CHART_TREE_NODES = 5000;
|
|
6
|
+
/**
|
|
7
|
+
* Checks a tree: every node has a name unique among its siblings, leaves have a value of 0 or
|
|
8
|
+
* more, groups have children. Problems are reported with the node's path and the node is
|
|
9
|
+
* dropped (or its value set to 0), so the rest of the tree is kept.
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeChartTree(value: unknown, issues?: ChartIssue[], path?: string): ChartTreeNode[];
|
|
12
|
+
/** The value of a node: its own, or the sum of its leaves. */
|
|
13
|
+
export declare function chartTreeTotal(node: ChartTreeNode): number;
|
|
14
|
+
/** Levels in the tree (1 for a flat list of leaves, 0 for none). */
|
|
15
|
+
export declare function chartTreeDepth(tree: readonly ChartTreeNode[]): number;
|
|
16
|
+
/** The node at a path of names from the top, or undefined. */
|
|
17
|
+
export declare function findChartTreeNode(tree: readonly ChartTreeNode[], path: readonly string[]): ChartTreeNode | undefined;
|
|
18
|
+
/** One leaf as a row: the names from the top down to it, and its value. */
|
|
19
|
+
export interface ChartTreeRow {
|
|
20
|
+
path: string[];
|
|
21
|
+
value: number;
|
|
22
|
+
}
|
|
23
|
+
/** Every leaf of the tree as a row, in order (the tree as a table: group, …, name, value). */
|
|
24
|
+
export declare function chartTreeToRows(tree: readonly ChartTreeNode[]): ChartTreeRow[];
|
|
25
|
+
/**
|
|
26
|
+
* Builds a tree from rows of names and a value: rows that share leading names share those
|
|
27
|
+
* groups, in the order they first appear. Empty names end a path. A name that is both a leaf
|
|
28
|
+
* and a group, or a repeated path, is reported; the first wins.
|
|
29
|
+
*/
|
|
30
|
+
export declare function chartTreeFromRows(rows: readonly {
|
|
31
|
+
path: readonly unknown[];
|
|
32
|
+
value: unknown;
|
|
33
|
+
}[], issues?: ChartIssue[]): ChartTreeNode[];
|
|
34
|
+
/**
|
|
35
|
+
* Reads a table as a tree: every column but the last holds names (group, subgroup, …, item),
|
|
36
|
+
* the last holds the value. Blank names repeat the name above (as spreadsheets lay out groups).
|
|
37
|
+
* With `header` (default `auto`: when the first row's last cell is not a number) the first row
|
|
38
|
+
* is skipped.
|
|
39
|
+
*/
|
|
40
|
+
export declare function chartTreeFromTable(rows: ReadonlyArray<ReadonlyArray<unknown>>, options?: {
|
|
41
|
+
header?: boolean | 'auto';
|
|
42
|
+
}, issues?: ChartIssue[]): ChartTreeNode[];
|
|
43
|
+
/** A flat tree (one leaf per category) from labels and values, for starting to group a table. */
|
|
44
|
+
export declare function chartTreeFromSeries(categories: readonly string[], values: readonly (number | null)[]): ChartTreeNode[];
|
|
45
|
+
/** A deep copy. */
|
|
46
|
+
export declare function cloneChartTree(tree: readonly ChartTreeNode[]): ChartTreeNode[];
|
|
47
|
+
/** Column headings for a tree table `depth` levels deep: Group, Level 2, …, Item. */
|
|
48
|
+
export declare function chartTreeColumnLabels(depth: number): string[];
|
|
49
|
+
/** Rows with the name at `level` of row `row` set (shorter paths are padded with blanks; a blank name ends the path there). */
|
|
50
|
+
export declare function setChartTreeRowName(rows: readonly ChartTreeRow[], row: number, level: number, name: string): {
|
|
51
|
+
path: string[];
|
|
52
|
+
value: unknown;
|
|
53
|
+
}[];
|
|
54
|
+
/** Rows with row `row`'s value set (text is parsed by `setTreeRows`). */
|
|
55
|
+
export declare function setChartTreeRowValue(rows: readonly ChartTreeRow[], row: number, value: unknown): {
|
|
56
|
+
path: string[];
|
|
57
|
+
value: unknown;
|
|
58
|
+
}[];
|
|
59
|
+
/** Rows with a new item after the last row, in the same group, named "Item n" (unique there), value 0. */
|
|
60
|
+
export declare function addChartTreeRow(rows: readonly ChartTreeRow[]): ChartTreeRow[];
|
|
61
|
+
/** Rows without row `row`. */
|
|
62
|
+
export declare function removeChartTreeRow(rows: readonly ChartTreeRow[], row: number): ChartTreeRow[];
|