semiotic 3.4.2 → 3.5.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/CLAUDE.md +114 -9
- package/README.md +45 -4
- package/ai/behaviorContracts.cjs +311 -0
- package/ai/chartSuggestions.cjs +291 -0
- package/ai/cli.js +255 -30
- package/ai/componentMetadata.cjs +107 -0
- package/ai/dist/mcp-server.js +907 -227
- package/ai/schema.json +3954 -2537
- package/ai/system-prompt.md +23 -4
- package/dist/components/LinkedCharts.d.ts +5 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +64 -0
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +71 -0
- package/dist/components/charts/custom/XYCustomChart.d.ts +59 -0
- package/dist/components/charts/geo/ChoroplethMap.d.ts +93 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +51 -4
- package/dist/components/charts/geo/FlowMap.d.ts +55 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +53 -0
- package/dist/components/charts/index.d.ts +6 -0
- package/dist/components/charts/network/ChordDiagram.d.ts +34 -2
- package/dist/components/charts/network/CirclePack.d.ts +36 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +130 -2
- package/dist/components/charts/network/OrbitDiagram.d.ts +37 -0
- package/dist/components/charts/network/SankeyDiagram.d.ts +51 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +37 -2
- package/dist/components/charts/network/Treemap.d.ts +36 -2
- package/dist/components/charts/ordinal/BarChart.d.ts +113 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/DonutChart.d.ts +36 -0
- package/dist/components/charts/ordinal/DotPlot.d.ts +33 -0
- package/dist/components/charts/ordinal/FunnelChart.d.ts +40 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +45 -0
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +97 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +44 -0
- package/dist/components/charts/ordinal/PieChart.d.ts +90 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +29 -0
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +40 -0
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +38 -0
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +62 -0
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +34 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +22 -4
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +5 -2
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +24 -3
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +12 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +14 -0
- package/dist/components/charts/realtime/defaultRealtimeTooltip.d.ts +67 -0
- package/dist/components/charts/realtime/resolveWindowSize.d.ts +26 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +91 -0
- package/dist/components/charts/shared/colorPalettes.d.ts +62 -0
- package/dist/components/charts/shared/colorUtils.d.ts +9 -10
- package/dist/components/charts/shared/numberFormat.d.ts +58 -0
- package/dist/components/charts/shared/sparseArray.d.ts +27 -0
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +113 -0
- package/dist/components/charts/shared/timeFormat.d.ts +60 -0
- package/dist/components/charts/shared/useChartSetup.d.ts +8 -0
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +84 -0
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +28 -0
- package/dist/components/charts/shared/useOrdinalStreaming.d.ts +6 -19
- package/dist/components/charts/shared/useStreamingLegend.d.ts +27 -11
- package/dist/components/charts/shared/validateProps.d.ts +2 -2
- package/dist/components/charts/shared/validationMap.d.ts +2 -1
- package/dist/components/charts/shared/withChartWrapper.d.ts +13 -4
- package/dist/components/charts/xy/AreaChart.d.ts +44 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +4 -0
- package/dist/components/charts/xy/CandlestickChart.d.ts +37 -6
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +28 -0
- package/dist/components/charts/xy/Heatmap.d.ts +4 -0
- package/dist/components/charts/xy/LineChart.d.ts +12 -0
- package/dist/components/charts/xy/MinimapChart.d.ts +58 -0
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +27 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +21 -0
- package/dist/components/charts/xy/Scatterplot.d.ts +38 -2
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +16 -0
- package/dist/components/charts/xy/StackedAreaChart.d.ts +61 -1
- package/dist/components/realtime/types.d.ts +2 -4
- package/dist/components/recipes/bullet.d.ts +86 -0
- package/dist/components/recipes/calendar.d.ts +43 -0
- package/dist/components/recipes/dagre.d.ts +56 -0
- package/dist/components/recipes/flextree.d.ts +55 -0
- package/dist/components/recipes/marimekko.d.ts +55 -0
- package/dist/components/recipes/parallelCoordinates.d.ts +97 -0
- package/dist/components/recipes/recipeUtils.d.ts +27 -0
- package/dist/components/recipes/waffle.d.ts +46 -0
- package/dist/components/semiotic-ai.d.ts +4 -0
- package/dist/components/semiotic-network.d.ts +3 -0
- package/dist/components/semiotic-ordinal.d.ts +3 -0
- package/dist/components/semiotic-recipes.d.ts +24 -0
- package/dist/components/semiotic-xy.d.ts +3 -0
- package/dist/components/semiotic.d.ts +2 -2
- package/dist/components/server/renderToStaticSVG.d.ts +8 -2
- package/dist/components/server/serverChartConfigs.d.ts +47 -1
- package/dist/components/server/staticAnnotations.d.ts +6 -0
- package/dist/components/store/ObservationStore.d.ts +1 -3
- package/dist/components/store/SelectionStore.d.ts +1 -3
- package/dist/components/store/ThemeStore.d.ts +4 -4
- package/dist/components/store/TooltipStore.d.ts +1 -3
- package/dist/components/store/createStore.d.ts +4 -2
- package/dist/components/stream/CanvasHitTester.d.ts +10 -8
- package/dist/components/stream/DataSourceAdapter.d.ts +9 -0
- package/dist/components/stream/GeoPipelineStore.d.ts +9 -0
- package/dist/components/stream/GeoTileRenderer.d.ts +14 -0
- package/dist/components/stream/NetworkPipelineStore.d.ts +25 -0
- package/dist/components/stream/OrdinalPipelineStore.d.ts +12 -0
- package/dist/components/stream/PipelineStore.d.ts +51 -0
- package/dist/components/stream/SVGOverlay.d.ts +12 -0
- package/dist/components/stream/SceneGraph.d.ts +15 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/categoryDomain.d.ts +4 -0
- package/dist/components/stream/composeOverlays.d.ts +15 -0
- package/dist/components/stream/customLayout.d.ts +76 -0
- package/dist/components/stream/customLayoutPalette.d.ts +29 -0
- package/dist/components/stream/geoTypes.d.ts +13 -0
- package/dist/components/stream/hoverUtils.d.ts +4 -10
- package/dist/components/stream/networkCustomLayout.d.ts +67 -0
- package/dist/components/stream/networkTypes.d.ts +45 -0
- package/dist/components/stream/ordinalCustomLayout.d.ts +84 -0
- package/dist/components/stream/ordinalTypes.d.ts +35 -1
- package/dist/components/stream/renderers/barFunnelCanvasRenderer.d.ts +9 -1
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +92 -0
- package/dist/components/stream/sampleCurvePath.d.ts +9 -0
- package/dist/components/stream/types.d.ts +44 -1
- package/dist/components/stream/useHydration.d.ts +89 -0
- package/dist/components/stream/useStableShallow.d.ts +1 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +4 -0
- package/dist/geo.min.js +2 -1
- package/dist/geo.module.min.js +2 -1
- package/dist/network.min.js +2 -1
- package/dist/network.module.min.js +2 -1
- package/dist/ordinal.min.js +2 -1
- package/dist/ordinal.module.min.js +2 -1
- package/dist/realtime.min.js +2 -1
- package/dist/realtime.module.min.js +2 -1
- package/dist/semiotic-ai.d.ts +69 -65
- package/dist/semiotic-ai.min.js +2 -1
- package/dist/semiotic-ai.module.min.js +2 -1
- package/dist/semiotic-data.d.ts +4 -4
- package/dist/semiotic-geo.d.ts +15 -15
- package/dist/semiotic-network.d.ts +19 -16
- package/dist/semiotic-ordinal.d.ts +31 -28
- package/dist/semiotic-realtime.d.ts +17 -17
- package/dist/semiotic-recipes.d.ts +24 -0
- package/dist/semiotic-recipes.min.js +1 -0
- package/dist/semiotic-recipes.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +6 -6
- package/dist/semiotic-statisticalOverlays-C3DsOgr_.js +1 -0
- package/dist/semiotic-themes.d.ts +3 -3
- package/dist/semiotic-themes.min.js +2 -1
- package/dist/semiotic-themes.module.min.js +2 -1
- package/dist/semiotic-utils.d.ts +23 -23
- package/dist/semiotic-utils.min.js +2 -1
- package/dist/semiotic-utils.module.min.js +2 -1
- package/dist/semiotic-xy.d.ts +27 -24
- package/dist/semiotic.d.ts +63 -63
- package/dist/semiotic.min.js +2 -1
- package/dist/semiotic.module.min.js +2 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/canvasMock.d.ts +34 -5
- package/dist/xy.min.js +2 -1
- package/dist/xy.module.min.js +2 -1
- package/package.json +38 -17
- package/dist/semiotic-statisticalOverlays-Ckd_jM8z.js +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inlined replacement for the subset of `d3-time-format` semiotic
|
|
3
|
+
* uses (the `timeFormat(spec)` factory).
|
|
4
|
+
*
|
|
5
|
+
* Why this module exists: `d3-time-format` (~86KB) plus its `d3-time`
|
|
6
|
+
* peer (~40KB) ship a complete strftime engine with locale-data
|
|
7
|
+
* bundles we don't use. semiotic only consumes the strftime token
|
|
8
|
+
* parser — locale formatting can defer to `Intl.DateTimeFormat`,
|
|
9
|
+
* which is built into every modern runtime.
|
|
10
|
+
*
|
|
11
|
+
* What's implemented (the chart-axis-relevant subset):
|
|
12
|
+
*
|
|
13
|
+
* - `%Y` — 4-digit year
|
|
14
|
+
* - `%y` — 2-digit year (zero-padded)
|
|
15
|
+
* - `%m` — 2-digit month (01–12)
|
|
16
|
+
* - `%d` — 2-digit day (01–31)
|
|
17
|
+
* - `%e` — day of month, space-padded (matches d3)
|
|
18
|
+
* - `%H` — 2-digit hour, 24-hr (00–23)
|
|
19
|
+
* - `%I` — 2-digit hour, 12-hr (01–12)
|
|
20
|
+
* - `%M` — 2-digit minute (00–59)
|
|
21
|
+
* - `%S` — 2-digit second (00–59)
|
|
22
|
+
* - `%L` — 3-digit millisecond (000–999)
|
|
23
|
+
* - `%p` — AM/PM
|
|
24
|
+
* - `%b` — short month name (Jan, Feb …)
|
|
25
|
+
* - `%B` — long month name (January, February …)
|
|
26
|
+
* - `%a` — short weekday name (Mon, Tue …)
|
|
27
|
+
* - `%A` — long weekday name (Monday, Tuesday …)
|
|
28
|
+
* - `%j` — day of year (001–366)
|
|
29
|
+
* - `%%` — literal `%`
|
|
30
|
+
*
|
|
31
|
+
* What's NOT implemented (rare in chart axis labels):
|
|
32
|
+
*
|
|
33
|
+
* - `%U` / `%W` — week of year (Sunday/Monday-based)
|
|
34
|
+
* - `%Z` / `%z` — timezone name / offset
|
|
35
|
+
* - `%c` / `%x` / `%X` — locale-default date/time/full forms
|
|
36
|
+
* - `%f` — microseconds (always 0 in JS Date anyway)
|
|
37
|
+
*
|
|
38
|
+
* Localized name forms (`%b`/`%B`/`%a`/`%A`) defer to
|
|
39
|
+
* `Intl.DateTimeFormat` pinned to `en-US`. `d3-time-format` ships
|
|
40
|
+
* with an en-US default locale (`d3-time-format`'s
|
|
41
|
+
* `timeFormatDefaultLocale` swap is opt-in), so pinning matches its
|
|
42
|
+
* default behavior — and crucially, keeps tick labels stable across
|
|
43
|
+
* environments. Using the runtime's ambient locale would change axis
|
|
44
|
+
* text per CI runner / browser system locale, which surfaces as
|
|
45
|
+
* baseline drift in pixel / SSR snapshot tests.
|
|
46
|
+
*
|
|
47
|
+
* This shim uses the local timezone (matching `d3-time-format`'s
|
|
48
|
+
* `timeFormat`); for UTC equivalence we'd add a `utcFormat` factory
|
|
49
|
+
* that mirrors `getUTC*` accessors. Add it to this module rather than
|
|
50
|
+
* re-introducing the dependency if a UTC formatter becomes necessary.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Build a date formatter from a strftime-style spec string.
|
|
54
|
+
* Mirrors `d3.timeFormat(spec)`: returns `(date: Date) => string`.
|
|
55
|
+
*
|
|
56
|
+
* Tokens are scanned left-to-right; literal text between tokens
|
|
57
|
+
* passes through unchanged. The returned function uses the local
|
|
58
|
+
* timezone (matching d3-time-format's `timeFormat`).
|
|
59
|
+
*/
|
|
60
|
+
export declare function timeFormat(spec: string): (date: Date) => string;
|
|
@@ -71,6 +71,14 @@ export interface ChartSetupInput {
|
|
|
71
71
|
* Output from useChartSetup.
|
|
72
72
|
*/
|
|
73
73
|
export interface ChartSetupResult {
|
|
74
|
+
/**
|
|
75
|
+
* The input `data` array with `null`/non-object entries removed. Use
|
|
76
|
+
* this in place of the raw `data` prop when forwarding to the frame
|
|
77
|
+
* or doing any per-row iteration in the HOC body — it is identity-
|
|
78
|
+
* equal to the original prop when nothing was dropped, so consumer
|
|
79
|
+
* memo cache hits are preserved in the common case.
|
|
80
|
+
*/
|
|
81
|
+
data: Array<Datum>;
|
|
74
82
|
/** Color scale function, or undefined if no colorBy */
|
|
75
83
|
colorScale: ((v: string) => string) | undefined;
|
|
76
84
|
/** All unique category values from colorBy */
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Ref, RefObject, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { useChartMode } from "./hooks";
|
|
3
|
+
import { type ChartSetupResult } from "./useChartSetup";
|
|
4
|
+
import type { ChartMode, SelectionConfig, LinkedHoverProp } from "./types";
|
|
5
|
+
import type { OnObservationCallback } from "../../store/ObservationStore";
|
|
6
|
+
import type { PartialMargin, MarginType } from "../../types/marginType";
|
|
7
|
+
import type { Datum } from "./datumTypes";
|
|
8
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
9
|
+
/**
|
|
10
|
+
* Margin shorthand → sided form. The Stream*Frame margin props only
|
|
11
|
+
* accept the sided object form, so HOCs that expose the user-friendly
|
|
12
|
+
* number shorthand have to expand it themselves. Centralized here so
|
|
13
|
+
* every custom-layout HOC normalizes consistently.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeUserMargin(m: PartialMargin | undefined): Partial<MarginType> | undefined;
|
|
16
|
+
interface ScaffoldOptions {
|
|
17
|
+
/** Ref forwarded by the HOC. The hook binds the imperative handle internally. */
|
|
18
|
+
imperativeRef: Ref<RealtimeFrameHandle> | undefined;
|
|
19
|
+
/** Which `useFrameImperativeHandle` variant to bind. XY/ordinal frames share "xy". */
|
|
20
|
+
imperativeVariant: "xy" | "network";
|
|
21
|
+
/** Margin shorthand or sided form from the HOC's `margin` prop. */
|
|
22
|
+
margin: PartialMargin | undefined;
|
|
23
|
+
width?: number;
|
|
24
|
+
height?: number;
|
|
25
|
+
showGrid?: boolean;
|
|
26
|
+
enableHover?: boolean;
|
|
27
|
+
showLegend?: boolean;
|
|
28
|
+
title?: string;
|
|
29
|
+
mode?: ChartMode;
|
|
30
|
+
xLabel?: string;
|
|
31
|
+
yLabel?: string;
|
|
32
|
+
}
|
|
33
|
+
interface ScaffoldResult<TFrameHandle> {
|
|
34
|
+
/** Ref to attach to the inner Stream*Frame component. */
|
|
35
|
+
frameRef: RefObject<TFrameHandle | null>;
|
|
36
|
+
/** Result of `useChartMode` — width/height/showGrid/etc. with mode defaults applied. */
|
|
37
|
+
resolved: ReturnType<typeof useChartMode>;
|
|
38
|
+
/** User margin normalized to the sided form, or undefined if not supplied. */
|
|
39
|
+
normalizedMargin: Partial<MarginType> | undefined;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Scaffold shared by all three custom-layout HOCs: imperative-handle
|
|
43
|
+
* binding, chart-mode resolution, margin normalization. Network HOCs
|
|
44
|
+
* stop here; data-shaped HOCs layer `useChartSetup` on top via
|
|
45
|
+
* `useCustomChartSetup`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function useCustomChartScaffold<TFrameHandle>(options: ScaffoldOptions): ScaffoldResult<TFrameHandle>;
|
|
48
|
+
interface DataSetupOptions extends ScaffoldOptions {
|
|
49
|
+
/** Raw `data` prop from the HOC (may be undefined in push mode). */
|
|
50
|
+
data: Datum[] | undefined;
|
|
51
|
+
/** Label used by useChartSetup for observation events ("XYCustomChart", "OrdinalCustomChart"). */
|
|
52
|
+
chartTypeLabel: string;
|
|
53
|
+
/** Whether the hover callback should unwrap the datum (ordinal/network = true, XY = false). */
|
|
54
|
+
unwrapData: boolean;
|
|
55
|
+
/** Color scheme threaded into useChartSetup's color resolution. */
|
|
56
|
+
colorScheme?: string | string[];
|
|
57
|
+
/** Pass-through chart-setup inputs. */
|
|
58
|
+
selection?: SelectionConfig;
|
|
59
|
+
linkedHover?: LinkedHoverProp;
|
|
60
|
+
onObservation?: OnObservationCallback;
|
|
61
|
+
onClick?: (datum: any, ev: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
}) => void;
|
|
65
|
+
chartId?: string;
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
emptyContent?: ReactNode;
|
|
68
|
+
}
|
|
69
|
+
interface DataSetupResult<TFrameHandle> extends ScaffoldResult<TFrameHandle> {
|
|
70
|
+
/** Sparse-filtered copy of the input data array. */
|
|
71
|
+
safeData: Datum[];
|
|
72
|
+
/** Full `useChartSetup` result — selection/legend/behavior wiring for the streamProps. */
|
|
73
|
+
setup: ChartSetupResult;
|
|
74
|
+
/** If non-null, the HOC should render this immediately (loading skeleton or empty state). */
|
|
75
|
+
earlyReturn: ReactElement | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Scaffold + `useChartSetup` wiring for the data-shaped custom-layout
|
|
79
|
+
* HOCs (`XYCustomChart`, `OrdinalCustomChart`). Each HOC stays in charge
|
|
80
|
+
* of its own frame-specific streamProps; the hook only owns the
|
|
81
|
+
* orchestration that is genuinely identical.
|
|
82
|
+
*/
|
|
83
|
+
export declare function useCustomChartSetup<TFrameHandle>(options: DataSetupOptions): DataSetupResult<TFrameHandle>;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Ref, RefObject, DependencyList } from "react";
|
|
2
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
3
|
+
type FrameVariant = "xy" | "network" | "geo-points";
|
|
4
|
+
interface Options {
|
|
5
|
+
/**
|
|
6
|
+
* Variant decides which default method bodies are emitted. The
|
|
7
|
+
* concrete `frameRef` shape must match the variant — the helper
|
|
8
|
+
* trusts the caller here rather than fighting TypeScript's
|
|
9
|
+
* discriminated-union narrowing across heterogeneous frame handle
|
|
10
|
+
* types (`StreamXYFrameHandle` vs `StreamNetworkFrameHandle` vs
|
|
11
|
+
* `StreamGeoFrameHandle`). A regression test in
|
|
12
|
+
* `useFrameImperativeHandle.test.ts` exercises each variant's
|
|
13
|
+
* defaults plus the `getScales` omission for network/geo.
|
|
14
|
+
*/
|
|
15
|
+
variant: FrameVariant;
|
|
16
|
+
frameRef: RefObject<unknown>;
|
|
17
|
+
overrides?: Partial<RealtimeFrameHandle>;
|
|
18
|
+
deps?: DependencyList;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wire up the HOC's exposed `ref` to the inner frame ref using the
|
|
22
|
+
* shape conventions for the chosen variant. Pass `overrides` to
|
|
23
|
+
* replace specific methods (e.g. a wrapped `push` or a custom `clear`
|
|
24
|
+
* that runs HOC-side cleanup before delegating to the frame); the
|
|
25
|
+
* variant's defaults fill in everything else.
|
|
26
|
+
*/
|
|
27
|
+
export declare function useFrameImperativeHandle(ref: Ref<RealtimeFrameHandle> | undefined, options: Options): void;
|
|
28
|
+
export {};
|
|
@@ -2,27 +2,14 @@ import type { Datum } from "./datumTypes";
|
|
|
2
2
|
import type { Ref, RefObject } from "react";
|
|
3
3
|
import type { StreamOrdinalFrameHandle } from "../../stream/ordinalTypes";
|
|
4
4
|
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
5
|
-
import type { Accessor } from "./types";
|
|
6
|
-
import type { LegendPosition } from "./hooks";
|
|
7
5
|
interface UseOrdinalStreamingConfig {
|
|
8
6
|
/** External ref for push API */
|
|
9
7
|
ref: Ref<RealtimeFrameHandle>;
|
|
10
8
|
/** Internal frame ref */
|
|
11
9
|
frameRef: RefObject<StreamOrdinalFrameHandle | null>;
|
|
12
|
-
/**
|
|
13
|
-
isPushMode: boolean;
|
|
14
|
-
/** Color-by accessor (may be derived from stackBy/groupBy/etc.) */
|
|
15
|
-
colorBy: Accessor<string> | undefined;
|
|
16
|
-
/** Color scheme name or array — undefined lets useColorScale consult the theme */
|
|
17
|
-
colorScheme: string | string[] | undefined;
|
|
18
|
-
/** Whether legend is requested */
|
|
19
|
-
showLegend: boolean | undefined;
|
|
20
|
-
/** Legend position */
|
|
21
|
-
legendPosition?: LegendPosition;
|
|
22
|
-
/** Results from useChartSetup — needed for legend/margin merge */
|
|
10
|
+
/** Results from useChartSetup that should be forwarded to the stream frame */
|
|
23
11
|
setup: {
|
|
24
12
|
legendBehaviorProps: Datum;
|
|
25
|
-
legendPosition: LegendPosition;
|
|
26
13
|
margin: {
|
|
27
14
|
top: number;
|
|
28
15
|
right: number;
|
|
@@ -32,9 +19,9 @@ interface UseOrdinalStreamingConfig {
|
|
|
32
19
|
};
|
|
33
20
|
}
|
|
34
21
|
interface UseOrdinalStreamingResult {
|
|
35
|
-
/** Legend props
|
|
22
|
+
/** Legend/category-domain props from useChartSetup (spread into streamProps) */
|
|
36
23
|
effectiveLegendProps: Datum;
|
|
37
|
-
/** Margin
|
|
24
|
+
/** Margin from useChartSetup, including frame-domain legend expansion */
|
|
38
25
|
effectiveMargin: {
|
|
39
26
|
top: number;
|
|
40
27
|
right: number;
|
|
@@ -45,11 +32,11 @@ interface UseOrdinalStreamingResult {
|
|
|
45
32
|
/**
|
|
46
33
|
* Shared hook for ordinal charts that support push API + streaming legend.
|
|
47
34
|
*
|
|
48
|
-
* Consolidates
|
|
49
|
-
*
|
|
35
|
+
* Consolidates imperative handle forwarding and returns the legend/margin
|
|
36
|
+
* props that useChartSetup derives from static data or frame-reported domains.
|
|
50
37
|
*
|
|
51
38
|
* Used by: StackedBarChart, GroupedBarChart, PieChart, DonutChart, SwimlaneChart.
|
|
52
39
|
* NOT used by LikertChart (custom accumulator + deterministic legend).
|
|
53
40
|
*/
|
|
54
|
-
export declare function useOrdinalStreaming({ ref, frameRef,
|
|
41
|
+
export declare function useOrdinalStreaming({ ref, frameRef, setup, }: UseOrdinalStreamingConfig): UseOrdinalStreamingResult;
|
|
55
42
|
export {};
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import type { Datum } from "./datumTypes";
|
|
2
2
|
import type { Accessor } from "./types";
|
|
3
|
-
import type
|
|
3
|
+
import { type LegendPosition } from "./hooks";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
* a legend dynamically.
|
|
5
|
+
* Low-level push-API category-discovery wrapper.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Most HOCs do NOT need this hook anymore. `useChartSetup` already
|
|
8
|
+
* synthesizes a push-mode legend from categories the StreamFrame emits
|
|
9
|
+
* via `onCategoriesChange`, applies the same provider/scheme/theme/
|
|
10
|
+
* STREAMING_PALETTE precedence the marks resolve through, and registers
|
|
11
|
+
* those categories with the parent `LinkedCharts` via
|
|
12
|
+
* `useChartLegendAndMargin` → `useLinkedChartCategories`. For HOCs that
|
|
13
|
+
* just want a working push-mode legend, that is enough.
|
|
10
14
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* This hook is kept as the escape hatch for HOCs that must intercept
|
|
16
|
+
* the push call BEFORE the frame ingests it — typically aggregator HOCs
|
|
17
|
+
* like `LikertChart` that re-aggregate streamed rows into a different
|
|
18
|
+
* shape (level × count) before the frame sees them. `wrapPush` /
|
|
19
|
+
* `wrapPushMany` give those charts a place to run their accumulator
|
|
20
|
+
* code; the wrapped function then forwards to the original push.
|
|
15
21
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
22
|
+
* Returned `streamingLegend` and `streamingMarginAdjust` are vestigial
|
|
23
|
+
* for these consumers — they're produced for backward compatibility,
|
|
24
|
+
* but new code should rely on `setup.legend` / `setup.margin` from
|
|
25
|
+
* `useChartSetup` instead.
|
|
18
26
|
*/
|
|
19
27
|
export declare function useStreamingLegend({ isPushMode, colorBy, colorScheme, showLegend, legendPosition, }: {
|
|
20
28
|
/** True when data prop is undefined (push API mode) */
|
|
@@ -31,6 +39,14 @@ export declare function useStreamingLegend({ isPushMode, colorBy, colorScheme, s
|
|
|
31
39
|
wrapPush: (originalPush: (d: Datum) => void) => (datum: Datum) => void;
|
|
32
40
|
wrapPushMany: (originalPushMany: (d: any[]) => void) => (data: any[]) => void;
|
|
33
41
|
resetCategories: () => void;
|
|
42
|
+
categories: string[];
|
|
43
|
+
categoryDomainProps: {
|
|
44
|
+
legendCategoryAccessor: Accessor<string>;
|
|
45
|
+
onCategoriesChange: (categories: string[]) => void;
|
|
46
|
+
} | {
|
|
47
|
+
legendCategoryAccessor?: undefined;
|
|
48
|
+
onCategoriesChange?: undefined;
|
|
49
|
+
};
|
|
34
50
|
streamingLegend: {
|
|
35
51
|
legendGroups: {
|
|
36
52
|
styleFn: (d: import("../../types/legendTypes").LegendItem) => Record<string, string | number>;
|
|
@@ -10,11 +10,11 @@ export interface PropDef {
|
|
|
10
10
|
type: PropType | PropType[];
|
|
11
11
|
enum?: readonly string[];
|
|
12
12
|
}
|
|
13
|
-
type DataShape = "array" | "object" | "network" | "realtime";
|
|
13
|
+
type DataShape = "array" | "object" | "network" | "realtime" | "none";
|
|
14
14
|
export interface ComponentSpec {
|
|
15
15
|
/** Props that must be present */
|
|
16
16
|
required: string[];
|
|
17
|
-
/** Data shape — drives which validateChartData helper to call */
|
|
17
|
+
/** Data shape — drives which validateChartData helper to call; "none" means no data prop is expected */
|
|
18
18
|
dataShape: DataShape;
|
|
19
19
|
/** Accessor props to validate against data (key = prop name) */
|
|
20
20
|
dataAccessors: string[];
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* via spread to keep individual entries concise.
|
|
7
7
|
*
|
|
8
8
|
* Consumed by: validateProps.ts (validation engine), diagnoseConfig.ts,
|
|
9
|
-
* chartConfig.ts
|
|
9
|
+
* chartConfig.ts. Schema/validation parity is locked by the
|
|
10
|
+
* Chart Spec Registry (`check:chart-specs`).
|
|
10
11
|
*/
|
|
11
12
|
import type { ComponentSpec } from "./validateProps";
|
|
12
13
|
export declare const VALIDATION_MAP: Record<string, ComponentSpec>;
|
|
@@ -3,15 +3,24 @@ interface SafeRenderProps {
|
|
|
3
3
|
componentName: string;
|
|
4
4
|
width: number;
|
|
5
5
|
height: number;
|
|
6
|
+
/** @deprecated Retained for back-compat; no longer threaded into the
|
|
7
|
+
* error boundary. Use `npx semiotic-ai --doctor` or import
|
|
8
|
+
* `diagnoseConfig` from `semiotic/utils` for validation diagnostics. */
|
|
6
9
|
chartProps?: Record<string, unknown>;
|
|
7
10
|
children: React.ReactNode;
|
|
8
11
|
}
|
|
9
12
|
/**
|
|
10
|
-
* Wraps a chart's rendered output with an error boundary.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
+
* Wraps a chart's rendered output with an error boundary. If the chart
|
|
14
|
+
* throws during render, displays the error message with the component
|
|
15
|
+
* name.
|
|
16
|
+
*
|
|
17
|
+
* For richer prop diagnostics ("missing accessor", "wrong data shape",
|
|
18
|
+
* etc.), use `npx semiotic-ai --doctor` (CLI) or import `diagnoseConfig`
|
|
19
|
+
* from `semiotic/utils`. We intentionally don't bundle the validation
|
|
20
|
+
* map into every subpath import — it would add ~7KB gz to xy/ordinal/
|
|
21
|
+
* network just to power a fallback that only fires when render throws.
|
|
13
22
|
*/
|
|
14
|
-
export declare function SafeRender({ componentName, width, height,
|
|
23
|
+
export declare function SafeRender({ componentName, width, height, children }: SafeRenderProps): import("react/jsx-runtime").JSX.Element;
|
|
15
24
|
/**
|
|
16
25
|
* Renders a "No data available" placeholder when data is empty.
|
|
17
26
|
* Returns null when data is present or emptyContent is `false`.
|
|
@@ -151,13 +151,28 @@ export interface AreaChartProps<TDatum extends Datum = Datum> extends BaseChartP
|
|
|
151
151
|
*/
|
|
152
152
|
legendPosition?: LegendPosition;
|
|
153
153
|
/**
|
|
154
|
-
* Tooltip configuration
|
|
154
|
+
* Tooltip configuration. Pass "multi" to show every area value at the
|
|
155
|
+
* hovered x position.
|
|
155
156
|
*/
|
|
156
157
|
tooltip?: TooltipProp;
|
|
157
158
|
/**
|
|
158
159
|
* Annotation objects to render on the chart
|
|
159
160
|
*/
|
|
160
161
|
annotations?: Datum[];
|
|
162
|
+
/**
|
|
163
|
+
* Fixed x domain `[min, max]`. Either bound may be `undefined` to leave
|
|
164
|
+
* that side data-derived. Useful for pinning a time axis to a known
|
|
165
|
+
* window (e.g. last 24 hours) so streamed updates don't shift the
|
|
166
|
+
* left/right edges as data flows in.
|
|
167
|
+
*/
|
|
168
|
+
xExtent?: [number | undefined, number | undefined] | [number];
|
|
169
|
+
/**
|
|
170
|
+
* Fixed y domain `[min, max]`. Either bound may be `undefined` to leave
|
|
171
|
+
* that side data-derived. The fill baseline is the y-domain minimum, so
|
|
172
|
+
* setting `yExtent={[0, 100]}` anchors both the axis AND the area's
|
|
173
|
+
* baseline at 0 — the typical "percentage / counter" shape.
|
|
174
|
+
*/
|
|
175
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
161
176
|
/**
|
|
162
177
|
* Additional StreamXYFrame props for advanced customization
|
|
163
178
|
* For full control, consider using StreamXYFrame directly
|
|
@@ -175,6 +190,7 @@ export interface AreaChartProps<TDatum extends Datum = Datum> extends BaseChartP
|
|
|
175
190
|
*
|
|
176
191
|
* @example
|
|
177
192
|
* ```tsx
|
|
193
|
+
* // Multi-series areas with overlap transparency
|
|
178
194
|
* <AreaChart
|
|
179
195
|
* data={[
|
|
180
196
|
* {x: 1, y: 10, category: 'A'},
|
|
@@ -188,6 +204,33 @@ export interface AreaChartProps<TDatum extends Datum = Datum> extends BaseChartP
|
|
|
188
204
|
* yLabel="Value"
|
|
189
205
|
* />
|
|
190
206
|
* ```
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```tsx
|
|
210
|
+
* // Single series with a vertical opacity gradient (tip → baseline fade)
|
|
211
|
+
* <AreaChart
|
|
212
|
+
* data={data}
|
|
213
|
+
* xAccessor="t"
|
|
214
|
+
* yAccessor="value"
|
|
215
|
+
* color="steelblue"
|
|
216
|
+
* gradientFill={{ topOpacity: 0.8, bottomOpacity: 0.05 }}
|
|
217
|
+
* />
|
|
218
|
+
* ```
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```tsx
|
|
222
|
+
* // Push mode — omit `data`, drive the chart through a ref. Use a
|
|
223
|
+
* // stable string id so `remove(id)` / `update(id, ...)` work later.
|
|
224
|
+
* const ref = useRef<RealtimeFrameHandle>(null)
|
|
225
|
+
* useEffect(() => {
|
|
226
|
+
* const id = setInterval(() => {
|
|
227
|
+
* const t = Date.now()
|
|
228
|
+
* ref.current?.push({ id: String(t), x: t, y: Math.random() })
|
|
229
|
+
* }, 200)
|
|
230
|
+
* return () => clearInterval(id)
|
|
231
|
+
* }, [])
|
|
232
|
+
* return <AreaChart ref={ref} xAccessor="x" yAccessor="y" pointIdAccessor="id" />
|
|
233
|
+
* ```
|
|
191
234
|
*/
|
|
192
235
|
export declare const AreaChart: {
|
|
193
236
|
<TDatum extends Datum = Datum>(props: AreaChartProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
@@ -110,6 +110,10 @@ export interface BubbleChartProps<TDatum extends Datum = Datum> extends BaseChar
|
|
|
110
110
|
* Annotation objects to render on the chart
|
|
111
111
|
*/
|
|
112
112
|
annotations?: Datum[];
|
|
113
|
+
/** Fixed x domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
114
|
+
xExtent?: [number | undefined, number | undefined] | [number];
|
|
115
|
+
/** Fixed y domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
116
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
113
117
|
/**
|
|
114
118
|
* Additional StreamXYFrame props for advanced customization
|
|
115
119
|
* For full control, consider using StreamXYFrame directly
|
|
@@ -19,6 +19,10 @@ export interface CandlestickChartProps<TDatum extends Datum = Datum> extends Bas
|
|
|
19
19
|
candlestickStyle?: CandlestickStyle;
|
|
20
20
|
tooltip?: TooltipProp;
|
|
21
21
|
annotations?: Datum[];
|
|
22
|
+
/** Fixed x domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
23
|
+
xExtent?: [number | undefined, number | undefined] | [number];
|
|
24
|
+
/** Fixed y domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
25
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
22
26
|
enableHover?: boolean;
|
|
23
27
|
showGrid?: boolean;
|
|
24
28
|
frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
|
|
@@ -32,13 +36,40 @@ export interface CandlestickChartProps<TDatum extends Datum = Datum> extends Bas
|
|
|
32
36
|
*
|
|
33
37
|
* @example
|
|
34
38
|
* ```tsx
|
|
35
|
-
* // Full OHLC
|
|
36
|
-
* <CandlestickChart
|
|
37
|
-
*
|
|
39
|
+
* // Full OHLC candlesticks
|
|
40
|
+
* <CandlestickChart
|
|
41
|
+
* data={prices}
|
|
42
|
+
* xAccessor="date"
|
|
43
|
+
* openAccessor="o"
|
|
44
|
+
* highAccessor="h"
|
|
45
|
+
* lowAccessor="l"
|
|
46
|
+
* closeAccessor="c"
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
38
49
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Range-only (e.g. min/max bands per period)
|
|
53
|
+
* <CandlestickChart
|
|
54
|
+
* data={data}
|
|
55
|
+
* xAccessor="date"
|
|
56
|
+
* highAccessor="max"
|
|
57
|
+
* lowAccessor="min"
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* // Custom up/down colors and bar width
|
|
64
|
+
* <CandlestickChart
|
|
65
|
+
* data={prices}
|
|
66
|
+
* xAccessor="date"
|
|
67
|
+
* openAccessor="o"
|
|
68
|
+
* highAccessor="h"
|
|
69
|
+
* lowAccessor="l"
|
|
70
|
+
* closeAccessor="c"
|
|
71
|
+
* candlestickStyle={{ upColor: "#22c55e", downColor: "#ef4444", bodyWidth: 8 }}
|
|
72
|
+
* />
|
|
42
73
|
* ```
|
|
43
74
|
*/
|
|
44
75
|
export declare const CandlestickChart: {
|
|
@@ -37,6 +37,10 @@ export interface ConnectedScatterplotProps<TDatum extends Datum = Datum> extends
|
|
|
37
37
|
legendInteraction?: LegendInteractionMode;
|
|
38
38
|
/** Annotation objects to render on the chart */
|
|
39
39
|
annotations?: Datum[];
|
|
40
|
+
/** Fixed x domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
41
|
+
xExtent?: [number | undefined, number | undefined] | [number];
|
|
42
|
+
/** Fixed y domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
43
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
40
44
|
/** Additional StreamXYFrame props for advanced customization */
|
|
41
45
|
frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
|
|
42
46
|
}
|
|
@@ -51,6 +55,7 @@ export interface ConnectedScatterplotProps<TDatum extends Datum = Datum> extends
|
|
|
51
55
|
*
|
|
52
56
|
* @example
|
|
53
57
|
* ```tsx
|
|
58
|
+
* // Country trajectory over time
|
|
54
59
|
* <ConnectedScatterplot
|
|
55
60
|
* data={trajectory}
|
|
56
61
|
* xAccessor="gdp"
|
|
@@ -58,6 +63,29 @@ export interface ConnectedScatterplotProps<TDatum extends Datum = Datum> extends
|
|
|
58
63
|
* pointRadius={4}
|
|
59
64
|
* />
|
|
60
65
|
* ```
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* // Explicit ordering field — sorts before connecting
|
|
70
|
+
* <ConnectedScatterplot
|
|
71
|
+
* data={observations}
|
|
72
|
+
* xAccessor="x"
|
|
73
|
+
* yAccessor="y"
|
|
74
|
+
* orderAccessor="timestamp"
|
|
75
|
+
* orderLabel="Time"
|
|
76
|
+
* />
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // Date-based ordering (Date or numeric values both work)
|
|
82
|
+
* <ConnectedScatterplot
|
|
83
|
+
* data={dataByDate}
|
|
84
|
+
* xAccessor="metric"
|
|
85
|
+
* yAccessor="cost"
|
|
86
|
+
* orderAccessor={(d) => new Date(d.month)}
|
|
87
|
+
* />
|
|
88
|
+
* ```
|
|
61
89
|
*/
|
|
62
90
|
export declare const ConnectedScatterplot: {
|
|
63
91
|
<TDatum extends Datum = Datum>(props: ConnectedScatterplotProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
@@ -114,6 +114,10 @@ export interface HeatmapProps<TDatum extends Datum = Datum> extends BaseChartPro
|
|
|
114
114
|
* Annotation objects to render on the chart
|
|
115
115
|
*/
|
|
116
116
|
annotations?: Datum[];
|
|
117
|
+
/** Fixed x domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
118
|
+
xExtent?: [number | undefined, number | undefined] | [number];
|
|
119
|
+
/** Fixed y domain `[min, max]` (either bound may be undefined to leave that side data-derived). */
|
|
120
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
117
121
|
/**
|
|
118
122
|
* Additional StreamXYFrame props for advanced customization
|
|
119
123
|
* For full control, consider using StreamXYFrame directly
|
|
@@ -181,6 +181,18 @@ export interface LineChartProps<TDatum extends Datum = Datum> extends BaseChartP
|
|
|
181
181
|
* envelope around the extrapolated forecast region.
|
|
182
182
|
*/
|
|
183
183
|
forecast?: ForecastConfig;
|
|
184
|
+
/**
|
|
185
|
+
* Fixed x domain `[min, max]`. Either bound may be `undefined` to leave
|
|
186
|
+
* that side data-derived.
|
|
187
|
+
*/
|
|
188
|
+
xExtent?: [number | undefined, number | undefined] | [number];
|
|
189
|
+
/**
|
|
190
|
+
* Fixed y domain `[min, max]`. Either bound may be `undefined` to leave
|
|
191
|
+
* that side data-derived. Wins over the auto-computed envelope extent
|
|
192
|
+
* when forecast bounds are present, so explicit user intent stays
|
|
193
|
+
* authoritative.
|
|
194
|
+
*/
|
|
195
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
184
196
|
/**
|
|
185
197
|
* Additional StreamXYFrame props for advanced customization
|
|
186
198
|
* For full control, consider using StreamXYFrame directly
|
|
@@ -67,9 +67,67 @@ export interface MinimapChartProps<TDatum extends Datum = Datum> extends Omit<Ba
|
|
|
67
67
|
onBrush?: (extent: [number, number] | null) => void;
|
|
68
68
|
/** Controlled brush extent */
|
|
69
69
|
brushExtent?: [number, number];
|
|
70
|
+
/**
|
|
71
|
+
* Fixed y domain `[min, max]` (either bound may be undefined to leave
|
|
72
|
+
* that side data-derived). xExtent is reserved for brush selection on
|
|
73
|
+
* MinimapChart — pass `frameProps.xExtent` if you need to override the
|
|
74
|
+
* brushed x range from advanced consumers.
|
|
75
|
+
*/
|
|
76
|
+
yExtent?: [number | undefined, number | undefined] | [number];
|
|
70
77
|
/** Additional StreamXYFrame props */
|
|
71
78
|
frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size">>;
|
|
72
79
|
}
|
|
80
|
+
/**
|
|
81
|
+
* MinimapChart - Line chart paired with a brushable overview minimap.
|
|
82
|
+
*
|
|
83
|
+
* Renders the same line data twice: a compressed overview (the minimap)
|
|
84
|
+
* and a zoomed detail view of the brushed range. Drag in the minimap to
|
|
85
|
+
* update the detail's domain. The minimap configuration (height, axes,
|
|
86
|
+
* brush direction) is nested under the `minimap` prop; brush state is
|
|
87
|
+
* exposed via `onBrush` (callback) and `brushExtent` (controlled value).
|
|
88
|
+
*
|
|
89
|
+
* Useful for long time series where the user needs both context and
|
|
90
|
+
* detail without losing their place in the full range.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* // Time series with default minimap below the detail view
|
|
95
|
+
* <MinimapChart
|
|
96
|
+
* data={timeSeries}
|
|
97
|
+
* xAccessor="date"
|
|
98
|
+
* yAccessor="value"
|
|
99
|
+
* xScaleType="time"
|
|
100
|
+
* minimap={{ height: 80, brushDirection: "x" }}
|
|
101
|
+
* />
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```tsx
|
|
106
|
+
* // Multi-series with a starting brush selection and an onBrush callback
|
|
107
|
+
* <MinimapChart
|
|
108
|
+
* data={timeSeries}
|
|
109
|
+
* xAccessor="t"
|
|
110
|
+
* yAccessor="v"
|
|
111
|
+
* lineBy="series"
|
|
112
|
+
* colorBy="series"
|
|
113
|
+
* minimap={{ height: 60, showAxes: true }}
|
|
114
|
+
* brushExtent={[100, 500]}
|
|
115
|
+
* onBrush={(extent) => console.log("brushed:", extent)}
|
|
116
|
+
* />
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```tsx
|
|
121
|
+
* // Render the minimap above the detail rather than below
|
|
122
|
+
* <MinimapChart
|
|
123
|
+
* data={timeSeries}
|
|
124
|
+
* xAccessor="date"
|
|
125
|
+
* yAccessor="value"
|
|
126
|
+
* renderBefore
|
|
127
|
+
* minimap={{ height: 50, background: "#f8fafc" }}
|
|
128
|
+
* />
|
|
129
|
+
* ```
|
|
130
|
+
*/
|
|
73
131
|
export declare function MinimapChart<TDatum extends Datum = Datum>(props: MinimapChartProps<TDatum>): import("react/jsx-runtime").JSX.Element;
|
|
74
132
|
export declare namespace MinimapChart {
|
|
75
133
|
var displayName: string;
|