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.
Files changed (33) hide show
  1. package/README.md +52 -31
  2. package/dist/components/Canvas/ChartCanvas.d.ts +0 -2
  3. package/dist/components/Canvas/TickUpStage.d.ts +1 -1
  4. package/dist/hooks/useChartData.d.ts +8 -2
  5. package/dist/tickup-full.cjs.js +7 -4
  6. package/dist/tickup-full.cjs.js.map +1 -1
  7. package/dist/tickup-full.es.js +91 -88
  8. package/dist/tickup-full.es.js.map +1 -1
  9. package/dist/tickup.cjs.js +6 -3
  10. package/dist/tickup.cjs.js.map +1 -1
  11. package/dist/tickup.es.js +86 -83
  12. package/dist/tickup.es.js.map +1 -1
  13. package/documentation/00-getting-started.md +130 -0
  14. package/documentation/01-glossary.md +53 -33
  15. package/documentation/01-introduction.md +39 -7
  16. package/documentation/02-installation.md +16 -14
  17. package/documentation/03-quick-start.md +13 -21
  18. package/documentation/04-products-and-layout.md +10 -16
  19. package/documentation/05-props-and-chart-options.md +41 -51
  20. package/documentation/06-imperative-api.md +40 -66
  21. package/documentation/07-data-and-live-updates.md +40 -28
  22. package/documentation/08-drawings-and-shapes.md +30 -76
  23. package/documentation/09-settings-modal.md +17 -26
  24. package/documentation/10-toolbar-and-interactions.md +80 -49
  25. package/documentation/11-exports-and-advanced.md +48 -106
  26. package/documentation/12-overlays-and-indicators.md +27 -28
  27. package/documentation/13-internationalization-and-axes.md +23 -33
  28. package/documentation/14-legal-and-policies.md +13 -15
  29. package/documentation/16-api-reference.md +422 -0
  30. package/documentation/17-interval-schema-and-debugging.md +86 -0
  31. package/documentation/18-comparison-showcase.md +56 -0
  32. package/documentation/README.md +48 -30
  33. 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` | Optional `TimeRange` (`start`/`end` unix seconds). |
11
- | `initialNumberOfYTicks` | Default Y tick count (default 5). |
12
- | `initialXAxisHeight` | X axis height hint (pixels). |
13
- | `initialYAxisWidth` | Y axis width hint (pixels). |
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`). **Important:** pass a **stable reference** (`useMemo`) when the object does not meaningfully change, so internal state (e.g. chart type from the toolbar) is not overwritten by a new empty `{}` every render.
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 in the top cluster. |
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 string (toolbar input when the top bar is shown). |
36
- | `defaultSymbol` | Initial symbol when `symbol` is **omitted** (uncontrolled). Ignored for display once `symbol` is passed. |
37
- | `onSymbolChange` | Fired when the user edits the symbol in the **top bar** (Flow, Command, Desk). |
38
- | `onSymbolSearch` | Search submit (button or Enter) when the top bar is present. Return **`false`** or **reject** the returned `Promise` if loading the symbol failed — the input reverts to the last successfully displayed ticker and **`onSymbolChange`** is invoked with that previous value so controlled state stays consistent. Return **`true`** or **`undefined`** on success. |
39
- | `onRefreshRequest` | User hit Refresh in toolbar. |
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
- `getChartContext()` still reports the same symbol metadata for introspection.
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 to a tier (`pulse` \| `flow` \| `command` \| `desk` \| `prime`). |
53
- | `showAttribution` | In-chart TickUp watermark (default true; forced on for Desk). Uses transparent bundled marks. |
54
- | `licenseKey` | For **`productId: 'prime'`**: non-empty value hides the eval strip. |
55
- | `themeVariant` | Shell **light** \| **dark** — when set, the host is **controlled**; keep it in sync with your app state and update from **`onThemeVariantChange`** when the user toggles theme in the toolbar. |
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
- - **`themeVariant` / `defaultThemeVariant` / `onThemeVariantChange`** drive **`GlobalStyle`** (page background), settings-modal chrome, and related shell UI — not the plot alone.
62
- - Plot colors still come from **`chartOptions`** (`base.theme`, `base.style`, …). Keep them **consistent** with the shell (e.g. light shell + `base.theme: 'light'`) so axes, grid, and watermarks stay readable.
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?, // 'standard' | 'prime' — canvas profile; prime + base.theme 'light' uses light Prime palette & toolbars (see doc 15)
71
- chartType, // Candlestick | Line | Area | Bar
62
+ engine?, // rendering profile key (Standard Edition defaults to Canvas 2D)
63
+ chartType,
72
64
  theme,
73
65
  showOverlayLine,
