@dwlf/charting 1.1.0 → 1.1.1
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 +41 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -166,6 +166,47 @@ const spec: ChartSpec = {
|
|
|
166
166
|
| `style` | `CSSProperties` | — | Inline styles on container |
|
|
167
167
|
| `animationState` | `ChartAnimationState` | — | Control entry animations |
|
|
168
168
|
|
|
169
|
+
## Crosshair Modes
|
|
170
|
+
|
|
171
|
+
By default the crosshair snaps to the nearest candle (`'series'` mode). Most traders prefer the crosshair to follow the mouse freely — use `'pointer'` mode:
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
<DWLFChart spec={spec} crosshairSnapMode="pointer" />
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
| Mode | Behaviour |
|
|
178
|
+
|------|-----------|
|
|
179
|
+
| `'series'` (default) | Snaps to nearest candle — good for precise OHLC readouts |
|
|
180
|
+
| `'pointer'` | Follows mouse position freely — feels more natural for interactive use |
|
|
181
|
+
|
|
182
|
+
## Pan & Zoom
|
|
183
|
+
|
|
184
|
+
Set `enablePanZoom={true}` to enable scroll-to-zoom and drag-to-pan. **This is off by default**, so the chart won't capture mouse scroll events unless you opt in.
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<DWLFChart spec={spec} enablePanZoom={true} />
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
If the chart is embedded in a scrollable page, be aware that `enablePanZoom` will capture scroll events over the chart area for zooming. You may want to place the chart in a fixed-height container so page scrolling still works outside the chart.
|
|
191
|
+
|
|
192
|
+
Use `initialVisibleCount` to control how many candles are visible on first render (the default shows all data):
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
<DWLFChart spec={spec} enablePanZoom={true} initialVisibleCount={100} />
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Right-Side Buffer
|
|
199
|
+
|
|
200
|
+
By default the chart fits data edge-to-edge. To add empty space on the right (useful for seeing the latest candle clearly or leaving room for annotations), use `extraRightSlots`:
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
<DWLFChart spec={spec} extraRightSlots={5} />
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
This adds 5 candle-widths of empty space to the right of the last data point.
|
|
207
|
+
|
|
208
|
+
Alternatively, you can append placeholder candles to your data with the same timestamp spacing but no visible data — the chart will render the empty space naturally.
|
|
209
|
+
|
|
169
210
|
## Annotations
|
|
170
211
|
|
|
171
212
|
20+ built-in annotation types with creation helpers:
|
package/package.json
CHANGED