@pond-ts/charts 0.56.2 → 0.58.0
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/CHANGELOG.md +1218 -1
- package/dist/AreaChart.d.ts +12 -1
- package/dist/AreaChart.js +131 -13
- package/dist/BarChart.d.ts +84 -9
- package/dist/BarChart.js +295 -40
- package/dist/BarList.d.ts +85 -5
- package/dist/BarList.js +25 -4
- package/dist/BoxList.d.ts +70 -3
- package/dist/BoxList.js +21 -7
- package/dist/BoxPlot.d.ts +2 -1
- package/dist/BoxPlot.js +101 -9
- package/dist/Candlestick.d.ts +13 -1
- package/dist/Candlestick.js +89 -3
- package/dist/ChartContainer.d.ts +79 -48
- package/dist/ChartContainer.js +482 -60
- package/dist/ChartRow.d.ts +9 -2
- package/dist/ChartRow.js +86 -12
- package/dist/HeatMap.d.ts +176 -0
- package/dist/HeatMap.js +344 -0
- package/dist/Layers.d.ts +5 -1
- package/dist/Layers.js +1014 -253
- package/dist/Legend.js +8 -4
- package/dist/LineChart.d.ts +18 -1
- package/dist/LineChart.js +165 -4
- package/dist/ListTable.d.ts +30 -3
- package/dist/ListTable.js +381 -23
- package/dist/ScatterChart.d.ts +3 -2
- package/dist/ScatterChart.js +68 -4
- package/dist/XAxis.js +40 -22
- package/dist/YAxis.d.ts +28 -1
- package/dist/YAxis.js +24 -2
- package/dist/annotations.d.ts +74 -0
- package/dist/annotations.js +97 -7
- package/dist/area.d.ts +34 -1
- package/dist/area.js +88 -1
- package/dist/bars.d.ts +178 -5
- package/dist/bars.js +504 -46
- package/dist/box.d.ts +2 -2
- package/dist/box.js +158 -40
- package/dist/brush.d.ts +142 -0
- package/dist/brush.js +179 -0
- package/dist/child-index.d.ts +27 -0
- package/dist/child-index.js +57 -0
- package/dist/context.d.ts +871 -36
- package/dist/cursors.d.ts +161 -0
- package/dist/cursors.js +503 -0
- package/dist/decimate.d.ts +78 -1
- package/dist/decimate.js +157 -0
- package/dist/heat.d.ts +163 -0
- package/dist/heat.js +659 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.js +25 -2
- package/dist/line.d.ts +137 -0
- package/dist/line.js +328 -0
- package/dist/ohlc.d.ts +16 -1
- package/dist/ohlc.js +93 -4
- package/dist/scatter.d.ts +17 -9
- package/dist/scatter.js +221 -33
- package/dist/select.d.ts +13 -5
- package/dist/select.js +14 -6
- package/dist/selection-fixtures.d.ts +174 -0
- package/dist/selection-fixtures.js +569 -0
- package/dist/selection-stories.d.ts +73 -0
- package/dist/selection-stories.js +301 -0
- package/dist/selectors.d.ts +316 -0
- package/dist/selectors.js +391 -0
- package/dist/span.d.ts +122 -0
- package/dist/span.js +203 -0
- package/dist/sweep.d.ts +154 -0
- package/dist/sweep.js +282 -0
- package/dist/theme.d.ts +517 -11
- package/dist/theme.js +220 -39
- package/dist/tracker.d.ts +6 -0
- package/dist/tracker.js +6 -0
- package/dist/tradingAxis.fixture.d.ts +78 -0
- package/dist/tradingAxis.fixture.js +215 -0
- package/dist/useChartLegend.js +18 -3
- package/package.json +3 -3
package/dist/ChartContainer.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
import { type DiscontinuityProvider, type TradingCalendarLike } from './tradingTimeScale.js';
|
|
3
3
|
import { Sequence, BoundedSequence } from 'pond-ts';
|
|
4
4
|
import type { TimeRange } from 'pond-ts';
|
|
5
|
-
import { type AnnotationKind, type CreateSpec, type CursorMode, type
|
|
5
|
+
import { type AnnotationKind, type CreateSpec, type CursorMode, type TrackerInfo, type DrawStatsFrame } from './context.js';
|
|
6
6
|
import { type AxisFormat, type CursorFormat } from './format.js';
|
|
7
7
|
import { type ChartTheme } from './theme.js';
|
|
8
8
|
export interface ChartContainerProps {
|
|
@@ -14,6 +14,49 @@ export interface ChartContainerProps {
|
|
|
14
14
|
* the data — so a tuple stays a time domain on a time chart.
|
|
15
15
|
*/
|
|
16
16
|
range?: readonly [number, number] | TimeRange;
|
|
17
|
+
/**
|
|
18
|
+
* **Cap the slot pitch** on a **category** x axis, in CSS pixels
|
|
19
|
+
* ([PND-BANDPACK]). A band scale otherwise spreads its categories across the
|
|
20
|
+
* full plot width, so three categories in a 900px panel become three 300px
|
|
21
|
+
* bars and thirty become thirty 30px ones — the same chart in the same panel
|
|
22
|
+
* reading as two different charts depending on how many categories the data
|
|
23
|
+
* happened to return.
|
|
24
|
+
*
|
|
25
|
+
* That is fine for a static chart with a known domain and wrong for a **live**
|
|
26
|
+
* one: when the category count moves over a session, bar width becomes a
|
|
27
|
+
* meaningless variable that moves on its own, and a reader can't compare the
|
|
28
|
+
* chart to what it looked like a minute ago or to the same chart on another
|
|
29
|
+
* screen. Capping the pitch keeps bar width constant and comparable, and the
|
|
30
|
+
* empty space left over is itself information — it shows the set is small.
|
|
31
|
+
*
|
|
32
|
+
* Omitted ⇒ slots fill the plot (unchanged). When `n × maxBandWidth` exceeds
|
|
33
|
+
* the plot, the cap can't bind and the slots fill as before, so this degrades
|
|
34
|
+
* correctly as categories accumulate. Use {@link bandAlign} to say where the
|
|
35
|
+
* capped block sits.
|
|
36
|
+
*
|
|
37
|
+
* **This caps the slot, not the bar.** `<BarChart gap>` still insets the bar
|
|
38
|
+
* within its slot, and the two compose — one knob for pitch, one for ink,
|
|
39
|
+
* neither doing the other's job. (Inverting `gap` against a measured plot
|
|
40
|
+
* width was the workaround this replaces for the width half; the packing half
|
|
41
|
+
* had no workaround at all.)
|
|
42
|
+
*
|
|
43
|
+
* **Vertical / x-axis categories only.** A `orientation="horizontal"`
|
|
44
|
+
* categorical chart puts its categories on the **y** axis as unit slots,
|
|
45
|
+
* which is a different mechanism and is not capped by this.
|
|
46
|
+
*/
|
|
47
|
+
maxBandWidth?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Where the capped category block sits in the plot when {@link maxBandWidth}
|
|
50
|
+
* binds. **Default `'start'`** — pack from the left, leaving the far side
|
|
51
|
+
* empty. `'center'` and `'end'` place it otherwise.
|
|
52
|
+
*
|
|
53
|
+
* A no-op without `maxBandWidth`, or when the cap doesn't bind: the block
|
|
54
|
+
* fills the plot and there is no slack to place. (There is deliberately no
|
|
55
|
+
* `'fill'` member — "fill" is what *omitting* `maxBandWidth` means, and a
|
|
56
|
+
* `fill` value alongside a pitch cap would be a contradiction rather than a
|
|
57
|
+
* choice.)
|
|
58
|
+
*/
|
|
59
|
+
bandAlign?: 'start' | 'center' | 'end';
|
|
17
60
|
/**
|
|
18
61
|
* A **trading-calendar** discontinuity provider — closed-market time
|
|
19
62
|
* (weekends, holidays, overnight, lunch breaks) collapsed. Supply it to turn
|
|
@@ -122,6 +165,13 @@ export interface ChartContainerProps {
|
|
|
122
165
|
* `'point'` / `'inline'` / `'flag'` add per-series marks; `'none'` hides it.
|
|
123
166
|
* `'region'` shades the bucket under the pointer (needs {@link cursorSequence}).
|
|
124
167
|
* See {@link CursorMode}.
|
|
168
|
+
*
|
|
169
|
+
* @deprecated Mount a **cursor component** instead — `<LineCursor>` /
|
|
170
|
+
* `<PointCursor>` / `<InlineCursor>` / `<FlagCursor>` / `<CrosshairCursor>` /
|
|
171
|
+
* `<RangeCursor>` as a child of the container (or inside a `<ChartRow>` for
|
|
172
|
+
* the per-row override); mount nothing for `'none'`. This prop keeps working
|
|
173
|
+
* for one more minor by synthesizing the equivalent preset internally; a
|
|
174
|
+
* mounted cursor component overrides it. See `docs/rfcs/interaction.md` §9.
|
|
125
175
|
*/
|
|
126
176
|
cursor?: CursorMode;
|
|
127
177
|
/**
|
|
@@ -144,6 +194,10 @@ export interface ChartContainerProps {
|
|
|
144
194
|
* re-realizes the buckets on each pointer move (harmless for a coarse
|
|
145
195
|
* day/session sequence, wasteful for a fine one over a wide view) — hoist it or
|
|
146
196
|
* `useMemo` it.
|
|
197
|
+
*
|
|
198
|
+
* @deprecated Use `<RangeCursor sequence={…}>` — the prop moved onto the
|
|
199
|
+
* component that uses it, where it is no longer mode-conditional. Works for
|
|
200
|
+
* one more minor; a mounted `<RangeCursor>`'s sequence wins over this.
|
|
147
201
|
*/
|
|
148
202
|
cursorSequence?: Sequence | BoundedSequence;
|
|
149
203
|
/**
|
|
@@ -166,6 +220,12 @@ export interface ChartContainerProps {
|
|
|
166
220
|
* domain is meaningless), so a **value** axis is always freeform. No-op unless
|
|
167
221
|
* `cursor="region"` on a **time** or **value** x-axis (a **category** axis is
|
|
168
222
|
* excluded — an ordinal-slot select is a different gesture).
|
|
223
|
+
*
|
|
224
|
+
* @deprecated Use `<RangeCursor onDragRelease>` — the drag moved onto the
|
|
225
|
+
* component, and the payload becomes `{ x: [lo, hi] }` (a {@link RangeSpan},
|
|
226
|
+
* forward-compatible with the 2-D drag's optional `y`) instead of the bare
|
|
227
|
+
* pair. Works for one more minor; a mounted `<RangeCursor onDragRelease>`
|
|
228
|
+
* takes over the gesture.
|
|
169
229
|
*/
|
|
170
230
|
onRegionSelect?: (range: readonly [number, number]) => void;
|
|
171
231
|
/**
|
|
@@ -176,6 +236,9 @@ export interface ChartContainerProps {
|
|
|
176
236
|
* selects). **Omitted** ⇒ a region-drag
|
|
177
237
|
* **preempts** pan (drag always selects; document that precedence for users).
|
|
178
238
|
* Wheel-zoom is unaffected in every case.
|
|
239
|
+
*
|
|
240
|
+
* @deprecated Use `<RangeCursor dragModifier>` — the prop moved onto the
|
|
241
|
+
* component alongside `onDragRelease`. Works for one more minor.
|
|
179
242
|
*/
|
|
180
243
|
regionSelectModifier?: 'shift';
|
|
181
244
|
/**
|
|
@@ -194,51 +257,6 @@ export interface ChartContainerProps {
|
|
|
194
257
|
* frame); route it to a ref/store rather than doing React state work per frame.
|
|
195
258
|
*/
|
|
196
259
|
onDrawStats?: (frame: DrawStatsFrame) => void;
|
|
197
|
-
/**
|
|
198
|
-
* Controlled selection — the selected mark (echo the `onSelect` arg back), or
|
|
199
|
-
* `null`. **Omitted ⇒ uncontrolled** (a click on a selectable layer manages it
|
|
200
|
-
* internally; pass `null` to force nothing selected). A layer is **selectable
|
|
201
|
-
* only when it carries an `id`** (the stable series identity) — `BarChart` /
|
|
202
|
-
* `ScatterChart` highlight the mark matching the selection's `id` (the series)
|
|
203
|
-
* and its `key` (the sample), so two series sharing a timestamp don't both
|
|
204
|
-
* light up, and the selection survives a data update (it keys on the stable
|
|
205
|
-
* `id`, not the sample `key`). A layer with no `id` renders + reads out but
|
|
206
|
-
* can't be selected.
|
|
207
|
-
*/
|
|
208
|
-
selected?: SelectInfo | null;
|
|
209
|
-
/**
|
|
210
|
-
* Fires when a selectable layer's mark is clicked, with the hit mark, or `null`
|
|
211
|
-
* when a click misses every mark (or hits a layer with no `id` — display-only,
|
|
212
|
-
* so it reads as empty space). Notification only — works in both controlled and
|
|
213
|
-
* uncontrolled mode. If this or `selected` is set but no layer has an `id`, a
|
|
214
|
-
* dev-warning notes that nothing is selectable.
|
|
215
|
-
*/
|
|
216
|
-
onSelect?: (hit: SelectInfo | null) => void;
|
|
217
|
-
/**
|
|
218
|
-
* Controlled hover-highlight — the transiently lit mark (echo the `onHover` arg
|
|
219
|
-
* back), or `null`. **Omitted ⇒ uncontrolled** (the pointer over a selectable
|
|
220
|
-
* layer manages it internally). The hover analog of {@link selected}: pass it to
|
|
221
|
-
* **pin** a lit mark from outside the chart (e.g. hovering a legend / list row
|
|
222
|
-
* lights the matching {@link BarChart} bar). Only layers with a hover-highlight
|
|
223
|
-
* (currently `BarChart`) render it; keyed by the same {@link SelectInfo} identity
|
|
224
|
-
* as selection.
|
|
225
|
-
*/
|
|
226
|
-
hovered?: SelectInfo | null;
|
|
227
|
-
/**
|
|
228
|
-
* Fires when the pointer enters a selectable layer's mark (the hit mark) or
|
|
229
|
-
* leaves every mark (`null`) — the hover analog of {@link onSelect}. Notification
|
|
230
|
-
* only (works controlled or uncontrolled), and **deduped**: it fires on a mark
|
|
231
|
-
* transition, not on every pointer move. Wire it to mirror hover out-of-band
|
|
232
|
-
* (e.g. a list row ↔ the bar), pairing with {@link hovered} to sync both ways.
|
|
233
|
-
* (The annotation counterpart is {@link onHoverAnnotation}.)
|
|
234
|
-
*
|
|
235
|
-
* **Dedup key:** by the mark's `key` + `label` only (not `value`/`color`). So on
|
|
236
|
-
* a live chart where a bar's value changes while the cursor stays on it, this
|
|
237
|
-
* won't re-fire — read the current value from your series, not the last
|
|
238
|
-
* `onHover` payload. (Matches the internal hover-highlight, which repaints on
|
|
239
|
-
* key transitions.)
|
|
240
|
-
*/
|
|
241
|
-
onHover?: (hit: SelectInfo | null) => void;
|
|
242
260
|
/**
|
|
243
261
|
* Which pan/zoom gestures the plot captures:
|
|
244
262
|
*
|
|
@@ -253,7 +271,7 @@ export interface ChartContainerProps {
|
|
|
253
271
|
* `false` ⇒ `'none'`). Bound the reachable range with {@link bounds}
|
|
254
272
|
* (zoom-out / pan extent) and {@link minDuration} (zoom-in floor).
|
|
255
273
|
*/
|
|
256
|
-
panZoom?: boolean | 'none' | 'pan' | 'panZoom';
|
|
274
|
+
panZoom?: boolean | 'none' | 'pan' | 'panZoom' | 'panZoomX' | 'panZoomY' | 'panZoomXY';
|
|
257
275
|
/**
|
|
258
276
|
* **Outer pan/zoom extent** — `[min, max]` (same units as {@link range}) the
|
|
259
277
|
* view can never move outside. Panning into an edge stops there (the window
|
|
@@ -284,6 +302,10 @@ export interface ChartContainerProps {
|
|
|
284
302
|
* Show the cursor's time atop the in-chart readout (when a row's `cursor` draws
|
|
285
303
|
* one). **Default `false`.** Formatted by {@link timeFormat} to match the time
|
|
286
304
|
* axis.
|
|
305
|
+
*
|
|
306
|
+
* @deprecated Use `showTime` on the mounted cursor component
|
|
307
|
+
* (`<LineCursor showTime>` / `<FlagCursor showTime>` / …). Works for one
|
|
308
|
+
* more minor via the shim.
|
|
287
309
|
*/
|
|
288
310
|
cursorTime?: boolean;
|
|
289
311
|
/**
|
|
@@ -294,6 +316,10 @@ export interface ChartContainerProps {
|
|
|
294
316
|
* the vertical line snaps its **x** to the data grid (so the time readout is
|
|
295
317
|
* clean), and both draw a full-height dashed vertical + full-width dashed
|
|
296
318
|
* horizontal line.
|
|
319
|
+
*
|
|
320
|
+
* @deprecated Use `<CrosshairCursor snap={…}>` — the prop moved onto the
|
|
321
|
+
* component, where it is no longer mode-conditional. Works for one more
|
|
322
|
+
* minor via the shim.
|
|
297
323
|
*/
|
|
298
324
|
crosshairSnap?: boolean;
|
|
299
325
|
/**
|
|
@@ -375,6 +401,11 @@ export interface ChartContainerProps {
|
|
|
375
401
|
* {@link timeFormat} owns the labels. (A category axis reads names, and a
|
|
376
402
|
* `transform`ed axis's pill speaks its derived unit — neither consults
|
|
377
403
|
* `cursorFormat`.)
|
|
404
|
+
*
|
|
405
|
+
* @deprecated Use `format` on the mounted cursor (`<CrosshairCursor
|
|
406
|
+
* format={…}>`) — it feeds the same shared readout channel (marker
|
|
407
|
+
* indicators and annotation auto-labels included). Works for one more
|
|
408
|
+
* minor; a mounted cursor's `format` wins over this.
|
|
378
409
|
*/
|
|
379
410
|
cursorFormat?: CursorFormat;
|
|
380
411
|
/**
|
|
@@ -419,5 +450,5 @@ export interface ChartContainerProps {
|
|
|
419
450
|
* {@link TimeAxis} at the bottom, aligned under the plots. Y axes are per-row
|
|
420
451
|
* (`<YAxis>`).
|
|
421
452
|
*/
|
|
422
|
-
export declare function ChartContainer({ range, width, rowGap, showAxis, trackerPosition, onTrackerChanged, onDrawStats,
|
|
453
|
+
export declare function ChartContainer({ range, maxBandWidth, bandAlign, width, rowGap, showAxis, trackerPosition, onTrackerChanged, onDrawStats, panZoom, bounds, onTimeRangeChange, minDuration, cursor: cursorProp, cursorSequence: cursorSequenceProp, onRegionSelect, regionSelectModifier, cursorTime: cursorTimeProp, crosshairSnap: crosshairSnapProp, editAnnotations, creating, onCreate, onSelectAnnotation, onHoverAnnotation, onEditAnnotation, snap, timeFormat, cursorFormat: cursorFormatProp, origin, theme, discontinuities, calendar, spacing, grid, sessionDividers, children, }: ChartContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
423
454
|
//# sourceMappingURL=ChartContainer.d.ts.map
|