74
66
  showHistogram,
75
- showCrosshair, // hover cross lines
76
- showCrosshairValues, // time/price labels on crosshair
77
- showCandleTooltip, // OHLC hover panel
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`** — Vertical + horizontal guide lines in default navigation mode.
88
- - **`showCrosshairValues`** — Labels for cursor time (along bottom) and price (along Y-axis side). Requires crosshair enabled.
89
- - **`showCandleTooltip`** — Corner panel with date, O/H/L/C, change, volume.
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, language, decimals, currency, date format, timezone, **trading sessions**, **holidays**, exchange, notation, tick size, conversion/display currency fields, etc. See [i18n & axes](./13-internationalization-and-axes.md).
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`** — Master switch for drawing indicator lines on the plot.
100
- - **`base.overlays`** — `OverlayWithCalc[]` (recommended for explicit periods).
101
- - **`base.overlayKinds`** — Shorthand list of kinds with library default parameters.
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
- ### Drawings default style
95
+ ### Standard Tier: data volume & live cadence
106
96
 
107
- Under `base.style.drawings`: line color, width, line style, fill, and **selected** state styling.
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
- See also existing reference: [`docs/Documentation/ChartStyleOptions.md`](../docs/Documentation/ChartStyleOptions.md) if present for extra detail; defaults live in `src/components/DefaultData.ts`.
99
+ ### Drawings default style
110
100
 
111
- ### Pro Tip
101
+ `base.style.drawings`: line, fill, selection styling.
112
102
 
113
- Keep your `chartOptions` stable in core, then layer Prime engine patches for premium rendering without changing your component contracts.
103
+ ---
114
104
 
115
- ### Prime Showcase
105
+ ## Tier comparison: TickUp Prime
116
106
 
