lightweight-charts-drawing 0.1.0 → 0.2.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 +92 -0
- package/LICENSE +21 -0
- package/README.md +82 -211
- package/dist/index.d.ts +1338 -3930
- package/dist/lightweight-charts-drawing.es.js +6088 -10513
- package/dist/lightweight-charts-drawing.es.js.map +1 -1
- package/dist/lightweight-charts-drawing.umd.cjs +8 -0
- package/dist/lightweight-charts-drawing.umd.cjs.map +1 -0
- package/package.json +12 -10
- package/dist/lightweight-charts-drawing.umd.js +0 -2
- package/dist/lightweight-charts-drawing.umd.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0 (26/09/2026)
|
|
4
|
+
|
|
5
|
+
A new library built on a shared drawing core (`src/tv`) that is also used by
|
|
6
|
+
[OpenTrader](https://github.com/deepentropy/opentrader), with a canvas
|
|
7
|
+
runtime (`src/runtime`). Breaking: the 0.1 API is removed.
|
|
8
|
+
|
|
9
|
+
### Breaking changes
|
|
10
|
+
|
|
11
|
+
- The 0.1 runtime is removed: `Drawing` and every tool class (`TrendLine`,
|
|
12
|
+
`FibRetracement`, …) with their pane views, the 0.1 `DrawingManager`
|
|
13
|
+
(`attach`, `addDrawing`, `selectDrawing`, …), `InteractionHandler`,
|
|
14
|
+
`ToolRegistry` / `getToolRegistry` / `TOOL_DEFINITIONS`, the geometry and
|
|
15
|
+
canvas helpers, `PreviewRenderer`.
|
|
16
|
+
- New drawing model: a drawing is plain data `{ id, kind, points: [{ time,
|
|
17
|
+
price }], style, … }` (types `Drawing`, `NewDrawing`, `DrawingStyle`) with
|
|
18
|
+
TradingView field names and factory defaults. The 0.1 JSON format
|
|
19
|
+
(`{ type, anchors, style: { lineColor, … }, options }`) is not read by
|
|
20
|
+
`importJSON`.
|
|
21
|
+
- Tool names follow TradingView / OpenTrader:
|
|
22
|
+
|
|
23
|
+
| 0.1 | 0.2 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| fib-extension | trend-based-fib-extension |
|
|
26
|
+
| fib-time-extension | trend-based-fib-time |
|
|
27
|
+
| fib-arcs | fib-speed-resistance-arcs |
|
|
28
|
+
| fib-speed-fan | fib-speed-resistance-fan |
|
|
29
|
+
| forecast | position-forecast |
|
|
30
|
+
| andrews-pitchfork | pitchfork |
|
|
31
|
+
| date-price-range | date-and-price-range |
|
|
32
|
+
| bars-pattern | bar-pattern |
|
|
33
|
+
| text-annotation | text |
|
|
34
|
+
| projection | sector |
|
|
35
|
+
|
|
36
|
+
- `anchored-text` is removed. TradingView has retired its Anchored text tool
|
|
37
|
+
in favour of the Text tool with "Anchor drawing" on
|
|
38
|
+
(`toggleAnchored`).
|
|
39
|
+
- `fancy-canvas` is no longer a dependency (types only, at build time).
|
|
40
|
+
|
|
41
|
+
### New
|
|
42
|
+
|
|
43
|
+
- `DrawingManager(chart, series, options)`: one series primitive draws every
|
|
44
|
+
drawing, the placement preview, the anchors (TradingView style) and the
|
|
45
|
+
drawings' price / time axis labels.
|
|
46
|
+
- Placement by TradingView's rules: clicks, 1-click tools, press-drag for
|
|
47
|
+
brush / highlighter, polyline / path / ghost feed finished by a
|
|
48
|
+
double-click or a click on the last point, the data TradingView computes
|
|
49
|
+
at placement (position levels, bar-pattern snapshot, ghost-feed seed,
|
|
50
|
+
curve controls, trend angle, Gann square), text tools ask the host for
|
|
51
|
+
an editor (`textEdit` event).
|
|
52
|
+
- Hover, multi-select (Ctrl / Cmd), anchor / body / group drags with each
|
|
53
|
+
tool's anchor rules, Ctrl + drag clone, magnet (weak / strong, Shift /
|
|
54
|
+
Ctrl modifiers), Shift 45° / square constraints, Escape / Delete, z-order,
|
|
55
|
+
per-interval visibility, locked drawings, cursors.
|
|
56
|
+
- "Anchor drawing" for Text, Pin and Table (`toggleAnchored`).
|
|
57
|
+
- Table cell editing (`tableEdit` event, `setTableCellText`, `tableOp`),
|
|
58
|
+
images (`addImage` + the image cache hooks).
|
|
59
|
+
- JSON export / import of the drawing model (`exportJSON`, `importJSON`
|
|
60
|
+
with schema check and point-model migration).
|
|
61
|
+
- 86 tools with TradingView factory defaults, labels and hit tests
|
|
62
|
+
([docs/TOOLS.md](docs/TOOLS.md)): lines, channels, pitchforks, Fibonacci
|
|
63
|
+
and Gann tools, chart patterns, Elliott waves, cycles, forecasting and
|
|
64
|
+
measuring tools (positions, ranges, forecast, bar pattern, ghost feed),
|
|
65
|
+
volume-based tools (anchored VWAP, fixed range / anchored volume
|
|
66
|
+
profile), shapes, text and notes, table, image, font icon.
|
|
67
|
+
- For hosts that draw their own way: `sceneOf` (renderer-neutral scene of a
|
|
68
|
+
drawing), `drawScene` (canvas), `hitTestKind`, `drawingAxisLabels`,
|
|
69
|
+
`finishPlacement` / `applyDrag` (interaction rules), `makeCoords` (chart ↔
|
|
70
|
+
price / time bridge), `parseDrawings` / `migrateDrawing`.
|
|
71
|
+
- The package imports nothing from lightweight-charts at run time (types
|
|
72
|
+
only), so a host keeps a single lightweight-charts copy.
|
|
73
|
+
|
|
74
|
+
### Notes
|
|
75
|
+
|
|
76
|
+
- The volume-based tools need bars with a volume: pass them with the
|
|
77
|
+
`bars` option (series data usually has none).
|
|
78
|
+
- Checks behind this release (in `docs/port-opentrader/`): the renderers
|
|
79
|
+
match OpenTrader's on 430 golden fixtures, the canvas renderer matches the
|
|
80
|
+
SVG output on 774 fixtures (0.05 % of drawn pixels differ, text
|
|
81
|
+
anti-aliasing), and all 86 tools pass a real-mouse survey (place, select,
|
|
82
|
+
anchor drag, body drag, delete) in the demo.
|
|
83
|
+
|
|
84
|
+
## 0.1.1 (26/02/2026)
|
|
85
|
+
|
|
86
|
+
- Description without "professional"; screenshots and the outdated
|
|
87
|
+
changelog removed from the README and docs.
|
|
88
|
+
|
|
89
|
+
## 0.1.0
|
|
90
|
+
|
|
91
|
+
- First release: tool classes with canvas pane views, `DrawingManager`,
|
|
92
|
+
tool registry, demo on GitHub Pages.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 deepentropy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
**[Live Demo](https://deepentropy.github.io/lightweight-charts-drawing/)**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
TradingView-style drawing tools for [lightweight-charts](https://github.com/tradingview/lightweight-charts) v5:
|
|
6
|
+
86 tools with TradingView's factory defaults, labels, hit tests, placement
|
|
7
|
+
and anchor rules (trend lines, channels, pitchforks, Fibonacci and Gann
|
|
8
|
+
tools, patterns, Elliott waves, cycles, forecasting and measuring tools,
|
|
9
|
+
volume-based tools, shapes, text and notes). List: [docs/TOOLS.md](docs/TOOLS.md).
|
|
10
|
+
|
|
11
|
+
> Version 0.2 breaks the 0.1 API: the tool classes of 0.1 are replaced by one
|
|
12
|
+
> `DrawingManager` on a shared drawing core. See [CHANGELOG.md](CHANGELOG.md).
|
|
6
13
|
|
|
7
14
|
## Installation
|
|
8
15
|
|
|
@@ -10,233 +17,97 @@
|
|
|
10
17
|
npm install lightweight-charts-drawing lightweight-charts
|
|
11
18
|
```
|
|
12
19
|
|
|
13
|
-
## Quick
|
|
20
|
+
## Quick start
|
|
14
21
|
|
|
15
22
|
```typescript
|
|
16
23
|
import { createChart, CandlestickSeries } from 'lightweight-charts';
|
|
17
|
-
import { DrawingManager
|
|
18
|
-
|
|
19
|
-
// Create chart
|
|
20
|
-
const chart = createChart(document.getElementById('chart')!, {
|
|
21
|
-
width: 800,
|
|
22
|
-
height: 400,
|
|
23
|
-
});
|
|
24
|
+
import { DrawingManager } from 'lightweight-charts-drawing';
|
|
24
25
|
|
|
26
|
+
const chart = createChart(document.getElementById('chart')!, { autoSize: true });
|
|
25
27
|
const series = chart.addSeries(CandlestickSeries);
|
|
26
|
-
series.setData(
|
|
27
|
-
|
|
28
|
-
// Set up drawing manager
|
|
29
|
-
const manager = new DrawingManager();
|
|
30
|
-
manager.attach(chart, series, document.getElementById('chart')!);
|
|
28
|
+
series.setData(bars); // your OHLC data
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
const trendLine = new TrendLine('tl-1', [
|
|
34
|
-
{ time: '2024-01-15', price: 100 },
|
|
35
|
-
{ time: '2024-02-15', price: 110 },
|
|
36
|
-
], { lineColor: '#2962FF', lineWidth: 2 });
|
|
30
|
+
const drawings = new DrawingManager(chart, series, { magnet: 'weak' });
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
// Arm a tool: the user places it with the mouse (TV clicks / drag rules).
|
|
33
|
+
drawings.setTool('fib-retracement');
|
|
39
34
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
{ time:
|
|
43
|
-
{ time:
|
|
44
|
-
]);
|
|
35
|
+
// Or add one in code (the tool's TradingView defaults fill the style).
|
|
36
|
+
drawings.add({ kind: 'trend-line', points: [
|
|
37
|
+
{ time: bars[10].time, price: bars[10].low },
|
|
38
|
+
{ time: bars[40].time, price: bars[40].high },
|
|
39
|
+
] });
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
// Save / restore (the core Drawing model, checked and migrated on import).
|
|
42
|
+
localStorage.setItem('drawings', drawings.exportJSON());
|
|
43
|
+
drawings.importJSON(localStorage.getItem('drawings') ?? '[]');
|
|
47
44
|
```
|
|
48
45
|
|
|
49
|
-
##
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
46
|
+
## DrawingManager
|
|
47
|
+
|
|
48
|
+
`new DrawingManager(chart, series, options?)` attaches one series primitive
|
|
49
|
+
that draws every drawing, the placement preview, the anchors and the
|
|
50
|
+
drawings' axis labels.
|
|
51
|
+
|
|
52
|
+
Options: `bars` (bar getter with volume; default the series data, which
|
|
53
|
+
usually has no volume: the volume profiles then show no rows and the
|
|
54
|
+
anchored VWAP uses equal weights), `fontFamily`
|
|
55
|
+
(default the chart font), `magnet` (`'off' | 'weak' | 'strong'`), `interval`
|
|
56
|
+
(per-interval visibility, TV Visibility tab), `timeInfo` (time zone /
|
|
57
|
+
intraday of date labels), `stayInDrawingMode` (TV Keep drawing).
|
|
58
|
+
|
|
59
|
+
| Method | |
|
|
60
|
+
|---|---|
|
|
61
|
+
| `setTool(kind \| null, { glyph? })`, `tool()` | arm / disarm a tool (`kind` from docs/TOOLS.md) |
|
|
62
|
+
| `setMagnet(mode)`, `setInterval(i)`, `setStayInDrawingMode(on)` | settings |
|
|
63
|
+
| `add(drawing)`, `update(drawing)`, `remove(id)`, `clear()`, `get(id)`, `drawings()` | drawings |
|
|
64
|
+
| `select(ids)`, `selection()` | selection (multi-select with Ctrl / Cmd) |
|
|
65
|
+
| `bringToFront(id)`, `sendToBack(id)` | z-order |
|
|
66
|
+
| `toggleAnchored(id)` | TV "Anchor drawing" for Text, Pin and Table: the drawing keeps its pane position when the chart scrolls (`isAnchorable(kind)`) |
|
|
67
|
+
| `exportJSON()`, `importJSON(json)` | save / restore |
|
|
68
|
+
| `addImage({ name, width, height })` | place an image (file put in the image cache by the host: `cacheImage` / `setImageReader`) |
|
|
69
|
+
| `setTableCellText(id, cell, text)`, `endTableEdit()`, `tableOp(id, op)`, `tableState()` | table cell editing (after a `tableEdit` event) and row / column operations |
|
|
70
|
+
| `on(event, cb)` → unsubscribe | events |
|
|
71
|
+
| `redraw()`, `destroy()` | |
|
|
72
|
+
|
|
73
|
+
Events: `change`, `add`, `update`, `remove`, `selection`, `tool`,
|
|
74
|
+
`textEdit` (a text tool was placed or double-clicked: open your editor at
|
|
75
|
+
the given pane point and `update` the drawing's `text`), `tableEdit` (a click
|
|
76
|
+
on a cell of the selected table: open your editor over the given cell box),
|
|
77
|
+
`gestureEnd` (end of a drag / placement, for undo grouping).
|
|
78
|
+
|
|
79
|
+
Mouse and keys (TradingView behaviour): placement by clicks, press-drag for
|
|
80
|
+
brush / highlighter, double-click (or a click on the last point) finishes a
|
|
81
|
+
path / polyline; anchor drags, body drag of a selected drawing, Ctrl / Cmd
|
|
82
|
+
click to multi-select and group drag, Ctrl + body drag clones; Shift = 45°
|
|
83
|
+
steps / square boxes and magnet off, Ctrl / Cmd inverts the magnet; Escape
|
|
84
|
+
drops pending points, then the tool, then the selection; Delete removes the
|
|
85
|
+
selection (locked drawings stay).
|
|
86
|
+
|
|
87
|
+
The host keeps what is not drawing logic: undo stack, storage, settings
|
|
88
|
+
dialogs, text / table editors, toolbar, context menu.
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// Select, deselect, remove
|
|
93
|
-
manager.selectDrawing('support');
|
|
94
|
-
manager.deselectAll();
|
|
95
|
-
manager.removeDrawing('support');
|
|
96
|
-
|
|
97
|
-
// Export/import drawings as JSON
|
|
98
|
-
const json = manager.exportDrawings();
|
|
99
|
-
// manager.importDrawings(json, factory);
|
|
90
|
+
## Architecture
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
```
|
|
93
|
+
src/tv/ shared drawing core, no UI and no lightweight-charts runtime:
|
|
94
|
+
tool model + TradingView factory defaults (specs), hit tests,
|
|
95
|
+
placement and drag rules (interact), saved-drawing migration
|
|
96
|
+
(serialize), renderer-neutral scenes per tool (scene)
|
|
97
|
+
src/runtime/ canvas runtime: DrawingManager, scene -> canvas renderer,
|
|
98
|
+
chart <-> price / time bridge (makeCoords)
|
|
104
99
|
```
|
|
105
100
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-

|
|
110
|
-
|
|
111
|
-
### Gann & Fibonacci Tools
|
|
112
|
-

|
|
113
|
-
|
|
114
|
-
### Forecasting & Measurement Tools
|
|
115
|
-

|
|
116
|
-
|
|
117
|
-
### Geometric Shapes
|
|
118
|
-

|
|
119
|
-
|
|
120
|
-
### Annotation Tools
|
|
121
|
-

|
|
122
|
-
|
|
123
|
-
## Available Drawing Tools (68)
|
|
124
|
-
|
|
125
|
-
### Lines
|
|
126
|
-
|
|
127
|
-
| Tool | Export | Anchors |
|
|
128
|
-
|------|--------|---------|
|
|
129
|
-
| Trend Line | `TrendLine` | 2 |
|
|
130
|
-
| Ray | `Ray` | 2 |
|
|
131
|
-
| Info Line | `InfoLine` | 2 |
|
|
132
|
-
| Extended Line | `ExtendedLine` | 2 |
|
|
133
|
-
| Trend Angle | `TrendAngle` | 2 |
|
|
134
|
-
| Horizontal Line | `HorizontalLine` | 1 |
|
|
135
|
-
| Horizontal Ray | `HorizontalRay` | 1 |
|
|
136
|
-
| Vertical Line | `VerticalLine` | 1 |
|
|
137
|
-
| Cross Line | `CrossLine` | 1 |
|
|
138
|
-
|
|
139
|
-
### Channels
|
|
140
|
-
|
|
141
|
-
| Tool | Export | Anchors |
|
|
142
|
-
|------|--------|---------|
|
|
143
|
-
| Parallel Channel | `ParallelChannel` | 3 |
|
|
144
|
-
| Regression Trend | `RegressionTrend` | 2 |
|
|
145
|
-
| Flat Top/Bottom | `FlatTopBottom` | 3 |
|
|
146
|
-
| Disjoint Channel | `DisjointChannel` | 4 |
|
|
147
|
-
|
|
148
|
-
### Pitchforks
|
|
149
|
-
|
|
150
|
-
| Tool | Export | Anchors |
|
|
151
|
-
|------|--------|---------|
|
|
152
|
-
| Andrews Pitchfork | `AndrewsPitchfork` | 3 |
|
|
153
|
-
| Schiff Pitchfork | `SchiffPitchfork` | 3 |
|
|
154
|
-
| Modified Schiff Pitchfork | `ModifiedSchiffPitchfork` | 3 |
|
|
155
|
-
| Inside Pitchfork | `InsidePitchfork` | 3 |
|
|
156
|
-
|
|
157
|
-
### Fibonacci
|
|
158
|
-
|
|
159
|
-
| Tool | Export | Anchors |
|
|
160
|
-
|------|--------|---------|
|
|
161
|
-
| Fib Retracement | `FibRetracement` | 2 |
|
|
162
|
-
| Fib Extension | `FibExtension` | 3 |
|
|
163
|
-
| Fib Channel | `FibChannel` | 3 |
|
|
164
|
-
| Fib Time Zone | `FibTimeZone` | 2 |
|
|
165
|
-
| Fib Speed Fan | `FibSpeedFan` | 2 |
|
|
166
|
-
| Fib Time Extension | `FibTimeExtension` | 3 |
|
|
167
|
-
| Fib Circles | `FibCircles` | 2 |
|
|
168
|
-
| Fib Spiral | `FibSpiral` | 2 |
|
|
169
|
-
| Fib Arcs | `FibArcs` | 2 |
|
|
170
|
-
| Fib Wedge | `FibWedge` | 3 |
|
|
171
|
-
| Pitchfan | `Pitchfan` | 3 |
|
|
172
|
-
|
|
173
|
-
### Gann
|
|
174
|
-
|
|
175
|
-
| Tool | Export | Anchors |
|
|
176
|
-
|------|--------|---------|
|
|
177
|
-
| Gann Box | `GannBox` | 2 |
|
|
178
|
-
| Gann Fan | `GannFan` | 2 |
|
|
179
|
-
| Gann Square Fixed | `GannSquareFixed` | 1 |
|
|
180
|
-
| Gann Square | `GannSquare` | 2 |
|
|
181
|
-
|
|
182
|
-
### Forecasting & Measurement
|
|
183
|
-
|
|
184
|
-
| Tool | Export | Anchors |
|
|
185
|
-
|------|--------|---------|
|
|
186
|
-
| Long Position | `LongPosition` | 3 |
|
|
187
|
-
| Short Position | `ShortPosition` | 3 |
|
|
188
|
-
| Forecast | `Forecast` | 2 |
|
|
189
|
-
| Bars Pattern | `BarsPattern` | 3 |
|
|
190
|
-
| Projection | `Projection` | 3 |
|
|
191
|
-
| Price Range | `PriceRange` | 2 |
|
|
192
|
-
| Date Range | `DateRange` | 2 |
|
|
193
|
-
| Date & Price Range | `DatePriceRange` | 2 |
|
|
194
|
-
|
|
195
|
-
### Shapes
|
|
196
|
-
|
|
197
|
-
| Tool | Export | Anchors |
|
|
198
|
-
|------|--------|---------|
|
|
199
|
-
| Rectangle | `Rectangle` | 2 |
|
|
200
|
-
| Rotated Rectangle | `RotatedRectangle` | 3 |
|
|
201
|
-
| Circle | `Circle` | 2 |
|
|
202
|
-
| Triangle | `Triangle` | 3 |
|
|
203
|
-
| Ellipse | `Ellipse` | 2 |
|
|
204
|
-
| Arc | `Arc` | 3 |
|
|
205
|
-
| Path | `Path` | 2+ |
|
|
206
|
-
| Polyline | `Polyline` | 2+ |
|
|
207
|
-
| Curve | `Curve` | 4 |
|
|
208
|
-
| Double Curve | `DoubleCurve` | 3 |
|
|
209
|
-
|
|
210
|
-
### Annotations
|
|
211
|
-
|
|
212
|
-
| Tool | Export | Anchors |
|
|
213
|
-
|------|--------|---------|
|
|
214
|
-
| Text | `TextAnnotation` | 1 |
|
|
215
|
-
| Callout | `Callout` | 2 |
|
|
216
|
-
| Anchored Text | `AnchoredText` | 2 |
|
|
217
|
-
| Note | `Note` | 1 |
|
|
218
|
-
| Price Note | `PriceNote` | 1 |
|
|
219
|
-
| Price Label | `PriceLabel` | 1 |
|
|
220
|
-
| Flag Mark | `FlagMark` | 1 |
|
|
221
|
-
| Pin | `Pin` | 1 |
|
|
222
|
-
| Comment | `Comment` | 1 |
|
|
223
|
-
| Signpost | `Signpost` | 1 |
|
|
224
|
-
| Table | `Table` | 1 |
|
|
225
|
-
| Brush | `Brush` | 2+ |
|
|
226
|
-
| Highlighter | `Highlighter` | 2+ |
|
|
227
|
-
| Arrow | `Arrow` | 2 |
|
|
228
|
-
| Arrow Marker | `ArrowMarker` | 1 |
|
|
229
|
-
| Arrow Mark Up | `ArrowMarkUp` | 1 |
|
|
230
|
-
| Arrow Mark Down | `ArrowMarkDown` | 1 |
|
|
231
|
-
|
|
232
|
-
## Architecture
|
|
233
|
-
|
|
234
|
-
Each drawing tool follows a two-class pattern:
|
|
101
|
+
The core is shared with [OpenTrader](https://github.com/deepentropy/opentrader),
|
|
102
|
+
which draws the same scenes as SVG. The package imports only types from
|
|
103
|
+
lightweight-charts, so the chart library is not bundled twice.
|
|
235
104
|
|
|
236
|
-
|
|
237
|
-
- **Pane view** (e.g. `TrendLinePaneView`) - implements `IPrimitivePaneView` from lightweight-charts, handles canvas rendering
|
|
105
|
+
## Demo
|
|
238
106
|
|
|
239
|
-
|
|
107
|
+
```bash
|
|
108
|
+
npm run demo # dev server, demo/
|
|
109
|
+
npm run build:demo # dist-demo/ (GitHub Pages)
|
|
110
|
+
```
|
|
240
111
|
|
|
241
112
|
## License
|
|
242
113
|
|