@wick-charts/react 0.2.1 → 0.2.3
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 +10 -12
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +5 -11
- package/dist/index.js +195 -197
- package/package.json +28 -3
- package/src/BarSeries.tsx +107 -0
- package/src/CandlestickSeries.tsx +107 -0
- package/src/ChartContainer.tsx +427 -0
- package/src/LineSeries.tsx +110 -0
- package/src/PieSeries.tsx +59 -0
- package/src/ThemeContext.tsx +21 -0
- package/src/context.ts +13 -0
- package/src/index.ts +120 -0
- package/src/store-bridge.ts +100 -0
- package/src/ui/Crosshair.tsx +61 -0
- package/src/ui/InfoBar.tsx +194 -0
- package/src/ui/Legend.tsx +274 -0
- package/src/ui/NumberFlow.tsx +118 -0
- package/src/ui/PieLegend.tsx +152 -0
- package/src/ui/PieTooltip.tsx +204 -0
- package/src/ui/Sparkline.tsx +214 -0
- package/src/ui/TimeAxis.tsx +112 -0
- package/src/ui/Title.tsx +62 -0
- package/src/ui/Tooltip.tsx +324 -0
- package/src/ui/YAxis.tsx +122 -0
- package/src/ui/YLabel.tsx +167 -0
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<!-- Generated from README.tmpl.md — edit the template, not this file. -->
|
|
2
|
-
|
|
3
1
|
# Wick Charts
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
<!-- Generated from README.tmpl.md — edit the template, not this file. -->
|
|
4
|
+
|
|
5
|
+
High-performance timeseries charts for **React**, **Vue**, and **Svelte**. Canvas-rendered, tree-shakeable, ~36KB gzipped when tree-shaken.
|
|
6
6
|
|
|
7
7
|
[Live Demo](https://mo4islona.github.io/wick-charts/)
|
|
8
8
|
|
|
@@ -70,8 +70,6 @@ Every DOM overlay ships a default UI **and** a scoped slot / render-prop so you
|
|
|
70
70
|
| `PieTooltip` | Tooltip for pie/donut hover | `{ info, format }` |
|
|
71
71
|
| `PieLegend` | Slice labels with values or percentages | `{ slices, mode, format }` |
|
|
72
72
|
|
|
73
|
-
> `TooltipLegend` is the former name of `InfoBar` and is still exported as a deprecated alias.
|
|
74
|
-
|
|
75
73
|
## Custom render (slots / render-props)
|
|
76
74
|
|
|
77
75
|
```tsx
|
|
@@ -102,7 +100,7 @@ Each overlay has its own slot context (see the Slot ctx column above); the shape
|
|
|
102
100
|
Every numeric overlay accepts a `format` prop so you can override the default label rendering. Two shared helpers ship in each framework package (`@wick-charts/react`, `@wick-charts/vue`, `@wick-charts/svelte`):
|
|
103
101
|
|
|
104
102
|
- `formatCompact(v)` — K/M/B/T suffixes with adaptive precision. Default for `YAxis` (at ranges ≥ 1e6), `PieLegend`, `PieTooltip`, `Sparkline`.
|
|
105
|
-
- `formatPriceAdaptive(v)` — full-precision display that scales decimals to the value's magnitude. Default for `Tooltip` / `
|
|
103
|
+
- `formatPriceAdaptive(v)` — full-precision display that scales decimals to the value's magnitude. Default for `Tooltip` / `InfoBar` OHLC and line-value cells. Handles sub-cent prices (`0.00001234` → `"0.00001234"`, not `"0.00"`).
|
|
106
104
|
|
|
107
105
|
```tsx
|
|
108
106
|
import { Tooltip, YAxis, formatCompact } from '@wick-charts/react';
|
|
@@ -111,7 +109,7 @@ import { Tooltip, YAxis, formatCompact } from '@wick-charts/react';
|
|
|
111
109
|
<Tooltip format={(v, field) => field === 'volume' ? formatCompact(v) : v.toFixed(4)} />
|
|
112
110
|
```
|
|
113
111
|
|
|
114
|
-
Tooltip /
|
|
112
|
+
Tooltip / InfoBar pass a `field` arg (`'open' | 'high' | 'low' | 'close' | 'volume' | 'value'`) so you can branch on which cell you're formatting. All other overlays receive a single `value: number`.
|
|
115
113
|
|
|
116
114
|
## Themes
|
|
117
115
|
|
|
@@ -198,15 +196,15 @@ Full `dist/index.js` (minified + gzipped):
|
|
|
198
196
|
|
|
199
197
|
| Package | Raw | Gzip |
|
|
200
198
|
|---|---|---|
|
|
201
|
-
| `@wick-charts/react` |
|
|
199
|
+
| `@wick-charts/react` | 224 KB | 59.3 KB |
|
|
202
200
|
|
|
203
201
|
Tree-shaking on the consumer side cuts this down further — `pnpm size` builds representative React scenarios through esbuild with production settings:
|
|
204
202
|
|
|
205
203
|
| Scenario | Raw | Gzip |
|
|
206
204
|
|---|---|---|
|
|
207
|
-
| Candlestick only |
|
|
208
|
-
| Line only |
|
|
209
|
-
| Full React (all overlays) |
|
|
205
|
+
| Candlestick only | 122.1 KB | 36.3 KB |
|
|
206
|
+
| Line only | 122.4 KB | 36.4 KB |
|
|
207
|
+
| Full React (all overlays) | 140.6 KB | 41.3 KB |
|
|
210
208
|
|
|
211
209
|
## Migration
|
|
212
210
|
|
|
@@ -214,4 +212,4 @@ Upgrading across versions? See [MIGRATION.md](https://github.com/mo4islona/wick-
|
|
|
214
212
|
|
|
215
213
|
## License
|
|
216
214
|
|
|
217
|
-
MIT
|
|
215
|
+
MIT
|