Skip to content

@sqlrooms/mosaic / ChartTypeDefinition

Interface: ChartTypeDefinition<TSettings>

Shared chart-type definition used by both the chart-builder UI and assistant-driven chart creation.

Type Parameters

Type ParameterDefault type
TSettingsany

Properties

id

id: "heatmap" | "histogram" | "count-plot" | "line-chart" | "bubble-chart" | "box-plot" | "custom-spec"

Unique identifier


label?

optional label: string

Short human-friendly name used in chart-type grids and prompts


description

description: string

Short description of what this builder creates


schema

schema: ZodType<TSettings>

Zod schema for runtime validation of settings


createSpec()

createSpec: (tableName, values) => Spec

Generate a Mosaic spec from table name and selected field values

Parameters

ParameterType
tableNamestring
valuesTSettings

Returns

Spec


createTool()?

optional createTool: (deps) => Tool

Create an AI tool for this chart type

Parameters

ParameterType
depsChartToolDeps

Returns

Tool


buildTitle()?

optional buildTitle: (fieldValues) => string

Generate a chart title from selected field values

Parameters

ParameterType
fieldValuesRecord<string, unknown>

Returns

string


isAvailable()?

optional isAvailable: (columns) => boolean

Optional availability override for a given table schema

Parameters

ParameterType
columnsChartBuilderColumn[]

Returns

boolean


aiDescription?

optional aiDescription: string

Optional extra assistant-facing description


settingsComponent

settingsComponent: ComponentType

Explicit settings component for this chart type


icon

icon: ComponentType<{ className?: string; }>

Optional icon component for chart-type grids