oakscriptjs 0.24.0 → 0.25.1
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 +25 -1
- package/bin/oakscript.mjs +10 -3
- package/dist/cjs/box/index.d.ts +348 -289
- package/dist/cjs/box/index.d.ts.map +1 -1
- package/dist/cjs/box/index.js.map +2 -2
- package/dist/cjs/check/node.d.ts.map +1 -1
- package/dist/cjs/check/node.js +1 -0
- package/dist/cjs/check/node.js.map +2 -2
- package/dist/cjs/check/preview.d.ts +31 -0
- package/dist/cjs/check/preview.d.ts.map +1 -0
- package/dist/cjs/check/preview.js +303 -0
- package/dist/cjs/check/preview.js.map +7 -0
- package/dist/cjs/color/index.d.ts +11 -11
- package/dist/cjs/color/index.js.map +1 -1
- package/dist/cjs/color/parse.d.ts +2 -0
- package/dist/cjs/color/parse.d.ts.map +1 -1
- package/dist/cjs/color/parse.js +6 -0
- package/dist/cjs/color/parse.js.map +2 -2
- package/dist/cjs/compare/index.d.ts +76 -12
- package/dist/cjs/compare/index.d.ts.map +1 -1
- package/dist/cjs/compare/index.js.map +2 -2
- package/dist/cjs/drawing/registry.d.ts +28 -5
- package/dist/cjs/drawing/registry.d.ts.map +1 -1
- package/dist/cjs/drawing/registry.js +14 -0
- package/dist/cjs/drawing/registry.js.map +2 -2
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/label/index.d.ts +265 -187
- package/dist/cjs/label/index.d.ts.map +1 -1
- package/dist/cjs/label/index.js +1 -1
- package/dist/cjs/label/index.js.map +2 -2
- package/dist/cjs/line/index.d.ts +247 -207
- package/dist/cjs/line/index.d.ts.map +1 -1
- package/dist/cjs/line/index.js.map +2 -2
- package/dist/cjs/linefill/index.d.ts +61 -89
- package/dist/cjs/linefill/index.d.ts.map +1 -1
- package/dist/cjs/linefill/index.js.map +2 -2
- package/dist/cjs/math/index.d.ts +49 -40
- package/dist/cjs/math/index.d.ts.map +1 -1
- package/dist/cjs/math/index.js.map +2 -2
- package/dist/cjs/polyline/index.d.ts +57 -78
- package/dist/cjs/polyline/index.d.ts.map +1 -1
- package/dist/cjs/polyline/index.js.map +2 -2
- package/dist/cjs/runtime/input-active.d.ts +2 -2
- package/dist/cjs/runtime/input-active.js.map +1 -1
- package/dist/cjs/runtime/series.d.ts +241 -161
- package/dist/cjs/runtime/series.d.ts.map +1 -1
- package/dist/cjs/runtime/series.js +223 -127
- package/dist/cjs/runtime/series.js.map +2 -2
- package/dist/cjs/script/api/alert.d.ts +37 -0
- package/dist/cjs/script/api/alert.d.ts.map +1 -0
- package/dist/cjs/script/api/alert.js +17 -0
- package/dist/cjs/script/api/alert.js.map +7 -0
- package/dist/cjs/script/api/calc.d.ts +232 -0
- package/dist/cjs/script/api/calc.d.ts.map +1 -0
- package/dist/cjs/script/api/calc.js +17 -0
- package/dist/cjs/script/api/calc.js.map +7 -0
- package/dist/cjs/script/api/color.d.ts +213 -0
- package/dist/cjs/script/api/color.d.ts.map +1 -0
- package/dist/cjs/script/api/color.js +17 -0
- package/dist/cjs/script/api/color.js.map +7 -0
- package/dist/cjs/script/api/context.d.ts +764 -0
- package/dist/cjs/script/api/context.d.ts.map +1 -0
- package/dist/cjs/script/api/context.js +17 -0
- package/dist/cjs/script/api/context.js.map +7 -0
- package/dist/cjs/script/api/log.d.ts +58 -0
- package/dist/cjs/script/api/log.d.ts.map +1 -0
- package/dist/cjs/script/api/log.js +17 -0
- package/dist/cjs/script/api/log.js.map +7 -0
- package/dist/cjs/script/api/strategy.d.ts +391 -0
- package/dist/cjs/script/api/strategy.d.ts.map +1 -0
- package/dist/cjs/script/api/strategy.js +17 -0
- package/dist/cjs/script/api/strategy.js.map +7 -0
- package/dist/cjs/script/api/ta.d.ts +1012 -0
- package/dist/cjs/script/api/ta.d.ts.map +1 -0
- package/dist/cjs/script/api/ta.js +17 -0
- package/dist/cjs/script/api/ta.js.map +7 -0
- package/dist/cjs/script/api/table.d.ts +479 -0
- package/dist/cjs/script/api/table.d.ts.map +1 -0
- package/dist/cjs/script/api/table.js +17 -0
- package/dist/cjs/script/api/table.js.map +7 -0
- package/dist/cjs/script/constants.d.ts +228 -83
- package/dist/cjs/script/constants.d.ts.map +1 -1
- package/dist/cjs/script/constants.js +87 -0
- package/dist/cjs/script/constants.js.map +2 -2
- package/dist/cjs/script/define.d.ts +94 -0
- package/dist/cjs/script/define.d.ts.map +1 -0
- package/dist/cjs/script/define.js +127 -0
- package/dist/cjs/script/define.js.map +7 -0
- package/dist/cjs/script/drawing-args.d.ts.map +1 -1
- package/dist/cjs/script/drawing-args.js +1 -1
- package/dist/cjs/script/drawing-args.js.map +2 -2
- package/dist/cjs/script/formula.d.ts +53 -0
- package/dist/cjs/script/formula.d.ts.map +1 -0
- package/dist/cjs/script/formula.js +402 -0
- package/dist/cjs/script/formula.js.map +7 -0
- package/dist/cjs/script/globals.d.ts +10 -0
- package/dist/cjs/script/globals.d.ts.map +1 -1
- package/dist/cjs/script/globals.js.map +1 -1
- package/dist/cjs/script/index.d.ts +1067 -1006
- package/dist/cjs/script/index.d.ts.map +1 -1
- package/dist/cjs/script/index.js +530 -60
- package/dist/cjs/script/index.js.map +3 -3
- package/dist/cjs/script/json.d.ts +117 -0
- package/dist/cjs/script/json.d.ts.map +1 -0
- package/dist/cjs/script/json.js +321 -0
- package/dist/cjs/script/json.js.map +7 -0
- package/dist/cjs/str/index.d.ts +50 -75
- package/dist/cjs/str/index.d.ts.map +1 -1
- package/dist/cjs/str/index.js +2 -2
- package/dist/cjs/str/index.js.map +2 -2
- package/dist/cjs/strategy/index.d.ts +102 -1
- package/dist/cjs/strategy/index.d.ts.map +1 -1
- package/dist/cjs/strategy/index.js.map +2 -2
- package/dist/cjs/table/index.d.ts +330 -49
- package/dist/cjs/table/index.d.ts.map +1 -1
- package/dist/cjs/table/index.js +55 -27
- package/dist/cjs/table/index.js.map +2 -2
- package/dist/cjs/text/index.d.ts +12 -14
- package/dist/cjs/text/index.d.ts.map +1 -1
- package/dist/cjs/text/index.js.map +2 -2
- package/dist/cjs/types/index.d.ts +15 -8
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js +12 -3
- package/dist/cjs/types/index.js.map +2 -2
- package/dist/esm/box/index.d.ts +348 -289
- package/dist/esm/box/index.d.ts.map +1 -1
- package/dist/esm/box/index.js +276 -276
- package/dist/esm/box/index.js.map +1 -1
- package/dist/esm/check/node.d.ts.map +1 -1
- package/dist/esm/check/node.js +1 -0
- package/dist/esm/check/node.js.map +1 -1
- package/dist/esm/check/preview.d.ts +31 -0
- package/dist/esm/check/preview.d.ts.map +1 -0
- package/dist/esm/check/preview.js +296 -0
- package/dist/esm/check/preview.js.map +1 -0
- package/dist/esm/color/index.d.ts +11 -11
- package/dist/esm/color/index.js +11 -11
- package/dist/esm/color/parse.d.ts +2 -0
- package/dist/esm/color/parse.d.ts.map +1 -1
- package/dist/esm/color/parse.js +7 -0
- package/dist/esm/color/parse.js.map +1 -1
- package/dist/esm/compare/index.d.ts +76 -12
- package/dist/esm/compare/index.d.ts.map +1 -1
- package/dist/esm/compare/index.js +76 -12
- package/dist/esm/compare/index.js.map +1 -1
- package/dist/esm/drawing/registry.d.ts +28 -5
- package/dist/esm/drawing/registry.d.ts.map +1 -1
- package/dist/esm/drawing/registry.js +39 -3
- package/dist/esm/drawing/registry.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/label/index.d.ts +265 -187
- package/dist/esm/label/index.d.ts.map +1 -1
- package/dist/esm/label/index.js +207 -177
- package/dist/esm/label/index.js.map +1 -1
- package/dist/esm/line/index.d.ts +247 -207
- package/dist/esm/line/index.d.ts.map +1 -1
- package/dist/esm/line/index.js +202 -194
- package/dist/esm/line/index.js.map +1 -1
- package/dist/esm/linefill/index.d.ts +61 -89
- package/dist/esm/linefill/index.d.ts.map +1 -1
- package/dist/esm/linefill/index.js +61 -89
- package/dist/esm/linefill/index.js.map +1 -1
- package/dist/esm/math/index.d.ts +49 -40
- package/dist/esm/math/index.d.ts.map +1 -1
- package/dist/esm/math/index.js +22 -9
- package/dist/esm/math/index.js.map +1 -1
- package/dist/esm/polyline/index.d.ts +57 -78
- package/dist/esm/polyline/index.d.ts.map +1 -1
- package/dist/esm/polyline/index.js +57 -78
- package/dist/esm/polyline/index.js.map +1 -1
- package/dist/esm/runtime/input-active.d.ts +2 -2
- package/dist/esm/runtime/input-active.js +2 -2
- package/dist/esm/runtime/series.d.ts +241 -161
- package/dist/esm/runtime/series.d.ts.map +1 -1
- package/dist/esm/runtime/series.js +241 -161
- package/dist/esm/runtime/series.js.map +1 -1
- package/dist/esm/script/api/alert.d.ts +37 -0
- package/dist/esm/script/api/alert.d.ts.map +1 -0
- package/dist/esm/script/api/alert.js +7 -0
- package/dist/esm/script/api/alert.js.map +1 -0
- package/dist/esm/script/api/calc.d.ts +232 -0
- package/dist/esm/script/api/calc.d.ts.map +1 -0
- package/dist/esm/script/api/calc.js +6 -0
- package/dist/esm/script/api/calc.js.map +1 -0
- package/dist/esm/script/api/color.d.ts +213 -0
- package/dist/esm/script/api/color.d.ts.map +1 -0
- package/dist/esm/script/api/color.js +6 -0
- package/dist/esm/script/api/color.js.map +1 -0
- package/dist/esm/script/api/context.d.ts +764 -0
- package/dist/esm/script/api/context.d.ts.map +1 -0
- package/dist/esm/script/api/context.js +7 -0
- package/dist/esm/script/api/context.js.map +1 -0
- package/dist/esm/script/api/log.d.ts +58 -0
- package/dist/esm/script/api/log.d.ts.map +1 -0
- package/dist/esm/script/api/log.js +6 -0
- package/dist/esm/script/api/log.js.map +1 -0
- package/dist/esm/script/api/strategy.d.ts +391 -0
- package/dist/esm/script/api/strategy.d.ts.map +1 -0
- package/dist/esm/script/api/strategy.js +7 -0
- package/dist/esm/script/api/strategy.js.map +1 -0
- package/dist/esm/script/api/ta.d.ts +1012 -0
- package/dist/esm/script/api/ta.d.ts.map +1 -0
- package/dist/esm/script/api/ta.js +6 -0
- package/dist/esm/script/api/ta.js.map +1 -0
- package/dist/esm/script/api/table.d.ts +479 -0
- package/dist/esm/script/api/table.d.ts.map +1 -0
- package/dist/esm/script/api/table.js +7 -0
- package/dist/esm/script/api/table.js.map +1 -0
- package/dist/esm/script/constants.d.ts +228 -83
- package/dist/esm/script/constants.d.ts.map +1 -1
- package/dist/esm/script/constants.js +110 -24
- package/dist/esm/script/constants.js.map +1 -1
- package/dist/esm/script/define.d.ts +94 -0
- package/dist/esm/script/define.d.ts.map +1 -0
- package/dist/esm/script/define.js +136 -0
- package/dist/esm/script/define.js.map +1 -0
- package/dist/esm/script/drawing-args.d.ts.map +1 -1
- package/dist/esm/script/drawing-args.js +2 -1
- package/dist/esm/script/drawing-args.js.map +1 -1
- package/dist/esm/script/formula.d.ts +53 -0
- package/dist/esm/script/formula.d.ts.map +1 -0
- package/dist/esm/script/formula.js +408 -0
- package/dist/esm/script/formula.js.map +1 -0
- package/dist/esm/script/globals.d.ts +10 -0
- package/dist/esm/script/globals.d.ts.map +1 -1
- package/dist/esm/script/globals.js.map +1 -1
- package/dist/esm/script/index.d.ts +1067 -1006
- package/dist/esm/script/index.d.ts.map +1 -1
- package/dist/esm/script/index.js +1096 -151
- package/dist/esm/script/index.js.map +1 -1
- package/dist/esm/script/json.d.ts +117 -0
- package/dist/esm/script/json.d.ts.map +1 -0
- package/dist/esm/script/json.js +375 -0
- package/dist/esm/script/json.js.map +1 -0
- package/dist/esm/str/index.d.ts +50 -75
- package/dist/esm/str/index.d.ts.map +1 -1
- package/dist/esm/str/index.js +51 -76
- package/dist/esm/str/index.js.map +1 -1
- package/dist/esm/strategy/index.d.ts +102 -1
- package/dist/esm/strategy/index.d.ts.map +1 -1
- package/dist/esm/strategy/index.js +1 -1
- package/dist/esm/strategy/index.js.map +1 -1
- package/dist/esm/table/index.d.ts +330 -49
- package/dist/esm/table/index.d.ts.map +1 -1
- package/dist/esm/table/index.js +372 -61
- package/dist/esm/table/index.js.map +1 -1
- package/dist/esm/text/index.d.ts +12 -14
- package/dist/esm/text/index.d.ts.map +1 -1
- package/dist/esm/text/index.js +12 -14
- package/dist/esm/text/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +15 -8
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js +15 -8
- package/dist/esm/types/index.js.map +1 -1
- package/docs/first-indicator.md +152 -0
- package/docs/guide.md +1185 -0
- package/docs/inventory.md +772 -0
- package/docs/no-code.md +207 -0
- package/docs/recipes.md +202 -0
- package/package.json +2 -1
- package/skills/oakscript/SKILL.md +8 -0
- package/skills/oakscript/reference/errors.md +3 -2
- package/src/box/index.ts +348 -289
- package/src/check/node.ts +1 -0
- package/src/check/preview.ts +307 -0
- package/src/color/index.ts +11 -11
- package/src/color/parse.ts +7 -0
- package/src/compare/index.ts +76 -12
- package/src/drawing/registry.ts +44 -5
- package/src/index.ts +1 -1
- package/src/label/index.ts +267 -189
- package/src/line/index.ts +248 -208
- package/src/linefill/index.ts +61 -89
- package/src/math/index.ts +51 -42
- package/src/polyline/index.ts +57 -78
- package/src/runtime/input-active.ts +2 -2
- package/src/runtime/series.ts +243 -163
- package/src/script/api/alert.ts +43 -0
- package/src/script/api/calc.ts +250 -0
- package/src/script/api/color.ts +245 -0
- package/src/script/api/context.ts +944 -0
- package/src/script/api/log.ts +60 -0
- package/src/script/api/strategy.ts +410 -0
- package/src/script/api/ta.ts +1115 -0
- package/src/script/api/table.ts +538 -0
- package/src/script/constants.ts +229 -25
- package/src/script/define.ts +221 -0
- package/src/script/drawing-args.ts +2 -1
- package/src/script/formula.ts +438 -0
- package/src/script/globals.ts +10 -0
- package/src/script/index.ts +1519 -239
- package/src/script/json.ts +457 -0
- package/src/str/index.ts +51 -76
- package/src/strategy/index.ts +102 -1
- package/src/table/index.ts +388 -62
- package/src/text/index.ts +12 -14
- package/src/types/index.ts +15 -8
package/src/table/index.ts
CHANGED
|
@@ -35,13 +35,28 @@ function freePosition(position: TablePosition, force_overlay: boolean, keep?: Ta
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Creates a
|
|
39
|
-
*
|
|
40
|
-
*
|
|
38
|
+
* Creates a table fixed at a place of the pane (it does not scroll with the bars) and returns its handle; fill its
|
|
39
|
+
* cells with `table.cell()`. A pane holds one table per position: a live table at the same position (with the same
|
|
40
|
+
* `force_overlay`) is deleted. The arguments after `rows` can also be given by name in an object.
|
|
41
|
+
* @param position - Where the table sits: `position.top_left`, `position.top_center`, `position.top_right`,
|
|
42
|
+
* `position.middle_left`, `position.middle_center`, `position.middle_right`, `position.bottom_left`,
|
|
43
|
+
* `position.bottom_center` or `position.bottom_right`.
|
|
44
|
+
* @param columns - Number of columns.
|
|
45
|
+
* @param rows - Number of rows.
|
|
46
|
+
* @param bgcolor - Background colour of the whole table. Default: none (transparent).
|
|
47
|
+
* @param frame_color - Colour of the outer frame. Default: none.
|
|
48
|
+
* @param frame_width - Width of the outer frame in pixels. Default: 0 (no frame).
|
|
49
|
+
* @param border_color - Colour of the lines between the cells. Default: none.
|
|
50
|
+
* @param border_width - Width of the lines between the cells in pixels. Default: 0 (no lines).
|
|
51
|
+
* @param force_overlay - When true, the table is drawn on the price pane even if the script has its own pane.
|
|
52
|
+
* Default: false.
|
|
53
|
+
* @returns The new table.
|
|
41
54
|
* @example
|
|
42
|
-
* ```
|
|
43
|
-
* const t = table.new(position.top_right, 2,
|
|
44
|
-
*
|
|
55
|
+
* ```js
|
|
56
|
+
* const t = table.new(position.top_right, 2, 1, { bgcolor: color.new(color.black, 20), border_width: 1 });
|
|
57
|
+
* eachBar((c) => {
|
|
58
|
+
* if (c.i === c.n - 1) table.cell(t, 0, 0, "Close", { text_color: color.white });
|
|
59
|
+
* });
|
|
45
60
|
* ```
|
|
46
61
|
*/
|
|
47
62
|
export function new_table(
|
|
@@ -91,7 +106,34 @@ function cellOf(caller: string, id: Table, column: number, row: number): TableCe
|
|
|
91
106
|
}
|
|
92
107
|
|
|
93
108
|
/**
|
|
94
|
-
*
|
|
109
|
+
* Writes a cell of a table: its text and look. The properties not given get their default, so calling it again
|
|
110
|
+
* replaces the whole cell; use `table.cell_set_*()` to change one property. A column or row outside the table is an
|
|
111
|
+
* error; on a deleted table it does nothing. The arguments after `row` can also be given by name in an object.
|
|
112
|
+
* @param table_id - The table (from `table.new()`).
|
|
113
|
+
* @param column - Column of the cell, from 0 (left).
|
|
114
|
+
* @param row - Row of the cell, from 0 (top).
|
|
115
|
+
* @param text - Text of the cell; `\n` starts a new line. Default: "".
|
|
116
|
+
* @param width - Width of the cell in percent of the pane's width; 0 fits the text. Default: 0.
|
|
117
|
+
* @param height - Height of the cell in percent of the pane's height; 0 fits the text. Default: 0.
|
|
118
|
+
* @param text_color - Text colour. Default: dark gray (#363A45).
|
|
119
|
+
* @param text_halign - Horizontal alignment of the text: `text.align_left`, `text.align_center` or
|
|
120
|
+
* `text.align_right`. Default: `text.align_center`.
|
|
121
|
+
* @param text_valign - Vertical alignment of the text: `text.align_top`, `text.align_center` or
|
|
122
|
+
* `text.align_bottom`. Default: `text.align_center`.
|
|
123
|
+
* @param text_size - `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`, `size.auto`, or a size in
|
|
124
|
+
* points. Default: `size.auto`.
|
|
125
|
+
* @param bgcolor - Background colour of the cell. Default: none (the table's background shows).
|
|
126
|
+
* @param tooltip - Text shown when the pointer is over the cell. Default: none.
|
|
127
|
+
* @param text_font_family - `font.family_default` or `font.family_monospace`. Default: `font.family_default`.
|
|
128
|
+
* @param text_formatting - `text.format_bold`, `text.format_italic`, their sum, or `text.format_none`.
|
|
129
|
+
* Default: `text.format_none`.
|
|
130
|
+
* @example
|
|
131
|
+
* ```js
|
|
132
|
+
* const t = table.new(position.bottom_right, 2, 1);
|
|
133
|
+
* eachBar((c) => {
|
|
134
|
+
* if (c.i === c.n - 1) table.cell(t, 1, 0, str.tostring(c.close, "#.##"), { bgcolor: color.teal, text_color: color.white });
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
95
137
|
*/
|
|
96
138
|
export function cell(
|
|
97
139
|
table_id: Table,
|
|
@@ -126,39 +168,219 @@ export function cell(
|
|
|
126
168
|
});
|
|
127
169
|
}
|
|
128
170
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
*
|
|
161
|
-
*
|
|
171
|
+
/** Sets one property of a cell (the cell is created when it was not defined); nothing on a deleted table. */
|
|
172
|
+
function setCell<K extends keyof TableCell>(name: string, field: K, table_id: Table, column: number, row: number, value: TableCell[K]): void {
|
|
173
|
+
if (isDeleted(table_id)) return;
|
|
174
|
+
cellOf(`table.${name}()`, table_id, column, row)[field] = value;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Changes the text of a cell and keeps its other properties. A cell that was not written yet is created.
|
|
179
|
+
* A column or row outside the table is an error; on a deleted table it does nothing.
|
|
180
|
+
* @param table_id - The table.
|
|
181
|
+
* @param column - Column of the cell, from 0.
|
|
182
|
+
* @param row - Row of the cell, from 0.
|
|
183
|
+
* @param value - New text; `\n` starts a new line.
|
|
184
|
+
* @example
|
|
185
|
+
* ```js
|
|
186
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
187
|
+
* eachBar((c) => {
|
|
188
|
+
* if (c.i === c.n - 1) table.cell_set_text(t, 0, 0, "Close " + str.tostring(c.close, "#.##"));
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
export function cell_set_text(table_id: Table, column: number, row: number, value: TableCell['text']): void {
|
|
193
|
+
setCell('cell_set_text', 'text', table_id, column, row, value);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Changes the width of a cell. A cell that was not written yet is created.
|
|
198
|
+
* @param table_id - The table.
|
|
199
|
+
* @param column - Column of the cell, from 0.
|
|
200
|
+
* @param row - Row of the cell, from 0.
|
|
201
|
+
* @param value - Width in percent of the pane's width; 0 fits the text.
|
|
202
|
+
* @example
|
|
203
|
+
* ```js
|
|
204
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
205
|
+
* table.cell(t, 0, 0, "Trend");
|
|
206
|
+
* table.cell_set_width(t, 0, 0, 10);
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
export function cell_set_width(table_id: Table, column: number, row: number, value: TableCell['width']): void {
|
|
210
|
+
setCell('cell_set_width', 'width', table_id, column, row, value);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Changes the height of a cell. A cell that was not written yet is created.
|
|
215
|
+
* @param table_id - The table.
|
|
216
|
+
* @param column - Column of the cell, from 0.
|
|
217
|
+
* @param row - Row of the cell, from 0.
|
|
218
|
+
* @param value - Height in percent of the pane's height; 0 fits the text.
|
|
219
|
+
* @example
|
|
220
|
+
* ```js
|
|
221
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
222
|
+
* table.cell(t, 0, 0, "Trend");
|
|
223
|
+
* table.cell_set_height(t, 0, 0, 5);
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
export function cell_set_height(table_id: Table, column: number, row: number, value: TableCell['height']): void {
|
|
227
|
+
setCell('cell_set_height', 'height', table_id, column, row, value);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Changes the text colour of a cell. A cell that was not written yet is created.
|
|
232
|
+
* @param table_id - The table.
|
|
233
|
+
* @param column - Column of the cell, from 0.
|
|
234
|
+
* @param row - Row of the cell, from 0.
|
|
235
|
+
* @param value - New text colour (`color.red`, `"#FF0000"`...).
|
|
236
|
+
* @example
|
|
237
|
+
* ```js
|
|
238
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
239
|
+
* eachBar((c) => {
|
|
240
|
+
* if (c.i === c.n - 1) table.cell_set_text_color(t, 0, 0, c.close > c.open ? color.green : color.red);
|
|
241
|
+
* });
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
export function cell_set_text_color(table_id: Table, column: number, row: number, value: TableCell['text_color']): void {
|
|
245
|
+
setCell('cell_set_text_color', 'text_color', table_id, column, row, value);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Changes the horizontal alignment of the text of a cell. A cell that was not written yet is created.
|
|
250
|
+
* @param table_id - The table.
|
|
251
|
+
* @param column - Column of the cell, from 0.
|
|
252
|
+
* @param row - Row of the cell, from 0.
|
|
253
|
+
* @param value - `text.align_left`, `text.align_center` or `text.align_right`.
|
|
254
|
+
* @example
|
|
255
|
+
* ```js
|
|
256
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
257
|
+
* table.cell(t, 0, 0, "Volume", { width: 15 });
|
|
258
|
+
* table.cell_set_text_halign(t, 0, 0, text.align_left);
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export function cell_set_text_halign(table_id: Table, column: number, row: number, value: TableCell['text_halign']): void {
|
|
262
|
+
setCell('cell_set_text_halign', 'text_halign', table_id, column, row, value);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Changes the vertical alignment of the text of a cell. A cell that was not written yet is created.
|
|
267
|
+
* @param table_id - The table.
|
|
268
|
+
* @param column - Column of the cell, from 0.
|
|
269
|
+
* @param row - Row of the cell, from 0.
|
|
270
|
+
* @param value - `text.align_top`, `text.align_center` or `text.align_bottom`.
|
|
271
|
+
* @example
|
|
272
|
+
* ```js
|
|
273
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
274
|
+
* table.cell(t, 0, 0, "Volume", { height: 8 });
|
|
275
|
+
* table.cell_set_text_valign(t, 0, 0, text.align_bottom);
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
export function cell_set_text_valign(table_id: Table, column: number, row: number, value: TableCell['text_valign']): void {
|
|
279
|
+
setCell('cell_set_text_valign', 'text_valign', table_id, column, row, value);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Changes the text size of a cell. A cell that was not written yet is created.
|
|
284
|
+
* @param table_id - The table.
|
|
285
|
+
* @param column - Column of the cell, from 0.
|
|
286
|
+
* @param row - Row of the cell, from 0.
|
|
287
|
+
* @param value - `size.tiny`, `size.small`, `size.normal`, `size.large`, `size.huge`, `size.auto`, or a size in points.
|
|
288
|
+
* @example
|
|
289
|
+
* ```js
|
|
290
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
291
|
+
* table.cell(t, 0, 0, "Signal");
|
|
292
|
+
* table.cell_set_text_size(t, 0, 0, size.large);
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
export function cell_set_text_size(table_id: Table, column: number, row: number, value: TableCell['text_size']): void {
|
|
296
|
+
setCell('cell_set_text_size', 'text_size', table_id, column, row, value);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Changes the background colour of a cell. A cell that was not written yet is created.
|
|
301
|
+
* @param table_id - The table.
|
|
302
|
+
* @param column - Column of the cell, from 0.
|
|
303
|
+
* @param row - Row of the cell, from 0.
|
|
304
|
+
* @param value - New background colour.
|
|
305
|
+
* @example
|
|
306
|
+
* ```js
|
|
307
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
308
|
+
* eachBar((c) => {
|
|
309
|
+
* if (c.i === c.n - 1) table.cell_set_bgcolor(t, 0, 0, c.close > c.open ? color.teal : color.maroon);
|
|
310
|
+
* });
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
export function cell_set_bgcolor(table_id: Table, column: number, row: number, value: TableCell['bgcolor']): void {
|
|
314
|
+
setCell('cell_set_bgcolor', 'bgcolor', table_id, column, row, value);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Changes the tooltip of a cell: the text shown when the pointer is over it. A cell that was not written yet is
|
|
319
|
+
* created.
|
|
320
|
+
* @param table_id - The table.
|
|
321
|
+
* @param column - Column of the cell, from 0.
|
|
322
|
+
* @param row - Row of the cell, from 0.
|
|
323
|
+
* @param value - Tooltip text.
|
|
324
|
+
* @example
|
|
325
|
+
* ```js
|
|
326
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
327
|
+
* table.cell(t, 0, 0, "ATR");
|
|
328
|
+
* table.cell_set_tooltip(t, 0, 0, "Average true range over 14 bars");
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
export function cell_set_tooltip(table_id: Table, column: number, row: number, value: TableCell['tooltip']): void {
|
|
332
|
+
setCell('cell_set_tooltip', 'tooltip', table_id, column, row, value);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Changes the font of a cell's text. A cell that was not written yet is created.
|
|
337
|
+
* @param table_id - The table.
|
|
338
|
+
* @param column - Column of the cell, from 0.
|
|
339
|
+
* @param row - Row of the cell, from 0.
|
|
340
|
+
* @param value - `font.family_default` or `font.family_monospace`.
|
|
341
|
+
* @example
|
|
342
|
+
* ```js
|
|
343
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
344
|
+
* table.cell(t, 0, 0, "123.45");
|
|
345
|
+
* table.cell_set_text_font_family(t, 0, 0, font.family_monospace);
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
export function cell_set_text_font_family(table_id: Table, column: number, row: number, value: TableCell['text_font_family']): void {
|
|
349
|
+
setCell('cell_set_text_font_family', 'text_font_family', table_id, column, row, value);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Makes a cell's text bold, italic, both or plain. A cell that was not written yet is created.
|
|
354
|
+
* @param table_id - The table.
|
|
355
|
+
* @param column - Column of the cell, from 0.
|
|
356
|
+
* @param row - Row of the cell, from 0.
|
|
357
|
+
* @param value - `text.format_bold`, `text.format_italic`, their sum, or `text.format_none`.
|
|
358
|
+
* @example
|
|
359
|
+
* ```js
|
|
360
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
361
|
+
* table.cell(t, 0, 0, "Summary");
|
|
362
|
+
* table.cell_set_text_formatting(t, 0, 0, text.format_bold + text.format_italic);
|
|
363
|
+
* ```
|
|
364
|
+
*/
|
|
365
|
+
export function cell_set_text_formatting(table_id: Table, column: number, row: number, value: TableCell['text_formatting']): void {
|
|
366
|
+
setCell('cell_set_text_formatting', 'text_formatting', table_id, column, row, value);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Joins a block of cells into one cell, for a title over several columns for example. The merged cell shows the
|
|
371
|
+
* content and look of its start (top-left) cell. Merging the same block again does nothing. A cell outside the table,
|
|
372
|
+
* or an end before the start, is an error; on a deleted table it does nothing.
|
|
373
|
+
* @param table_id - The table.
|
|
374
|
+
* @param start_column - Column of the top-left cell of the block, from 0.
|
|
375
|
+
* @param start_row - Row of the top-left cell of the block, from 0.
|
|
376
|
+
* @param end_column - Column of the bottom-right cell of the block (not before `start_column`).
|
|
377
|
+
* @param end_row - Row of the bottom-right cell of the block (not before `start_row`).
|
|
378
|
+
* @example
|
|
379
|
+
* ```js
|
|
380
|
+
* const t = table.new(position.top_right, 2, 2);
|
|
381
|
+
* table.cell(t, 0, 0, "Daily stats");
|
|
382
|
+
* table.merge_cells(t, 0, 0, 1, 0); // the title spans both columns
|
|
383
|
+
* ```
|
|
162
384
|
*/
|
|
163
385
|
export function merge_cells(
|
|
164
386
|
table_id: Table,
|
|
@@ -181,8 +403,20 @@ export function merge_cells(
|
|
|
181
403
|
}
|
|
182
404
|
|
|
183
405
|
/**
|
|
184
|
-
*
|
|
185
|
-
*
|
|
406
|
+
* Empties a block of cells (text and look), and removes the merges that start inside it. Without an end, only the
|
|
407
|
+
* start cell is cleared. A cell outside the table is an error; on a deleted table it does nothing.
|
|
408
|
+
* @param table_id - The table.
|
|
409
|
+
* @param start_column - Column of the top-left cell of the block, from 0.
|
|
410
|
+
* @param start_row - Row of the top-left cell of the block, from 0.
|
|
411
|
+
* @param end_column - Column of the bottom-right cell of the block. Default: `start_column`.
|
|
412
|
+
* @param end_row - Row of the bottom-right cell of the block. Default: `start_row`.
|
|
413
|
+
* @example
|
|
414
|
+
* ```js
|
|
415
|
+
* const t = table.new(position.top_right, 3, 3);
|
|
416
|
+
* eachBar((c) => {
|
|
417
|
+
* if (c.i === c.n - 1) table.clear(t, 0, 0, 2, 2); // empty all nine cells
|
|
418
|
+
* });
|
|
419
|
+
* ```
|
|
186
420
|
*/
|
|
187
421
|
export function clear(
|
|
188
422
|
table_id: Table,
|
|
@@ -202,39 +436,131 @@ export function clear(
|
|
|
202
436
|
if (table_id.merges) table_id.merges = table_id.merges.filter((m) => !inside(m.start_column, m.start_row));
|
|
203
437
|
}
|
|
204
438
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
439
|
+
/** Sets one property of a table; nothing on a deleted table. */
|
|
440
|
+
function setTable<K extends keyof Table>(table_id: Table, field: K, value: Table[K]): void {
|
|
441
|
+
if (isDeleted(table_id)) return;
|
|
442
|
+
table_id[field] = value;
|
|
210
443
|
}
|
|
211
444
|
|
|
212
445
|
/**
|
|
213
|
-
* Moves the table to another
|
|
214
|
-
* deleted
|
|
446
|
+
* Moves the table to another place of the pane. A live table already at that position (with the same
|
|
447
|
+
* `force_overlay`) is deleted. Does nothing on a deleted table.
|
|
448
|
+
* @param table_id - The table.
|
|
449
|
+
* @param position - New place: `position.top_left`, `position.top_center`, `position.top_right`,
|
|
450
|
+
* `position.middle_left`, `position.middle_center`, `position.middle_right`, `position.bottom_left`,
|
|
451
|
+
* `position.bottom_center` or `position.bottom_right`.
|
|
452
|
+
* @example
|
|
453
|
+
* ```js
|
|
454
|
+
* const where = input.string("Top right", "Table", { options: ["Top right", "Bottom left"] });
|
|
455
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
456
|
+
* if (where === "Bottom left") table.set_position(t, position.bottom_left);
|
|
457
|
+
* ```
|
|
215
458
|
*/
|
|
216
459
|
export function set_position(table_id: Table, position: TablePosition): void {
|
|
217
460
|
if (isDeleted(table_id)) return;
|
|
218
461
|
freePosition(position, table_id.force_overlay ?? false, table_id);
|
|
219
462
|
table_id.position = position;
|
|
220
463
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Changes the background colour of the whole table (cells with their own background keep it). Does nothing on a
|
|
467
|
+
* deleted table.
|
|
468
|
+
* @param table_id - The table.
|
|
469
|
+
* @param value - New background colour.
|
|
470
|
+
* @example
|
|
471
|
+
* ```js
|
|
472
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
473
|
+
* eachBar((c) => {
|
|
474
|
+
* if (c.i === c.n - 1) table.set_bgcolor(t, c.close > c.open ? color.new(color.green, 80) : color.new(color.red, 80));
|
|
475
|
+
* });
|
|
476
|
+
* ```
|
|
477
|
+
*/
|
|
478
|
+
export function set_bgcolor(table_id: Table, value: Table['bgcolor']): void {
|
|
479
|
+
setTable(table_id, 'bgcolor', value);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Changes the colour of the outer frame of the table. Does nothing on a deleted table.
|
|
484
|
+
* @param table_id - The table.
|
|
485
|
+
* @param value - New frame colour.
|
|
486
|
+
* @example
|
|
487
|
+
* ```js
|
|
488
|
+
* const t = table.new(position.top_right, 1, 1, { frame_width: 1 });
|
|
489
|
+
* table.set_frame_color(t, color.gray);
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
export function set_frame_color(table_id: Table, value: Table['frame_color']): void {
|
|
493
|
+
setTable(table_id, 'frame_color', value);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Changes the width of the outer frame of the table. Does nothing on a deleted table.
|
|
498
|
+
* @param table_id - The table.
|
|
499
|
+
* @param value - New frame width in pixels; 0 hides the frame.
|
|
500
|
+
* @example
|
|
501
|
+
* ```js
|
|
502
|
+
* const t = table.new(position.top_right, 1, 1, { frame_color: color.gray });
|
|
503
|
+
* table.set_frame_width(t, 2);
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
export function set_frame_width(table_id: Table, value: Table['frame_width']): void {
|
|
507
|
+
setTable(table_id, 'frame_width', value);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Changes the colour of the lines between the cells. Does nothing on a deleted table.
|
|
512
|
+
* @param table_id - The table.
|
|
513
|
+
* @param value - New border colour.
|
|
514
|
+
* @example
|
|
515
|
+
* ```js
|
|
516
|
+
* const t = table.new(position.top_right, 2, 2, { border_width: 1 });
|
|
517
|
+
* table.set_border_color(t, color.silver);
|
|
518
|
+
* ```
|
|
519
|
+
*/
|
|
520
|
+
export function set_border_color(table_id: Table, value: Table['border_color']): void {
|
|
521
|
+
setTable(table_id, 'border_color', value);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Changes the width of the lines between the cells. Does nothing on a deleted table.
|
|
526
|
+
* @param table_id - The table.
|
|
527
|
+
* @param value - New border width in pixels; 0 hides the lines.
|
|
528
|
+
* @example
|
|
529
|
+
* ```js
|
|
530
|
+
* const t = table.new(position.top_right, 2, 2, { border_color: color.silver });
|
|
531
|
+
* table.set_border_width(t, 1);
|
|
532
|
+
* ```
|
|
533
|
+
*/
|
|
534
|
+
export function set_border_width(table_id: Table, value: Table['border_width']): void {
|
|
535
|
+
setTable(table_id, 'border_width', value);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Removes the table from the pane and from `table.all`. Afterwards the table functions do nothing on it; deleting it
|
|
540
|
+
* again does nothing.
|
|
541
|
+
* @param table_id - The table to delete.
|
|
542
|
+
* @example
|
|
543
|
+
* ```js
|
|
544
|
+
* const show = input.bool(true, "Show table");
|
|
545
|
+
* const t = table.new(position.top_right, 1, 1);
|
|
546
|
+
* if (!show) table.delete(t);
|
|
547
|
+
* ```
|
|
548
|
+
*/
|
|
233
549
|
export function delete_table(table_id: Table): void {
|
|
234
550
|
remove('table', table_id);
|
|
235
551
|
}
|
|
236
552
|
|
|
237
|
-
/**
|
|
553
|
+
/**
|
|
554
|
+
* Returns the tables that are still on the pane, oldest first. The array is a copy.
|
|
555
|
+
* (In a script, `table.all` is read as a value, without a call.)
|
|
556
|
+
* @returns The live tables in creation order.
|
|
557
|
+
* @example
|
|
558
|
+
* ```js
|
|
559
|
+
* eachBar((c) => {
|
|
560
|
+
* if (c.i === c.n - 1) for (const t of table.all) table.set_bgcolor(t, color.new(color.black, 50));
|
|
561
|
+
* });
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
238
564
|
export function all(): Table[] {
|
|
239
565
|
return allDrawings('table');
|
|
240
566
|
}
|
package/src/text/index.ts
CHANGED
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Text namespace
|
|
3
|
-
*
|
|
4
|
-
* `text.align_*` / `text.wrap_*` constants.
|
|
2
|
+
* Text namespace: the `text.format_*` constants of `label.set_text_formatting()` and `box.set_text_formatting()`
|
|
3
|
+
* (`text_formatting` option), and the `text.align_*` / `text.wrap_*` constants of labels, boxes and table cells.
|
|
5
4
|
*
|
|
6
|
-
* The format values are flags that add up
|
|
7
|
-
* They are the values PineScript uses for drawn labels and boxes.
|
|
5
|
+
* The format values are flags that add up: `text.format_bold + text.format_italic` is bold italic text.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
|
-
/**
|
|
8
|
+
/** Plain text: neither bold nor italic (the default). */
|
|
11
9
|
export const format_none = 0;
|
|
12
|
-
/** Bold text. */
|
|
10
|
+
/** Bold text; add `text.format_italic` for bold italic. */
|
|
13
11
|
export const format_bold = 1;
|
|
14
|
-
/** Italic text. */
|
|
12
|
+
/** Italic text; add `text.format_bold` for bold italic. */
|
|
15
13
|
export const format_italic = 2;
|
|
16
14
|
|
|
17
|
-
/** Text aligned to the left (`table.cell
|
|
15
|
+
/** Text aligned to the left (`text_halign` of `table.cell()` and `box.new()`, `textalign` of `label.new()`). */
|
|
18
16
|
export const align_left = 'left' as const;
|
|
19
|
-
/** Text centred horizontally or vertically. */
|
|
17
|
+
/** Text centred, horizontally or vertically. */
|
|
20
18
|
export const align_center = 'center' as const;
|
|
21
19
|
/** Text aligned to the right. */
|
|
22
20
|
export const align_right = 'right' as const;
|
|
23
|
-
/** Text aligned to the top (`table.cell
|
|
21
|
+
/** Text aligned to the top (`text_valign` of `table.cell()` and `box.new()`). */
|
|
24
22
|
export const align_top = 'top' as const;
|
|
25
|
-
/** Text aligned to the bottom. */
|
|
23
|
+
/** Text aligned to the bottom (`text_valign`). */
|
|
26
24
|
export const align_bottom = 'bottom' as const;
|
|
27
|
-
/** Text wrapped to the box
|
|
25
|
+
/** Text wrapped onto several lines to fit the width of the box (`text_wrap` of `box.new()`). */
|
|
28
26
|
export const wrap_auto = 'auto' as const;
|
|
29
|
-
/** Text not wrapped. */
|
|
27
|
+
/** Text not wrapped: each line of the text stays on one line. */
|
|
30
28
|
export const wrap_none = 'none' as const;
|
package/src/types/index.ts
CHANGED
|
@@ -355,31 +355,38 @@ export interface OHLC {
|
|
|
355
355
|
export const na = null;
|
|
356
356
|
export type na = null;
|
|
357
357
|
|
|
358
|
-
/**
|
|
359
|
-
* X-axis location constants
|
|
360
|
-
* Used to specify whether x-coordinates are bar indices, timestamps or places on the pane
|
|
361
|
-
*/
|
|
358
|
+
/** What the x coordinates of a drawing (label, line, box, polyline) are (`xloc` option). */
|
|
362
359
|
export const xloc = {
|
|
363
|
-
/**
|
|
360
|
+
/** Bar indexes: 0 is the first bar, `bar_index` the current one (the default). */
|
|
364
361
|
bar_index: 'bar_index' as const,
|
|
365
|
-
/**
|
|
362
|
+
/** UNIX times in milliseconds, such as `time` or `time_close`. */
|
|
366
363
|
bar_time: 'bar_time' as const,
|
|
367
|
-
/**
|
|
364
|
+
/** Percents of the pane's width (0 left edge, 100 right edge): the drawing stays in place while the user scrolls and zooms. */
|
|
368
365
|
pane: 'pane' as const,
|
|
369
366
|
};
|
|
370
367
|
|
|
371
368
|
/**
|
|
372
|
-
*
|
|
369
|
+
* Where a table sits in the pane: the first argument of `table.new()` and of `table.set_position()`
|
|
370
|
+
* (`table.new(position.top_right, 2, 3)`).
|
|
373
371
|
*/
|
|
374
372
|
export const position = {
|
|
373
|
+
/** The top-left corner of the pane. */
|
|
375
374
|
top_left: 'top_left' as const,
|
|
375
|
+
/** The middle of the top edge. */
|
|
376
376
|
top_center: 'top_center' as const,
|
|
377
|
+
/** The top-right corner of the pane. */
|
|
377
378
|
top_right: 'top_right' as const,
|
|
379
|
+
/** The middle of the left edge. */
|
|
378
380
|
middle_left: 'middle_left' as const,
|
|
381
|
+
/** The centre of the pane. */
|
|
379
382
|
middle_center: 'middle_center' as const,
|
|
383
|
+
/** The middle of the right edge. */
|
|
380
384
|
middle_right: 'middle_right' as const,
|
|
385
|
+
/** The bottom-left corner of the pane. */
|
|
381
386
|
bottom_left: 'bottom_left' as const,
|
|
387
|
+
/** The middle of the bottom edge. */
|
|
382
388
|
bottom_center: 'bottom_center' as const,
|
|
389
|
+
/** The bottom-right corner of the pane. */
|
|
383
390
|
bottom_right: 'bottom_right' as const,
|
|
384
391
|
};
|
|
385
392
|
|