semiotic 3.5.3 → 3.6.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/CLAUDE.md +62 -4
- package/README.md +19 -12
- package/ai/componentMetadata.cjs +9 -2
- package/ai/dist/mcp-server.js +253 -3
- package/ai/examples.md +27 -0
- package/ai/schema.json +319 -49
- package/ai/system-prompt.md +1 -1
- package/dist/components/ai/audienceProfile.d.ts +90 -0
- package/dist/components/ai/audiences.d.ts +31 -0
- package/dist/components/ai/chartCapabilities.d.ts +55 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +196 -0
- package/dist/components/ai/diffProfile.d.ts +51 -0
- package/dist/components/ai/inferIntent.d.ts +24 -0
- package/dist/components/ai/intents.d.ts +34 -0
- package/dist/components/ai/profileData.d.ts +16 -0
- package/dist/components/ai/qualityFixtures.d.ts +2 -0
- package/dist/components/ai/qualityScorecard.d.ts +82 -0
- package/dist/components/ai/repairChartConfig.d.ts +73 -0
- package/dist/components/ai/streamingTypes.d.ts +64 -0
- package/dist/components/ai/suggestCharts.d.ts +76 -0
- package/dist/components/ai/suggestDashboard.d.ts +92 -0
- package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
- package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
- package/dist/components/ai/useChartSuggestions.d.ts +22 -0
- package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
- package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
- package/dist/components/charts/index.d.ts +4 -4
- package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
- package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
- package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
- package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
- package/dist/components/charts/network/Treemap.d.ts +8 -0
- package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.d.ts +10 -0
- package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
- package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
- package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +22 -0
- package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +0 -34
- package/dist/components/charts/shared/gaugeGradient.d.ts +62 -0
- package/dist/components/charts/shared/hooks.d.ts +2 -2
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -2
- package/dist/components/charts/shared/types.d.ts +11 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +2 -2
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +1 -1
- package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
- package/dist/components/charts/xy/AreaChart.d.ts +15 -0
- package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
- package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
- package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
- package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
- package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
- package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
- package/dist/components/data/DataSummarizer.d.ts +45 -0
- package/dist/components/semiotic-ai.d.ts +36 -1
- package/dist/components/semiotic-realtime.d.ts +3 -3
- package/dist/components/semiotic-server.d.ts +1 -0
- package/dist/components/semiotic-xy.d.ts +2 -2
- package/dist/components/semiotic.d.ts +5 -4
- package/dist/components/server/renderToStaticSVG.d.ts +2 -0
- package/dist/components/server/staticLegend.d.ts +35 -0
- package/dist/components/store/ThemeStore.d.ts +2 -0
- package/dist/components/store/useChartFocus.d.ts +43 -0
- package/dist/components/store/useChartInterrogation.d.ts +141 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +2 -1
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -1
- package/dist/components/stream/SVGOverlay.d.ts +2 -1
- package/dist/components/stream/SceneToSVG.d.ts +1 -1
- package/dist/components/stream/geoTypes.d.ts +2 -1
- package/dist/components/stream/hoverUtils.d.ts +1 -0
- package/dist/components/stream/legendRenderer.d.ts +2 -1
- package/dist/components/stream/networkTypes.d.ts +2 -1
- package/dist/components/stream/ordinalTypes.d.ts +16 -2
- package/dist/components/stream/renderers/wedgePathBuilder.d.ts +31 -0
- package/dist/components/stream/types.d.ts +2 -1
- package/dist/components/types/legendTypes.d.ts +15 -0
- package/dist/components/types/marginType.d.ts +17 -3
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +36 -1
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +3 -3
- package/dist/semiotic-server.d.ts +1 -0
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +2 -2
- package/dist/semiotic.d.ts +5 -4
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +25 -24
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
3
|
+
import type { IntentId } from "./intents";
|
|
4
|
+
/**
|
|
5
|
+
* Repair result when the chosen chart fits the data — nothing to fix.
|
|
6
|
+
*/
|
|
7
|
+
export interface RepairOkResult {
|
|
8
|
+
status: "ok";
|
|
9
|
+
component: string;
|
|
10
|
+
/** The same data profile that was evaluated. */
|
|
11
|
+
profile: ChartDataProfile;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Repair result when the chosen chart doesn't fit. Carries the diagnostic
|
|
15
|
+
* reason from the capability's `fits()` plus ranked alternatives that *do*
|
|
16
|
+
* fit, with their reasons surfaced for caller narration.
|
|
17
|
+
*/
|
|
18
|
+
export interface RepairAlternativeResult {
|
|
19
|
+
status: "alternative";
|
|
20
|
+
/** The component the caller asked about. */
|
|
21
|
+
component: string;
|
|
22
|
+
/** Why it doesn't fit. */
|
|
23
|
+
reason: string;
|
|
24
|
+
/** Whether the caller intended one of the alternatives anyway. */
|
|
25
|
+
alternatives: Suggestion[];
|
|
26
|
+
profile: ChartDataProfile;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Repair result when no capability is registered for the asked component.
|
|
30
|
+
*/
|
|
31
|
+
export interface RepairUnknownResult {
|
|
32
|
+
status: "unknown";
|
|
33
|
+
component: string;
|
|
34
|
+
/** Closest matches by family/intent — best effort. */
|
|
35
|
+
alternatives: Suggestion[];
|
|
36
|
+
profile: ChartDataProfile;
|
|
37
|
+
}
|
|
38
|
+
export type RepairResult = RepairOkResult | RepairAlternativeResult | RepairUnknownResult;
|
|
39
|
+
export interface RepairOptions {
|
|
40
|
+
/** Caller's intent — informs ranking of alternatives when the chart doesn't fit. */
|
|
41
|
+
intent?: IntentId | IntentId[];
|
|
42
|
+
/** Non-tabular payload (network/hierarchy/GeoJSON). Forwarded to profileData. */
|
|
43
|
+
rawInput?: unknown;
|
|
44
|
+
/** Limit number of alternatives returned (default 3). */
|
|
45
|
+
maxAlternatives?: number;
|
|
46
|
+
/** Pre-computed profile, avoids recomputation. */
|
|
47
|
+
profile?: ChartDataProfile;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate that a chart component is a sensible choice for a dataset, and
|
|
51
|
+
* if not, propose alternatives that *do* fit — ranked by the caller's
|
|
52
|
+
* intent if provided.
|
|
53
|
+
*
|
|
54
|
+
* This is the "auto-fix" surface for `--doctor` and agent retry loops.
|
|
55
|
+
* Given a chart + data, returns either:
|
|
56
|
+
*
|
|
57
|
+
* - { status: "ok", component } — the chart fits, ship it
|
|
58
|
+
* - { status: "alternative", reason, alternatives } — the chart doesn't
|
|
59
|
+
* fit; here are charts that do, ranked by intent if specified
|
|
60
|
+
* - { status: "unknown", alternatives } — we don't have a
|
|
61
|
+
* capability for that component name; here are sensible defaults
|
|
62
|
+
*
|
|
63
|
+
* The contract: a caller can always render `alternatives[0]` and get
|
|
64
|
+
* something useful. The `reason` field is suitable for verbatim display
|
|
65
|
+
* to the user.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* repairChartConfig("PieChart", productData, { intent: "rank" })
|
|
69
|
+
* // → { status: "alternative",
|
|
70
|
+
* // reason: "9 slices is too many for a pie chart",
|
|
71
|
+
* // alternatives: [BarChart, DotPlot, ...] }
|
|
72
|
+
*/
|
|
73
|
+
export declare function repairChartConfig(component: string, data: ReadonlyArray<Datum> | null | undefined, options?: RepairOptions): RepairResult;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ChartRubric } from "./chartCapabilityTypes";
|
|
2
|
+
import type { IntentId } from "./intents";
|
|
3
|
+
/**
|
|
4
|
+
* Streaming chart selection has a different shape than static. We don't have
|
|
5
|
+
* rows yet — we have a *schema*: which fields will arrive, what types, plus
|
|
6
|
+
* environment hints (throughput, retention).
|
|
7
|
+
*
|
|
8
|
+
* Rather than overloading `profileData` (which is row-statistics-centric) we
|
|
9
|
+
* model streams as a parallel API. The two share the intent vocabulary —
|
|
10
|
+
* "trend" still means trend — but the suitability logic is its own thing.
|
|
11
|
+
*/
|
|
12
|
+
export type StreamFieldKind = "numeric" | "categorical" | "date" | "boolean";
|
|
13
|
+
export interface StreamFieldSchema {
|
|
14
|
+
name: string;
|
|
15
|
+
kind: StreamFieldKind;
|
|
16
|
+
/** Optional role hint — overrides the engine's inference. */
|
|
17
|
+
role?: "x" | "y" | "value" | "category" | "series" | "size";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Schema describing what a stream emits. No data, just shape + environment hints.
|
|
21
|
+
*/
|
|
22
|
+
export interface StreamSchema {
|
|
23
|
+
fields: ReadonlyArray<StreamFieldSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Hint about expected event rate. Affects chart selection — heatmaps and
|
|
26
|
+
* waterfalls amortize high-throughput streams better than line charts do.
|
|
27
|
+
* • "low" — < 1 event/sec, line/area charts read well
|
|
28
|
+
* • "medium" — ~1-100 events/sec
|
|
29
|
+
* • "high" — > 100 events/sec, prefer aggregating visualizations
|
|
30
|
+
*/
|
|
31
|
+
throughput?: "low" | "medium" | "high";
|
|
32
|
+
/**
|
|
33
|
+
* Hint about how long events are kept in view.
|
|
34
|
+
* • "windowed" — only recent events visible (default)
|
|
35
|
+
* • "cumulative" — all events accumulate
|
|
36
|
+
*/
|
|
37
|
+
retention?: "windowed" | "cumulative";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stream capability descriptor — parallel to ChartCapability but operates on
|
|
41
|
+
* a schema. No `fits(profile)`; instead `fits(schema)` returns null/reason.
|
|
42
|
+
*/
|
|
43
|
+
export interface StreamChartCapability {
|
|
44
|
+
component: string;
|
|
45
|
+
importPath: "semiotic/realtime";
|
|
46
|
+
rubric: ChartRubric;
|
|
47
|
+
fits: (schema: StreamSchema) => null | string;
|
|
48
|
+
intentScores: Partial<Record<IntentId, StreamIntentScorer>>;
|
|
49
|
+
caveats?: (schema: StreamSchema) => ReadonlyArray<string>;
|
|
50
|
+
buildProps: (schema: StreamSchema) => Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
export type StreamIntentScorer = number | ((schema: StreamSchema) => number);
|
|
53
|
+
export interface StreamSuggestion {
|
|
54
|
+
component: string;
|
|
55
|
+
family: "realtime";
|
|
56
|
+
importPath: "semiotic/realtime";
|
|
57
|
+
score: number;
|
|
58
|
+
intentScores: Partial<Record<IntentId, number>>;
|
|
59
|
+
rubric: ChartRubric;
|
|
60
|
+
reasons: ReadonlyArray<string>;
|
|
61
|
+
caveats: ReadonlyArray<string>;
|
|
62
|
+
/** Props ready to spread into the matching realtime chart. */
|
|
63
|
+
props: Record<string, unknown>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type ProfileDataOptions } from "./profileData";
|
|
3
|
+
import type { ChartCapability, ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
4
|
+
import type { IntentId } from "./intents";
|
|
5
|
+
import { type AudienceProfile } from "./audienceProfile";
|
|
6
|
+
export interface SuggestChartsOptions extends ProfileDataOptions {
|
|
7
|
+
/** Ranking intent(s). When omitted, suggestions are ranked by mean intent score. */
|
|
8
|
+
intent?: IntentId | IntentId[];
|
|
9
|
+
/** Restrict to these component names. */
|
|
10
|
+
allow?: ReadonlyArray<string>;
|
|
11
|
+
/** Exclude these component names. */
|
|
12
|
+
deny?: ReadonlyArray<string>;
|
|
13
|
+
/** Maximum suggestions to return (default 10). */
|
|
14
|
+
maxResults?: number;
|
|
15
|
+
/** Include variant-level suggestions (default true). */
|
|
16
|
+
includeVariants?: boolean;
|
|
17
|
+
/** Filter out suggestions with a composite score below this (default 0 — keep all). */
|
|
18
|
+
minScore?: number;
|
|
19
|
+
/** Provide a pre-built profile instead of re-deriving from data. */
|
|
20
|
+
profile?: ChartDataProfile;
|
|
21
|
+
/** Override the registry. Defaults to the global capability registry. */
|
|
22
|
+
capabilities?: ReadonlyArray<ChartCapability>;
|
|
23
|
+
/**
|
|
24
|
+
* Audience profile — overrides chart familiarity and applies adoption-target
|
|
25
|
+
* bias to the ranking. See `audienceProfile.ts`.
|
|
26
|
+
*/
|
|
27
|
+
audience?: AudienceProfile;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Suggest charts for a dataset, ranked by intent suitability.
|
|
31
|
+
*
|
|
32
|
+
* Heuristic-only — does not call an LLM. Designed to be cheap enough to run on every
|
|
33
|
+
* keystroke in a UI, and to feed structured context to an LLM when one is available.
|
|
34
|
+
*/
|
|
35
|
+
export declare function suggestCharts(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestChartsOptions): Suggestion[];
|
|
36
|
+
/**
|
|
37
|
+
* One rejected capability: a chart whose `fits()` returned a reason.
|
|
38
|
+
* Surfaced by `explainCapabilityFit` for diagnostic panels and `--doctor` auto-fix.
|
|
39
|
+
*/
|
|
40
|
+
export interface RejectedCapability {
|
|
41
|
+
component: string;
|
|
42
|
+
family: ChartCapability["family"];
|
|
43
|
+
importPath: ChartCapability["importPath"];
|
|
44
|
+
/** Human-readable reason this chart can't render this profile. */
|
|
45
|
+
reason: string;
|
|
46
|
+
}
|
|
47
|
+
export interface ExplainCapabilityFitResult {
|
|
48
|
+
/** Capabilities that fit the profile — full ranked suggestion list. */
|
|
49
|
+
fitting: Suggestion[];
|
|
50
|
+
/** Capabilities that did not fit, with their rejection reasons. */
|
|
51
|
+
rejected: RejectedCapability[];
|
|
52
|
+
/** The profile that was evaluated against (provided or computed). */
|
|
53
|
+
profile: ChartDataProfile;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Like `suggestCharts`, but also returns the capabilities that *didn't* fit
|
|
57
|
+
* along with their rejection reasons. The single best primitive for:
|
|
58
|
+
* • "Why isn't there a pie chart option?" UI surfaces (vizmart V.4)
|
|
59
|
+
* • `--doctor` auto-fix loops that need to enumerate alternatives
|
|
60
|
+
* • Descriptor authoring — quickly see whose `fits()` is too strict
|
|
61
|
+
*
|
|
62
|
+
* Mirrors `suggestCharts` for the fitting side. Rejection enumeration walks
|
|
63
|
+
* every registered capability whether it fits or not.
|
|
64
|
+
*/
|
|
65
|
+
export declare function explainCapabilityFit(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestChartsOptions): ExplainCapabilityFitResult;
|
|
66
|
+
/**
|
|
67
|
+
* Score a specific (component, variant) pair against a dataset and (optionally) an intent.
|
|
68
|
+
* Useful for evaluating a chart a user already chose: "is this a good fit for what they want?"
|
|
69
|
+
*/
|
|
70
|
+
export declare function scoreChart(component: string, data: ReadonlyArray<Datum> | null | undefined, options?: {
|
|
71
|
+
intent?: IntentId | IntentId[];
|
|
72
|
+
variantKey?: string;
|
|
73
|
+
profile?: ChartDataProfile;
|
|
74
|
+
}): Suggestion | {
|
|
75
|
+
reason: string;
|
|
76
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type StretchSuggestion } from "./suggestStretchCharts";
|
|
3
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
4
|
+
import type { IntentId } from "./intents";
|
|
5
|
+
import type { AudienceProfile } from "./audienceProfile";
|
|
6
|
+
/**
|
|
7
|
+
* One panel in a generated dashboard. Pairs a chart suggestion with the
|
|
8
|
+
* intent that motivated it — consumers render the suggestion and label it
|
|
9
|
+
* with the intent so readers know *why* that panel exists.
|
|
10
|
+
*/
|
|
11
|
+
export interface DashboardPanel {
|
|
12
|
+
/** The intent this panel covers. */
|
|
13
|
+
intent: IntentId;
|
|
14
|
+
/** The chart picked for that intent. */
|
|
15
|
+
suggestion: Suggestion;
|
|
16
|
+
}
|
|
17
|
+
export interface DashboardSuggestion {
|
|
18
|
+
/** Ordered panels, each covering a distinct intent. */
|
|
19
|
+
panels: DashboardPanel[];
|
|
20
|
+
/** Intents the engine actually filled. */
|
|
21
|
+
intentsCovered: IntentId[];
|
|
22
|
+
/** Intents the engine couldn't fill from this data. */
|
|
23
|
+
intentsMissing: IntentId[];
|
|
24
|
+
/**
|
|
25
|
+
* Stretch panels — unfamiliar-but-fitting charts the audience could grow
|
|
26
|
+
* into. Empty when no `audience` is provided or `exposureLevel` is 0.
|
|
27
|
+
* Render alongside the main panels in a distinct surface so users see
|
|
28
|
+
* them as opt-in literacy growth, not silent defaults.
|
|
29
|
+
*/
|
|
30
|
+
stretchPanels: StretchSuggestion[];
|
|
31
|
+
/** The shape profile (computed once, reused for every panel). */
|
|
32
|
+
profile: ChartDataProfile;
|
|
33
|
+
}
|
|
34
|
+
export interface SuggestDashboardOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Intents to attempt. When omitted, the engine picks a sensible default set
|
|
37
|
+
* based on the data shape (e.g. if `hasTimeAxis`, include "trend"; if
|
|
38
|
+
* `categoryCount`, include "rank" and "part-to-whole").
|
|
39
|
+
*/
|
|
40
|
+
intents?: ReadonlyArray<IntentId>;
|
|
41
|
+
/** Maximum number of panels. Default 6. */
|
|
42
|
+
maxPanels?: number;
|
|
43
|
+
/**
|
|
44
|
+
* When true (default), prefer not to repeat the same chart family across
|
|
45
|
+
* panels — produces a more varied dashboard. Set false to allow duplicates.
|
|
46
|
+
*/
|
|
47
|
+
diversifyByFamily?: boolean;
|
|
48
|
+
/** Allow only these component names. */
|
|
49
|
+
allow?: ReadonlyArray<string>;
|
|
50
|
+
/** Exclude these component names. */
|
|
51
|
+
deny?: ReadonlyArray<string>;
|
|
52
|
+
/** Optional pre-built profile (avoids recomputation). */
|
|
53
|
+
profile?: ChartDataProfile;
|
|
54
|
+
/** Non-tabular payload — forwarded to profileData. */
|
|
55
|
+
rawInput?: unknown;
|
|
56
|
+
/**
|
|
57
|
+
* Audience profile — applies familiarity overrides and adoption-target bias
|
|
58
|
+
* to every panel's ranking. When set with `exposureLevel >= 1`, the dashboard
|
|
59
|
+
* additionally returns `stretchPanels` showing unfamiliar-but-fitting charts.
|
|
60
|
+
*/
|
|
61
|
+
audience?: AudienceProfile;
|
|
62
|
+
/** Max stretch panels (default min(maxPanels, 3)). */
|
|
63
|
+
maxStretchPanels?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Generate a dashboard: a set of complementary chart panels, each
|
|
67
|
+
* answering a distinct analytical intent on the same dataset.
|
|
68
|
+
*
|
|
69
|
+
* The contract: every panel has a stated `intent` and a suggestion that
|
|
70
|
+
* fits that intent. The engine diversifies by chart family by default to
|
|
71
|
+
* avoid "every panel is a bar chart" outcomes. Intents that can't be
|
|
72
|
+
* filled from the data (e.g. "geo" on row data with no lat/lon) are
|
|
73
|
+
* reported in `intentsMissing` so consumers can show "no fit for geo
|
|
74
|
+
* here" rather than silently dropping them.
|
|
75
|
+
*
|
|
76
|
+
* Heuristic only — no LLM call. The result is suitable for direct
|
|
77
|
+
* rendering (each panel's `suggestion.props` is spreadable into the
|
|
78
|
+
* matching chart) or for piping to an LLM as composition context.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* const { panels } = suggestDashboard(data)
|
|
82
|
+
* return (
|
|
83
|
+
* <Grid>
|
|
84
|
+
* {panels.map(({ intent, suggestion }) => (
|
|
85
|
+
* <Panel key={intent} title={intent}>
|
|
86
|
+
* <DynamicChart component={suggestion.component} props={suggestion.props} />
|
|
87
|
+
* </Panel>
|
|
88
|
+
* ))}
|
|
89
|
+
* </Grid>
|
|
90
|
+
* )
|
|
91
|
+
*/
|
|
92
|
+
export declare function suggestDashboard(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestDashboardOptions): DashboardSuggestion;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StreamChartCapability, StreamSchema, StreamSuggestion } from "./streamingTypes";
|
|
2
|
+
import type { IntentId } from "./intents";
|
|
3
|
+
export declare function registerStreamChartCapability(capability: StreamChartCapability): void;
|
|
4
|
+
export declare function unregisterStreamChartCapability(component: string): void;
|
|
5
|
+
export declare function getStreamCapabilities(): ReadonlyArray<StreamChartCapability>;
|
|
6
|
+
export interface SuggestStreamChartsOptions {
|
|
7
|
+
intent?: IntentId | IntentId[];
|
|
8
|
+
allow?: ReadonlyArray<string>;
|
|
9
|
+
deny?: ReadonlyArray<string>;
|
|
10
|
+
maxResults?: number;
|
|
11
|
+
minScore?: number;
|
|
12
|
+
capabilities?: ReadonlyArray<StreamChartCapability>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Suggest realtime charts for a schema, ranked by intent.
|
|
16
|
+
*
|
|
17
|
+
* Parallel to `suggestCharts` but operates on a `StreamSchema` (fields +
|
|
18
|
+
* throughput/retention hints) rather than row data. Use for live dashboards,
|
|
19
|
+
* monitoring views, anywhere events arrive over time rather than as a bounded
|
|
20
|
+
* table.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const suggestions = suggestStreamCharts({
|
|
24
|
+
* fields: [
|
|
25
|
+
* { name: "ts", kind: "date" },
|
|
26
|
+
* { name: "latency_ms", kind: "numeric" },
|
|
27
|
+
* { name: "endpoint", kind: "categorical" },
|
|
28
|
+
* ],
|
|
29
|
+
* throughput: "high",
|
|
30
|
+
* retention: "windowed",
|
|
31
|
+
* }, { intent: "trend" })
|
|
32
|
+
* // → [{ component: "RealtimeHeatmap", ... }, { component: "RealtimeWaterfallChart", ... }]
|
|
33
|
+
*/
|
|
34
|
+
export declare function suggestStreamCharts(schema: StreamSchema, options?: SuggestStreamChartsOptions): StreamSuggestion[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
3
|
+
import type { IntentId } from "./intents";
|
|
4
|
+
import { type AudienceProfile } from "./audienceProfile";
|
|
5
|
+
/**
|
|
6
|
+
* A "stretch pick" — an unfamiliar-but-fitting chart paired with the
|
|
7
|
+
* familiar chart it could substitute for. Pairing makes the literacy
|
|
8
|
+
* suggestion concrete: "instead of BarChart, try BoxPlot here, because…"
|
|
9
|
+
*/
|
|
10
|
+
export interface StretchSuggestion {
|
|
11
|
+
/** The unfamiliar chart we're suggesting as growth. */
|
|
12
|
+
suggestion: Suggestion;
|
|
13
|
+
/**
|
|
14
|
+
* The familiar chart this stretch could replace for the same intent.
|
|
15
|
+
* Undefined when the stretch is recommended on its own merits (e.g. a
|
|
16
|
+
* direct "increase" target with no obvious familiar counterpart).
|
|
17
|
+
*/
|
|
18
|
+
replacing?: string;
|
|
19
|
+
/** Human-readable rationale, suitable for verbatim display. */
|
|
20
|
+
rationale: string;
|
|
21
|
+
/** Audience familiarity for this chart — the number that made it qualify as a stretch. */
|
|
22
|
+
familiarity: number;
|
|
23
|
+
}
|
|
24
|
+
export interface SuggestStretchChartsOptions {
|
|
25
|
+
/** Intent(s) to rank by. When omitted, charts are picked by data fit alone. */
|
|
26
|
+
intent?: IntentId | IntentId[];
|
|
27
|
+
/** Required — without an audience profile, the concept of "stretch" doesn't apply. */
|
|
28
|
+
audience?: AudienceProfile;
|
|
29
|
+
/** Restrict to these component names. */
|
|
30
|
+
allow?: ReadonlyArray<string>;
|
|
31
|
+
/** Exclude these component names. */
|
|
32
|
+
deny?: ReadonlyArray<string>;
|
|
33
|
+
/** Max stretch picks to return (default 5). */
|
|
34
|
+
maxResults?: number;
|
|
35
|
+
/** Pre-built profile. */
|
|
36
|
+
profile?: ChartDataProfile;
|
|
37
|
+
/** Non-tabular payload — forwarded to profileData. */
|
|
38
|
+
rawInput?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Only return stretches within this score distance of the top familiar pick
|
|
41
|
+
* (default 1.5). Tighter values keep the suggestions plausible; wider values
|
|
42
|
+
* expose more variety.
|
|
43
|
+
*/
|
|
44
|
+
scoreTolerance?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Find pairs (familiar, stretch) where the stretch chart fits the data,
|
|
48
|
+
* has audience familiarity at or below the stretch ceiling, and either:
|
|
49
|
+
* • is an `increase` target for this audience, OR
|
|
50
|
+
* • scores within `scoreTolerance` of a familiar alternative for the
|
|
51
|
+
* same intent.
|
|
52
|
+
*
|
|
53
|
+
* Each pair is returned as a StretchSuggestion with `replacing` (the
|
|
54
|
+
* familiar chart it could substitute for) and a rationale string.
|
|
55
|
+
*
|
|
56
|
+
* Heuristic only. Use `audience` with care — without target signals, every
|
|
57
|
+
* audience-unfamiliar chart becomes a candidate, which can drown the
|
|
58
|
+
* surface in dubious recommendations.
|
|
59
|
+
*/
|
|
60
|
+
export declare function suggestStretchCharts(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestStretchChartsOptions): StretchSuggestion[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type ProfileDataOptions } from "./profileData";
|
|
3
|
+
import { type SuggestChartsOptions } from "./suggestCharts";
|
|
4
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
5
|
+
export interface UseChartSuggestionsOptions extends SuggestChartsOptions, ProfileDataOptions {
|
|
6
|
+
}
|
|
7
|
+
export interface UseChartSuggestionsResult {
|
|
8
|
+
suggestions: ReadonlyArray<Suggestion>;
|
|
9
|
+
profile: ChartDataProfile;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Memoized chart suggestion hook.
|
|
13
|
+
*
|
|
14
|
+
* Heuristic-only: this hook never calls an LLM. Pair with `useChartInterrogation`
|
|
15
|
+
* to let an LLM re-rank or narrate the heuristic suggestions.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const { suggestions } = useChartSuggestions(data, { intent: "trend" })
|
|
19
|
+
* const top = suggestions[0]
|
|
20
|
+
* return <DynamicChart component={top.component} props={top.props} />
|
|
21
|
+
*/
|
|
22
|
+
export declare function useChartSuggestions(data: ReadonlyArray<Datum> | null | undefined, options?: UseChartSuggestionsOptions): UseChartSuggestionsResult;
|
|
@@ -13,7 +13,7 @@ export type { ConnectedScatterplotProps } from "./xy/ConnectedScatterplot";
|
|
|
13
13
|
export { LineChart } from "./xy/LineChart";
|
|
14
14
|
export type { LineChartProps } from "./xy/LineChart";
|
|
15
15
|
export { AreaChart } from "./xy/AreaChart";
|
|
16
|
-
export type { AreaChartProps } from "./xy/AreaChart";
|
|
16
|
+
export type { AreaChartProps, SemanticGradientStop } from "./xy/AreaChart";
|
|
17
17
|
export { DifferenceChart } from "./xy/DifferenceChart";
|
|
18
18
|
export type { DifferenceChartProps } from "./xy/DifferenceChart";
|
|
19
19
|
export { StackedAreaChart } from "./xy/StackedAreaChart";
|
|
@@ -27,7 +27,7 @@ export type { ScatterplotMatrixProps } from "./xy/ScatterplotMatrix";
|
|
|
27
27
|
export { MinimapChart } from "./xy/MinimapChart";
|
|
28
28
|
export type { MinimapChartProps, MinimapConfig } from "./xy/MinimapChart";
|
|
29
29
|
export { QuadrantChart } from "./xy/QuadrantChart";
|
|
30
|
-
export type { QuadrantChartProps, QuadrantsConfig, QuadrantConfig, CenterlineStyle } from "./xy/QuadrantChart";
|
|
30
|
+
export type { QuadrantChartProps, QuadrantsConfig, QuadrantsConfigOverride, QuadrantConfig, CenterlineStyle } from "./xy/QuadrantChart";
|
|
31
31
|
export { MultiAxisLineChart } from "./xy/MultiAxisLineChart";
|
|
32
32
|
export type { MultiAxisLineChartProps, MultiAxisSeriesConfig } from "./xy/MultiAxisLineChart";
|
|
33
33
|
export { CandlestickChart } from "./xy/CandlestickChart";
|
|
@@ -88,8 +88,8 @@ export { OrbitDiagram } from "./network/OrbitDiagram";
|
|
|
88
88
|
export type { OrbitDiagramProps, OrbitNode } from "./network/OrbitDiagram";
|
|
89
89
|
export { RealtimeLineChart } from "./realtime/RealtimeLineChart";
|
|
90
90
|
export type { RealtimeLineChartProps } from "./realtime/RealtimeLineChart";
|
|
91
|
-
export { RealtimeTemporalHistogram, RealtimeHistogram } from "./realtime/RealtimeHistogram";
|
|
92
|
-
export type { RealtimeTemporalHistogramProps, RealtimeHistogramProps } from "./realtime/RealtimeHistogram";
|
|
91
|
+
export { RealtimeTemporalHistogram, RealtimeHistogram, TemporalHistogram } from "./realtime/RealtimeHistogram";
|
|
92
|
+
export type { RealtimeTemporalHistogramProps, RealtimeHistogramProps, TemporalHistogramProps } from "./realtime/RealtimeHistogram";
|
|
93
93
|
export { RealtimeSwarmChart } from "./realtime/RealtimeSwarmChart";
|
|
94
94
|
export type { RealtimeSwarmChartProps } from "./realtime/RealtimeSwarmChart";
|
|
95
95
|
export { RealtimeWaterfallChart } from "./realtime/RealtimeWaterfallChart";
|
|
@@ -19,6 +19,14 @@ export interface TreemapProps<TNode extends Datum = Datum> extends BaseChartProp
|
|
|
19
19
|
nodeLabel?: ChartAccessor<TNode, string>;
|
|
20
20
|
padding?: number;
|
|
21
21
|
paddingTop?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Per-node style overlay. The returned style is merged on top of
|
|
24
|
+
* Treemap's built-in colorBy/colorByDepth/default fill, then primitive
|
|
25
|
+
* props and selection state are applied. Use this for root hiding,
|
|
26
|
+
* custom borders, or per-depth opacity without re-implementing color
|
|
27
|
+
* encoding.
|
|
28
|
+
*/
|
|
29
|
+
nodeStyle?: (d: Datum) => Datum;
|
|
22
30
|
enableHover?: boolean;
|
|
23
31
|
legendInteraction?: LegendInteractionMode;
|
|
24
32
|
tooltip?: TooltipProp;
|
|
@@ -4,6 +4,7 @@ import type { StreamOrdinalFrameProps } from "../../stream/ordinalTypes";
|
|
|
4
4
|
import type { BaseChartProps } from "../shared/types";
|
|
5
5
|
import { type TooltipProp } from "../../Tooltip/Tooltip";
|
|
6
6
|
import type { RealtimeFrameHandle } from "../../realtime/types";
|
|
7
|
+
import { type GaugeGradientFill } from "../shared/gaugeGradient";
|
|
7
8
|
export interface GaugeThreshold {
|
|
8
9
|
/** Upper bound of this zone (value, not percentage) */
|
|
9
10
|
value: number;
|
|
@@ -21,6 +22,15 @@ export interface GaugeChartProps extends BaseChartProps {
|
|
|
21
22
|
max?: number;
|
|
22
23
|
/** Threshold zones — ordered list of { value, color, label? }. Last threshold's value should equal max. */
|
|
23
24
|
thresholds?: GaugeThreshold[];
|
|
25
|
+
/**
|
|
26
|
+
* Arc-length gradient for the gauge band.
|
|
27
|
+
*
|
|
28
|
+
* The gradient is sampled along the visible filled arc from sweep start
|
|
29
|
+
* toward the current value. If `fillZones` is false, the entire arc uses
|
|
30
|
+
* the gradient. If `fillZones` is true, the unfilled remainder stays on
|
|
31
|
+
* `backgroundColor`.
|
|
32
|
+
*/
|
|
33
|
+
gradientFill?: GaugeGradientFill;
|
|
24
34
|
/** Color of the value arc when no thresholds defined (default: theme primary) */
|
|
25
35
|
color?: string;
|
|
26
36
|
/** Background arc color (default: var(--semiotic-grid, #e0e0e0)) */
|
|
@@ -23,8 +23,10 @@ export interface HistogramProps<TDatum extends Datum = Datum> extends BaseChartP
|
|
|
23
23
|
data?: TDatum[];
|
|
24
24
|
/**
|
|
25
25
|
* Field name or function returning the bin label (used when data is
|
|
26
|
-
* already binned).
|
|
27
|
-
*
|
|
26
|
+
* already binned). For raw-observation data with no category dimension,
|
|
27
|
+
* the default treats all rows as a single "All" bucket — no need to set
|
|
28
|
+
* this explicitly.
|
|
29
|
+
* @default (d) => d.category ?? "All"
|
|
28
30
|
*/
|
|
29
31
|
categoryAccessor?: ChartAccessor<TDatum, string>;
|
|
30
32
|
/**
|
|
@@ -62,7 +62,7 @@ export interface LikertChartProps<TDatum extends Datum = Datum> extends BaseChar
|
|
|
62
62
|
*
|
|
63
63
|
* Odd count → center level is neutral. Even count → clean negative/positive split.
|
|
64
64
|
*/
|
|
65
|
-
levels
|
|
65
|
+
levels?: string[];
|
|
66
66
|
/**
|
|
67
67
|
* "horizontal" (default): diverging bar chart centered at 0%.
|
|
68
68
|
* "vertical": stacked 100% bar chart.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_LIKERT_LEVELS: string[];
|