or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-10/

Chart Template Toolkit

Build reusable visual themes for interactive figures by extracting defaults from one chart and reapplying them to others.

Capabilities

Extracts reusable template from a base figure

  • Given a base figure with scatter data that sets custom marker color, background, and font, produce a template capturing those styling defaults while excluding the source data arrays. @test

Applies a template to new figures

  • Applying a generated template to a new scatter figure carries over default marker color and background while preserving the new figure's data and any explicit layout overrides. @test

Validates templates before use

  • Attempting to apply a malformed template whose layout block is missing triggers an error before any plotting occurs. @test

Merges template defaults with overrides

  • Combining a template with per-plot overrides keeps the template's defaults (e.g., marker color) while allowing override values (e.g., font family) to replace matching entries. @test

Implementation

@generates

API

export type PlotFigure = {
  data: any[];
  layout?: Record<string, any>;
  config?: Record<string, any>;
};

export type Template = Record<string, any>;

export function buildTemplate(baseFigure: PlotFigure): Template;

export function applyTemplate(template: Template, targetFigure: PlotFigure): PlotFigure;

export function mergeTemplate(template: Template, overrides: Partial<PlotFigure>): PlotFigure;

Dependencies { .dependencies }

plotly.js { .dependency }

Interactive charting library with template extraction, validation, and rendering support.