tickup 1.0.34 → 1.0.37
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 +52 -31
- package/dist/components/Canvas/ChartCanvas.d.ts +0 -2
- package/dist/components/Canvas/TickUpStage.d.ts +1 -1
- package/dist/hooks/useChartData.d.ts +8 -2
- package/dist/tickup-full.cjs.js +7 -4
- package/dist/tickup-full.cjs.js.map +1 -1
- package/dist/tickup-full.es.js +91 -88
- package/dist/tickup-full.es.js.map +1 -1
- package/dist/tickup.cjs.js +6 -3
- package/dist/tickup.cjs.js.map +1 -1
- package/dist/tickup.es.js +86 -83
- package/dist/tickup.es.js.map +1 -1
- package/documentation/00-getting-started.md +130 -0
- package/documentation/01-glossary.md +53 -33
- package/documentation/01-introduction.md +39 -7
- package/documentation/02-installation.md +16 -14
- package/documentation/03-quick-start.md +13 -21
- package/documentation/04-products-and-layout.md +10 -16
- package/documentation/05-props-and-chart-options.md +41 -51
- package/documentation/06-imperative-api.md +40 -66
- package/documentation/07-data-and-live-updates.md +40 -28
- package/documentation/08-drawings-and-shapes.md +30 -76
- package/documentation/09-settings-modal.md +17 -26
- package/documentation/10-toolbar-and-interactions.md +80 -49
- package/documentation/11-exports-and-advanced.md +48 -106
- package/documentation/12-overlays-and-indicators.md +27 -28
- package/documentation/13-internationalization-and-axes.md +23 -33
- package/documentation/14-legal-and-policies.md +13 -15
- package/documentation/16-api-reference.md +422 -0
- package/documentation/17-interval-schema-and-debugging.md +86 -0
- package/documentation/18-comparison-showcase.md +56 -0
- package/documentation/README.md +48 -30
- package/package.json +3 -2
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
# Props & chart options
|
|
2
2
|
|
|
3
|
+
For **exhaustive tables** (every host prop, `TickUpRenderEngine`, and `chartOptions` field with types, defaults, and Standard Tier notes), see **[API reference](./16-api-reference.md)**. This page is a shorter narrative companion.
|
|
4
|
+
|
|
3
5
|
## `TickUpHostProps` / `TickUpHostHandle`
|
|
4
6
|
|
|
5
7
|
### Data & view
|
|
6
8
|
|
|
7
9
|
| Prop | Purpose |
|
|
8
10
|
|------|---------|
|
|
9
|
-
| `intervalsArray` | OHLCV series (`Interval[]`). Default `[]`. |
|
|
10
|
-
| `initialVisibleTimeRange` |
|
|
11
|
-
| `initialNumberOfYTicks` |
|
|
12
|
-
| `initialXAxisHeight` |
|
|
13
|
-
| `initialYAxisWidth` |
|
|
11
|
+
| `intervalsArray` | OHLCV series (`Interval[]`). Default `[]`. Clamped to **5,000** bars (Standard Tier). |
|
|
12
|
+
| `initialVisibleTimeRange` | On the type for API stability; **not wired** in `TickUpHost` today — use ref pan/fit or load data first. |
|
|
13
|
+
| `initialNumberOfYTicks` | Seeds `chartOptions.axes.numberOfYTicks` when that axis field is omitted in `chartOptions` (default **5**). |
|
|
14
|
+
| `initialXAxisHeight` | **Not read** by the host today; layout uses internal constants. |
|
|
15
|
+
| `initialYAxisWidth` | **Not read** by the host today. |
|
|
14
16
|
| `initialTimeDetailLevel` | `TimeDetailLevel` for axis time density. |
|
|
15
17
|
| `initialTimeFormat12h` | 12h vs 24h time formatting. |
|
|
16
18
|
|
|
17
19
|
### `chartOptions` (deep partial merge)
|
|
18
20
|
|
|
19
|
-
Type: `DeepPartial<ChartOptions>`. Merged with library defaults (`DEFAULT_GRAPH_OPTIONS`).
|
|
20
|
-
|
|
21
|
-
When you **do** change options intentionally, any deep change triggers a merge into current state.
|
|
21
|
+
Type: `DeepPartial<ChartOptions>`. Merged with library defaults (`DEFAULT_GRAPH_OPTIONS`). Pass a **stable** reference (`useMemo`) when values do not change every render, so toolbar-driven state is not overwritten by a new `{}` each time.
|
|
22
22
|
|
|
23
23
|
### Layout (only without `productId`)
|
|
24
24
|
|
|
@@ -26,55 +26,47 @@ When you **do** change options intentionally, any deep change triggers a merge i
|
|
|
26
26
|
|------|---------|
|
|
27
27
|
| `showSidebar` | Drawing tools column. |
|
|
28
28
|
| `showTopBar` | Symbol + chart controls row. |
|
|
29
|
-
| `showSettingsBar` | Gear and related controls
|
|
29
|
+
| `showSettingsBar` | Gear and related controls. |
|
|
30
30
|
|
|
31
31
|
### Toolbar / host hooks
|
|
32
32
|
|
|
33
33
|
| Prop | Purpose |
|
|
34
34
|
|------|---------|
|
|
35
|
-
| `symbol` | Controlled symbol
|
|
36
|
-
| `defaultSymbol` | Initial symbol when `symbol` is **omitted
|
|
37
|
-
| `onSymbolChange` |
|
|
38
|
-
| `onSymbolSearch` | Search submit
|
|
39
|
-
| `onRefreshRequest` | User
|
|
40
|
-
|
|
41
|
-
**When the top bar is hidden** (e.g. **Pulse**, or `showTopBar: false` on `TickUpHost`):
|
|
42
|
-
|
|
43
|
-
- There is no editable symbol control; use React state and pass **`symbol`** (or **`defaultSymbol`** only) from the host.
|
|
44
|
-
- If the resolved text is non-empty (trimmed controlled value, else trimmed `defaultSymbol`), a **read-only symbol strip** is rendered above the chart. Empty string hides it.
|
|
35
|
+
| `symbol` | Controlled symbol (top bar when shown). |
|
|
36
|
+
| `defaultSymbol` | Initial symbol when `symbol` is **omitted**. |
|
|
37
|
+
| `onSymbolChange` | Top-bar symbol edits (Flow, Command, Desk). |
|
|
38
|
+
| `onSymbolSearch` | Search submit; return **`false`** or **reject** to revert input. |
|
|
39
|
+
| `onRefreshRequest` | User chose Refresh. |
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
**Top bar hidden** (e.g. Pulse): use **`symbol`** / **`defaultSymbol`** for the compact strip; see [Toolbar & interactions](./10-toolbar-and-interactions.md).
|
|
47
42
|
|
|
48
43
|
### Other
|
|
49
44
|
|
|
50
45
|
| Prop | Purpose |
|
|
51
46
|
|------|---------|
|
|
52
|
-
| `productId` | Lock layout
|
|
53
|
-
| `showAttribution` | In-chart TickUp watermark (
|
|
54
|
-
| `licenseKey` | For
|
|
55
|
-
| `themeVariant`
|
|
56
|
-
| `defaultThemeVariant` | Initial shell theme when **`themeVariant`** is omitted (uncontrolled). Default **`light`**. |
|
|
57
|
-
| `onThemeVariantChange` | Called when the user toggles light/dark from the settings toolbar; use with **`themeVariant`** for controlled mode or alone to observe toggles in uncontrolled mode. |
|
|
47
|
+
| `productId` | Lock layout (`pulse` \| `flow` \| `command` \| `desk` \| `prime`). |
|
|
48
|
+
| `showAttribution` | In-chart TickUp watermark (Desk forces on). |
|
|
49
|
+
| `licenseKey` | For `productId: 'prime'`: evaluation vs licensed chrome (Prime product). |
|
|
50
|
+
| `themeVariant` / `defaultThemeVariant` / `onThemeVariantChange` | Shell light/dark. |
|
|
58
51
|
|
|
59
52
|
### Shell vs chart theme
|
|
60
53
|
|
|
61
|
-
-
|
|
62
|
-
- Plot colors
|
|
63
|
-
- For the **Prime** renderer (`base.engine: 'prime'`), use **`getTickUpPrimeThemePatch('light' | 'dark')`** or **`createTickUpPrimeEngine(theme)`** with **`ref.setEngine`** so the merged patch matches your host theme. **`TickUpPrime`** alone applies the **dark** Prime plot; see [Prime engine & Pro roadmap](https://github.com/BARDAMRI/tickup-prime/blob/main/documentation/15-prime-engine-and-pro-roadmap.md).
|
|
54
|
+
- Shell props drive **`GlobalStyle`**, settings modal chrome, and toolbar surfaces.
|
|
55
|
+
- Plot colors come from **`chartOptions`** (`base.theme`, `base.style`, …). Align shell and chart theme for readable grid and watermarks.
|
|
64
56
|
|
|
65
57
|
## `ChartOptions` structure (high level)
|
|
66
58
|
|
|
67
59
|
```ts
|
|
68
60
|
ChartOptions = {
|
|
69
61
|
base: {
|
|
70
|
-
engine?, //
|
|
71
|
-
chartType,
|
|
62
|
+
engine?, // rendering profile key (Standard Edition defaults to Canvas 2D)
|
|
63
|
+
chartType,
|
|
72
64
|
theme,
|
|
73
65
|
showOverlayLine,
|
|
74
66
|
showHistogram,
|
|
75
|
-
showCrosshair,
|
|
76
|
-
showCrosshairValues,
|
|
77
|
-
showCandleTooltip,
|
|
67
|
+
showCrosshair,
|
|
68
|
+
showCrosshairValues,
|
|
69
|
+
showCandleTooltip,
|
|
78
70
|
style: { candles, line, area, bar, histogram, grid, overlay, axes, drawings, showGrid, backgroundColor },
|
|
79
71
|
overlays?, overlayKinds?,
|
|
80
72
|
},
|
|
@@ -84,34 +76,32 @@ ChartOptions = {
|
|
|
84
76
|
|
|
85
77
|
### Interaction flags (`base`)
|
|
86
78
|
|
|
87
|
-
- **`showCrosshair`** —
|
|
88
|
-
- **`showCrosshairValues`** —
|
|
89
|
-
- **`showCandleTooltip`** —
|
|
90
|
-
|
|
91
|
-
These can be toggled from the **Settings** modal (Chart Style → Hover) when using the full shell.
|
|
79
|
+
- **`showCrosshair`** — Guide lines in navigation mode.
|
|
80
|
+
- **`showCrosshairValues`** — Time/price labels (requires crosshair).
|
|
81
|
+
- **`showCandleTooltip`** — OHLC / change / volume panel.
|
|
92
82
|
|
|
93
83
|
### Axes & formatting
|
|
94
84
|
|
|
95
|
-
Under `base.style.axes`: locale,
|
|
85
|
+
Under `base.style.axes`: locale, decimals, currency, sessions, holidays, etc. See [i18n & axes](./13-internationalization-and-axes.md).
|
|
96
86
|
|
|
97
87
|
### Overlays / indicators
|
|
98
88
|
|
|
99
|
-
- **`base.showOverlayLine`** —
|
|
100
|
-
- **`base.overlays`** — `OverlayWithCalc[]` (recommended
|
|
101
|
-
- **`base.overlayKinds`** — Shorthand list
|
|
89
|
+
- **`base.showOverlayLine`** — Draw indicator lines.
|
|
90
|
+
- **`base.overlays`** — `OverlayWithCalc[]` (recommended).
|
|
91
|
+
- **`base.overlayKinds`** — Shorthand list.
|
|
102
92
|
|
|
103
|
-
See [Overlays & indicators](./12-overlays-and-indicators.md).
|
|
93
|
+
Standard Tier: **three** overlays maximum. See [Overlays & indicators](./12-overlays-and-indicators.md).
|
|
104
94
|
|
|
105
|
-
###
|
|
95
|
+
### Standard Tier: data volume & live cadence
|
|
106
96
|
|
|
107
|
-
|
|
97
|
+
**TickUp Core** (Standard Tier) keeps at most **5,000** bars in the rendered series and throttles rapid live merges to about **1 Hz** on Standard shells so dashboards stay responsive. If you need deeper history or faster merge cadence without that throttle, evaluate **Prime** (see [Comparison showcase](./18-comparison-showcase.md)).
|
|
108
98
|
|
|
109
|
-
|
|
99
|
+
### Drawings default style
|
|
110
100
|
|
|
111
|
-
|
|
101
|
+
`base.style.drawings`: line, fill, selection styling.
|
|
112
102
|
|
|
113
|
-
|
|
103
|
+
---
|
|
114
104
|
|
|
115
|
-
|
|
105
|
+
## Tier comparison: TickUp Prime
|
|
116
106
|
|
|
117
|
-
|
|
107
|
+
**TickUp Prime** documents optional engine patches and commercial styling. **TickUp Core** integration does not require them. **[Prime docs](https://github.com/BARDAMRI/tickup-prime)** · **[Showcase](https://bardamri.github.io/tickup-charts/)**
|
|
@@ -1,66 +1,64 @@
|
|
|
1
1
|
# Imperative API (ref handle)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Host **props** and **`chartOptions`** field tables: **[API reference](./16-api-reference.md)**.
|
|
4
|
+
|
|
5
|
+
**Standard Tier:** `applyLiveData`, `addInterval`, and related paths still enforce the **5,000**-bar cap and (on Standard shells) the **~1 Hz** live merge throttle — same as the `intervalsArray` prop path. See [Data & live updates](./07-data-and-live-updates.md).
|
|
6
|
+
|
|
7
|
+
Use `useRef<TickUpHostHandle>()` and attach `ref` to `TickUpCommand`, `TickUpHost`, or another supported shell.
|
|
4
8
|
|
|
5
9
|
## Drawings
|
|
6
10
|
|
|
7
11
|
| Method | Description |
|
|
8
12
|
|--------|-------------|
|
|
9
|
-
| `addShape(shape)` | Add from `DrawingSpec` or
|
|
10
|
-
| `updateShape(shapeId, newShape)` | Replace
|
|
11
|
-
| `patchShape(shapeId, patch)` | `DrawingPatch` only
|
|
13
|
+
| `addShape(shape)` | Add from `DrawingSpec` or shape instance (`DrawingInput`). |
|
|
14
|
+
| `updateShape(shapeId, newShape)` | Replace or apply a `DrawingPatch` (see `isDrawingPatch`). |
|
|
15
|
+
| `patchShape(shapeId, patch)` | `DrawingPatch` only. |
|
|
12
16
|
| `deleteShape(shapeId)` | Remove by id. |
|
|
13
|
-
| `deleteSelectedDrawing()` |
|
|
14
|
-
| `updateSelectedShape(patch)` |
|
|
17
|
+
| `deleteSelectedDrawing()` | Remove selected shape. |
|
|
18
|
+
| `updateSelectedShape(patch)` | Patch selected shape. |
|
|
15
19
|
| `setDrawingsFromSpecs(specs)` | Replace stack from `DrawingSpec[]`. |
|
|
16
20
|
|
|
17
|
-
Helpers
|
|
21
|
+
Helpers: `drawingFromSpec`, `applyDrawingPatch`, `isDrawingPatch`.
|
|
18
22
|
|
|
19
23
|
## Intervals (series)
|
|
20
24
|
|
|
21
25
|
| Method | Description |
|
|
22
26
|
|--------|-------------|
|
|
23
|
-
| `addInterval(interval)` | Append
|
|
24
|
-
| `updateInterval(index, interval)` | Replace
|
|
25
|
-
| `deleteInterval(index)` | Remove
|
|
26
|
-
| `applyLiveData(updates, placement)` |
|
|
27
|
+
| `addInterval(interval)` | Append; series sorted by `t`. |
|
|
28
|
+
| `updateInterval(index, interval)` | Replace at **0-based** index. |
|
|
29
|
+
| `deleteInterval(index)` | Remove at index. |
|
|
30
|
+
| `applyLiveData(updates, placement)` | Streaming merges; see [Data & live updates](./07-data-and-live-updates.md). |
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
Prefer **`mergeByTime`** for time-keyed upserts. Indices refer to the **trimmed** series under Standard Tier rules.
|
|
29
33
|
|
|
30
34
|
## View & canvas
|
|
31
35
|
|
|
32
36
|
| Method | Description |
|
|
33
37
|
|--------|-------------|
|
|
34
|
-
| `fitVisibleRangeToData()` | Fit visible time
|
|
35
|
-
| `nudgeVisibleTimeRangeToLatest(options?)` |
|
|
36
|
-
| `getMainCanvasElement()` | Main OHLC
|
|
37
|
-
| `getCanvasSize()` | `{ width, height, dpr }
|
|
38
|
-
| `getVisibleRanges()` |
|
|
39
|
-
| `clearCanvas()` | Clear
|
|
40
|
-
| `redrawCanvas()` |
|
|
41
|
-
| `reloadCanvas()` |
|
|
42
|
-
| `setEngine(engine)` | Merge a **`TickUpChartEngine`** patch into live **`chartOptions
|
|
43
|
-
| `setInteractionMode(mode)` |
|
|
44
|
-
| `
|
|
45
|
-
| `selectShape(id)` | Programmatically select a drawing by its ID. |
|
|
46
|
-
| `unselectShape()` | Clear the current selection. |
|
|
47
|
-
| `updateSelectedShape(patch)` | Modify the active selection properties. |
|
|
38
|
+
| `fitVisibleRangeToData()` | Fit visible time to loaded data. |
|
|
39
|
+
| `nudgeVisibleTimeRangeToLatest(options?)` | Pan so the last bar stays in view when needed. |
|
|
40
|
+
| `getMainCanvasElement()` | Main OHLC canvas. |
|
|
41
|
+
| `getCanvasSize()` | `{ width, height, dpr }`. |
|
|
42
|
+
| `getVisibleRanges()` | `VisibleViewRanges`: visible time + price. May be **`null`** until mount — use `?.`. |
|
|
43
|
+
| `clearCanvas()` | Clear buffers and drawings. |
|
|
44
|
+
| `redrawCanvas()` | Redraw with current state. |
|
|
45
|
+
| `reloadCanvas()` | Reload path for current intervals. |
|
|
46
|
+
| `setEngine(engine)` | Merge a **`TickUpChartEngine`** patch into live **`chartOptions`** (optional profiles from **`tickup/full`**). |
|
|
47
|
+
| `setInteractionMode(mode)` | Drawing / navigation mode (`Mode` enum). |
|
|
48
|
+
| `selectShape(id)` / `unselectShape()` | Selection control. |
|
|
48
49
|
|
|
49
50
|
## Introspection
|
|
50
51
|
|
|
51
52
|
| Method | Description |
|
|
52
53
|
|--------|-------------|
|
|
53
|
-
| `getViewInfo()` | Intervals, drawings
|
|
54
|
-
| `getDrawings(query?)` | `DrawingSnapshot[]
|
|
55
|
-
| `getDrawingById(id)` |
|
|
56
|
-
| `getSelectedDrawing()`
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `getChartContext()` | `ChartContextInfo`: symbol, chart type, theme, layout metrics, data window (`data.visibleTimeStart` / `visibleTimeEnd` / indices / price fields mirror **`getVisibleRanges()`**), drawing count, selection index, tick settings. May be `null` from the shell until the stage is ready. |
|
|
54
|
+
| `getViewInfo()` | Intervals, drawings, ranges, canvas size. **`null`** until ready — use `?.`. |
|
|
55
|
+
| `getDrawings(query?)` | `DrawingSnapshot[]`. |
|
|
56
|
+
| `getDrawingById(id)` | One snapshot or null. |
|
|
57
|
+
| `getSelectedDrawing()` / `getSelectedDrawingId()` | Current selection. |
|
|
58
|
+
| `getDrawingInstances(query?)` | Live `IDrawingShape[]` (advanced). |
|
|
59
|
+
| `getChartContext()` | Symbol, chart type, theme, layout, data window, drawing count. |
|
|
60
60
|
|
|
61
|
-
## Example:
|
|
62
|
-
|
|
63
|
-
`time.start` / `time.end` track the plotted X domain (unix seconds). `price.min` / `price.max` include padding around the highs/lows of the bars in view.
|
|
61
|
+
## Example: visible ranges
|
|
64
62
|
|
|
65
63
|
```tsx
|
|
66
64
|
import { useEffect, useRef } from 'react';
|
|
@@ -72,18 +70,17 @@ useEffect(() => {
|
|
|
72
70
|
const t = window.setInterval(() => {
|
|
73
71
|
const v = ref.current?.getVisibleRanges();
|
|
74
72
|
if (v) {
|
|
75
|
-
console.log('visible unix sec', v.time.start, v.time.end
|
|
76
|
-
console.log('visible price', v.price.min, v.price.max);
|
|
73
|
+
console.log('visible unix sec', v.time.start, v.time.end);
|
|
77
74
|
}
|
|
78
75
|
}, 1000);
|
|
79
76
|
return () => clearInterval(t);
|
|
80
77
|
}, []);
|
|
81
78
|
```
|
|
82
79
|
|
|
83
|
-
## Example: add
|
|
80
|
+
## Example: add a line
|
|
84
81
|
|
|
85
82
|
```tsx
|
|
86
|
-
import { ShapeType
|
|
83
|
+
import { ShapeType } from 'tickup/full';
|
|
87
84
|
|
|
88
85
|
ref.current?.addShape({
|
|
89
86
|
type: ShapeType.Line,
|
|
@@ -93,33 +90,10 @@ ref.current?.addShape({
|
|
|
93
90
|
],
|
|
94
91
|
style: { lineColor: '#ff00aa', lineWidth: 2 },
|
|
95
92
|
});
|
|
96
|
-
|
|
97
|
-
ref.current?.patchShape('some-id', {
|
|
98
|
-
style: { lineWidth: 3 },
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
After `addShape`, read the new id via `getDrawings()` (last / highest `zIndex`) or pass an explicit `id` in `DrawingSpec`.
|
|
103
|
-
|
|
104
|
-
## Example: programmatic selection and update
|
|
105
|
-
|
|
106
|
-
```tsx
|
|
107
|
-
// 1. Select a specific shape
|
|
108
|
-
chartRef.current?.selectShape("trend-line-1");
|
|
109
|
-
|
|
110
|
-
// 2. Modify whichever shape is currently selected (convenience)
|
|
111
|
-
chartRef.current?.updateSelectedShape({
|
|
112
|
-
style: { lineColor: "#00ff00" }
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// 3. Clear focus
|
|
116
|
-
chartRef.current?.unselectShape();
|
|
117
93
|
```
|
|
118
94
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
Prime workflows benefit most from the imperative API when you need precise runtime control over rendering mode, overlays, and drawing orchestration.
|
|
95
|
+
---
|
|
122
96
|
|
|
123
|
-
|
|
97
|
+
## Tier comparison: TickUp Prime
|
|
124
98
|
|
|
125
|
-
|
|
99
|
+
Commercial Prime deployments may expose additional runtime controls. **TickUp Core** APIs above are the supported baseline. **[TickUp Prime](https://github.com/BARDAMRI/tickup-prime)** · **[Showcase](https://bardamri.github.io/tickup-charts/)**
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
# Data & live updates
|
|
2
2
|
|
|
3
|
+
## Standard Tier guardrails
|
|
4
|
+
|
|
5
|
+
**TickUp Core** applies the following on every ingest path (initial props, history refresh, and live merges):
|
|
6
|
+
|
|
7
|
+
| Guardrail | Behavior |
|
|
8
|
+
|-----------|----------|
|
|
9
|
+
| **History depth** | Only the **last 5,000** candles are kept for rendering and downstream calculations. Older bars are discarded (`slice(-5000)` semantics). |
|
|
10
|
+
| **Live update rate** | On Standard product shells, rapid `applyLiveData` / prop updates are **throttled to about 1 second** between applied frames so the UI stays stable. Licensed Prime-tier host configurations may opt out of this throttle. |
|
|
11
|
+
|
|
12
|
+
If your feed sends more than 5,000 bars, trim server-side as well to save bandwidth; the chart will still enforce the cap client-side.
|
|
13
|
+
|
|
3
14
|
## `Interval` shape
|
|
4
15
|
|
|
16
|
+
What **open / high / low / close** mean in practice, and how to debug bad data: **[Interval schema & debugging](./17-interval-schema-and-debugging.md)**.
|
|
17
|
+
|
|
5
18
|
```ts
|
|
6
19
|
interface Interval {
|
|
7
20
|
t: number; // unix seconds
|
|
@@ -17,54 +30,53 @@ Times are **seconds**, not milliseconds.
|
|
|
17
30
|
|
|
18
31
|
## React prop: `intervalsArray`
|
|
19
32
|
|
|
20
|
-
Supply the
|
|
33
|
+
Supply the series from parent state. When the reference or backing data changes, the stage syncs and applies Standard Tier clamping.
|
|
21
34
|
|
|
22
35
|
For high-frequency streaming, prefer **`applyLiveData`** on the ref to avoid reallocating huge arrays on every tick.
|
|
23
36
|
|
|
24
37
|
## `applyLiveData(updates, placement)`
|
|
25
38
|
|
|
26
|
-
- **updates** —
|
|
39
|
+
- **updates** — One `Interval` or `Interval[]`.
|
|
27
40
|
- **placement** — `LiveDataPlacement`:
|
|
28
41
|
|
|
29
|
-
| Value | Behavior
|
|
30
|
-
|
|
31
|
-
| `replace` | Replace series with normalized incoming set.
|
|
32
|
-
| `append` | Append
|
|
33
|
-
| `prepend` | Prepend
|
|
34
|
-
| `mergeByTime` | Concatenate, sort by `t`,
|
|
42
|
+
| Value | Behavior |
|
|
43
|
+
|-------|----------|
|
|
44
|
+
| `replace` | Replace series with normalized incoming set. |
|
|
45
|
+
| `append` | Append bars with `t` ≥ last bar’s `t`; same `t` replaces last. |
|
|
46
|
+
| `prepend` | Prepend bars with `t` ≤ first bar’s `t`; same `t` replaces first. |
|
|
47
|
+
| `mergeByTime` | Concatenate, sort by `t`, dedupe by time (last wins). |
|
|
35
48
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Returns **`LiveDataApplyResult`**: `{ ok, intervals, errors, warnings }`. Always check `ok` and surface `errors` in production; inspect `warnings` for skipped bars or clamping.
|
|
49
|
+
Returns **`LiveDataApplyResult`**: `{ ok, intervals, errors, warnings }`. Check `ok` in production.
|
|
39
50
|
|
|
40
51
|
## Normalization utilities (exported)
|
|
41
52
|
|
|
42
53
|
From `tickup`:
|
|
43
54
|
|
|
44
|
-
- **`normalizeInterval`**
|
|
45
|
-
- **`
|
|
46
|
-
- **`
|
|
47
|
-
- **`applyLiveDataMerge`** — Lower-level merge helper used by the stage.
|
|
48
|
-
|
|
49
|
-
Use these server-side or before calling `applyLiveData` if you need consistent cleaning.
|
|
55
|
+
- **`normalizeInterval`**, **`normalizeIntervals`**
|
|
56
|
+
- **`dedupeByTimePreferLast`**
|
|
57
|
+
- **`applyLiveDataMerge`**
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
## Timeframe changes
|
|
52
60
|
|
|
53
|
-
|
|
61
|
+
Use **`onIntervalSearch(tf)`** on **`TickUpHost`** to load data for a new timeframe. See [Toolbar & interactions](./10-toolbar-and-interactions.md).
|
|
54
62
|
|
|
55
|
-
|
|
63
|
+
## Pitfalls
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
- Do not pass a **new** `chartOptions={{}}` every render without `useMemo`; see [Props & chart options](./05-props-and-chart-options.md).
|
|
66
|
+
- Keep `t` ordering consistent with your merge mode.
|
|
58
67
|
|
|
59
|
-
##
|
|
68
|
+
## Troubleshooting (Standard Tier)
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
| Observation | Explanation |
|
|
71
|
+
|---------------|-------------|
|
|
72
|
+
| Bar count stuck at **5,000** | **By design** — older bars are dropped client-side. Trim server-side too to save bandwidth. |
|
|
73
|
+
| Live path updates ~once per second | **By design** — **~1 Hz** throttle on Standard shells. Prime license may opt out of throttling. |
|
|
74
|
+
| Indicators look “wrong” on huge CSV | Overlays only see the **last 5,000** bars; verify your window matches expectations. |
|
|
63
75
|
|
|
64
|
-
|
|
76
|
+
More symptoms: [Interval schema & debugging](./17-interval-schema-and-debugging.md), [API reference](./16-api-reference.md).
|
|
65
77
|
|
|
66
|
-
|
|
78
|
+
---
|
|
67
79
|
|
|
68
|
-
|
|
80
|
+
## Tier comparison: TickUp Prime
|
|
69
81
|
|
|
70
|
-
|
|
82
|
+
**TickUp Prime** targets higher update rates and much larger histories than the **5,000**-candle Standard Tier baseline. Evaluate **[TickUp Prime](https://github.com/BARDAMRI/tickup-prime)** and the **[showcase](https://bardamri.github.io/tickup-charts/)**.
|
|
@@ -6,16 +6,14 @@
|
|
|
6
6
|
|------|----------------|
|
|
7
7
|
| **Line** | 2 points: start and end (time/price). |
|
|
8
8
|
| **Rectangle** | 2 corners (diagonal). |
|
|
9
|
-
| **Circle** | 2 points: center and rim
|
|
10
|
-
| **Triangle** | 3 vertices
|
|
9
|
+
| **Circle** | 2 points: center and rim. |
|
|
10
|
+
| **Triangle** | 3 vertices. |
|
|
11
11
|
| **Angle** | Vertex + two rays (two-phase placement in UI). |
|
|
12
12
|
| **Arrow** | 2 points: tail and head. |
|
|
13
13
|
| **Polyline** | Multiple vertices; double-click to finish in UI. |
|
|
14
|
-
| **CustomSymbol** | 1 anchor
|
|
14
|
+
| **CustomSymbol** | 1 anchor + `symbol` string + `size`. |
|
|
15
15
|
|
|
16
|
-
## Toolbar (Command / Desk /
|
|
17
|
-
|
|
18
|
-
The visible **sidebar** exposes these tools only:
|
|
16
|
+
## Toolbar (Command / Desk / host with sidebar)
|
|
19
17
|
|
|
20
18
|
| Tool | Mode |
|
|
21
19
|
|------|------|
|
|
@@ -27,33 +25,29 @@ The visible **sidebar** exposes these tools only:
|
|
|
27
25
|
| Select | `select` |
|
|
28
26
|
| Edit | `editShape` |
|
|
29
27
|
|
|
30
|
-
**Not on the toolbar** (
|
|
28
|
+
**Not on the default toolbar** (supported via code): **Arrow**, **Polyline**, **CustomSymbol**. Use `addShape` / `DrawingSpec`.
|
|
31
29
|
|
|
32
|
-
The enum
|
|
30
|
+
The enum may include **`Mode.drawText`** for future use; there is no text tool in the default toolbar today.
|
|
33
31
|
|
|
34
|
-
Click the active tool again to return to
|
|
32
|
+
Click the active tool again to return to **`Mode.none`**.
|
|
35
33
|
|
|
36
|
-
###
|
|
34
|
+
### Mouse workflow
|
|
37
35
|
|
|
38
36
|
1. Choose a draw tool.
|
|
39
|
-
2. Click (and drag or multi-click per tool)
|
|
40
|
-
3. Shapes commit when enough points are placed
|
|
37
|
+
2. Click (and drag or multi-click per tool).
|
|
38
|
+
3. Shapes commit when enough points are placed.
|
|
41
39
|
|
|
42
|
-
**Polyline
|
|
40
|
+
**Polyline**: double-click finishes. **Angle**: two-step ray placement.
|
|
43
41
|
|
|
44
42
|
### Select & edit
|
|
45
43
|
|
|
46
|
-
- **Select** —
|
|
47
|
-
- **Edit** —
|
|
48
|
-
- **Double-click**
|
|
49
|
-
|
|
50
|
-
The shell uses the exported **`ShapePropertiesModal`** component wired to `onRequestShapeProperties` on the canvas; you can reuse it in custom hosts.
|
|
44
|
+
- **Select** — Top-most hit wins.
|
|
45
|
+
- **Edit** — Handles where implemented.
|
|
46
|
+
- **Double-click** or **right‑click** (selected) opens **Shape properties** (`ShapePropertiesModal`): line, fill, selection styling; custom symbols: text + size.
|
|
51
47
|
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
```
|
|
48
|
+
The shell wires **`ShapePropertiesModal`** via `onRequestShapeProperties`.
|
|
55
49
|
|
|
56
|
-
Minimum points
|
|
50
|
+
Minimum points are enforced in `drawingFromSpec`.
|
|
57
51
|
|
|
58
52
|
```tsx
|
|
59
53
|
chartRef.current?.addShape({
|
|
@@ -63,78 +57,38 @@ chartRef.current?.addShape({
|
|
|
63
57
|
});
|
|
64
58
|
```
|
|
65
59
|
|
|
66
|
-
## Programmatic tools
|
|
67
|
-
|
|
68
|
-
You can trigger any drawing tool programmatically (as if the user clicked the toolbar) using **`setInteractionMode(Mode)`**:
|
|
60
|
+
## Programmatic tools
|
|
69
61
|
|
|
70
62
|
```tsx
|
|
71
63
|
import { Mode } from 'tickup/full';
|
|
72
64
|
|
|
73
|
-
// Start the rectangle tool
|
|
74
65
|
chartRef.current?.setInteractionMode(Mode.drawRectangle);
|
|
75
|
-
|
|
76
|
-
// Cancel/return to navigation
|
|
77
66
|
chartRef.current?.setInteractionMode(Mode.none);
|
|
78
67
|
```
|
|
79
68
|
|
|
80
|
-
|
|
81
|
-
Use **`addShape(DrawingSpec)`** to instantly place a shape on the chart without user interaction (e.g., loading saved annotations).
|
|
69
|
+
Use **`addShape(DrawingSpec)`** to insert without UI interaction.
|
|
82
70
|
|
|
83
|
-
##
|
|
84
|
-
|
|
85
|
-
In addition to UI interaction, you can fully control the selection state via the API:
|
|
86
|
-
|
|
87
|
-
* **`selectShape(id)`**: Highlights and selects a specific drawing by its ID.
|
|
88
|
-
* **`unselectShape()`**: Clears the current selection.
|
|
89
|
-
* **`getSelectedDrawing()`**: Returns the plain data snapshot of the currently active drawing (or `null`).
|
|
90
|
-
* **`getSelectedDrawingId()`**: Returns the ID of the selected drawing.
|
|
91
|
-
|
|
92
|
-
```tsx
|
|
93
|
-
const selected = chartRef.current?.getSelectedDrawing();
|
|
94
|
-
if (selected) {
|
|
95
|
-
console.log("Editing shape of type:", selected.type);
|
|
96
|
-
}
|
|
97
|
-
```
|
|
71
|
+
## Selection API
|
|
98
72
|
|
|
99
|
-
|
|
73
|
+
- `selectShape(id)`, `unselectShape()`
|
|
74
|
+
- `getSelectedDrawing()`, `getSelectedDrawingId()`
|
|
75
|
+
- `updateSelectedShape(patch)`, `deleteSelectedDrawing()`
|
|
100
76
|
|
|
101
|
-
|
|
102
|
-
* **`updateShape(id, data)`**: Full replacement.
|
|
103
|
-
* **`patchShape(id, patch)`**: Partial property update (color, width, points).
|
|
104
|
-
* **`deleteShape(id)`**: Remove the shape.
|
|
77
|
+
## Updates & deletion
|
|
105
78
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
* **`deleteSelectedDrawing()`**: Removes the current selection from the chart.
|
|
109
|
-
|
|
110
|
-
```tsx
|
|
111
|
-
// Force the selected shape to be red
|
|
112
|
-
chartRef.current?.updateSelectedShape({
|
|
113
|
-
style: { lineColor: '#ff0000' }
|
|
114
|
-
});
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
## Bulk replace
|
|
118
|
-
|
|
119
|
-
`setDrawingsFromSpecs(specs: DrawingSpec[])` rebuilds the entire overlay stack from JSON-friendly specs (e.g. after loading a layout from your server).
|
|
79
|
+
- `updateShape`, `patchShape`, `deleteShape` by id.
|
|
80
|
+
- `setDrawingsFromSpecs(specs)` — bulk replace.
|
|
120
81
|
|
|
121
82
|
## Query & persistence
|
|
122
83
|
|
|
123
|
-
|
|
124
|
-
- `shapeToSnapshot` / `queryDrawingsToSnapshots` — Export plain objects for storage.
|
|
84
|
+
`getDrawings(query?)`, `shapeToSnapshot`, `queryDrawingsToSnapshots` — export plain objects for storage.
|
|
125
85
|
|
|
126
86
|
## Coordinate space
|
|
127
87
|
|
|
128
|
-
`DrawingPoint` uses **time** (unix seconds) and **price
|
|
129
|
-
|
|
130
|
-
## Shape properties UI
|
|
131
|
-
|
|
132
|
-
`ShapePropertiesModal` is exported for advanced hosts who want to embed the same form outside the default flow. The shell wires it from the chart when editing.
|
|
133
|
-
|
|
134
|
-
### Pro Tip
|
|
88
|
+
`DrawingPoint` uses **time** (unix seconds) and **price**, not pixels.
|
|
135
89
|
|
|
136
|
-
|
|
90
|
+
---
|
|
137
91
|
|
|
138
|
-
|
|
92
|
+
## Tier comparison: TickUp Prime
|
|
139
93
|
|
|
140
|
-
|
|
94
|
+
Additional drawing and analysis tooling may ship with the commercial product. **TickUp Core** covers the shapes and APIs above. **[TickUp Prime](https://github.com/BARDAMRI/tickup-prime)** · **[Showcase](https://bardamri.github.io/tickup-charts/)**
|