@lexaxai/spreadsheet-engine 0.0.0-stage → 0.1.0-dryrun.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/LICENSE +202 -0
- package/index.d.ts +2282 -0
- package/index.js +865 -0
- package/lexax.darwin-arm64.node +0 -0
- package/package.json +24 -4
- package/types/calc.d.ts +260 -0
- package/types/chart.d.ts +479 -0
- package/types/chart_ex.d.ts +379 -0
- package/types/chart_format.d.ts +440 -0
- package/types/chart_series.d.ts +336 -0
- package/types/drawings.d.ts +383 -0
- package/types/files.d.ts +367 -0
- package/types/formats.d.ts +380 -0
- package/types/page.d.ts +352 -0
- package/types/render.d.ts +137 -0
- package/types/sheet.d.ts +432 -0
- package/types/styles.d.ts +383 -0
- package/types/tables.d.ts +420 -0
- package/types/validation.d.ts +151 -0
- package/types/values.d.ts +280 -0
- package/README.md +0 -3
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
// A chart's series and what hangs on them: trendlines, error bars,
|
|
2
|
+
// markers, single points and the data labels.
|
|
3
|
+
|
|
4
|
+
import type { ChartPictureOptions, ChartSubType, ChartType } from './chart';
|
|
5
|
+
import type { ChartColor, ChartEffects, ChartFill, ChartFont, ChartLine, ChartOutline, ChartShapeFormat } from './chart_format';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* One series of a chart: the cells it plots, its name, its type and its formatting. `Worksheet.addChart`
|
|
9
|
+
* takes a list of these.
|
|
10
|
+
*/
|
|
11
|
+
export interface ChartSeries {
|
|
12
|
+
/**
|
|
13
|
+
* A cell reference such as `'Sheet1!$B$1'` keeps the name live in Excel;
|
|
14
|
+
* any other string is used as a literal.
|
|
15
|
+
*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/** overrides the chart-level categories */
|
|
18
|
+
categories?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The cells holding the series' values, as a reference such as `'Data!$B$2:$B$13'`.
|
|
21
|
+
*/
|
|
22
|
+
values?: string;
|
|
23
|
+
/** scatter and bubble charts */
|
|
24
|
+
xValues?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The cells holding the y values of a scatter or bubble series. `values` is used where this is left out.
|
|
27
|
+
*/
|
|
28
|
+
yValues?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The cells holding the bubble sizes of a bubble series.
|
|
31
|
+
*/
|
|
32
|
+
bubbleSizes?: string;
|
|
33
|
+
/** set to make this series a different type from the rest - that is a combo chart */
|
|
34
|
+
type?: ChartType;
|
|
35
|
+
/**
|
|
36
|
+
* How the series relates to the others in its plot group, as `ChartSubType` gives it, such as `'stacked'`.
|
|
37
|
+
*/
|
|
38
|
+
subType?: ChartSubType;
|
|
39
|
+
/** plot against the secondary value axis */
|
|
40
|
+
axis?: 'primary' | 'secondary';
|
|
41
|
+
/**
|
|
42
|
+
* The colour of the series: its fill for a bar, area or pie series, or its line for a line series. A series
|
|
43
|
+
* without one takes a default colour.
|
|
44
|
+
*/
|
|
45
|
+
color?: ChartColor;
|
|
46
|
+
/**
|
|
47
|
+
* The series' line, as `ChartLine`, or `false` for no line.
|
|
48
|
+
*/
|
|
49
|
+
line?: ChartLine | false;
|
|
50
|
+
/**
|
|
51
|
+
* The series' markers, as `ChartMarker`, or `false` for none.
|
|
52
|
+
*/
|
|
53
|
+
marker?: ChartMarker | false;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the line joins the points with a smooth curve.
|
|
56
|
+
*/
|
|
57
|
+
smooth?: boolean;
|
|
58
|
+
/** pie/doughnut slice offset */
|
|
59
|
+
explosion?: number;
|
|
60
|
+
/** bar3D per-series bar shape */
|
|
61
|
+
shape?: 'cone' | 'coneToMax' | 'box' | 'cylinder' | 'pyramid' | 'pyramidToMax';
|
|
62
|
+
/**
|
|
63
|
+
* The data labels of the series, as `ChartDataLabels`.
|
|
64
|
+
*/
|
|
65
|
+
dataLabels?: ChartDataLabels;
|
|
66
|
+
/** formatting for single points: a pie slice's colour, one bar picked out */
|
|
67
|
+
points?: ChartPoint[];
|
|
68
|
+
/**
|
|
69
|
+
* The fill of the series, as `ChartFill`: a colour, a gradient, a pattern or a picture.
|
|
70
|
+
*/
|
|
71
|
+
fill?: ChartFill;
|
|
72
|
+
/**
|
|
73
|
+
* The border of the series, as `ChartOutline`, or `false` for none.
|
|
74
|
+
*/
|
|
75
|
+
border?: ChartOutline | false;
|
|
76
|
+
/**
|
|
77
|
+
* The effects of the series, as `ChartEffects`, or `false` for none.
|
|
78
|
+
*/
|
|
79
|
+
effects?: ChartEffects | false;
|
|
80
|
+
/**
|
|
81
|
+
* The transparency of the series' fill, in percent.
|
|
82
|
+
*/
|
|
83
|
+
transparency?: number;
|
|
84
|
+
/**
|
|
85
|
+
* bar and bubble: draw values below zero inverted - white, or in `color`
|
|
86
|
+
*/
|
|
87
|
+
invertIfNegative?: boolean | {color: ChartColor};
|
|
88
|
+
/** bar and area: how a picture fill is laid */
|
|
89
|
+
pictureOptions?: ChartPictureOptions;
|
|
90
|
+
/** bubble: shade this series' bubbles as spheres */
|
|
91
|
+
bubble3D?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Legal on bar, line, area, scatter, bubble and stock. A single object or a
|
|
94
|
+
* list; `getCharts()` always reads them back as a list.
|
|
95
|
+
*/
|
|
96
|
+
trendline?: ChartTrendline | ChartTrendline[];
|
|
97
|
+
/**
|
|
98
|
+
* Legal on bar, bar3D, line, area, scatter, bubble and stock. Scatter and
|
|
99
|
+
* bubble may carry two sets - one per axis, distinguished by `direction`.
|
|
100
|
+
*/
|
|
101
|
+
errorBars?: ChartErrorBars | ChartErrorBars[];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The type of trendline: `'linear'`, `'exp'` (exponential), `'log'` (logarithmic), `'poly'` (polynomial),
|
|
106
|
+
* `'power'` or `'movingAvg'` (moving average).
|
|
107
|
+
*/
|
|
108
|
+
export type ChartTrendlineType = 'exp' | 'linear' | 'log' | 'movingAvg' | 'poly' | 'power';
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* A trendline fitted to a series, as `ChartSeries.trendline` takes it.
|
|
112
|
+
*/
|
|
113
|
+
export interface ChartTrendline {
|
|
114
|
+
/**
|
|
115
|
+
* The type of trendline, one of `ChartTrendlineType`. Left out, it is `'linear'`.
|
|
116
|
+
*/
|
|
117
|
+
type?: ChartTrendlineType;
|
|
118
|
+
/** shown in the legend in place of the generated label */
|
|
119
|
+
name?: string;
|
|
120
|
+
/** polynomial degree, 2-6. Only valid when type is 'poly' */
|
|
121
|
+
order?: number;
|
|
122
|
+
/** moving-average window. Only valid when type is 'movingAvg' */
|
|
123
|
+
period?: number;
|
|
124
|
+
/** extend the line forwards/backwards by this many periods */
|
|
125
|
+
forward?: number;
|
|
126
|
+
/**
|
|
127
|
+
* The number of periods the trendline extends back before the first point. `0` by default.
|
|
128
|
+
*/
|
|
129
|
+
backward?: number;
|
|
130
|
+
/** force the line through this y value */
|
|
131
|
+
intercept?: number;
|
|
132
|
+
/**
|
|
133
|
+
* Whether the trendline's equation is shown on the chart.
|
|
134
|
+
*/
|
|
135
|
+
displayEquation?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Whether the trendline's R-squared value is shown on the chart.
|
|
138
|
+
*/
|
|
139
|
+
displayRSquared?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* The line the trendline is drawn with, as `ChartLine`.
|
|
142
|
+
*/
|
|
143
|
+
line?: ChartLine;
|
|
144
|
+
/**
|
|
145
|
+
* The effects of the trendline, as `ChartEffects`, or `false` for none.
|
|
146
|
+
*/
|
|
147
|
+
effects?: ChartEffects | false;
|
|
148
|
+
/**
|
|
149
|
+
* The box the equation and R-squared are drawn in; written only while one
|
|
150
|
+
* of them is displayed. layout moves it: offsets in fractions of the chart.
|
|
151
|
+
*/
|
|
152
|
+
label?: ChartShapeFormat & {numFmt?: string; font?: ChartFont; layout?: {x?: number; y?: number}};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* How the length of each error bar is set: `'cust'` (custom amounts from cells), `'fixedVal'` (a fixed
|
|
157
|
+
* value), `'percentage'`, `'stdDev'` (standard deviation) or `'stdErr'` (standard error).
|
|
158
|
+
*/
|
|
159
|
+
export type ChartErrorBarValueType = 'cust' | 'fixedVal' | 'percentage' | 'stdDev' | 'stdErr';
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The error bars of a series (`ChartSeries.errorBars`): how long they are, which way they run, and how they
|
|
163
|
+
* are drawn.
|
|
164
|
+
*/
|
|
165
|
+
export interface ChartErrorBars {
|
|
166
|
+
/** scatter and bubble only - which axis this set applies to */
|
|
167
|
+
direction?: 'x' | 'y';
|
|
168
|
+
/**
|
|
169
|
+
* Which bars are drawn: `'both'`, `'minus'` (below or to the left of each point) or `'plus'` (above or to
|
|
170
|
+
* the right of it).
|
|
171
|
+
*/
|
|
172
|
+
barType?: 'both' | 'minus' | 'plus';
|
|
173
|
+
/**
|
|
174
|
+
* How the length of the bars is set, as `ChartErrorBarValueType` gives it.
|
|
175
|
+
*/
|
|
176
|
+
valueType?: ChartErrorBarValueType;
|
|
177
|
+
/** the amount, for every valueType except 'cust' */
|
|
178
|
+
value?: number;
|
|
179
|
+
/** cell ranges holding the custom amounts, when valueType is 'cust' */
|
|
180
|
+
plus?: string;
|
|
181
|
+
/**
|
|
182
|
+
* The cells holding the custom minus amounts, as a reference such as `'Data!$D$2:$D$13'`, when `valueType`
|
|
183
|
+
* is `'cust'`.
|
|
184
|
+
*/
|
|
185
|
+
minus?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Whether the bars are drawn without their end caps.
|
|
188
|
+
*/
|
|
189
|
+
noEndCap?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* The line the bars are drawn with, as `ChartLine`.
|
|
192
|
+
*/
|
|
193
|
+
line?: ChartLine;
|
|
194
|
+
/**
|
|
195
|
+
* The effects of the bars, as `ChartEffects`, or `false` for none.
|
|
196
|
+
*/
|
|
197
|
+
effects?: ChartEffects | false;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The shape a marker is drawn as. `'picture'` draws the marker's own picture fill, `'none'` draws no marker,
|
|
202
|
+
* and `'auto'` leaves the shape to Excel.
|
|
203
|
+
*/
|
|
204
|
+
export type ChartMarkerSymbol =
|
|
205
|
+
| 'circle' | 'dash' | 'diamond' | 'dot' | 'none' | 'picture' | 'plus' | 'square' | 'star' | 'triangle'
|
|
206
|
+
| 'x' | 'auto';
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* A marker drawn at each point of a line, scatter, radar or stock series, or at one point of a series.
|
|
210
|
+
*/
|
|
211
|
+
export interface ChartMarker extends ChartShapeFormat {
|
|
212
|
+
/**
|
|
213
|
+
* 'picture' draws the marker's own picture fill; null writes none, which
|
|
214
|
+
* Excel draws as its automatic symbol
|
|
215
|
+
*/
|
|
216
|
+
symbol?: ChartMarkerSymbol | null;
|
|
217
|
+
/** marker size in points, 2..72 */
|
|
218
|
+
size?: number;
|
|
219
|
+
/** shorthand for a solid fill with no outline */
|
|
220
|
+
color?: ChartColor;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** One data point formatted on its own. */
|
|
224
|
+
export interface ChartPoint extends ChartShapeFormat {
|
|
225
|
+
/** counted from 0 */
|
|
226
|
+
index: number;
|
|
227
|
+
/**
|
|
228
|
+
* The colour of this point alone, as a `ChartColor`.
|
|
229
|
+
*/
|
|
230
|
+
color?: ChartColor;
|
|
231
|
+
/** line, scatter, radar */
|
|
232
|
+
marker?: ChartMarker | false;
|
|
233
|
+
/** pie family: how far this slice is pulled out, percent */
|
|
234
|
+
explosion?: number;
|
|
235
|
+
/** bubble */
|
|
236
|
+
bubble3D?: boolean;
|
|
237
|
+
/** bar and bubble */
|
|
238
|
+
invertIfNegative?: boolean;
|
|
239
|
+
/** bar and area */
|
|
240
|
+
pictureOptions?: ChartPictureOptions;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* One point's label, where it differs from the rest. It is written whole: the
|
|
245
|
+
* show switches and separator it leaves out come from the series' labels.
|
|
246
|
+
*/
|
|
247
|
+
export type ChartPointLabel =
|
|
248
|
+
| {index: number; delete: true}
|
|
249
|
+
| (ChartDataLabelFormat & {
|
|
250
|
+
index: number;
|
|
251
|
+
/** words of your own in place of the value */
|
|
252
|
+
text?: string;
|
|
253
|
+
/** words and fields, for example [{field: 'seriesName'}, {text: ': '}, {field: 'value'}] */
|
|
254
|
+
runs?: ChartDataLabelRun[];
|
|
255
|
+
/** a cell whose text the label shows, for example 'Sheet1!$A$5' */
|
|
256
|
+
ref?: string;
|
|
257
|
+
/** moved from its place: offsets in fractions of the chart */
|
|
258
|
+
layout?: {x?: number; y?: number};
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Where a data label sits: `'bestFit'`, `'ctr'` (centred), `'inBase'`, `'inEnd'`, `'outEnd'`, `'l'`, `'r'`,
|
|
263
|
+
* `'t'` or `'b'`, which are left, right, above and below.
|
|
264
|
+
*/
|
|
265
|
+
export type ChartDataLabelPosition = 'bestFit' | 'b' | 'ctr' | 'inBase' | 'inEnd' | 'l' | 'outEnd' | 'r' | 't';
|
|
266
|
+
|
|
267
|
+
/** A field in a data label's words: Excel fills it in when it draws the label */
|
|
268
|
+
export type ChartDataLabelField = 'value' | 'seriesName' | 'categoryName' | 'cellRange';
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* A run of words in a data label: either text, or a field that Excel fills in when it draws the label, each
|
|
272
|
+
* with its own font.
|
|
273
|
+
*/
|
|
274
|
+
export type ChartDataLabelRun = {text: string; font?: ChartFont} | {field: ChartDataLabelField; text?: string; font?: ChartFont};
|
|
275
|
+
|
|
276
|
+
/** What a series' labels and one point's label share */
|
|
277
|
+
export interface ChartDataLabelFormat extends ChartShapeFormat {
|
|
278
|
+
/**
|
|
279
|
+
* Whether the label shows the value.
|
|
280
|
+
*/
|
|
281
|
+
value?: boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Whether the label shows the category name.
|
|
284
|
+
*/
|
|
285
|
+
category?: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Whether the label shows the series name.
|
|
288
|
+
*/
|
|
289
|
+
series?: boolean;
|
|
290
|
+
/**
|
|
291
|
+
* Whether the label shows the share of the total, for pie and doughnut charts.
|
|
292
|
+
*/
|
|
293
|
+
percent?: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Whether the label shows the bubble size, for bubble charts.
|
|
296
|
+
*/
|
|
297
|
+
bubbleSize?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Whether the label shows the series' legend key beside its words.
|
|
300
|
+
*/
|
|
301
|
+
legendKey?: boolean;
|
|
302
|
+
/** not every position is legal for every chart type; illegal ones are dropped */
|
|
303
|
+
position?: ChartDataLabelPosition;
|
|
304
|
+
/** '\n' puts each part on a line of its own */
|
|
305
|
+
separator?: string;
|
|
306
|
+
/**
|
|
307
|
+
* The number format of the label's value, as an Excel format code such as `0.0%`.
|
|
308
|
+
*/
|
|
309
|
+
numFmt?: string;
|
|
310
|
+
/**
|
|
311
|
+
* The font of the label's words, as `ChartFont`.
|
|
312
|
+
*/
|
|
313
|
+
font?: ChartFont;
|
|
314
|
+
/** a preset shape name, such as 'wedgeRectCallout' or 'wedgeEllipseCallout' */
|
|
315
|
+
shape?: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The data labels of a series (`ChartSeries.dataLabels`): the formatting of `ChartDataLabelFormat`, with
|
|
320
|
+
* leader lines, a range of cells as text, and labels for single points.
|
|
321
|
+
*/
|
|
322
|
+
export interface ChartDataLabels extends ChartDataLabelFormat {
|
|
323
|
+
/** a series' labels removed */
|
|
324
|
+
delete?: boolean;
|
|
325
|
+
/**
|
|
326
|
+
* Lines from moved labels back to their points. On a pie these are the
|
|
327
|
+
* classic leader lines; on other charts, the newer ones. Line options format them.
|
|
328
|
+
*/
|
|
329
|
+
leaderLines?: boolean | ChartLine;
|
|
330
|
+
/** a range whose text each label shows (Excel's "Value From Cells"); a series' labels only */
|
|
331
|
+
valueFromCells?: string;
|
|
332
|
+
/**
|
|
333
|
+
* The labels of single points, where they differ from the series' labels (`ChartPointLabel`).
|
|
334
|
+
*/
|
|
335
|
+
points?: ChartPointLabel[];
|
|
336
|
+
}
|