• English
  • Builder

    Methods

    prepare

    prepare(): Promise<void>

    Asynchronously executes dynamic filter code. Call before build() to execute code defined in dynamicFilter. This is an idempotent method — multiple calls will not re-execute.

    build

    build<T = S>(): T

    Generates the final chart configuration (Spec). This is the most commonly used core method. If the configuration includes a dynamicFilter code, call prepare() first.

    buildSpec

    buildSpec<T = S>(advanced: AdvancedVSeed): T

    Converts the intermediate-layer configuration (AdvancedVSeed) to the final Spec. Use only when you need deep customization of the intermediate-layer configuration.

    buildAdvanced

    buildAdvanced(): AdvancedVSeed | null

    Generates the intermediate-layer configuration (AdvancedVSeed), i.e., the chart template. More detailed than the raw VSeed, exposing more chart internals.

    getColorItems

    getColorItems(): __type[]

    Gets field information related to colors in the data. Commonly used to generate chart legends or color filter UIs.

    getColorIdMap

    getColorIdMap(): Record

    Gets a detailed mapping table for color fields. Key is the color ID, Value is the detailed information.

    getColorValueMap

    getColorValueMap(): undefined | Record

    Gets the mapping from colorId to the final color value in a discrete color map.

    Static Methods

    getAdvancedPipeline

    static getAdvancedPipeline(chartType: ChartType): Pipe[]

    [Internal] Gets the template build pipeline for the specified chart type, used for debugging the VSeed → AdvancedVSeed conversion process.

    getSpecPipeline

    static getSpecPipeline(chartType: ChartType): SpecPipe[]

    [Internal] Gets the Spec build pipeline for the specified chart type, used for debugging the AdvancedVSeed → Spec conversion process.

    getTheme

    static getTheme(themeKey?: string): CustomThemeConfig

    Gets the configuration of the specified theme. If themeKey is not provided, returns the 'light' theme by default.

    getThemeMap

    static getThemeMap(): Record<string, CustomThemeConfig>

    Gets all registered theme configurations.

    from

    static from<T extends Spec = Spec>(vseed: VSeed): Builder<T>

    Static factory method for conveniently creating a Builder instance.

    registerAdvancedPipeline

    static registerAdvancedPipeline(chartType: ChartType, pipeline: AdvancedPipeline): void

    [Extension] Registers a template build pipeline for a new chart type.

    registerSpecPipeline

    static registerSpecPipeline(chartType: ChartType, pipeline: SpecPipeline): void

    [Extension] Registers a Spec build pipeline for a new chart type.

    updateAdvanced

    static updateAdvanced(chartType: ChartType, pipe: AdvancedPipe): void

    [Extension] Modifies the template build logic for an existing chart, inserting a custom Pipe to influence the generated AdvancedVSeed.

    updateSpec

    static updateSpec(chartType: ChartType, pipe: SpecPipe): void

    [Extension] Modifies the Spec build logic for an existing chart, inserting a custom Pipe to influence the final generated Spec.

    registerTheme

    static registerTheme(key: string, theme: CustomThemeConfig): void

    [Extension] Registers a custom theme.

    Properties

    get locale

    get locale()

    Gets the locale currently used by the Builder.

    get vseed

    get vseed()

    Gets the current VSeed input data.

    set vseed

    set vseed(value)

    Updates the VSeed input data. After updating, the cached state from prepare() will be cleared.

    get isPrepared

    get isPrepared()

    Gets the prepare() state.

    set isPrepared

    set isPrepared(value: boolean)

    Sets the prepare() state.

    get advancedVSeed

    get advancedVSeed()

    Gets the current AdvancedVSeed intermediate configuration object.

    set advancedVSeed

    set advancedVSeed(value)

    Sets the AdvancedVSeed intermediate configuration object. Typically used for caching or reusing an existing intermediate configuration.

    get spec

    get spec()

    Gets the currently generated final Spec object.

    set spec

    set spec(value)

    Sets the Spec object. Typically used for caching.

    get performance

    get performance()

    Gets performance statistics from the build process, including the duration of each phase (in ms).

    set performance

    set performance(value)

    Sets the performance statistics.