@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/AreaChart.d.ts
CHANGED
|
@@ -14,6 +14,17 @@ export interface AreaChartCommon<S extends SeriesSchema = SeriesSchema, VS exten
|
|
|
14
14
|
* single styling channel).
|
|
15
15
|
*/
|
|
16
16
|
as?: string;
|
|
17
|
+
/**
|
|
18
|
+
* **Opt in to selection** — see `<LineChart id>`; the currency is identical
|
|
19
|
+
* because the premise is ([PND-TRACESEL]): a click commits a **series-scoped**
|
|
20
|
+
* `SelectInfo` (`NaN` key/value plus a stable `mark`), a sweep commits a
|
|
21
|
+
* `SpanSelection` with **no marks**.
|
|
22
|
+
*
|
|
23
|
+
* What differs is only the **hit test**: an area is a filled region, so the
|
|
24
|
+
* pointer counts as on it when it lies **between the trace and the
|
|
25
|
+
* baseline** — the whole shape is the target, not the 1.5px edge.
|
|
26
|
+
*/
|
|
27
|
+
id?: string;
|
|
17
28
|
/**
|
|
18
29
|
* Which `<YAxis>` (by its `id`) this area scales against — picks the *scale*,
|
|
19
30
|
* where `as` picks the *style*. **Omitted ⇒ the row's default axis.**
|
|
@@ -140,6 +151,6 @@ export declare function resolveAreaBaseline(baseline: number | undefined, yScale
|
|
|
140
151
|
* </Layers>
|
|
141
152
|
* ```
|
|
142
153
|
*/
|
|
143
|
-
export declare function AreaChart<S extends SeriesSchema = SeriesSchema, VS extends ValueSeriesSchema = ValueSeriesSchema>({ series, column, readout, as: semantic, axis, baseline, curve, gaps, decimate, legend, index, }: AreaChartProps<S, VS>): null;
|
|
154
|
+
export declare function AreaChart<S extends SeriesSchema = SeriesSchema, VS extends ValueSeriesSchema = ValueSeriesSchema>({ series, column, readout, as: semantic, axis, id, baseline, curve, gaps, decimate, legend, index, }: AreaChartProps<S, VS>): null;
|
|
144
155
|
export {};
|
|
145
156
|
//# sourceMappingURL=AreaChart.d.ts.map
|
package/dist/AreaChart.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { useContext, useEffect, useMemo } from 'react';
|
|
2
2
|
import { ValueSeries } from 'pond-ts';
|
|
3
3
|
import { assertNumericColumn, fromTimeSeries, fromValueSeries, } from './data.js';
|
|
4
|
-
import { areaExtent, drawArea } from './area.js';
|
|
4
|
+
import { areaExtent, areaHitIndex, areaStateStyle, drawArea } from './area.js';
|
|
5
|
+
import { drawPartitioned, plotExtentOf, strokeSpanEdges, } from './line.js';
|
|
6
|
+
import { sweepSpan } from './sweep.js';
|
|
5
7
|
import { resolveCurve } from './curve.js';
|
|
6
8
|
import { DEFAULT_GAP_MODE, DEFAULT_GAP_CONNECTOR_OPACITY, } from './gaps.js';
|
|
7
|
-
import { ContainerContext, LayersContext } from './context.js';
|
|
9
|
+
import { ContainerContext, LayersContext, } from './context.js';
|
|
8
10
|
import { legendLabelFor, useLegendItems, } from './swatch.js';
|
|
9
11
|
import { useSlotKey } from './use-slot-key.js';
|
|
10
12
|
/** Read a d3 linear scale's domain lower bound (the axis floor) from the plain
|
|
@@ -54,7 +56,7 @@ function domainFloor(yScale) {
|
|
|
54
56
|
* </Layers>
|
|
55
57
|
* ```
|
|
56
58
|
*/
|
|
57
|
-
export function AreaChart({ series, column, readout, as: semantic, axis, baseline, curve, gaps = DEFAULT_GAP_MODE, decimate = true, legend, index = 0, }) {
|
|
59
|
+
export function AreaChart({ series, column, readout, as: semantic, axis, id, baseline, curve, gaps = DEFAULT_GAP_MODE, decimate = true, legend, index = 0, }) {
|
|
58
60
|
const container = useContext(ContainerContext);
|
|
59
61
|
if (container === null) {
|
|
60
62
|
throw new Error('<AreaChart> must be rendered inside a <ChartContainer>');
|
|
@@ -91,6 +93,45 @@ export function AreaChart({ series, column, readout, as: semantic, axis, baselin
|
|
|
91
93
|
// Faintness of the inferred dashed connectors (dashed / step) — theme-level,
|
|
92
94
|
// falling back to the shared default so a theme without it still renders faint.
|
|
93
95
|
const gapConnectorOpacity = container.theme.gap?.connectorOpacity ?? DEFAULT_GAP_CONNECTOR_OPACITY;
|
|
96
|
+
// ── The trace's interaction state ([PND-TRACESEL]) — see `<LineChart>` for
|
|
97
|
+
// the reasoning; this is the same derivation over `AreaStyle`'s channels.
|
|
98
|
+
const selectedEntries = container.selected;
|
|
99
|
+
const hoveredEntries = container.hovered;
|
|
100
|
+
// The committed spans, plus the **live** ones of a sweep in flight. A
|
|
101
|
+
// previewed span draws exactly as a committed one, so releasing changes
|
|
102
|
+
// nothing visually — the preview cannot promise a picture the commit does not
|
|
103
|
+
// deliver. The live channel wins while it is non-empty, because during a drag
|
|
104
|
+
// it IS the current answer.
|
|
105
|
+
const previewing = container.previewSpans.length > 0;
|
|
106
|
+
const allSpans = previewing
|
|
107
|
+
? container.previewSpans
|
|
108
|
+
: container.selectedSpans;
|
|
109
|
+
const traceState = useMemo(() => {
|
|
110
|
+
if (id === undefined)
|
|
111
|
+
return 'rest';
|
|
112
|
+
if (allSpans.some((sp) => sp.id === id))
|
|
113
|
+
return 'rest';
|
|
114
|
+
const mine = (e) => e.id === id;
|
|
115
|
+
if (selectedEntries.some(mine))
|
|
116
|
+
return 'selected';
|
|
117
|
+
if (hoveredEntries.some(mine))
|
|
118
|
+
return 'hover';
|
|
119
|
+
if (selectedEntries.length > 0 || allSpans.length > 0)
|
|
120
|
+
return 'dimmed';
|
|
121
|
+
return 'rest';
|
|
122
|
+
}, [id, selectedEntries, hoveredEntries, allSpans]);
|
|
123
|
+
// **`spanColor` only when this is the ONLY swept trace.** The hue is
|
|
124
|
+
// justified by identity not being in question inside a single series — but
|
|
125
|
+
// sweep two traces and both would go blue, so inside the window you could no
|
|
126
|
+
// longer tell them apart, which is the very thing the rule exists to prevent.
|
|
127
|
+
// With more than one, the window thickens and every trace keeps its colour.
|
|
128
|
+
const soleSpannedTrace = allSpans.length === 1;
|
|
129
|
+
const spanX = useMemo(() => {
|
|
130
|
+
if (id === undefined)
|
|
131
|
+
return null;
|
|
132
|
+
const mine = allSpans.find((sp) => sp.id === id);
|
|
133
|
+
return mine === undefined ? null : mine.x;
|
|
134
|
+
}, [id, allSpans]);
|
|
94
135
|
const entry = useMemo(() => ({
|
|
95
136
|
layer: {
|
|
96
137
|
as: semantic,
|
|
@@ -99,6 +140,36 @@ export function AreaChart({ series, column, readout, as: semantic, axis, baselin
|
|
|
99
140
|
// ValueSeries plots on a value axis, a TimeSeries on time.
|
|
100
141
|
xKind: series instanceof ValueSeries ? 'value' : 'time',
|
|
101
142
|
xExtent: () => cs.length === 0 ? null : [cs.x[0], cs.x[cs.length - 1]],
|
|
143
|
+
// ── Selection, gated on `id` ([PND-TRACESEL]). Same currency as
|
|
144
|
+
// `<LineChart>`; only `hitTest` differs, because a fill is not a stroke.
|
|
145
|
+
...(id === undefined
|
|
146
|
+
? {}
|
|
147
|
+
: {
|
|
148
|
+
sweepsRect: false,
|
|
149
|
+
sweepAxis: 'x',
|
|
150
|
+
sweepSpanOnly: true,
|
|
151
|
+
hitTest: (px, py, xScale, yScale) => {
|
|
152
|
+
const i = areaHitIndex(cs, baseline, px, py, xScale, yScale);
|
|
153
|
+
if (i === null)
|
|
154
|
+
return null;
|
|
155
|
+
return {
|
|
156
|
+
id,
|
|
157
|
+
// Series-scoped, with a stable `mark` for identity — see
|
|
158
|
+
// `<LineChart>`'s hitTest for why both halves are needed.
|
|
159
|
+
key: NaN,
|
|
160
|
+
value: NaN,
|
|
161
|
+
color: style.fill,
|
|
162
|
+
label,
|
|
163
|
+
mark: label,
|
|
164
|
+
};
|
|
165
|
+
},
|
|
166
|
+
beginSweep: () => cs.length === 0
|
|
167
|
+
? null
|
|
168
|
+
: sweepSpan({
|
|
169
|
+
id,
|
|
170
|
+
bounds: [cs.x[0], cs.x[cs.length - 1]],
|
|
171
|
+
}),
|
|
172
|
+
}),
|
|
102
173
|
sampleAt: (x) => {
|
|
103
174
|
// No readout past the data (tracker policy — nearest clamps to an
|
|
104
175
|
// endpoint outside the span); bounds from the columnar x axis.
|
|
@@ -151,16 +222,49 @@ export function AreaChart({ series, column, readout, as: semantic, axis, baselin
|
|
|
151
222
|
]
|
|
152
223
|
: [];
|
|
153
224
|
},
|
|
154
|
-
draw: (ctx, xScale, yScale) =>
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
225
|
+
draw: (ctx, xScale, yScale) => {
|
|
226
|
+
const fill = (st, alpha) => () => {
|
|
227
|
+
const prior = ctx.globalAlpha;
|
|
228
|
+
if (alpha !== 1)
|
|
229
|
+
ctx.globalAlpha = prior * alpha;
|
|
230
|
+
const out = drawAreaWith(st);
|
|
231
|
+
ctx.globalAlpha = prior;
|
|
232
|
+
return out;
|
|
233
|
+
};
|
|
234
|
+
if (spanX === null) {
|
|
235
|
+
const [st, alpha] = areaStateStyle(style, traceState);
|
|
236
|
+
return fill(st, alpha)();
|
|
237
|
+
}
|
|
238
|
+
// EXPERIMENT: annotation-register rules at the window's edges,
|
|
239
|
+
// underneath the trace ink (drawn first). See `strokeSpanEdges`.
|
|
240
|
+
//
|
|
241
|
+
// **Committed spans only.** While the drag is live the brush band
|
|
242
|
+
// already strokes its own edges at the same two x positions, so
|
|
243
|
+
// drawing these too put two rules a fraction of a pixel apart on each
|
|
244
|
+
// boundary — which read as one muddy smear rather than as either. The
|
|
245
|
+
// handoff is the honest reading anyway: the band is the gesture's
|
|
246
|
+
// mark and belongs to the drag; these preview the annotation you
|
|
247
|
+
// would get, and belong to the result.
|
|
248
|
+
if (!previewing)
|
|
249
|
+
strokeSpanEdges(ctx, [xScale(spanX[0]), xScale(spanX[1])], ctx.canvas.height, container.theme.annotation?.spanEdge ?? '#f0b26b');
|
|
250
|
+
const [outStyle, outAlpha] = areaStateStyle(style, 'dimmed');
|
|
251
|
+
const [inStyle] = areaStateStyle(style, 'selected');
|
|
252
|
+
return drawPartitioned(ctx, [xScale(spanX[0]), xScale(spanX[1])], plotExtentOf(ctx, xScale, yScale).height, fill(outStyle, outAlpha), fill(style.spanColor === undefined || !soleSpannedTrace
|
|
253
|
+
? inStyle
|
|
254
|
+
: { ...inStyle, color: style.spanColor, fill: style.spanColor }, 1), true, 0, plotExtentOf(ctx, xScale, yScale).width);
|
|
255
|
+
function drawAreaWith(st) {
|
|
256
|
+
return drawArea(ctx, cs, xScale, yScale, st,
|
|
257
|
+
// Omitted baseline rests on the axis floor (resolved late from the
|
|
258
|
+
// scale, so it tracks the auto-fit domain); a fixed baseline is used
|
|
259
|
+
// verbatim.
|
|
260
|
+
// A log axis has no position for zero — or anything at or below
|
|
261
|
+
// it — so an explicit out-of-domain `baseline` would scale to
|
|
262
|
+
// `NaN` and poison every coordinate in the fill path. Fall back
|
|
263
|
+
// to the axis floor, which is exactly what an omitted baseline
|
|
264
|
+
// already resolves to.
|
|
265
|
+
resolveAreaBaseline(baseline, yScale), curveFactory, gaps, gapConnectorOpacity, decimate);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
164
268
|
},
|
|
165
269
|
axisId: axis,
|
|
166
270
|
index,
|
|
@@ -178,6 +282,11 @@ export function AreaChart({ series, column, readout, as: semantic, axis, baselin
|
|
|
178
282
|
gapConnectorOpacity,
|
|
179
283
|
decimate,
|
|
180
284
|
axis,
|
|
285
|
+
id,
|
|
286
|
+
traceState,
|
|
287
|
+
spanX,
|
|
288
|
+
soleSpannedTrace,
|
|
289
|
+
previewing,
|
|
181
290
|
index,
|
|
182
291
|
]);
|
|
183
292
|
// A stable per-instance slot (see useSlotKey) keeps this layer's z-position
|
|
@@ -194,6 +303,15 @@ export function AreaChart({ series, column, readout, as: semantic, axis, baselin
|
|
|
194
303
|
useEffect(() => {
|
|
195
304
|
registerTrackerSource(slot, entry.layer);
|
|
196
305
|
}, [registerTrackerSource, slot, entry.layer]);
|
|
306
|
+
// Advertise selectability (only when an `id` was given) — see the same block
|
|
307
|
+
// in `LineChart.tsx` for why a trace was missing from this set.
|
|
308
|
+
const { registerSelectable, unregisterSelectable } = container;
|
|
309
|
+
useEffect(() => {
|
|
310
|
+
if (id === undefined)
|
|
311
|
+
return;
|
|
312
|
+
registerSelectable(slot);
|
|
313
|
+
return () => unregisterSelectable(slot);
|
|
314
|
+
}, [registerSelectable, unregisterSelectable, slot, id]);
|
|
197
315
|
// And a legend row: the readout identity + the resolved area style (top line
|
|
198
316
|
// over the translucent fill), so a `<Legend>` swatch can never drift.
|
|
199
317
|
const legendRows = useMemo(() => {
|
package/dist/BarChart.d.ts
CHANGED
|
@@ -26,6 +26,22 @@ import type { DecimateOption } from './decimate.js';
|
|
|
26
26
|
* (`Array<{ start, end, …aggregates }>`); the names are **aggregate
|
|
27
27
|
* fields** of the record, not schema columns, so they stay `string`. Pair
|
|
28
28
|
* with `ordinal` for a band axis.
|
|
29
|
+
*
|
|
30
|
+
* **`bins` selects a *value* axis, so a time-bucketed histogram fed this way
|
|
31
|
+
* gets decimal ticks** ([PND-TICKUNIT]). A `TimeSeries`/`Map` bins on time; a
|
|
32
|
+
* `ValueSeries`/`bins`-array bins on a value axis — which means the tick
|
|
33
|
+
* ladder is the plain 1-2-5 walk, not the **duration** ladder a clock
|
|
34
|
+
* subdivides by (15s and 30s are round durations where 20s and 50s are not).
|
|
35
|
+
* A minute-of-day histogram passed as `bins` therefore labels something like
|
|
36
|
+
* 11:40 and 13:20 — real times at a ~100-minute step — and nothing at the
|
|
37
|
+
* call site says why.
|
|
38
|
+
*
|
|
39
|
+
* The natural reading ("I have pre-binned buckets, so I'll pass `bins`") is
|
|
40
|
+
* exactly what forecloses the time axis. For a **time-keyed** histogram use
|
|
41
|
+
* the series door instead — `<BarChart series columns>` on a time-keyed wide
|
|
42
|
+
* series — and the clock ticks are native with no workaround.
|
|
43
|
+
* `<ChartContainer origin>` does not rescue it: it relabels a value axis but
|
|
44
|
+
* does not re-ladder it.
|
|
29
45
|
* - **`categories`** — an ordered `{ label, value }[]`, one bar per category.
|
|
30
46
|
* Takes **no** `column`/`columns` (each datum carries its own value).
|
|
31
47
|
* Vertical puts the categories on the ordinal **x** axis (the container's
|
|
@@ -116,6 +132,58 @@ export interface BarChartCommon<S extends SeriesSchema = SeriesSchema, VS extend
|
|
|
116
132
|
* carry many bars' colours, so every visible bar draws.
|
|
117
133
|
*/
|
|
118
134
|
binColors?: readonly (string | undefined)[];
|
|
135
|
+
/**
|
|
136
|
+
* **Threshold breakpoints** — colour each bar *along its length* against a
|
|
137
|
+
* ladder, so a long bar shows how far through the ladder it travelled rather
|
|
138
|
+
* than only which band it ended in. Breakpoints are **absolute data values**
|
|
139
|
+
* in the axis's own units — `[1, 2]` means "warning above 1, alarm above 2",
|
|
140
|
+
* not offsets from wherever the bar happens to rest — and `n` of them make
|
|
141
|
+
* `n + 1` bands. Each must be finite and greater than zero; anything else is
|
|
142
|
+
* dropped with a dev warning (the ladder is walked on the magnitude, so a
|
|
143
|
+
* negative breakpoint is not expressible).
|
|
144
|
+
*
|
|
145
|
+
* ```tsx
|
|
146
|
+
* // neutral to 1, warning 1–2, alarm above 2
|
|
147
|
+
* <BarChart categories={cats} thresholds={[1, 2]} />
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
* Band fills come from {@link BarStyle.bands} on the resolved role
|
|
151
|
+
* (`theme.bar[as] ?? theme.bar.default`), overridden by {@link bandColors}.
|
|
152
|
+
* Breakpoints are data and live here; colour stays in the theme — the same
|
|
153
|
+
* split as `colors` over the stack's group fills.
|
|
154
|
+
*
|
|
155
|
+
* **A banded bar is still one bar.** It keeps one hit region, one stable
|
|
156
|
+
* `SelectInfo.mark` and one legend row — which is the whole difference from
|
|
157
|
+
* the N-overlaid-layers recipe this replaces, where each band was separately
|
|
158
|
+
* hittable and separately listed. Selection and hover pop the opacity and
|
|
159
|
+
* keep the band colours (as `binColors` does), outlining in the colour of the
|
|
160
|
+
* band the value actually reached.
|
|
161
|
+
*
|
|
162
|
+
* **Negatives band symmetrically**: the ladder is walked on the magnitude and
|
|
163
|
+
* re-signed, so a bar hanging below the baseline reads the same ±ladder
|
|
164
|
+
* without negative breakpoints. Out-of-order entries are sorted (the bands
|
|
165
|
+
* are defined by their boundaries, so there is no second reading) and
|
|
166
|
+
* non-finite ones dropped.
|
|
167
|
+
*
|
|
168
|
+
* Applies to any **single-value** bar — a `series`/`bins` chart, `categories`,
|
|
169
|
+
* and both orientations. On a genuine **multi-group stack** it is ignored
|
|
170
|
+
* with a dev warning: a segment that is already one slice of a total has no
|
|
171
|
+
* defined banding. Set with `binColors` it also yields (per-bar colour is the
|
|
172
|
+
* more specific answer) and warns. **Disables envelope decimation** for the
|
|
173
|
+
* same reason `binColors` does.
|
|
174
|
+
*/
|
|
175
|
+
thresholds?: readonly number[];
|
|
176
|
+
/**
|
|
177
|
+
* Call-site override for the {@link thresholds} band fills — `bandColors[k]`
|
|
178
|
+
* paints the band above `thresholds[k - 1]`, so a ladder of `n` thresholds
|
|
179
|
+
* reads `n + 1` entries. Omitted ⇒ {@link BarStyle.bands} from the theme.
|
|
180
|
+
*
|
|
181
|
+
* Prefer the theme for anything a design system owns; this is the escape
|
|
182
|
+
* hatch for a one-off ladder that shouldn't mint a theme role. If neither
|
|
183
|
+
* source supplies enough entries, the shortfall falls back to the flat fill
|
|
184
|
+
* and dev-warns rather than silently drawing an unbanded bar.
|
|
185
|
+
*/
|
|
186
|
+
bandColors?: readonly string[];
|
|
119
187
|
/**
|
|
120
188
|
* Bar growth direction (the histogram orientation). **Default `'vertical'`.**
|
|
121
189
|
*
|
|
@@ -220,14 +288,21 @@ export type BarChartProps<S extends SeriesSchema = SeriesSchema, VS extends Valu
|
|
|
220
288
|
* domain spans zero, or on the axis floor when an explicit `<YAxis min>` sits
|
|
221
289
|
* above zero (see {@link resolveBarBaseline}).
|
|
222
290
|
*
|
|
223
|
-
* **Baseline (stacked).** A stack is **cumulative from value 0** —
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* An explicit `<YAxis min>` **above** 0 is therefore unsupported
|
|
227
|
-
* would hide the bottom of the cumulative column; only the
|
|
228
|
-
* draws (clipped cleanly at the plot floor, as any bar
|
|
229
|
-
*
|
|
230
|
-
*
|
|
291
|
+
* **Baseline (stacked).** A stack is **cumulative from value 0** — so its value
|
|
292
|
+
* axis **must include 0**. The auto-fit guarantees this:
|
|
293
|
+
* {@link stackValueExtent} returns `[minNegativeTotal, maxPositiveTotal]`, both
|
|
294
|
+
* seeded at `0`. An explicit `<YAxis min>` **above** 0 is therefore unsupported
|
|
295
|
+
* for a stack — it would hide the bottom of the cumulative column; only the
|
|
296
|
+
* portion above the floor draws (clipped cleanly at the plot floor, as any bar
|
|
297
|
+
* below an explicit floor is).
|
|
298
|
+
*
|
|
299
|
+
* **Signed stacks are supported** ([PND-SIGNSTACK]): each bin keeps two running
|
|
300
|
+
* totals, so positive segments stack **up** from the zero line and negative
|
|
301
|
+
* ones stack **down** from it — the signed histogram (net flow by category,
|
|
302
|
+
* inflow/outflow, buy/sell pressure by venue). A **zero** segment is still
|
|
303
|
+
* skipped, having no extent to draw or hit-test. This changed in the
|
|
304
|
+
* threshold-banding wave: negative segments were previously dropped outright
|
|
305
|
+
* and silently, so a mixed-sign series rendered as an all-positive chart.
|
|
231
306
|
*
|
|
232
307
|
* **Interaction (opt-in via `id`).** Hover lights the bar / segment under the
|
|
233
308
|
* cursor (hit-tested by pixel rect, so it works in both orientations); click
|
|
@@ -244,6 +319,6 @@ export type BarChartProps<S extends SeriesSchema = SeriesSchema, VS extends Valu
|
|
|
244
319
|
* </Layers>
|
|
245
320
|
* ```
|
|
246
321
|
*/
|
|
247
|
-
export declare function BarChart<S extends SeriesSchema = SeriesSchema, VS extends ValueSeriesSchema = ValueSeriesSchema>({ series, bins, categories, column, columns, as: semantic, colors, binColors, orientation, ordinal, id, axis, gap, decimate, legend, index, }: BarChartProps<S, VS>): null;
|
|
322
|
+
export declare function BarChart<S extends SeriesSchema = SeriesSchema, VS extends ValueSeriesSchema = ValueSeriesSchema>({ series, bins, categories, column, columns, as: semantic, colors, binColors, thresholds, bandColors, orientation, ordinal, id, axis, gap, decimate, legend, index, }: BarChartProps<S, VS>): null;
|
|
248
323
|
export {};
|
|
249
324
|
//# sourceMappingURL=BarChart.d.ts.map
|