openalgo-script 0.7.1 → 0.8.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/CHANGELOG.md +89 -0
- package/README.md +22 -9
- package/dist/adapters/charts/capabilities.d.ts +48 -0
- package/dist/adapters/charts/capabilities.d.ts.map +1 -0
- package/dist/adapters/charts/capabilities.js +82 -0
- package/dist/adapters/charts/capabilities.js.map +1 -0
- package/dist/adapters/charts/columns.d.ts +2 -0
- package/dist/adapters/charts/columns.d.ts.map +1 -1
- package/dist/adapters/charts/columns.js +4 -0
- package/dist/adapters/charts/columns.js.map +1 -1
- package/dist/adapters/charts/contract.d.ts +35 -3
- package/dist/adapters/charts/contract.d.ts.map +1 -1
- package/dist/adapters/charts/descriptor.d.ts +1 -1
- package/dist/adapters/charts/descriptor.d.ts.map +1 -1
- package/dist/adapters/charts/descriptor.js +17 -5
- package/dist/adapters/charts/descriptor.js.map +1 -1
- package/dist/adapters/charts/fills.d.ts +26 -5
- package/dist/adapters/charts/fills.d.ts.map +1 -1
- package/dist/adapters/charts/fills.js +55 -7
- package/dist/adapters/charts/fills.js.map +1 -1
- package/dist/adapters/charts/index.d.ts +9 -3
- package/dist/adapters/charts/index.d.ts.map +1 -1
- package/dist/adapters/charts/index.js +7 -1
- package/dist/adapters/charts/index.js.map +1 -1
- package/dist/adapters/charts/produced.d.ts +3 -2
- package/dist/adapters/charts/produced.d.ts.map +1 -1
- package/dist/adapters/charts/produced.js +1 -1
- package/dist/adapters/charts/produced.js.map +1 -1
- package/dist/adapters/charts/run.d.ts +23 -0
- package/dist/adapters/charts/run.d.ts.map +1 -1
- package/dist/adapters/charts/run.js +2 -1
- package/dist/adapters/charts/run.js.map +1 -1
- package/dist/adapters/charts/surfaces.d.ts +11 -0
- package/dist/adapters/charts/surfaces.d.ts.map +1 -1
- package/dist/adapters/charts/tables.d.ts +21 -11
- package/dist/adapters/charts/tables.d.ts.map +1 -1
- package/dist/adapters/charts/tables.js +17 -6
- package/dist/adapters/charts/tables.js.map +1 -1
- package/dist/adapters/charts/undrawable.d.ts +2 -1
- package/dist/adapters/charts/undrawable.d.ts.map +1 -1
- package/dist/adapters/charts/undrawable.js +24 -14
- package/dist/adapters/charts/undrawable.js.map +1 -1
- package/dist/core/stdlib/volume/accumulation.d.ts +14 -0
- package/dist/core/stdlib/volume/accumulation.d.ts.map +1 -1
- package/dist/core/stdlib/volume/accumulation.js +32 -2
- package/dist/core/stdlib/volume/accumulation.js.map +1 -1
- package/dist/core/stdlib/volume/flow.d.ts.map +1 -1
- package/dist/core/stdlib/volume/flow.js +3 -1
- package/dist/core/stdlib/volume/flow.js.map +1 -1
- package/dist/core/stdlib/volume/weighted.d.ts +7 -0
- package/dist/core/stdlib/volume/weighted.d.ts.map +1 -1
- package/dist/core/stdlib/volume/weighted.js +15 -3
- package/dist/core/stdlib/volume/weighted.js.map +1 -1
- package/dist/core/version/version.generated.d.ts +1 -1
- package/dist/core/version/version.generated.js +1 -1
- package/package.json +1 -1
- package/src/adapters/charts/capabilities.ts +103 -0
- package/src/adapters/charts/columns.ts +5 -0
- package/src/adapters/charts/contract.ts +36 -2
- package/src/adapters/charts/descriptor.ts +21 -6
- package/src/adapters/charts/fills.ts +95 -11
- package/src/adapters/charts/index.ts +9 -1
- package/src/adapters/charts/produced.ts +4 -3
- package/src/adapters/charts/run.ts +25 -1
- package/src/adapters/charts/surfaces.ts +12 -0
- package/src/adapters/charts/tables.ts +31 -14
- package/src/adapters/charts/undrawable.ts +24 -14
- package/src/core/stdlib/volume/accumulation.ts +37 -2
- package/src/core/stdlib/volume/flow.ts +3 -1
- package/src/core/stdlib/volume/weighted.ts +14 -3
- package/src/core/version/version.generated.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,95 @@ nothing, fails the build before it can become permanent.
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## 0.8.0
|
|
11
|
+
|
|
12
|
+
The chart adapter now draws two things it used to refuse, on a chart that can
|
|
13
|
+
draw them. A band whose colour the script computes per bar is shaded bar by bar,
|
|
14
|
+
and a study that declares more than one grid gets every grid, each in the corner
|
|
15
|
+
its own `position` names. Both need hooks the chart library added in its version
|
|
16
|
+
2.5.4, and a chart ignores a hook it does not know, so the adapter is told which
|
|
17
|
+
chart it is drawing on: a host passes the library's exported `VERSION` string as
|
|
18
|
+
the new `chartVersion` option, `descriptorFor(program, { chartVersion: VERSION })`.
|
|
19
|
+
|
|
20
|
+
A host that passes nothing draws exactly what it drew with 0.7.2, and such a
|
|
21
|
+
study is still refused before any bar runs with OS6024. So is one on a chart
|
|
22
|
+
older than 2.5.4, on a prerelease of 2.5.4, or on a version string that cannot
|
|
23
|
+
be read, and the refusal now ends by saying which version the host stated. On no
|
|
24
|
+
chart version is either thing drawn in part or dropped in silence.
|
|
25
|
+
|
|
26
|
+
How a computed band colour is drawn. Each bar is shaded in the colour the script
|
|
27
|
+
computed there for the side the band is on, and the side is decided the way the
|
|
28
|
+
chart decides it, the first plot at or above the second, so the colour always
|
|
29
|
+
belongs to the run the chart draws that bar in. An absent colour leaves the bar
|
|
30
|
+
unshaded, as `docs/visuals/fills.md` has always taught. A side the script did
|
|
31
|
+
not compute keeps the colour it declared. `opacity` dims a computed colour
|
|
32
|
+
exactly as it dims a constant one, and the twelve percent fade of a band with no
|
|
33
|
+
colour of its own does not apply to a band whose colour is computed.
|
|
34
|
+
|
|
35
|
+
How several grids are drawn. Each grid reaches the chart under its declaration's
|
|
36
|
+
key, which does not change between recomputes, so the chart keeps a grid rather
|
|
37
|
+
than building it again on every tick. The single `table` hook still carries the
|
|
38
|
+
first grid, for a chart without the list. Two grids pinned to the same corner are
|
|
39
|
+
drawn one over the other, so give each grid its own `position`.
|
|
40
|
+
|
|
41
|
+
For a host that type checks the descriptor: `ChartFill` gains an optional
|
|
42
|
+
`colorBy`, `ChartDescriptor` an optional `tables`, and `ChartFillContext` and
|
|
43
|
+
`ChartTableSpec` are new exports. The one line assignment to the chart library's
|
|
44
|
+
own descriptor type was compiled against that library's types at 2.5.1 and at
|
|
45
|
+
2.5.5, and a study with two grids and a computed band was drawn end to end on
|
|
46
|
+
2.5.5.
|
|
47
|
+
|
|
48
|
+
The Python engine is unchanged. It never had either limit: its fills channel
|
|
49
|
+
already publishes each band's colours bar by bar, and its table channel already
|
|
50
|
+
serves every declared grid in declaration order. The chart adapter ships only in
|
|
51
|
+
the npm package. The Python package moves to 0.8.0 because the two packages carry
|
|
52
|
+
one version and ship as one release, and upgrading it changes nothing.
|
|
53
|
+
|
|
54
|
+
No compiled-format change, no language change, and no computed value moves:
|
|
55
|
+
every shipped example builds the same descriptor and the same columns as 0.7.2
|
|
56
|
+
when no chart version is stated. Still not decided: a band that computes one
|
|
57
|
+
side's colour and names none for the other draws that side in the chart's own
|
|
58
|
+
default colour, as a band with one constant side always has; whether such a side
|
|
59
|
+
should be unshaded is recorded as open in decision 75.
|
|
60
|
+
|
|
61
|
+
## 0.7.2
|
|
62
|
+
|
|
63
|
+
Running totals in both engines now survive one overflowing bar. `pvt` added its
|
|
64
|
+
per-bar term without checking it, so a price change, proportion or product that
|
|
65
|
+
overflowed stored an infinite total and every later reading was absent. `vwap`
|
|
66
|
+
and `vwapAnchor` did the same with an overflowing price times volume. Such a term
|
|
67
|
+
is now absent: that bar reads `none` and the total carries on from the bar
|
|
68
|
+
before it, as the specification's per-operation rule and its running-total rule
|
|
69
|
+
require together. Closes of 1, 1e308, -1e308, 2 and 3 on a volume of 1 now give
|
|
70
|
+
`pvt` readings of `none`, 1e308, `none`, 1e308 and 1e308, where 0.7.1 gave
|
|
71
|
+
`none` from the third bar on.
|
|
72
|
+
|
|
73
|
+
Two neighbouring readings change with it. `vwap` and `vwapAnchor` read `none`,
|
|
74
|
+
not an exact zero, while their volume total has overflowed, until the next anchor
|
|
75
|
+
or session starts it again. `ad`, `adOsc` and `cmf` treat a bar whose high to low
|
|
76
|
+
span overflows as absent instead of adding a zero term for it, so `ad` reads
|
|
77
|
+
`none` on that bar and `cmf` on the windows that hold it. A total that overflows
|
|
78
|
+
although its term was finite is still kept, and its readings stay `none`, as
|
|
79
|
+
before. Section 20.6 of the library specification now says both rules in so many
|
|
80
|
+
words.
|
|
81
|
+
|
|
82
|
+
Both engines were wrong in the same way, which is why exact agreement between
|
|
83
|
+
them never showed it. Independent expected results now cover every case above,
|
|
84
|
+
through compiled programs, forming-bar updates and restored checkpoints, and new
|
|
85
|
+
conformance cases pin the specified values. The strict numerical gates
|
|
86
|
+
compare 1,504,962 accepted calls with no differing bits or absent values, and
|
|
87
|
+
the library vectors for ordinary inputs are unchanged.
|
|
88
|
+
|
|
89
|
+
Separately, the TypeScript engine read `cmf` as `none` on any window whose volume sums
|
|
90
|
+
below zero; the Python engine divided, as the rule that a ratio is absent only
|
|
91
|
+
where its divisor is zero requires. Both now divide, and a fifth conformance case
|
|
92
|
+
pins it.
|
|
93
|
+
|
|
94
|
+
Upgrade both packages together. No source migration or compiled-format change
|
|
95
|
+
is required. Recompute stored `pvt`, `vwap`, `vwapAnchor`, `ad`, `adOsc` or `cmf`
|
|
96
|
+
results over data whose prices, volumes or their products come near the largest
|
|
97
|
+
finite number.
|
|
98
|
+
|
|
10
99
|
## 0.7.1
|
|
11
100
|
|
|
12
101
|
Python's ADX now normalizes a selected overflowing directional movement to
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ execution; see [Phase 6](./ROADMAP.md#phase-6-the-second-engine-and-live-running
|
|
|
26
26
|
|
|
27
27
|
## Status
|
|
28
28
|
|
|
29
|
-
**`0.
|
|
29
|
+
**`0.8.0` runs studies, backtests strategies, draws a strategy on a chart,
|
|
30
30
|
imports scripts from another chart language, and ships the language
|
|
31
31
|
intelligence an editor needs.** The Python engine is on PyPI
|
|
32
32
|
as `openscript`, at the same version, and the two are released together.
|
|
@@ -45,10 +45,19 @@ examples on every run rather than asserting it in a page. Two records can be put
|
|
|
45
45
|
beside each other, and a pair over different bars is reported incomparable
|
|
46
46
|
instead of being subtracted into a table that reads like a result.
|
|
47
47
|
|
|
48
|
-
**New in `0.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
**New in `0.8.0`:** the chart adapter draws a band whose colour is computed per
|
|
49
|
+
bar, and every grid a study declares, on a chart library from version 2.5.4 on.
|
|
50
|
+
A host states its chart by passing the library's `VERSION` as `chartVersion`;
|
|
51
|
+
one that states nothing, or an older chart, draws what 0.7.2 drew and gets the
|
|
52
|
+
same OS6024 refusal as before. The Python engine already served both and is
|
|
53
|
+
unchanged. No computed value or compiled format changes.
|
|
54
|
+
|
|
55
|
+
`0.7.2` stopped one overflowing bar from ending `pvt`, `vwap` or `vwapAnchor`
|
|
56
|
+
for good in both engines, and from counting as a false zero in `ad`, `adOsc` or
|
|
57
|
+
`cmf`.
|
|
58
|
+
|
|
59
|
+
`0.7.1` made Python's ADX recover from overflowing directional movements with
|
|
60
|
+
the same values as the JavaScript engine.
|
|
52
61
|
|
|
53
62
|
The `0.7.0` numerical work established exact comparisons across
|
|
54
63
|
all 116 scalar and stateful numerical signatures. Portable elementary kernels,
|
|
@@ -91,7 +100,7 @@ first thing a stranger reads:
|
|
|
91
100
|
writes the files a suite runs from straight out of a record, which is where the
|
|
92
101
|
strategy cases under [`cases/`](./cases) came from.
|
|
93
102
|
|
|
94
|
-
There are
|
|
103
|
+
There are 126 cases now: 72 in the `core` profile, 46 in `chart` and 8 in
|
|
95
104
|
`strategy`. They assert eight of the channels section 4 of
|
|
96
105
|
[`spec/conformance.md`](./spec/conformance.md) defines: diagnostics, a value
|
|
97
106
|
per bar per plot, the log, drawing objects, grid cells, orders, trades and the
|
|
@@ -100,7 +109,7 @@ first thing a stranger reads:
|
|
|
100
109
|
`numerics` categories, which are the reason the suite exists, now hold real
|
|
101
110
|
cases, each with expected values computed independently of both engines.
|
|
102
111
|
|
|
103
|
-
`npm run suite:agree` reports
|
|
112
|
+
`npm run suite:agree` reports 107 pass and 19 skipped of 126 between the two
|
|
104
113
|
engines, exactly, the skips being the compiler-diagnostic cases the Python
|
|
105
114
|
engine rightly has no compiler for. The two engines hold the same 251 library
|
|
106
115
|
entries, which a check asks each of them for on every build. What that run
|
|
@@ -112,7 +121,7 @@ first thing a stranger reads:
|
|
|
112
121
|
corroborating implementation, not a result. That is why no conformance badge
|
|
113
122
|
is shown here, though `npm run badge` will make one for an engine that passes.
|
|
114
123
|
|
|
115
|
-
The version is `0.
|
|
124
|
+
The version is `0.8.0` rather than `1.0` because of that list. The studies
|
|
116
125
|
surface is the part that is finished, and it is the part to build on.
|
|
117
126
|
|
|
118
127
|
`ROADMAP.md` says what each phase owes before it is allowed to finish. The
|
|
@@ -238,7 +247,11 @@ recomputing it; explicitly live state is retained. Drawing values are published
|
|
|
238
247
|
on updates, while signals, alerts and orders follow the confirmation policy.
|
|
239
248
|
|
|
240
249
|
The [chart adapter](./src/adapters/charts/index.ts) maps study outputs into the
|
|
241
|
-
host's chart.
|
|
250
|
+
host's chart. A host passes the chart library's own version as `chartVersion`,
|
|
251
|
+
and the adapter draws what that version has room for: a band coloured per bar
|
|
252
|
+
and every declared grid need a newer chart, and on an older one, or when no
|
|
253
|
+
version is stated, such a study is refused with OS6024 rather than drawn in
|
|
254
|
+
part. The [backtest driver](./src/core/backtest/drive.ts) supplies a
|
|
242
255
|
simulated order destination and records frames, fills, orders and the report.
|
|
243
256
|
[Replay and rerun](./src/core/backtest/replay.ts) let a stored result be checked
|
|
244
257
|
again. The host owns data access, rendering, persistence and order routing;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host's chart can draw, read from the version the host states.
|
|
3
|
+
*
|
|
4
|
+
* The adapter declares the descriptor's shape rather than importing the chart
|
|
5
|
+
* library, for the reason `contract.ts` gives, so it cannot ask the library
|
|
6
|
+
* what it has. Two hooks arrived after the oldest chart the peer range accepts:
|
|
7
|
+
* a band's per-bar colour callback and the list of grids, both in 2.5.4. A
|
|
8
|
+
* chart ignores a hook it does not know, so a descriptor that relied on either
|
|
9
|
+
* would draw, on an older chart, a band in the chart's own default colours or
|
|
10
|
+
* the first grid alone, and say nothing. That is the failure OS6024 exists to
|
|
11
|
+
* end, so where the adapter cannot tell, it refuses (`undrawable.ts`).
|
|
12
|
+
*
|
|
13
|
+
* **The host states the version, and the adapter reads what that version
|
|
14
|
+
* has.** The library exports its own version string, and a host that imports
|
|
15
|
+
* the chart already holds it: `descriptorFor(program, { chartVersion: VERSION })`.
|
|
16
|
+
* A version rather than a switch per hook, because a switch is a fact about the
|
|
17
|
+
* chart that the host has to look up and keep true through every upgrade and
|
|
18
|
+
* downgrade, while the version is the chart it actually installed.
|
|
19
|
+
*
|
|
20
|
+
* **Nothing stated reads as the oldest chart**, which is the descriptor every
|
|
21
|
+
* host got before the option existed: nothing it draws changes, and a program
|
|
22
|
+
* that needs either hook is refused as it was. A string that is not a version
|
|
23
|
+
* reads the same way, and the refusal says the string could not be read rather
|
|
24
|
+
* than guessing at what it meant. A prerelease orders before its release, as
|
|
25
|
+
* version precedence orders it, so `2.5.4-rc.1` reads as a chart without what
|
|
26
|
+
* 2.5.4 added; build metadata after a `+` orders nothing and is ignored.
|
|
27
|
+
*/
|
|
28
|
+
/** What the chart this descriptor is registered with will read. */
|
|
29
|
+
export interface ChartCapabilities {
|
|
30
|
+
/** A band's colour per bar, through the band's own colour callback. */
|
|
31
|
+
readonly bandColours: boolean;
|
|
32
|
+
/** Every declared grid, through the list of grids with an id each. */
|
|
33
|
+
readonly grids: boolean;
|
|
34
|
+
/** What the host stated, for the sentence a refusal carries. */
|
|
35
|
+
readonly stated: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
/** The two hooks this reads a version for. */
|
|
38
|
+
export type Capability = 'bandColours' | 'grids';
|
|
39
|
+
export declare function capabilitiesOf(stated: string | undefined): ChartCapabilities;
|
|
40
|
+
/**
|
|
41
|
+
* The sentence a refusal gives for a hook the chart may not have.
|
|
42
|
+
*
|
|
43
|
+
* `older` is what a chart without the hook does, in the words a reader of the
|
|
44
|
+
* refusal needs; the rest says which version has it and what this host stated,
|
|
45
|
+
* because the fix is the host's and it has to know which of the two to change.
|
|
46
|
+
*/
|
|
47
|
+
export declare function lacking(chart: ChartCapabilities, capability: Capability, older: string): string;
|
|
48
|
+
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,mEAAmE;AACnE,MAAM,WAAW,iBAAiB;IAChC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,8CAA8C;AAC9C,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,OAAO,CAAC;AAgBjD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,iBAAiB,CAO5E;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAU/F"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host's chart can draw, read from the version the host states.
|
|
3
|
+
*
|
|
4
|
+
* The adapter declares the descriptor's shape rather than importing the chart
|
|
5
|
+
* library, for the reason `contract.ts` gives, so it cannot ask the library
|
|
6
|
+
* what it has. Two hooks arrived after the oldest chart the peer range accepts:
|
|
7
|
+
* a band's per-bar colour callback and the list of grids, both in 2.5.4. A
|
|
8
|
+
* chart ignores a hook it does not know, so a descriptor that relied on either
|
|
9
|
+
* would draw, on an older chart, a band in the chart's own default colours or
|
|
10
|
+
* the first grid alone, and say nothing. That is the failure OS6024 exists to
|
|
11
|
+
* end, so where the adapter cannot tell, it refuses (`undrawable.ts`).
|
|
12
|
+
*
|
|
13
|
+
* **The host states the version, and the adapter reads what that version
|
|
14
|
+
* has.** The library exports its own version string, and a host that imports
|
|
15
|
+
* the chart already holds it: `descriptorFor(program, { chartVersion: VERSION })`.
|
|
16
|
+
* A version rather than a switch per hook, because a switch is a fact about the
|
|
17
|
+
* chart that the host has to look up and keep true through every upgrade and
|
|
18
|
+
* downgrade, while the version is the chart it actually installed.
|
|
19
|
+
*
|
|
20
|
+
* **Nothing stated reads as the oldest chart**, which is the descriptor every
|
|
21
|
+
* host got before the option existed: nothing it draws changes, and a program
|
|
22
|
+
* that needs either hook is refused as it was. A string that is not a version
|
|
23
|
+
* reads the same way, and the refusal says the string could not be read rather
|
|
24
|
+
* than guessing at what it meant. A prerelease orders before its release, as
|
|
25
|
+
* version precedence orders it, so `2.5.4-rc.1` reads as a chart without what
|
|
26
|
+
* 2.5.4 added; build metadata after a `+` orders nothing and is ignored.
|
|
27
|
+
*/
|
|
28
|
+
/** The chart version each hook arrived in. */
|
|
29
|
+
const SINCE = {
|
|
30
|
+
bandColours: '2.5.4',
|
|
31
|
+
grids: '2.5.4',
|
|
32
|
+
};
|
|
33
|
+
/** `major.minor.patch`, an optional prerelease, optional build metadata. */
|
|
34
|
+
const VERSION = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/;
|
|
35
|
+
export function capabilitiesOf(stated) {
|
|
36
|
+
const read = stated === undefined ? undefined : readVersion(stated);
|
|
37
|
+
return {
|
|
38
|
+
bandColours: read !== undefined && reaches(read, SINCE.bandColours),
|
|
39
|
+
grids: read !== undefined && reaches(read, SINCE.grids),
|
|
40
|
+
stated,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The sentence a refusal gives for a hook the chart may not have.
|
|
45
|
+
*
|
|
46
|
+
* `older` is what a chart without the hook does, in the words a reader of the
|
|
47
|
+
* refusal needs; the rest says which version has it and what this host stated,
|
|
48
|
+
* because the fix is the host's and it has to know which of the two to change.
|
|
49
|
+
*/
|
|
50
|
+
export function lacking(chart, capability, older) {
|
|
51
|
+
const since = SINCE[capability];
|
|
52
|
+
const stated = chart.stated;
|
|
53
|
+
const which = stated === undefined
|
|
54
|
+
? 'this host stated no chart version'
|
|
55
|
+
: readVersion(stated) === undefined
|
|
56
|
+
? `this host stated ${JSON.stringify(stated)}, which is not a version this adapter can read`
|
|
57
|
+
: `this host stated version ${stated}`;
|
|
58
|
+
return `${older} before chart version ${since}, and ${which}`;
|
|
59
|
+
}
|
|
60
|
+
function readVersion(text) {
|
|
61
|
+
const match = VERSION.exec(text);
|
|
62
|
+
if (match === null)
|
|
63
|
+
return undefined;
|
|
64
|
+
return {
|
|
65
|
+
release: [Number(match[1]), Number(match[2]), Number(match[3])],
|
|
66
|
+
prerelease: match[4] !== undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Whether a stated version is at or past the one a hook arrived in. */
|
|
70
|
+
function reaches(read, since) {
|
|
71
|
+
const needed = readVersion(since);
|
|
72
|
+
if (needed === undefined)
|
|
73
|
+
return false;
|
|
74
|
+
for (let part = 0; part < 3; part += 1) {
|
|
75
|
+
const have = read.release[part] ?? 0;
|
|
76
|
+
const need = needed.release[part] ?? 0;
|
|
77
|
+
if (have !== need)
|
|
78
|
+
return have > need;
|
|
79
|
+
}
|
|
80
|
+
return !read.prerelease;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../src/adapters/charts/capabilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAeH,8CAA8C;AAC9C,MAAM,KAAK,GAAyC;IAClD,WAAW,EAAE,OAAO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C,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/D,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS;KACnC,CAAC;AACJ,CAAC;AAED,wEAAwE;AACxE,SAAS,OAAO,CAAC,IAAU,EAAE,KAAa;IACxC,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACvC,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,GAAG,IAAI,CAAC;IACxC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;AAC1B,CAAC"}
|
|
@@ -16,6 +16,8 @@ export interface ColumnSpec {
|
|
|
16
16
|
}
|
|
17
17
|
/** The key a level's price column travels under. */
|
|
18
18
|
export declare function levelKey(index: number): string;
|
|
19
|
+
/** The key one side of a band's computed colour travels under. */
|
|
20
|
+
export declare function bandColourKey(band: number, side: 'up' | 'down'): string;
|
|
19
21
|
/** The two keys a per-bar colour travels under. */
|
|
20
22
|
export declare function colourKeys(key: string): {
|
|
21
23
|
readonly rgb: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columns.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/columns.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,M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E,MAAM,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,oDAAoD;AACpD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,kEAAkE;AAClE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAEvE;AAED,mDAAmD;AACnD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAExF;AAED,8EAA8E;AAC9E,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAM5F;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,UAAU,EAAE,CAMjF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,WAAW,CAWb"}
|
|
@@ -3,6 +3,10 @@ import { isColourValue, packChannels, unpackColour } from './colours.js';
|
|
|
3
3
|
export function levelKey(index) {
|
|
4
4
|
return `openscript:level:${index}`;
|
|
5
5
|
}
|
|
6
|
+
/** The key one side of a band's computed colour travels under. */
|
|
7
|
+
export function bandColourKey(band, side) {
|
|
8
|
+
return `openscript:fill:${band}:${side}`;
|
|
9
|
+
}
|
|
6
10
|
/** The two keys a per-bar colour travels under. */
|
|
7
11
|
export function colourKeys(key) {
|
|
8
12
|
return { rgb: `${key}:rgb`, alpha: `${key}:alpha`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AAC,KAAK,CAAC,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* What is declared is the whole output surface: the inputs and the settings
|
|
33
33
|
* dialog a chart generates from them, the plots with their styles and scales,
|
|
34
34
|
* the bands between them, the horizontal levels, the pane's fixed range, the
|
|
35
|
-
* markers, the candle and pane painting, the summary
|
|
35
|
+
* markers, the candle and pane painting, the summary grids, the drawing objects,
|
|
36
36
|
* the watched conditions, and the lifecycle a read of another instrument fetches
|
|
37
37
|
* through.
|
|
38
38
|
*
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
* still assignable to the library's wider one, and a value this adapter cannot
|
|
50
50
|
* produce is better left out than declared and never written.
|
|
51
51
|
*/
|
|
52
|
-
import type { ChartAlertSpec, ChartAttachContext, ChartDrawing, ChartGrid, ChartMarker, ChartSurfaceContext } from './surfaces.js';
|
|
52
|
+
import type { ChartAlertSpec, ChartAttachContext, ChartDrawing, ChartGrid, ChartMarker, ChartSurfaceContext, ChartTableSpec } from './surfaces.js';
|
|
53
53
|
/** One bar as the chart holds it. Its time is UTC seconds, not milliseconds. */
|
|
54
54
|
export interface ChartBar {
|
|
55
55
|
readonly time: number;
|
|
@@ -194,6 +194,19 @@ export interface ChartPlot {
|
|
|
194
194
|
colorBy?(ctx: ChartColorContext): string | undefined;
|
|
195
195
|
colorParts?(ctx: ChartColorContext): ChartBarColor | undefined;
|
|
196
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* What a band's per-bar colour callback is handed, for one bar.
|
|
199
|
+
*
|
|
200
|
+
* `a` and `b` are the two columns the band is drawn between, read on that bar,
|
|
201
|
+
* and `null` where either has no value, which is a bar the band is not drawn on.
|
|
202
|
+
*/
|
|
203
|
+
export interface ChartFillContext {
|
|
204
|
+
readonly index: number;
|
|
205
|
+
readonly a: number | null;
|
|
206
|
+
readonly b: number | null;
|
|
207
|
+
readonly values: ChartValues;
|
|
208
|
+
readonly settings: ChartSettings;
|
|
209
|
+
}
|
|
197
210
|
export interface ChartFill {
|
|
198
211
|
readonly between: readonly [string, string];
|
|
199
212
|
readonly colorUp?: string;
|
|
@@ -202,6 +215,15 @@ export interface ChartFill {
|
|
|
202
215
|
readonly colorDownKey?: string;
|
|
203
216
|
readonly opacity?: number;
|
|
204
217
|
readonly overlay?: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* The band's colour on one bar, for a band whose colour the script computes.
|
|
220
|
+
*
|
|
221
|
+
* Present only on such a band, and only where the host states a chart that
|
|
222
|
+
* has the callback (`capabilities.ts`). Nothing where that bar's side is not
|
|
223
|
+
* computed per bar, which leaves the chart drawing the band's own colour for
|
|
224
|
+
* that side.
|
|
225
|
+
*/
|
|
226
|
+
colorBy?(ctx: ChartFillContext): string | undefined;
|
|
205
227
|
}
|
|
206
228
|
export interface ChartLevel {
|
|
207
229
|
readonly price: number;
|
|
@@ -262,8 +284,18 @@ export interface ChartDescriptor {
|
|
|
262
284
|
background?(ctx: ChartSurfaceContext): readonly (string | null)[];
|
|
263
285
|
/** Every marker the last calculation produced, oldest bar first. */
|
|
264
286
|
markers?(ctx: ChartSurfaceContext): readonly ChartMarker[];
|
|
265
|
-
/** The declared grid as the last executed bar left it, or nothing. */
|
|
287
|
+
/** The first declared grid as the last executed bar left it, or nothing. */
|
|
266
288
|
table?(ctx: ChartSurfaceContext): ChartGrid | null;
|
|
289
|
+
/**
|
|
290
|
+
* Every declared grid as the last executed bar left it, each under its
|
|
291
|
+
* declaration's key.
|
|
292
|
+
*
|
|
293
|
+
* A chart that has this hook reads it in place of `table`, and one that does
|
|
294
|
+
* not reads `table` and draws the first grid. So it is present only where the
|
|
295
|
+
* host states a chart that has it (`capabilities.ts`), and a second grid is
|
|
296
|
+
* refused on a chart that does not.
|
|
297
|
+
*/
|
|
298
|
+
tables?(ctx: ChartSurfaceContext): readonly ChartTableSpec[];
|
|
267
299
|
/** Every drawing object the script currently holds, oldest first. */
|
|
268
300
|
draws?(ctx: ChartSurfaceContext): readonly ChartDrawing[];
|
|
269
301
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,mBAAmB,
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,cAAc,EACf,MAAM,eAAe,CAAC;AAEvB,gFAAgF;AAChF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,sDAAsD;AACtD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElG,+EAA+E;AAC/E,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,cAAc,GACd,MAAM,GACN,MAAM,GACN,WAAW,GACX,QAAQ,GACR,aAAa,CAAC;AAElB,MAAM,MAAM,cAAc,GAAG,OAA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AE,mBAAmB,GAAG,SAAS,YAAY,EAAE,CAAC;IAC1D;;;;;;OAMG;IACH,MAAM,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* second thing to keep in step with the specification.
|
|
15
15
|
*
|
|
16
16
|
* **The hooks that follow a calculation read it and do not repeat it.** Markers,
|
|
17
|
-
* the
|
|
17
|
+
* the grids, the drawing objects and each alert's message channel are taken once,
|
|
18
18
|
* while the engine is in hand, and left in the run record `produced.ts` keeps.
|
|
19
19
|
* The chart calls each hook after every calculation, so asking twice gives one
|
|
20
20
|
* answer and a study with a grid costs the same over a hundred thousand bars as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"descriptor.d.ts","sourceRoot":"","sources":["../../../src/adapters/charts/descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAIhE,OAAO,KAAK,EAGV,eAAe,EAIhB,MAAM,eAAe,CAAC;AAWvB,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,UAAU,CAAC;AAe/D,wBAAgB,aAAa,CAC3B,OAAO,EAAE,eAAe,EACxB,OAAO,GAAE,mBAAwB,GAChC,eAAe,CAkIjB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { alertMessages, buildAlerts } from './alerts.js';
|
|
2
|
+
import { capabilitiesOf } from './capabilities.js';
|
|
2
3
|
import { valuesFrom } from './columns.js';
|
|
3
4
|
import { buildDrawings } from './drawings.js';
|
|
4
5
|
import { buildFills } from './fills.js';
|
|
@@ -11,7 +12,7 @@ import { producedFor, remember } from './produced.js';
|
|
|
11
12
|
import { stationIn } from './requests.js';
|
|
12
13
|
import { fullRun, release, tailRun } from './run.js';
|
|
13
14
|
import { inputRows, lookupFor } from './settings.js';
|
|
14
|
-
import {
|
|
15
|
+
import { buildTables, firstGrid } from './tables.js';
|
|
15
16
|
/** The grey an unnamed marker is drawn in, where the host names no default. */
|
|
16
17
|
const MARKER_COLOUR = 'rgba(128, 128, 128, 1)';
|
|
17
18
|
export function descriptorFor(program, options = {}) {
|
|
@@ -22,10 +23,13 @@ export function descriptorFor(program, options = {}) {
|
|
|
22
23
|
// afterwards carry a settings key instead of a value, and the two that cannot
|
|
23
24
|
// are read again per call: a level's style and the pane's range.
|
|
24
25
|
const declared = lookupFor(program, options.settings ?? {});
|
|
26
|
+
// Which of the descriptor's newer hooks the host's chart reads. A hook it may
|
|
27
|
+
// not read is left off, and what needs one is refused before a bar runs.
|
|
28
|
+
const chart = capabilitiesOf(options.chartVersion);
|
|
25
29
|
const overlay = boolField(program.meta.overlay, declared) === true;
|
|
26
30
|
const plots = buildPlots(program, declared, !overlay);
|
|
27
31
|
const levels = buildLevels(program);
|
|
28
|
-
const fills = buildFills(program, declared);
|
|
32
|
+
const fills = buildFills(program, declared, chart);
|
|
29
33
|
const paint = buildPaint(program);
|
|
30
34
|
const alerts = buildAlerts(program, declared);
|
|
31
35
|
const columns = [
|
|
@@ -33,6 +37,7 @@ export function descriptorFor(program, options = {}) {
|
|
|
33
37
|
...levels.columns,
|
|
34
38
|
...paint.columns,
|
|
35
39
|
...alerts.columns,
|
|
40
|
+
...fills.columns,
|
|
36
41
|
];
|
|
37
42
|
const markerColour = options.markerColor ?? MARKER_COLOUR;
|
|
38
43
|
/**
|
|
@@ -46,7 +51,7 @@ export function descriptorFor(program, options = {}) {
|
|
|
46
51
|
const lookup = lookupFor(program, settings);
|
|
47
52
|
remember(settings, {
|
|
48
53
|
markers: buildMarkers(program, lookup, bars, ran.columns, markerColour),
|
|
49
|
-
|
|
54
|
+
tables: buildTables(program, lookup, ran.tables),
|
|
50
55
|
drawings: buildDrawings(ran.drawings),
|
|
51
56
|
messages: alertMessages(program, ran.columns),
|
|
52
57
|
});
|
|
@@ -62,7 +67,7 @@ export function descriptorFor(program, options = {}) {
|
|
|
62
67
|
placement: overlay ? 'onchart' : 'pane',
|
|
63
68
|
inputs: inputRows(program),
|
|
64
69
|
plots: plots.plots,
|
|
65
|
-
...(fills.length === 0 ? {} : { fills }),
|
|
70
|
+
...(fills.fills.length === 0 ? {} : { fills: fills.fills }),
|
|
66
71
|
...(alerts.alerts.length === 0 ? {} : { alerts: alerts.alerts }),
|
|
67
72
|
calc(bars, settings, store, ctx) {
|
|
68
73
|
const ran = fullRun(program, bars, settings, store, ctx, options);
|
|
@@ -87,7 +92,14 @@ export function descriptorFor(program, options = {}) {
|
|
|
87
92
|
}),
|
|
88
93
|
...(program.outputs.tables.length === 0
|
|
89
94
|
? {}
|
|
90
|
-
: {
|
|
95
|
+
: {
|
|
96
|
+
table: (ctx) => firstGrid(producedFor(ctx.settings).tables),
|
|
97
|
+
}),
|
|
98
|
+
...(program.outputs.tables.length === 0 || !chart.grids
|
|
99
|
+
? {}
|
|
100
|
+
: {
|
|
101
|
+
tables: (ctx) => producedFor(ctx.settings).tables,
|
|
102
|
+
}),
|
|
91
103
|
...(program.requires.includes('objects')
|
|
92
104
|
? {
|
|
93
105
|
draws: (ctx) => producedFor(ctx.settings).drawings,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"descriptor.js","sourceRoot":"","sources":["../../../src/adapters/charts/descriptor.ts"],"names":[],"mappings":"AA4CA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,OAAO,EA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AC,GAAwB,EAA6B,EAAE,CAC9D,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,MAAM;aACnC,CAAC;QACN,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;YACtC,CAAC,CAAC;gBACE,KAAK,EAAE,CAAC,GAAwB,EAA2B,EAAE,CAC3D,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,QAAQ;aACrC;YACH,CAAC,CAAC,EAAE,CAAC;QACP,2EAA2E;QAC3E,4EAA4E;QAC5E,2DAA2D;QAC3D,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;YACzC,CAAC,CAAC;gBACE,MAAM,CAAC,GAAuB;oBAC5B,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;oBAC/B,OAAO,GAAS,EAAE;wBAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;oBACrB,CAAC,CAAC;gBACJ,CAAC;aACF;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -2,22 +2,43 @@
|
|
|
2
2
|
* Declared bands into the chart's shaded bands.
|
|
3
3
|
*
|
|
4
4
|
* A band is two plot keys and two colours, which is the chart's own spec, so the
|
|
5
|
-
* pair of keys crosses unchanged.
|
|
5
|
+
* pair of keys crosses unchanged. Three details do not.
|
|
6
6
|
*
|
|
7
7
|
* **Opacity is a dimmer, not a second alpha.** A colour carries its own alpha
|
|
8
8
|
* everywhere in the language, and the band's `opacity` multiplies whatever the
|
|
9
|
-
* colours already are. That is exactly what the chart does with the field,
|
|
10
|
-
*
|
|
9
|
+
* colours already are. That is exactly what the chart does with the field, to a
|
|
10
|
+
* colour computed per bar as much as to a constant one, so a script that never
|
|
11
|
+
* touches it gets the colour it wrote.
|
|
11
12
|
*
|
|
12
13
|
* **A band with no colour of its own follows the first plot.** `stdlib.md` 14.2
|
|
13
14
|
* says such a band is that plot's colour faded to twelve percent, and the plot's
|
|
14
15
|
* colour may be one the host picked from its palette rather than one the script
|
|
15
16
|
* wrote, so the band is pointed at the plot's settings key rather than at a value
|
|
16
17
|
* read now. The twelve percent is then the dimmer, multiplied by whatever the
|
|
17
|
-
* script asked for.
|
|
18
|
+
* script asked for. A band whose colour is computed per bar has a colour of its
|
|
19
|
+
* own, so neither applies to it.
|
|
20
|
+
*
|
|
21
|
+
* **A colour computed per bar travels as columns and is read back per bar.**
|
|
22
|
+
* It arrives on a channel, rides the values table as the two columns
|
|
23
|
+
* `columns.ts` describes, and the band's colour callback reads them on each bar
|
|
24
|
+
* for the side the band is on there. The side is decided the way the chart
|
|
25
|
+
* decides it, the first plot at or above the second, so the colour answered is
|
|
26
|
+
* the colour of the run the chart is drawing that bar in. An absent colour is a
|
|
27
|
+
* transparent one rather than no answer, because no answer hands the bar to
|
|
28
|
+
* the band's colour for that side, and `docs/visuals/fills.md` teaches an absent
|
|
29
|
+
* colour as how a band switches itself off. The callback exists only on a chart
|
|
30
|
+
* that reads it (`capabilities.ts`); on any other, `undrawable.ts` has refused
|
|
31
|
+
* the program before this is drawn.
|
|
18
32
|
*/
|
|
19
33
|
import type { CompiledProgram } from '../../core/emit/index.js';
|
|
34
|
+
import type { ChartCapabilities } from './capabilities.js';
|
|
35
|
+
import type { ColumnSpec } from './columns.js';
|
|
20
36
|
import type { ChartFill } from './contract.js';
|
|
21
37
|
import type { InputLookup } from './fields.js';
|
|
22
|
-
export
|
|
38
|
+
export interface FillsBuild {
|
|
39
|
+
readonly fills: readonly ChartFill[];
|
|
40
|
+
/** The colour columns the bands' callbacks read, for the values table. */
|
|
41
|
+
readonly columns: readonly ColumnSpec[];
|
|
42
|
+
}
|
|
43
|
+
export declare function buildFills(program: CompiledProgram, lookup: InputLookup, chart: ChartCapabilities): FillsBuild;
|
|
23
44
|
//# sourceMappingURL=fills.d.ts.map
|