or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-2/

Trace Array Control Utility

Build a small module that manages the traces on an existing interactive chart using the package's in-place trace array operations rather than rebuilding the entire figure.

Capabilities

Initialize plot

  • Creating a plot with two preloaded traces (sine and cosine arrays) in a supplied DOM container renders both traces and returns a handle used for later operations. @test

Insert or remove traces in place

  • Inserting a new trace at index 0 shifts existing traces and keeps their axis references unchanged. @test
  • Deleting a trace by negative index removes the last trace while leaving the others unchanged. @test

Reorder traces

  • Moving the last trace to the first position reorders the plot without losing data or trace names. @test

Stream data with windowing

  • Appending new x/y points to a target trace trims history to a maximum length when provided, keeping only the most recent points. @test

Implementation

@generates

API

export async function initPlot(container, initialTraces);
export async function insertTraces(container, traces, index);
export async function removeTraces(container, indexes);
export async function moveTraces(container, fromIndexes, toIndex);
export async function streamPoints(container, updates, maxPoints);

Dependencies { .dependencies }

plotly.js { .dependency }

Enables in-place trace array manipulation and rendering.