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
package/ai/system-prompt.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Semiotic — React Data Visualization
|
|
2
2
|
|
|
3
|
-
Use sub-path imports: `semiotic/xy` (143KB gz), `semiotic/ordinal` (109KB), `semiotic/network` (98KB), `semiotic/geo` (93KB), `semiotic/realtime` (145KB). Or `semiotic/ai` for all
|
|
3
|
+
Use sub-path imports: `semiotic/xy` (143KB gz), `semiotic/ordinal` (109KB), `semiotic/network` (98KB), `semiotic/geo` (93KB), `semiotic/realtime` (145KB). Or `semiotic/ai` for all 39 non-geo HOCs in one import (269KB).
|
|
4
4
|
|
|
5
5
|
## Flat Array Data (`data: object[]`)
|
|
6
6
|
- **LineChart** — `xAccessor`, `yAccessor`, `lineBy` (multi-line), `curve`
|
|
@@ -105,7 +105,7 @@ All charts respond to CSS custom properties on any ancestor:
|
|
|
105
105
|
```
|
|
106
106
|
Or use ThemeProvider with 15 named presets: `<ThemeProvider theme="tufte">`, `"tufte-dark"`, `"pastels"`, `"bi-tool"`, `"italian"`, `"journalist"`, `"playful"` (each with `-dark` variant), `"dark"`, `"high-contrast"`.
|
|
107
107
|
|
|
108
|
-
**Color resolution**: When `colorBy` is set, charts use: explicit `colorScheme`
|
|
108
|
+
**Color resolution**: When `colorBy` is set, charts use: CategoryColorProvider/LinkedCharts category map > explicit `colorScheme` fallback > ThemeProvider `colors.categorical` > `"category10"`. No need to pass `colorScheme` on every chart when using ThemeProvider.
|
|
109
109
|
|
|
110
110
|
`semiotic/themes` entry point: `themeToCSS(theme, selector)` generates CSS string, `themeToTokens(theme)` generates DTCG design tokens, `resolveThemePreset("tufte")` returns theme object by name. Theme objects: `TUFTE_LIGHT`, `TUFTE_DARK`, `PASTELS_LIGHT`, `BI_TOOL_LIGHT`, `ITALIAN_LIGHT`, `JOURNALIST_LIGHT`, `PLAYFUL_LIGHT`, etc.
|
|
111
111
|
|
|
@@ -113,9 +113,28 @@ Or use ThemeProvider with 15 named presets: `<ThemeProvider theme="tufte">`, `"t
|
|
|
113
113
|
|
|
114
114
|
**Scoped CSS cascade override** (per-subtree, no ThemeProvider needed): wrap in `<div style={{ "--semiotic-danger": "#c00" }}>` — every chart beneath inherits the override via canvas CSS-var lookup (`getComputedStyle` on the canvas's DOM ancestor). Use CSS vars for **single-role** overrides, nested `ThemeProvider` for **array/scale** overrides.
|
|
115
115
|
|
|
116
|
-
`COLOR_BLIND_SAFE_CATEGORICAL` — 8-color accessible palette (Wong 2011). Import from `semiotic`.
|
|
116
|
+
`COLOR_BLIND_SAFE_CATEGORICAL` — 8-color accessible palette (Wong 2011). Import from `semiotic/themes`.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
## Behavior Contracts
|
|
120
|
+
|
|
121
|
+
<!-- semiotic-behavior-contracts:start -->
|
|
122
|
+
|
|
123
|
+
These rules are generated from `ai/behaviorContracts.cjs` and are consumed by `semiotic-ai --doctor`, MCP resources, and docs checks.
|
|
124
|
+
|
|
125
|
+
- **Data required by usage mode** (`props.data-required-by-usage-mode`): Static usage (`renderChart`, MCP previews, SSR snapshots, and copy/paste examples with immediate data) requires data in props. React push mode selects live ingestion by omitting data and mutating through a ref.
|
|
126
|
+
- **Categorical color precedence** (`color.category-precedence`): When colorBy is set, CategoryColorProvider/LinkedCharts category maps win for mapped categories. Unmapped categories fall back to explicit colorScheme, then ThemeProvider colors.categorical, then the built-in categorical fallback.
|
|
127
|
+
- **Required prop combinations** (`props.required-combinations`): Some chart families need semantic props beyond data. These combinations are enforced by validation/schema for static configs and remain required in push mode unless explicitly noted.
|
|
128
|
+
Required combinations: StackedAreaChart: static data + areaBy; push areaBy. Stacked areas need a flat data array plus areaBy to identify the stacked series. BubbleChart: static data + sizeBy; push sizeBy. Bubbles need sizeBy in addition to x/y accessors so radius encodes data rather than a constant point size. StackedBarChart: static data + stackBy; push stackBy. Stacked bars need stackBy to split each category into stack segments. GroupedBarChart: static data + groupBy; push groupBy. Grouped bars need groupBy to split each category into side-by-side bars. SwimlaneChart: static data + subcategoryAccessor; push subcategoryAccessor. Swimlanes need subcategoryAccessor; colorBy defaults to the same field when not provided. GaugeChart: static value; push not supported. GaugeChart is value-only. thresholds, min, max, sweep, and arcWidth are optional. ForceDirectedGraph: static nodes + edges; push nodes + edges. ForceDirectedGraph schema/rendering requires nodes and edges. If an agent infers nodes from edge endpoints, it must materialize a nodes array before returning code.
|
|
129
|
+
- **Push mode omits data** (`streaming.push-mode-data`): HOC push mode is selected by omitting the data prop entirely. Passing data={[]} is static empty data and can clear/reinitialize the frame on render.
|
|
130
|
+
- **Ref mutations need stable IDs** (`streaming.ref-mutations-require-id-accessors`): push() and pushMany() can append without IDs, but remove(id) and update(id, updater) require a stable ID accessor: pointIdAccessor for XY/realtime charts, dataIdAccessor for ordinal charts, and nodeIDAccessor/edgeIdAccessor for network operations.
|
|
131
|
+
- **renderChart uses static props only** (`rendering.renderchart-static-props`): MCP renderChart and semiotic/server renderChart render a single static SVG/PNG snapshot. Browser-only realtime components and future ref pushes are not renderable through that path.
|
|
132
|
+
|
|
133
|
+
<!-- semiotic-behavior-contracts:end -->
|
|
117
134
|
|
|
118
135
|
## Key Patterns
|
|
119
136
|
- **Percentile band + main line**: Layer `<AreaChart yAccessor="p95" y0Accessor="p5" showLine={false} />` + `<LineChart yAccessor="p50" />`. AreaChart's `showLine` only draws the top edge, NOT a separate main line.
|
|
120
|
-
- **SSR**: `renderChart("BarChart", props)` from `semiotic/server` — uses HOC names. Also `"Sparkline"` (no axes, 2px margins). `renderToImage()` (PNG), `renderToAnimatedGif()` (GIF), `renderDashboard()` (multi-chart). All accept `theme`. Required props: StackedBarChart needs `stackBy`, GroupedBarChart needs `groupBy`, StackedAreaChart needs `areaBy`, BubbleChart needs `sizeBy`, FunnelChart uses `stepAccessor`, GaugeChart needs `thresholds
|
|
137
|
+
- **SSR**: `renderChart("BarChart", props)` from `semiotic/server` — uses HOC names. Also `"Sparkline"` (no axes, 2px margins). `renderToImage()` (PNG), `renderToAnimatedGif()` (GIF), `renderDashboard()` (multi-chart). All accept `theme`. Required props: StackedBarChart needs `stackBy`, GroupedBarChart needs `groupBy`, StackedAreaChart needs `areaBy`, BubbleChart needs `sizeBy`, FunnelChart uses `stepAccessor`, GaugeChart needs `value` (`thresholds` optional).
|
|
138
|
+
- **CLI**: `npx semiotic-ai --list` shows components/import paths/renderability; `npx semiotic-ai --schema GaugeChart` prints one component schema with metadata; `--doctor` validates props JSON and behavior contracts.
|
|
139
|
+
- **MCP**: `npx semiotic-mcp` exposes tools (`getSchema`, `suggestChart`, `diagnoseConfig`, `renderChart`, `applyTheme`, `reportIssue`), resources (`semiotic://schema`, `semiotic://components`, `semiotic://behavior-contracts`, `semiotic://system-prompt`, `semiotic://examples`), and prompts (`build-semiotic-chart`, `debug-semiotic-chart`).
|
|
121
140
|
- **exportChart**: Pass the wrapper div, not the SVG element: `exportChart(wrapperDiv, { format: "png" })`. It finds canvas+SVG internally.
|
|
@@ -7,6 +7,10 @@ export { useChartObserver } from "./store/useObservation";
|
|
|
7
7
|
export type { UseChartObserverOptions, UseChartObserverResult } from "./store/useObservation";
|
|
8
8
|
/** Hook: returns true when a parent LinkedCharts is handling the legend. */
|
|
9
9
|
export declare function useLinkedLegendSuppression(): boolean;
|
|
10
|
+
/** Register a chart's current color categories with the nearest LinkedCharts. */
|
|
11
|
+
export declare function useLinkedChartCategories(categories: string[]): void;
|
|
12
|
+
/** True when a chart can register live categories with a parent LinkedCharts. */
|
|
13
|
+
export declare function useLinkedChartCategoryRegistryActive(): boolean;
|
|
10
14
|
export interface LinkedChartsProps {
|
|
11
15
|
children: React.ReactNode;
|
|
12
16
|
/** Pre-configure selections with resolution modes */
|
|
@@ -16,7 +20,7 @@ export interface LinkedChartsProps {
|
|
|
16
20
|
/**
|
|
17
21
|
* Show a unified legend for all linked charts.
|
|
18
22
|
* When true, child chart legends are automatically suppressed unless explicitly set.
|
|
19
|
-
* @default true
|
|
23
|
+
* @default true
|
|
20
24
|
*/
|
|
21
25
|
showLegend?: boolean;
|
|
22
26
|
/**
|
|
@@ -151,4 +151,4 @@ export declare function MultiPointTooltip(): TooltipContentFn;
|
|
|
151
151
|
* Returns `false` to disable, or a `TooltipContentFn` compatible with
|
|
152
152
|
* all Stream Frame `tooltipContent` signatures.
|
|
153
153
|
*/
|
|
154
|
-
export declare function normalizeTooltip(tooltip: TooltipProp | undefined): false | TooltipContentFn;
|
|
154
|
+
export declare function normalizeTooltip(tooltip: TooltipProp | undefined): false | TooltipContentFn | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StreamNetworkFrameProps } from "../../stream/networkTypes";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { NetworkCustomLayout } from "../../stream/networkCustomLayout";
|
|
5
|
+
import type { Datum } from "../shared/datumTypes";
|
|
6
|
+
import type { BaseChartProps } from "../shared/types";
|
|
7
|
+
export interface NetworkCustomChartProps<TNode extends Datum = Datum, TEdge extends Datum = Datum, TConfig extends object = Record<string, unknown>> extends BaseChartProps {
|
|
8
|
+
/** Node objects with at least an `id` field. Positions are typically pre-computed by the user (e.g. from dagre / d3-flextree) and read by the layout. */
|
|
9
|
+
nodes?: TNode[];
|
|
10
|
+
/** Edge objects referencing node ids via `source`/`target`. */
|
|
11
|
+
edges?: TEdge[];
|
|
12
|
+
/** The layout function. Receives NetworkLayoutContext, returns scene primitives. */
|
|
13
|
+
layout: NetworkCustomLayout<TConfig>;
|
|
14
|
+
/** Config blob threaded through to NetworkLayoutContext.config. */
|
|
15
|
+
layoutConfig?: TConfig;
|
|
16
|
+
/** Field name (or function) for the node id. @default "id" */
|
|
17
|
+
nodeIDAccessor?: StreamNetworkFrameProps["nodeIDAccessor"];
|
|
18
|
+
/** Field name for the edge source id. @default "source" */
|
|
19
|
+
sourceAccessor?: StreamNetworkFrameProps["sourceAccessor"];
|
|
20
|
+
/** Field name for the edge target id. @default "target" */
|
|
21
|
+
targetAccessor?: StreamNetworkFrameProps["targetAccessor"];
|
|
22
|
+
/** Color scheme threaded into the layout's `resolveColor` helper. */
|
|
23
|
+
colorScheme?: string | string[];
|
|
24
|
+
enableHover?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Custom layouts own their own color resolution (the layout function
|
|
27
|
+
* decides what each node looks like), so the auto-legend infrastructure
|
|
28
|
+
* the built-in network HOCs use can't run. To render a legend, build a
|
|
29
|
+
* `legendGroups` array yourself and pass it through `frameProps.legend`.
|
|
30
|
+
*/
|
|
31
|
+
/** Additional StreamNetworkFrame props for advanced customization. */
|
|
32
|
+
frameProps?: Partial<Omit<StreamNetworkFrameProps, "nodes" | "edges" | "chartType" | "size" | "customNetworkLayout" | "layoutConfig">>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* NetworkCustomChart — escape hatch for bespoke network geometry.
|
|
36
|
+
*
|
|
37
|
+
* Wraps StreamNetworkFrame and threads a user-supplied layout function
|
|
38
|
+
* into the scene-building pipeline. The layout receives raw nodes/edges,
|
|
39
|
+
* dimensions, theme, and a `resolveColor` helper, and returns positioned
|
|
40
|
+
* scene primitives + optional overlays.
|
|
41
|
+
*
|
|
42
|
+
* Pair with `flextreeLayout`, `dagreLayout`, or your own. Built-in chart
|
|
43
|
+
* types (force, sankey, chord, tree, ...) should still be preferred when
|
|
44
|
+
* they fit; reach for this HOC when none does.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* import { NetworkCustomChart } from "semiotic/network"
|
|
49
|
+
* import { dagreLayout } from "semiotic/recipes"
|
|
50
|
+
*
|
|
51
|
+
* <NetworkCustomChart
|
|
52
|
+
* nodes={positionedNodes}
|
|
53
|
+
* edges={positionedEdges}
|
|
54
|
+
* layout={dagreLayout}
|
|
55
|
+
* layoutConfig={{ edgeStyle: "smooth" }}
|
|
56
|
+
* width={800}
|
|
57
|
+
* height={500}
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare const NetworkCustomChart: {
|
|
62
|
+
<TNode extends Datum = Datum, TEdge extends Datum = Datum, TConfig extends object = Record<string, unknown>>(props: NetworkCustomChartProps<TNode, TEdge, TConfig> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
63
|
+
displayName?: string;
|
|
64
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StreamOrdinalFrameProps } from "../../stream/ordinalTypes";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { OrdinalCustomLayout } from "../../stream/ordinalCustomLayout";
|
|
5
|
+
import type { Datum } from "../shared/datumTypes";
|
|
6
|
+
import type { BaseChartProps } from "../shared/types";
|
|
7
|
+
export interface OrdinalCustomChartProps<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>> extends BaseChartProps {
|
|
8
|
+
/** Data passed through to OrdinalLayoutContext.data. */
|
|
9
|
+
data?: TDatum[];
|
|
10
|
+
/** The layout function. Receives OrdinalLayoutContext, returns scene nodes + overlays. */
|
|
11
|
+
layout: OrdinalCustomLayout<TConfig>;
|
|
12
|
+
/** Config blob threaded through to OrdinalLayoutContext.config. */
|
|
13
|
+
layoutConfig?: TConfig;
|
|
14
|
+
/** Field name (or function) for the category. The frame builds the o-scale from these. */
|
|
15
|
+
categoryAccessor?: StreamOrdinalFrameProps["categoryAccessor"];
|
|
16
|
+
/** Field name (or function) for the value. The frame builds the r-scale from these. */
|
|
17
|
+
valueAccessor?: StreamOrdinalFrameProps["valueAccessor"];
|
|
18
|
+
/**
|
|
19
|
+
* Optional category order — overrides the data's insertion order. Most
|
|
20
|
+
* recipes can ignore this and read `ctx.scales.o.domain()` instead.
|
|
21
|
+
*/
|
|
22
|
+
oExtent?: StreamOrdinalFrameProps["oExtent"];
|
|
23
|
+
/** Optional fixed value extent. */
|
|
24
|
+
rExtent?: StreamOrdinalFrameProps["rExtent"];
|
|
25
|
+
/** Vertical / horizontal / radial. Default vertical. */
|
|
26
|
+
projection?: StreamOrdinalFrameProps["projection"];
|
|
27
|
+
/** Color scheme threaded into the layout's `resolveColor` helper. */
|
|
28
|
+
colorScheme?: string | string[];
|
|
29
|
+
enableHover?: boolean;
|
|
30
|
+
showAxes?: boolean;
|
|
31
|
+
showGrid?: boolean;
|
|
32
|
+
annotations?: Datum[];
|
|
33
|
+
/** Additional StreamOrdinalFrame props for advanced customization. */
|
|
34
|
+
frameProps?: Partial<Omit<StreamOrdinalFrameProps, "data" | "chartType" | "size" | "customLayout" | "layoutConfig">>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* OrdinalCustomChart — escape hatch for bespoke ordinal geometry.
|
|
38
|
+
*
|
|
39
|
+
* Wraps StreamOrdinalFrame and threads a user-supplied layout function
|
|
40
|
+
* into the scene-building pipeline. The layout receives the o-scale
|
|
41
|
+
* (band scale over categories) and r-scale (linear over values), plus
|
|
42
|
+
* dimensions, theme, and a `resolveColor` helper, and returns scene
|
|
43
|
+
* primitives plus optional overlays.
|
|
44
|
+
*
|
|
45
|
+
* Built-in chart types (BarChart, SwarmPlot, BoxPlot, PieChart, ...)
|
|
46
|
+
* should still be preferred when they fit. Reach for this HOC when none
|
|
47
|
+
* does — marimekko, parallel coordinates, bullet, fan chart, slope graph,
|
|
48
|
+
* etc.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* import { OrdinalCustomChart } from "semiotic/ordinal"
|
|
53
|
+
* import { marimekkoLayout } from "semiotic/recipes"
|
|
54
|
+
*
|
|
55
|
+
* <OrdinalCustomChart
|
|
56
|
+
* data={cohorts}
|
|
57
|
+
* layout={marimekkoLayout}
|
|
58
|
+
* layoutConfig={{
|
|
59
|
+
* categoryAccessor: "segment",
|
|
60
|
+
* valueAccessor: "revenue",
|
|
61
|
+
* stackBy: "product",
|
|
62
|
+
* }}
|
|
63
|
+
* width={700}
|
|
64
|
+
* height={300}
|
|
65
|
+
* />
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export declare const OrdinalCustomChart: {
|
|
69
|
+
<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>>(props: OrdinalCustomChartProps<TDatum, TConfig> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
70
|
+
displayName?: string;
|
|
71
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { StreamXYFrameProps } from "../../stream/types";
|
|
3
|
+
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
4
|
+
import type { CustomLayout } from "../../stream/customLayout";
|
|
5
|
+
import type { Datum } from "../shared/datumTypes";
|
|
6
|
+
import type { BaseChartProps, AxisConfig } from "../shared/types";
|
|
7
|
+
import type { TooltipProp } from "../../Tooltip/Tooltip";
|
|
8
|
+
export interface XYCustomChartProps<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>> extends BaseChartProps, AxisConfig {
|
|
9
|
+
/** Data passed through to LayoutContext.data. */
|
|
10
|
+
data?: TDatum[];
|
|
11
|
+
/** The layout function. Receives LayoutContext, returns SceneNode[] + overlays. */
|
|
12
|
+
layout: CustomLayout<TConfig>;
|
|
13
|
+
/** Config blob threaded through to LayoutContext.config. */
|
|
14
|
+
layoutConfig?: TConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Optional fixed extents — flow into scale construction *before* the layout
|
|
17
|
+
* runs, so scales reflect the layout's intended domain. Layouts that don't
|
|
18
|
+
* use scales (waffle, calendar, treemap) can ignore this.
|
|
19
|
+
*/
|
|
20
|
+
xExtent?: [number | undefined, number | undefined];
|
|
21
|
+
yExtent?: [number | undefined, number | undefined];
|
|
22
|
+
/** Show axes — default false; most custom layouts draw their own axes. */
|
|
23
|
+
showAxes?: boolean;
|
|
24
|
+
showGrid?: boolean;
|
|
25
|
+
enableHover?: boolean;
|
|
26
|
+
showLegend?: boolean;
|
|
27
|
+
annotations?: Datum[];
|
|
28
|
+
colorScheme?: string | string[];
|
|
29
|
+
tooltip?: TooltipProp;
|
|
30
|
+
/** Additional StreamXYFrame props for advanced customization, excluding XYCustomChart-controlled fields. */
|
|
31
|
+
frameProps?: Partial<Omit<StreamXYFrameProps, "chartType" | "data" | "size" | "customLayout" | "layoutConfig">>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* XYCustomChart — escape hatch for bespoke chart geometry.
|
|
35
|
+
*
|
|
36
|
+
* Wraps StreamXYFrame and threads a user-supplied layout function into the
|
|
37
|
+
* scene-building pipeline. The layout receives scales, dimensions, theme,
|
|
38
|
+
* and a resolveColor helper, and returns scene nodes + optional overlays.
|
|
39
|
+
*
|
|
40
|
+
* Built-in chart types should always be preferred. Reach for XYCustomChart
|
|
41
|
+
* when no HOC fits — waffle grids, calendar heatmaps, horizon bands,
|
|
42
|
+
* bespoke composites. See `semiotic/recipes` for reference layouts.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* import { XYCustomChart } from "semiotic/xy"
|
|
47
|
+
* import { waffleLayout } from "semiotic/recipes"
|
|
48
|
+
*
|
|
49
|
+
* <XYCustomChart
|
|
50
|
+
* data={cells}
|
|
51
|
+
* layout={waffleLayout}
|
|
52
|
+
* layoutConfig={{ rows: 10, columns: 10, gutter: 2, valueAccessor: "value" }}
|
|
53
|
+
* />
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare const XYCustomChart: {
|
|
57
|
+
<TDatum extends Datum = Datum, TConfig extends object = Record<string, unknown>>(props: XYCustomChartProps<TDatum, TConfig> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
58
|
+
displayName?: string;
|
|
59
|
+
};
|
|
@@ -4,10 +4,31 @@ import type { BaseChartProps, ChartAccessor } from "../shared/types";
|
|
|
4
4
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
5
|
import type { LegendInteractionMode } from "../shared/hooks";
|
|
6
6
|
import { type AreasProp } from "../../geo/useReferenceAreas";
|
|
7
|
+
/**
|
|
8
|
+
* ChoroplethMap component props
|
|
9
|
+
*/
|
|
7
10
|
export interface ChoroplethMapProps<TDatum extends Datum = Datum> extends BaseChartProps {
|
|
8
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Either a `GeoJSON.Feature[]` array (one feature per region) or a
|
|
13
|
+
* reference string the library resolves into bundled topology:
|
|
14
|
+
* `"world-110m"`, `"world-50m"`, `"land-110m"`, `"land-50m"`. To pass a
|
|
15
|
+
* custom geography stored as a `FeatureCollection`, hand its `.features`
|
|
16
|
+
* array in. Each feature's `properties` should carry the value
|
|
17
|
+
* `valueAccessor` reads.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* areas="world-110m" // bundled world borders
|
|
21
|
+
* areas={features} // GeoJSON.Feature[]
|
|
22
|
+
* areas={featureCollection.features} // FeatureCollection → unwrap to .features
|
|
23
|
+
* areas={mergeData(world, rows, { featureKey: "iso", dataKey: "iso" })}
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
9
26
|
areas: AreasProp;
|
|
10
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Field name or function returning the numeric value for each feature.
|
|
29
|
+
* Read from `feature.properties` after merging or directly off the
|
|
30
|
+
* feature when values are baked in.
|
|
31
|
+
*/
|
|
11
32
|
valueAccessor: ChartAccessor<TDatum, number>;
|
|
12
33
|
/** Sequential color scheme @default "blues" */
|
|
13
34
|
colorScheme?: string;
|
|
@@ -47,6 +68,76 @@ export interface ChoroplethMapProps<TDatum extends Datum = Datum> extends BaseCh
|
|
|
47
68
|
/** Passthrough to StreamGeoFrame */
|
|
48
69
|
frameProps?: Partial<Omit<StreamGeoFrameProps, "areas" | "projection">>;
|
|
49
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* ChoroplethMap - Encode a numeric value per region with a sequential color scale.
|
|
73
|
+
*
|
|
74
|
+
* Each feature in `areas` is filled with a color derived from its
|
|
75
|
+
* `valueAccessor` value, scaled across the data extent. For point-based
|
|
76
|
+
* geographic data use {@link ProportionalSymbolMap}; for flow data use
|
|
77
|
+
* {@link FlowMap}.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // World choropleth from a bundled topology, values merged in.
|
|
82
|
+
* // `resolveReferenceGeography` is async, so resolve it in an effect
|
|
83
|
+
* // before merging — or pass the reference string directly to `areas`
|
|
84
|
+
* // if your topology already carries the values you need.
|
|
85
|
+
* import * as React from "react"
|
|
86
|
+
* import { ChoroplethMap, mergeData, resolveReferenceGeography } from "semiotic/geo"
|
|
87
|
+
*
|
|
88
|
+
* function WorldGDPMap({ gdpRows }) {
|
|
89
|
+
* const [areas, setAreas] = React.useState([])
|
|
90
|
+
* React.useEffect(() => {
|
|
91
|
+
* let cancelled = false
|
|
92
|
+
* resolveReferenceGeography("world-110m").then(world => {
|
|
93
|
+
* if (cancelled) return
|
|
94
|
+
* setAreas(mergeData(world, gdpRows, { featureKey: "iso_a3", dataKey: "iso" }))
|
|
95
|
+
* })
|
|
96
|
+
* return () => { cancelled = true }
|
|
97
|
+
* }, [gdpRows])
|
|
98
|
+
*
|
|
99
|
+
* return (
|
|
100
|
+
* <ChoroplethMap
|
|
101
|
+
* areas={areas}
|
|
102
|
+
* valueAccessor={(f) => f.properties.gdp}
|
|
103
|
+
* colorScheme="viridis"
|
|
104
|
+
* projection="equalEarth"
|
|
105
|
+
* />
|
|
106
|
+
* )
|
|
107
|
+
* }
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* // Custom GeoJSON + graticule + zoom/pan
|
|
113
|
+
* <ChoroplethMap
|
|
114
|
+
* areas={statesGeoJson}
|
|
115
|
+
* valueAccessor="population_density"
|
|
116
|
+
* colorScheme="oranges"
|
|
117
|
+
* projection="albersUsa"
|
|
118
|
+
* graticule
|
|
119
|
+
* zoomable
|
|
120
|
+
* />
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* // Tile basemap underlay (Mercator only) with semi-transparent areas
|
|
126
|
+
* <ChoroplethMap
|
|
127
|
+
* areas={countiesGeoJson}
|
|
128
|
+
* valueAccessor="rate"
|
|
129
|
+
* projection="mercator"
|
|
130
|
+
* tileURL="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
131
|
+
* tileAttribution="© OpenStreetMap contributors"
|
|
132
|
+
* areaOpacity={0.7}
|
|
133
|
+
* />
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @remarks
|
|
137
|
+
* The legend defaults to a sequential gradient legend matching the chosen
|
|
138
|
+
* `colorScheme`. For diverging data (positive/negative around zero), use
|
|
139
|
+
* a diverging scheme name and pass `frameProps={{ colorDomain: [-max, max] }}`.
|
|
140
|
+
*/
|
|
50
141
|
export declare function ChoroplethMap<TDatum extends Datum = Datum>(props: ChoroplethMapProps<TDatum>): import("react/jsx-runtime").JSX.Element;
|
|
51
142
|
export declare namespace ChoroplethMap {
|
|
52
143
|
var displayName: string;
|
|
@@ -9,12 +9,11 @@ export interface DistanceCartogramProps<TDatum extends Datum = Datum> extends Ba
|
|
|
9
9
|
/** Point data with geographic coordinates */
|
|
10
10
|
points?: TDatum[];
|
|
11
11
|
/** Route/edge data with source/target fields */
|
|
12
|
-
lines?: {
|
|
12
|
+
lines?: Array<{
|
|
13
13
|
source: string;
|
|
14
14
|
target: string;
|
|
15
|
-
coordinates?:
|
|
16
|
-
|
|
17
|
-
}[];
|
|
15
|
+
coordinates?: Datum[];
|
|
16
|
+
} & Record<string, unknown>>;
|
|
18
17
|
/** Longitude accessor @default "lon" */
|
|
19
18
|
xAccessor?: ChartAccessor<TDatum, number>;
|
|
20
19
|
/** Latitude accessor @default "lat" */
|
|
@@ -85,6 +84,54 @@ export interface DistanceCartogramProps<TDatum extends Datum = Datum> extends Ba
|
|
|
85
84
|
/** Passthrough */
|
|
86
85
|
frameProps?: Partial<Omit<StreamGeoFrameProps, "projection">>;
|
|
87
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* DistanceCartogram - Distort a map so distances reflect cost/time, not geography.
|
|
89
|
+
*
|
|
90
|
+
* Points are repositioned so their pixel distance from `center` is
|
|
91
|
+
* proportional to `costAccessor` (commute time, fare, hops, etc.) rather
|
|
92
|
+
* than great-circle distance. `strength` interpolates between the
|
|
93
|
+
* geographic positions (0) and the fully-distorted cartogram (1).
|
|
94
|
+
* Concentric rings show iso-cost contours by default.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* // Cities by travel-time from NYC
|
|
99
|
+
* <DistanceCartogram
|
|
100
|
+
* points={cities}
|
|
101
|
+
* xAccessor="lon"
|
|
102
|
+
* yAccessor="lat"
|
|
103
|
+
* nodeIdAccessor="iata"
|
|
104
|
+
* center="JFK"
|
|
105
|
+
* costAccessor="hours_from_jfk"
|
|
106
|
+
* costLabel="hrs"
|
|
107
|
+
* />
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* // Half-distorted view + colored points + custom ring intervals
|
|
113
|
+
* <DistanceCartogram
|
|
114
|
+
* points={cities}
|
|
115
|
+
* center="JFK"
|
|
116
|
+
* costAccessor="hours_from_jfk"
|
|
117
|
+
* strength={0.5}
|
|
118
|
+
* colorBy="region"
|
|
119
|
+
* showRings={[1, 3, 6, 12]}
|
|
120
|
+
* />
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* // With route lines connecting source→target by cost
|
|
126
|
+
* <DistanceCartogram
|
|
127
|
+
* points={airports}
|
|
128
|
+
* lines={routes}
|
|
129
|
+
* center="JFK"
|
|
130
|
+
* costAccessor="cost"
|
|
131
|
+
* lineMode="fractional"
|
|
132
|
+
* />
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
88
135
|
export declare const DistanceCartogram: {
|
|
89
136
|
<TDatum extends Datum = Datum>(props: DistanceCartogramProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
90
137
|
displayName?: string;
|
|
@@ -2,6 +2,7 @@ import type { Datum } from "../shared/datumTypes";
|
|
|
2
2
|
import type { StreamGeoFrameProps, ProjectionProp } from "../../stream/geoTypes";
|
|
3
3
|
import type { BaseChartProps, ChartAccessor } from "../shared/types";
|
|
4
4
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
5
|
+
import type { LegendInteractionMode, LegendPosition } from "../shared/hooks";
|
|
5
6
|
import type { Style } from "../../stream/types";
|
|
6
7
|
import type { GeoParticleStyle } from "../../stream/GeoParticlePool";
|
|
7
8
|
import { type AreasProp } from "../../geo/useReferenceAreas";
|
|
@@ -53,6 +54,10 @@ export interface FlowMapProps<TDatum extends Datum = Datum> extends BaseChartPro
|
|
|
53
54
|
tooltip?: TooltipProp;
|
|
54
55
|
/** Show legend */
|
|
55
56
|
showLegend?: boolean;
|
|
57
|
+
/** Legend interaction mode */
|
|
58
|
+
legendInteraction?: LegendInteractionMode;
|
|
59
|
+
/** Legend position */
|
|
60
|
+
legendPosition?: LegendPosition;
|
|
56
61
|
/** Padding fraction for auto-fit projection. 0.1 = 10% inset from edges. @default 0 */
|
|
57
62
|
fitPadding?: number;
|
|
58
63
|
/** Enable zoom/pan. Defaults to true when tileURL is set, false otherwise. */
|
|
@@ -77,6 +82,56 @@ export interface FlowMapProps<TDatum extends Datum = Datum> extends BaseChartPro
|
|
|
77
82
|
/** Passthrough */
|
|
78
83
|
frameProps?: Partial<Omit<StreamGeoFrameProps, "projection">>;
|
|
79
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* FlowMap - Visualize directed flows between geographic locations.
|
|
87
|
+
*
|
|
88
|
+
* Each `flow` connects two `nodes` by id; line width encodes
|
|
89
|
+
* `valueAccessor` and (optionally) color encodes `edgeColorBy`. Use
|
|
90
|
+
* `flowStyle="arc"` for curved lines or `"offset"` for bidirectional pairs
|
|
91
|
+
* that don't overlap. Toggle `showParticles` for animated traffic along
|
|
92
|
+
* each line.
|
|
93
|
+
*
|
|
94
|
+
* For static value-per-region maps use {@link ChoroplethMap}; for
|
|
95
|
+
* point-size encodings use {@link ProportionalSymbolMap}.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* // Migration flows between cities
|
|
100
|
+
* <FlowMap
|
|
101
|
+
* nodes={cities} // [{ id, lon, lat, name }]
|
|
102
|
+
* flows={migrations} // [{ source, target, value }]
|
|
103
|
+
* nodeIdAccessor="id"
|
|
104
|
+
* valueAccessor="value"
|
|
105
|
+
* projection="albersUsa"
|
|
106
|
+
* />
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* // Curved arcs colored by source country, particles for live feel
|
|
112
|
+
* <FlowMap
|
|
113
|
+
* nodes={airports}
|
|
114
|
+
* flows={routes}
|
|
115
|
+
* valueAccessor="passengers"
|
|
116
|
+
* flowStyle="arc"
|
|
117
|
+
* edgeColorBy="origin_country"
|
|
118
|
+
* showParticles
|
|
119
|
+
* areas="world-110m"
|
|
120
|
+
* />
|
|
121
|
+
* ```
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* // Bidirectional offset so A→B and B→A are visible separately
|
|
126
|
+
* <FlowMap
|
|
127
|
+
* nodes={hubs}
|
|
128
|
+
* flows={trades}
|
|
129
|
+
* flowStyle="offset"
|
|
130
|
+
* lineType="line"
|
|
131
|
+
* edgeOpacity={0.8}
|
|
132
|
+
* />
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
80
135
|
export declare function FlowMap<TDatum extends Datum = Datum>(props: FlowMapProps<TDatum>): import("react/jsx-runtime").JSX.Element;
|
|
81
136
|
export declare namespace FlowMap {
|
|
82
137
|
var displayName: string;
|
|
@@ -62,6 +62,59 @@ export interface ProportionalSymbolMapProps<TDatum extends Datum = Datum> extend
|
|
|
62
62
|
/** Passthrough */
|
|
63
63
|
frameProps?: Partial<Omit<StreamGeoFrameProps, "points" | "projection">>;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* ProportionalSymbolMap - Plot points on a map sized by a numeric value.
|
|
67
|
+
*
|
|
68
|
+
* Each row in `points` becomes a circle whose pixel radius is scaled from
|
|
69
|
+
* `sizeBy`. Optional `colorBy` adds a categorical encoding; an optional
|
|
70
|
+
* `areas` background gives geographic context.
|
|
71
|
+
*
|
|
72
|
+
* For value-per-region encodings use {@link ChoroplethMap}; for
|
|
73
|
+
* directed-flow encodings use {@link FlowMap}.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Cities sized by population
|
|
78
|
+
* <ProportionalSymbolMap
|
|
79
|
+
* points={cities} // [{ lon, lat, population, country }]
|
|
80
|
+
* xAccessor="lon"
|
|
81
|
+
* yAccessor="lat"
|
|
82
|
+
* sizeBy="population"
|
|
83
|
+
* sizeRange={[3, 30]}
|
|
84
|
+
* areas="world-110m"
|
|
85
|
+
* />
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* // Color by region + tile basemap (Mercator)
|
|
91
|
+
* <ProportionalSymbolMap
|
|
92
|
+
* points={cities}
|
|
93
|
+
* sizeBy="population"
|
|
94
|
+
* colorBy="region"
|
|
95
|
+
* projection="mercator"
|
|
96
|
+
* tileURL="https://tile.openstreetmap.org/{z}/{x}/{y}.png"
|
|
97
|
+
* tileAttribution="© OpenStreetMap contributors"
|
|
98
|
+
* showLegend
|
|
99
|
+
* />
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```tsx
|
|
104
|
+
* // Push API — stream new observations onto the map.
|
|
105
|
+
* // Include the id field in pushed data so remove()/update() can target it.
|
|
106
|
+
* const ref = useRef<RealtimeFrameHandle>(null)
|
|
107
|
+
* useEffect(() => {
|
|
108
|
+
* ref.current?.push({ id: "evt-1", lon: -73.9, lat: 40.7, magnitude: 5.2 })
|
|
109
|
+
* }, [])
|
|
110
|
+
*
|
|
111
|
+
* <ProportionalSymbolMap
|
|
112
|
+
* ref={ref}
|
|
113
|
+
* sizeBy="magnitude"
|
|
114
|
+
* pointIdAccessor="id"
|
|
115
|
+
* />
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
65
118
|
export declare const ProportionalSymbolMap: {
|
|
66
119
|
<TDatum extends Datum = Datum>(props: ProportionalSymbolMapProps<TDatum> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|
|
67
120
|
displayName?: string;
|
|
@@ -30,6 +30,12 @@ export { MultiAxisLineChart } from "./xy/MultiAxisLineChart";
|
|
|
30
30
|
export type { MultiAxisLineChartProps, MultiAxisSeriesConfig } from "./xy/MultiAxisLineChart";
|
|
31
31
|
export { CandlestickChart } from "./xy/CandlestickChart";
|
|
32
32
|
export type { CandlestickChartProps } from "./xy/CandlestickChart";
|
|
33
|
+
export { XYCustomChart } from "./custom/XYCustomChart";
|
|
34
|
+
export type { XYCustomChartProps } from "./custom/XYCustomChart";
|
|
35
|
+
export { NetworkCustomChart } from "./custom/NetworkCustomChart";
|
|
36
|
+
export type { NetworkCustomChartProps } from "./custom/NetworkCustomChart";
|
|
37
|
+
export { OrdinalCustomChart } from "./custom/OrdinalCustomChart";
|
|
38
|
+
export type { OrdinalCustomChartProps } from "./custom/OrdinalCustomChart";
|
|
33
39
|
export { BarChart } from "./ordinal/BarChart";
|
|
34
40
|
export type { BarChartProps } from "./ordinal/BarChart";
|
|
35
41
|
export { StackedBarChart } from "./ordinal/StackedBarChart";
|
|
@@ -30,9 +30,41 @@ export interface ChordDiagramProps<TNode extends Datum = Datum, TEdge extends Da
|
|
|
30
30
|
frameProps?: Partial<Omit<StreamNetworkFrameProps, "edges" | "size">>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* ChordDiagram - Visualize
|
|
33
|
+
* ChordDiagram - Visualize bidirectional flows between a small set of categories.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
35
|
+
* Each node is a wedge around a circle; ribbons inside connect nodes whose
|
|
36
|
+
* `valueAccessor` describes the flow magnitude. Best for ≤30 categories
|
|
37
|
+
* with a square many-to-many relationship matrix.
|
|
38
|
+
*
|
|
39
|
+
* For directed many-step flows prefer {@link SankeyDiagram}; for
|
|
40
|
+
* unbounded networks prefer {@link ForceDirectedGraph}.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* // Trade flows between regions
|
|
45
|
+
* <ChordDiagram
|
|
46
|
+
* nodes={[{ id: "EMEA" }, { id: "Americas" }, { id: "APAC" }]}
|
|
47
|
+
* edges={[
|
|
48
|
+
* { source: "EMEA", target: "Americas", value: 32 },
|
|
49
|
+
* { source: "Americas", target: "APAC", value: 18 },
|
|
50
|
+
* { source: "APAC", target: "EMEA", value: 24 },
|
|
51
|
+
* ]}
|
|
52
|
+
* valueAccessor="value"
|
|
53
|
+
* showLabels
|
|
54
|
+
* />
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* // Color ribbons by source, custom padAngle
|
|
60
|
+
* <ChordDiagram
|
|
61
|
+
* nodes={nodes}
|
|
62
|
+
* edges={edges}
|
|
63
|
+
* valueAccessor="value"
|
|
64
|
+
* edgeColorBy="source"
|
|
65
|
+
* padAngle={0.04}
|
|
66
|
+
* />
|
|
67
|
+
* ```
|
|
36
68
|
*/
|
|
37
69
|
export declare const ChordDiagram: {
|
|
38
70
|
<TNode extends Datum = Datum, TEdge extends Datum = Datum>(props: ChordDiagramProps<TNode, TEdge> & React.RefAttributes<RealtimeFrameHandle>): React.ReactElement | null;
|