/** * The role a field plays when choosing a chart type. Mutually exclusive: * every field is classified into exactly one role (the most specific one). */ type ChartFieldRole = 'measure' | 'temporal' | 'categorical' | 'ordinal' | 'geoPlace' | 'latitude' | 'longitude' | 'identifier' | 'other'; /** A single field annotated with its data/semantic type, cardinality, and role. */ interface ProfiledField { name: string; /** Vega-Lite-style vis category: 'quantitative' | 'temporal' | 'nominal' | 'ordinal'. */ type: string; /** Semantic type annotation (e.g. "Country", "Amount"), or '' if none. */ semanticType: string; /** Number of distinct non-null values. */ cardinality: number; role: ChartFieldRole; } /** * A deterministic summary of a table's shape, used to rank chart types. * The bucketed arrays are views over {@link fields} grouped by role, plus * `dimensions` (all category-axis-capable fields: categorical ∪ ordinal ∪ * geoPlace ∪ temporal). */ interface DataProfile { fields: ProfiledField[]; measures: ProfiledField[]; temporals: ProfiledField[]; categoricals: ProfiledField[]; ordinals: ProfiledField[]; geoPlaces: ProfiledField[]; latitudes: ProfiledField[]; longitudes: ProfiledField[]; identifiers: ProfiledField[]; /** Fields usable on a category/discrete axis (categorical ∪ ordinal ∪ geoPlace ∪ temporal). */ dimensions: ProfiledField[]; rowCount: number; } /** * Build a {@link DataProfile} from raw rows + semantic-type annotations. * Deterministic — no random sampling; classification is per-field and * order-independent. * * @param data Array of row objects. * @param semanticTypes Field → semantic-type map (e.g. `{ Entity: "Country" }`). */ declare function profileData(data: any[], semanticTypes: Record): DataProfile; /** A ranked chart-type candidate with its score and human-readable reasons. */ interface ChartTypeSuggestion { chartType: string; /** Higher is a better fit. Scores are relative; only the ordering is meaningful. */ score: number; reasons: string[]; } /** Options for {@link recommendChartTypes} / {@link recommendChartTypesDetailed}. */ interface RecommendChartTypesOptions { /** * Restrict results to these chart-type names (e.g. a backend's template * catalog). Types not in the list are dropped. Omit for all shared types. */ supportedTypes?: string[]; /** Cap the number of suggestions returned (after ranking). */ max?: number; } /** * A recommended chart type paired with its recommended channel → field * encodings. Returned by the backend one-step recommenders * (`vlRecommendCharts`, …) that chain type selection with encoding selection. */ interface RecommendedChart { chartType: string; encodings: Record; } /** * Score candidate chart types for a data profile. Returns suggestions sorted by * descending score; ties keep a stable, priority-ordered arrangement. * * The rules are curated design heuristics: more *specific* chart types * (maps, time series) outrank generic ones (bar) when the data supports them, * so a table with a geographic place + a measure surfaces "Choropleth" ahead of * "Bar Chart" without a model call. */ declare function rankChartTypes(profile: DataProfile): ChartTypeSuggestion[]; /** * Recommend candidate chart types for a dataset, with scores and reasons. * * @param data Array of row objects. * @param semanticTypes Field → semantic-type map (e.g. `{ Entity: "Country" }`). * @param options Optional `supportedTypes` filter and `max` cap. * @returns Ranked {@link ChartTypeSuggestion}s (best first). */ declare function recommendChartTypesDetailed(data: any[], semanticTypes: Record, options?: RecommendChartTypesOptions): ChartTypeSuggestion[]; /** * Recommend a ranked list of chart-type names for a dataset (best first). * * A convenience wrapper over {@link recommendChartTypesDetailed} that drops the * scores/reasons. This is the "type-selection step that sits in front of" * `recommendChannels` — call it first, then feed the chosen type to * `…RecommendEncodings` to populate channels. * * @param data Array of row objects. * @param semanticTypes Field → semantic-type map. * @param options Optional `supportedTypes` filter and `max` cap. * @returns Ranked chart-type names (best first). */ declare function recommendChartTypes(data: any[], semanticTypes: Record, options?: RecommendChartTypesOptions): string[]; export { type ChartFieldRole as C, type DataProfile as D, type ProfiledField as P, type RecommendChartTypesOptions as R, type ChartTypeSuggestion as a, type RecommendedChart as b, recommendChartTypes as c, recommendChartTypesDetailed as d, profileData as p, rankChartTypes as r };