117
- [Explore the TickUp Prime Showcase](https://bardamri.github.io/tickup-charts/)
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
- Obtain a handle with `useRef<TickUpHostHandle>()` (or `TickUpHostHandle`) and attach `ref` to `TickUpCommand`, `TickUpHost`, etc.
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 a shape instance (`DrawingInput`). |
10
- | `updateShape(shapeId, newShape)` | Replace with full spec/instance or apply a `DrawingPatch` (see `isDrawingPatch`). |
11
- | `patchShape(shapeId, patch)` | `DrawingPatch` only: style, points, symbol/size for custom symbols. |
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()` | Removes the currently selected shape from the stage. |
14
- | `updateSelectedShape(patch)` | Update properties (color, points, etc.) of the currently selected shape. |
17
+ | `deleteSelectedDrawing()` | Remove selected shape. |
18
+ | `updateSelectedShape(patch)` | Patch selected shape. |
15
19
  | `setDrawingsFromSpecs(specs)` | Replace stack from `DrawingSpec[]`. |
16
20
 
17
- Helpers exported from the package: `drawingFromSpec`, `applyDrawingPatch`, `isDrawingPatch`.
21
+ Helpers: `drawingFromSpec`, `applyDrawingPatch`, `isDrawingPatch`.
18
22
 
19
23
  ## Intervals (series)
20
24
 
21
25
  | Method | Description |
22
26
  |--------|-------------|
23
- | `addInterval(interval)` | Append a bar; series is kept sorted by `t`. |
24
- | `updateInterval(index, interval)` | Replace bar at **0-based index** in the current sorted series. |
25
- | `deleteInterval(index)` | Remove bar at **0-based index**. |
26
- | `applyLiveData(updates, placement)` | Preferred for streaming and time-keyed upserts; see [Data & live updates](./07-data-and-live-updates.md). |
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
- Resolve an index with `getViewInfo()?.intervals.findIndex(...)`. For time-based edits, prefer **`mergeByTime`** in `applyLiveData`.
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 range to loaded data. |
35
- | `nudgeVisibleTimeRangeToLatest(options?)` | If the last bar is past the right edge, pans the window by the minimum amount so it stays visible (keeps the same time span when possible). Optional `trailingPaddingSec`. No-op if the latest bar is already in view useful for live streams without calling `fitVisibleRangeToData` every tick. |
36
- | `getMainCanvasElement()` | Main OHLC `HTMLCanvasElement` (snapshots). |
37
- | `getCanvasSize()` | `{ width, height, dpr }` (backing store pixels + DPR). |
38
- | `getVisibleRanges()` | **`VisibleViewRanges`**: current **time** window (`time.start` / `time.end` in **unix seconds**, `time.startIndex` / `time.endIndex` into the sorted series) and **price** band (`price.min`, `price.max`, `price.range`) used for Y-axis scaling. Same values as `getViewInfo().visibleRange` / `.visiblePriceRange`. On **`TickUpHost`** / product refs, returns **`null`** until the inner stage is mounted — use `?.`. Type **`VisibleViewRanges`** is exported from **`tickup`** / **`tickup/full`**. |
39
- | `clearCanvas()` | Clear off-screen buffers **and** clear the drawings list (shapes removed). |
40
- | `redrawCanvas()` | Re-run the draw pipeline with current state (no data reload). |
41
- | `reloadCanvas()` | Stage **reload** hook (rebinds view to current intervals / internal reload path). |
42
- | `setEngine(engine)` | Merge a **`TickUpChartEngine`** patch into live **`chartOptions`**. Use **`TickUpPrime`** (dark Prime plot), **`createTickUpPrimeEngine('light' \| 'dark')`** (Prime plot aligned to host theme), **`TickUpStandardEngine`**, or a custom **`{ id, getChartOptionsPatch }`**. Imports: **`tickup`** or **`tickup/full`**. Prefer **`getTickUpPrimeThemePatch`** in **`chartOptions`** when applying Prime so props and **`setEngine`** stay in sync — see [Prime engine & Pro roadmap](https://github.com/BARDAMRI/tickup-prime/blob/main/documentation/15-prime-engine-and-pro-roadmap.md). |
43
- | `setInteractionMode(mode)` | Forwarded to the stage: same drawing modes as the package toolbar (`Mode` enum from **`tickup/full`**). |
44
- | `deleteSelectedDrawing()` | Removes the currently selected shape on the stage (no-op if nothing selected). |
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 instances, visible time/price ranges, canvas size. On **`TickUpHost` / product refs**, this may be **`null`** until the inner stage is mounted — use optional chaining (`?.`) in `useEffect` or after layout. Prefer **`getVisibleRanges()`** when you only need the visible time/price snapshot (no intervals or drawings). |
54
- | `getDrawings(query?)` | `DrawingSnapshot[]` with optional `DrawingQuery` filter. |
55
- | `getDrawingById(id)` | Single snapshot or null. |
56
- | `getSelectedDrawing()` | Get the snapshot of the currently selected drawing. |
57
- | `getSelectedDrawingId()` | Get the unique ID of the selected drawing. |
58
- | `getDrawingInstances(query?)` | Live `IDrawingShape[]` for advanced use. |
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: read visible ranges after zoom/pan
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, 'bars', v.time.startIndex, v.time.endIndex);
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 and patch a line
80
+ ## Example: add a line
84
81
 
85
82
  ```tsx
86
- import { ShapeType, type TickUpHostHandle } from 'tickup/full';
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
- ### Pro Tip
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
- ### Prime Showcase
97
+ ## Tier comparison: TickUp Prime
124
98
 
125
- [Explore the TickUp Prime Showcase](https://bardamri.github.io/tickup-charts/)
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 full series from parent state. When the array reference or backing data changes, the chart updates.
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** — Single `Interval` or `Interval[]`.
39
+ - **updates** — One `Interval` or `Interval[]`.
27
40
  - **placement** — `LiveDataPlacement`:
28
41
 
29
- | Value | Behavior (conceptual) |
30
- |-------|------------------------|
31
- | `replace` | Replace series with normalized incoming set. Fails `ok` if incoming is empty after validation. |
32
- | `append` | Append only bars with `t` ≥ last bar’s `t`; same `t` replaces the last bar; earlier times produce **warnings** and are skipped. |
33
- | `prepend` | Prepend only bars with `t` ≤ first bar’s `t`; same `t` replaces the first bar; later times produce **warnings** and are skipped. |
34
- | `mergeByTime` | Concatenate, sort by `t`, then **dedupe by time** (last row wins per timestamp). |
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
- **Existing** series is normalized on merge; invalid base rows add to `errors`. Incoming rows go through **`normalizeIntervals`** (OHLC clamping, bad volume dropped, low/high swap notes in `warnings`).
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`** — Validate/clamp one partial row; returns `{ value, notes }`.
45
- - **`normalizeIntervals`** — Batch version; `errors` / `warnings` arrays.
46
- - **`dedupeByTimePreferLast`** — Collapse duplicate `t`.
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
- `onRefreshRequest` fires when the user chooses Refresh. Reload your feed, set new `intervalsArray`, or call `reloadCanvas` / `fitVisibleRangeToData` as needed.
59
+ ## Timeframe changes
52
60
 
53
- ## Timeframe / Interval changes
61
+ Use **`onIntervalSearch(tf)`** on **`TickUpHost`** to load data for a new timeframe. See [Toolbar & interactions](./10-toolbar-and-interactions.md).
54
62
 
55
- While `intervalsArray` provides the chart with data, the user often initiates a change in the required data set by picking a new interval (e.g. from 1m to 1h).
63
+ ## Pitfalls
56
64
 
57
- Use **`onIntervalSearch(tf)`** on the `TickUpHost` to intercept these changes. This is the ideal place to swap your data source or fetch a new historical block for the new timeframe. See [Toolbar & Interactions](./10-toolbar-and-interactions.md) for details on the search and revert flow.
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
- ## Pitfalls
68
+ ## Troubleshooting (Standard Tier)
60
69
 
61
- - Do not pass a **new literal** `chartOptions={{}}` every render without `useMemo`; see [Props & chart options](./05-props-and-chart-options.md).
62
- - Ensure `t` is monotonic where your feed requires it; merge modes handle ordering differently.
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
- ### Pro Tip
76
+ More symptoms: [Interval schema & debugging](./17-interval-schema-and-debugging.md), [API reference](./16-api-reference.md).
65
77
 
66
- Prime deployments pair live merge flows with high-density rendering profiles to keep interaction smooth on larger streaming datasets.
78
+ ---
67
79
 
68
- ### Prime Showcase
80
+ ## Tier comparison: TickUp Prime
69
81
 
70
- [Explore the TickUp Prime Showcase](https://bardamri.github.io/tickup-charts/)
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 (or bounding logic per implementation). |
10
- | **Triangle** | 3 vertices (polyline workflow may add progressively). |
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 point + `symbol` string + `size`. |
14
+ | **CustomSymbol** | 1 anchor + `symbol` string + `size`. |
15
15
 
16
- ## Toolbar (Command / Desk / custom host with sidebar)
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** (but fully supported via **code**): **Arrow**, **Polyline**, **Custom symbol** (`ShapeType.Arrow` / `Polyline` / `CustomSymbol`). Use `addShape` / `DrawingSpec` for those.
28
+ **Not on the default toolbar** (supported via code): **Arrow**, **Polyline**, **CustomSymbol**. Use `addShape` / `DrawingSpec`.
31
29
 
32
- The enum also includes **`Mode.drawText`** for future use; there is no text drawing tool in the default toolbar today.
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 default navigation (`Mode.none`).
32
+ Click the active tool again to return to **`Mode.none`**.
35
33
 
36
- ### Creating shapes with the mouse
34
+ ### Mouse workflow
37
35
 
38
36
  1. Choose a draw tool.
39
- 2. Click (and drag or multi-click per tool) on the plot.
40
- 3. Shapes commit when enough points are placed (tool-specific).
37
+ 2. Click (and drag or multi-click per tool).
38
+ 3. Shapes commit when enough points are placed.
41
39
 
42
- **Polyline** (programmatic / custom UI only in the default product): add vertices with clicks; **double-click** finishes the path. **Angle** uses a two-step flow (first ray, then second ray) before committing.
40
+ **Polyline**: double-click finishes. **Angle**: two-step ray placement.
43
41
 
44
42
  ### Select & edit
45
43
 
46
- - **Select** — Click a shape to highlight (top-most hit wins).
47
- - **Edit** — Adjust handles where implemented.
48
- - **Double-click** a shape (in select/navigation modes) or **right‑click** a **selected** shape to open **Shape properties** modal fields include line color/width/style, fill, selection styling, and for custom symbols: text + size (`ShapePropertiesFormState`).
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
- size?: number;
53
- };
54
- ```
48
+ The shell wires **`ShapePropertiesModal`** via `onRequestShapeProperties`.
55
49
 
56
- Minimum points per type are enforced in `drawingFromSpec` (e.g. 2 for line/rect/circle/arrow).
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 & drawing by code
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
- ### Direct insertion
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
- ## Programmatic selection and management
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
- ## Programmatic updates \& deletion
73
+ - `selectShape(id)`, `unselectShape()`
74
+ - `getSelectedDrawing()`, `getSelectedDrawingId()`
75
+ - `updateSelectedShape(patch)`, `deleteSelectedDrawing()`
100
76
 
101
- ### Specific shape (by ID)
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
- ### Selection-centric (Convenience)
107
- * **`updateSelectedShape(patch)`**: Updates the properties of whichever shape is currently selected.
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
- - `getDrawings(query?)` — Filter by `types`, `ids`, `idPrefix`, time/price bounds, or custom `predicate`.
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** (Y value), not pixels. The canvas maps these using the current visible ranges.
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
- Note: Advanced drawing tools like Fibonacci Retracements are available exclusively in TickUp Prime.
90
+ ---
137
91
 
138
- ### Prime Showcase
92
+ ## Tier comparison: TickUp Prime
139
93
 
140
- [Explore the TickUp Prime Showcase](https://bardamri.github.io/tickup-charts/)
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/)**