liveline 0.0.5 → 0.0.7
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 +38 -2
- package/dist/index.cjs +661 -30
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +662 -31
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Liveline
|
|
2
2
|
|
|
3
|
-
Real-time animated charts for React. Line and candlestick modes, canvas-rendered, 60fps, zero CSS imports.
|
|
3
|
+
Real-time animated charts for React. Line, multi-series, and candlestick modes, canvas-rendered, 60fps, zero CSS imports.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -54,6 +54,7 @@ The component fills its parent container. Set a height on the parent. Pass `data
|
|
|
54
54
|
| `badgeTail` | `boolean` | `true` | Pointed tail on badge pill |
|
|
55
55
|
| `fill` | `boolean` | `true` | Gradient under the curve |
|
|
56
56
|
| `pulse` | `boolean` | `true` | Pulsing ring on live dot |
|
|
57
|
+
| `lineWidth` | `number` | `2` | Stroke width of the main line in pixels |
|
|
57
58
|
|
|
58
59
|
**Features**
|
|
59
60
|
|
|
@@ -83,6 +84,16 @@ When `mode="candle"`, pass `candles` (committed OHLC bars) and `liveCandle` (the
|
|
|
83
84
|
|
|
84
85
|
The `onModeChange` prop renders a built-in line/candle toggle next to the time window buttons.
|
|
85
86
|
|
|
87
|
+
**Multi-series**
|
|
88
|
+
|
|
89
|
+
| Prop | Type | Default | Description |
|
|
90
|
+
|------|------|---------|-------------|
|
|
91
|
+
| `series` | `LivelineSeries[]` | — | Multiple overlapping lines `{ id, data, value, color, label? }` |
|
|
92
|
+
| `onSeriesToggle` | `(id, visible) => void` | — | Callback when a series is toggled via built-in chips |
|
|
93
|
+
| `seriesToggleCompact` | `boolean` | `false` | Show only colored dots in toggle (no text labels) |
|
|
94
|
+
|
|
95
|
+
Pass `series` instead of `data`/`value` to draw multiple lines sharing the same axes. Each series gets its own color, label, and endpoint dot. Toggle chips appear automatically when there are 2+ series — clicking one hides/shows that line with a smooth fade. The Y-axis range adjusts when series are hidden. Badge, momentum arrows, and fill are disabled in multi-series mode.
|
|
96
|
+
|
|
86
97
|
**State**
|
|
87
98
|
|
|
88
99
|
| Prop | Type | Default | Description |
|
|
@@ -123,7 +134,7 @@ When `loading` flips to `false` with data present, the loading line morphs into
|
|
|
123
134
|
| `formatValue` | `(v: number) => string` | `v.toFixed(2)` | Value label formatter |
|
|
124
135
|
| `formatTime` | `(t: number) => string` | `HH:MM:SS` | Time axis formatter |
|
|
125
136
|
| `lerpSpeed` | `number` | `0.08` | Interpolation speed (0–1) |
|
|
126
|
-
| `padding` | `Padding` | `{ top: 12, right:
|
|
137
|
+
| `padding` | `Padding` | `{ top: 12, right: auto, bottom: 28, left: 12 }` | Chart padding override (`right` is 80/54/12 based on badge/grid) |
|
|
127
138
|
| `onHover` | `(point \| null) => void` | — | Hover callback with `{ time, value, x, y }` |
|
|
128
139
|
| `cursor` | `string` | `'crosshair'` | CSS cursor on canvas hover |
|
|
129
140
|
| `className` | `string` | — | Container class |
|
|
@@ -209,6 +220,30 @@ When `loading` flips to `false` with data present, the loading line morphs into
|
|
|
209
220
|
/>
|
|
210
221
|
```
|
|
211
222
|
|
|
223
|
+
### Multi-series (prediction market)
|
|
224
|
+
|
|
225
|
+
```tsx
|
|
226
|
+
<Liveline
|
|
227
|
+
data={[]}
|
|
228
|
+
value={0}
|
|
229
|
+
series={[
|
|
230
|
+
{ id: 'yes', data: yesData, value: yesValue, color: '#3b82f6', label: 'Yes' },
|
|
231
|
+
{ id: 'no', data: noData, value: noValue, color: '#ef4444', label: 'No' },
|
|
232
|
+
]}
|
|
233
|
+
grid
|
|
234
|
+
scrub
|
|
235
|
+
pulse
|
|
236
|
+
windowStyle="rounded"
|
|
237
|
+
formatValue={(v) => v.toFixed(1) + '%'}
|
|
238
|
+
onSeriesToggle={(id, visible) => console.log(id, visible)}
|
|
239
|
+
windows={[
|
|
240
|
+
{ label: '10s', secs: 10 },
|
|
241
|
+
{ label: '30s', secs: 30 },
|
|
242
|
+
{ label: '1m', secs: 60 },
|
|
243
|
+
]}
|
|
244
|
+
/>
|
|
245
|
+
```
|
|
246
|
+
|
|
212
247
|
### Loading + pause
|
|
213
248
|
|
|
214
249
|
```tsx
|
|
@@ -241,6 +276,7 @@ When `loading` flips to `false` with data present, the loading line morphs into
|
|
|
241
276
|
- **Frame-rate-independent lerp** on value, Y-axis range, badge color, and scrub opacity
|
|
242
277
|
- **Candlestick rendering** — OHLC bodies + wicks with bull/bear coloring, smooth live candle updates
|
|
243
278
|
- **Line/candle morph** — candle bodies collapse to close price, morph line extends center-out, coordinated alpha crossfade
|
|
279
|
+
- **Multi-series** — overlapping lines with per-series toggle, smooth alpha fade, and dynamic Y-axis range
|
|
244
280
|
- **ResizeObserver** tracks container size — no per-frame layout reads
|
|
245
281
|
- **Theme derivation** — full palette from one accent color + light/dark mode
|
|
246
282
|
- **Binary search interpolation** for hover value lookup
|