A useful interactive invites the reader to test a relationship, not merely watch an animation. In this sample, readers can change a function's parameters, inspect a chart, explore a hierarchy, and check a short answer.

Every dataset here is invented for demonstration. The numbers do not describe site visitors, actual experiments, or a person's routine. Source blocks show the complete author-facing configuration; the live component appears immediately below each block.

Describe a widget with data

An interactive fence contains one validated JSON object. The type chooses a widget; chart widgets also have a style. Titles and captions explain what the reader should notice. Use JSON data rather than JavaScript expressions or callback functions.

The simplest experiment is a sine curve with amplitude and frequency controls.

markdown
```interactive
{
"type": "function-plot",
"title": "Change one parameter at a time",
"preset": "sine",
"amplitude": 1,
"frequency": 1,
"caption": "First change amplitude, then reset and change frequency. Compare height with repetition."
}
```

Change one parameter at a time

−2π02π
First change amplitude, then reset and change frequency. Compare height with repetition.

Try it: move a slider with the keyboard, inspect its value, and use Reset. A caption should give the reader a concrete comparison to make.

Follow a trend with a line chart

A category chart has labels and equally sized value arrays. A null is a missing observation, not a measured zero. A second series and a reference line give the reader useful comparisons.

markdown
```interactive
{
"type": "chart",
"style": "line",
"title": "Two imagined sequences",
"labels": ["Pass 1", "Pass 2", "Pass 3", "Pass 4", "Pass 5"],
"series": [
{"name": "Sequence A", "values": [4, 6, null, 9, 11]},
{"name": "Sequence B", "values": [3, 5, 7, 8, 10], "dashed": true}
],
"yAxis": {"type": "value", "title": "Illustrative count", "min": 0, "max": 12},
"format": {"precision": 0},
"annotations": [{"type": "line", "axis": "y", "value": 8, "label": "Example target"}],
"zoom": true,
"caption": "Synthetic counts. Sequence A deliberately has a missing value at Pass 3."
}
```

Two imagined sequences

Illustrative count 0 2 4 6 8 10 12 Pass 1 Pass 2 Pass 3 Pass 4 Pass 5 Example target
Illustrative count 0 2 4 6 8 10 12 Pass 1 Pass 2 Pass 3 Pass 4 Pass 5 Example target

View data table
Two imagined sequences — full source data
LabelSequence ASequence B
Pass 143
Pass 265
Pass 3—7
Pass 498
Pass 51110
Synthetic counts. Sequence A deliberately has a missing value at Pass 3.

Try it: inspect the shared tooltip, hide a series with its legend, and reset. Focus the plot and use Left/Right to move between points and Up/Down to change series. Enter pins a tooltip; Escape dismisses it. Zoom controls change the visible range, while the data table retains the source values.

Use a time axis and dated XY points when the spacing represents real elapsed time. Category labels alone do not make an evenly spaced timeline into a continuous time scale.

Compare parts with stacked bars

Stacking is appropriate when the values are meaningful parts of a total. These invented minutes form one small scheduling example.

markdown
```interactive
{
"type": "chart",
"style": "bar",
"title": "An imagined study session",
"labels": ["Plan", "Draft", "Review"],
"series": [
{"name": "Reading", "values": [10, 5, 8]},
{"name": "Making", "values": [5, 20, 7]}
],
"stacking": "normal",
"yAxis": {"type": "value", "title": "Minutes", "min": 0},
"format": {"precision": 0, "suffix": " min"},
"caption": "Illustrative allocations, not a record of anyone's actual work."
}
```

An imagined study session

Minutes 0 min 5 min 10 min 15 min 20 min 25 min Plan Draft Review
Minutes 0 min 5 min 10 min 15 min 20 min 25 min Plan Draft Review

View data table
An imagined study session — full source data
LabelReadingMaking
Plan105
Draft520
Review87
Illustrative allocations, not a record of anyone's actual work.

Try it: compare the total heights, then hide one category to inspect its contribution. Be explicit about whether the chart shows raw totals or percentages; changing the visual form changes the question a reader can answer.

Use numeric coordinates for a scatter plot

XY data uses points, with numeric x and y. Optional low and high fields display an interval. Here those bounds are illustrative marks, not estimated confidence intervals.

markdown
```interactive
{
"type": "chart",
"style": "scatter",
"title": "A synthetic input-response relationship",
"series": [{"name": "Example points", "points": [
{"x": 1, "y": 2, "low": 1.5, "high": 2.5},
{"x": 2, "y": 4.5, "low": 4, "high": 5},
{"x": 3, "y": 6, "low": 5.5, "high": 6.5},
{"x": 4, "y": 8.5, "low": 8, "high": 9}
]}],
"xAxis": {"type": "value", "title": "Input (arbitrary units)", "min": 0, "max": 5},
"yAxis": {"type": "value", "title": "Response (arbitrary units)", "min": 0, "max": 10},
"format": {"precision": 1},
"tooltip": "item",
"zoom": true,
"caption": "Invented points and bounds used solely to demonstrate XY data and intervals."
}
```

A synthetic input-response relationship

Response (arbitrary units) Input (arbitrary units) 0 2 4 6 8 10 0 1 2 3 4 5
Response (arbitrary units) Input (arbitrary units) 0 2 4 6 8 10 0 1 2 3 4 5

View data table
A synthetic input-response relationship — full source data
SeriesLabelXYRadiusLowHigh
Example points12—1.52.5
Example points24.5—45
Example points36—5.56.5
Example points48.5—89
Invented points and bounds used solely to demonstrate XY data and intervals.

A visually smooth pattern is not evidence of a causal relationship. Supply the data source, units, sampling method, and interpretation when replacing this synthetic example with real results.

Find a pattern across two categories

A heatmap has column labels, row labels, and cells of the form [columnIndex, rowIndex, value]. Indices begin at zero.

markdown
```interactive
{
"type": "chart",
"style": "heatmap",
"title": "An imagined weekly practice grid",
"labels": ["Mon", "Tue", "Wed", "Thu"],
"yLabels": ["Read", "Make", "Review"],
"cells": [
[0,0,5], [1,0,8], [2,0,4], [3,0,6],
[0,1,3], [1,1,5], [2,1,9], [3,1,7],
[0,2,2], [1,2,4], [2,2,3], [3,2,5]
],
"format": {"precision": 0, "suffix": " min"},
"caption": "Synthetic practice minutes. Inspect individual cells and try the value-range filter."
}
```

An imagined weekly practice grid

Read Make Review Mon Tue Wed Thu 5 8 4 6 3 5 9 7 2 4 3 5
Read Make Review Mon Tue Wed Thu 5 8 4 6 3 5 9 7 2 4 3 5

View data table
An imagined weekly practice grid — full source data
XYValue
MonRead5
TueRead8
WedRead4
ThuRead6
MonMake3
TueMake5
WedMake9
ThuMake7
MonReview2
TueReview4
WedReview3
ThuReview5
Synthetic practice minutes. Inspect individual cells and try the value-range filter.

Try it: inspect a cell and check its row in the data table. Then narrow the value range to highlight only part of the grid. A legend or exact-value table should carry meaning that color alone cannot communicate.

Explore a hierarchy with a treemap

A hierarchy uses named branches and numeric leaf values. A treemap emphasizes relative area; it should not be used when precise comparison of similar values is the main task.

markdown
```interactive
{
"type": "chart",
"style": "treemap",
"title": "An illustrative allocation of attention",
"tree": [
{"name": "Study", "children": [
{"name": "Reading", "value": 12},
{"name": "Notes", "value": 8}
]},
{"name": "Practice", "children": [
{"name": "Experiments", "value": 18},
{"name": "Review", "value": 10}
]}
],
"format": {"precision": 0},
"caption": "Invented values. Explore a branch, then use the chart's return navigation."
}
```

An illustrative allocation of attention

Practice Experiments Review Study Reading Notes
Practice Experiments Review Study Reading Notes

View data table
An illustrative allocation of attention — full source data
PathValue
Study—
Study / Reading12
Study / Notes8
Practice—
Practice / Experiments18
Practice / Review10
Invented values. Explore a branch, then use the chart's return navigation.

The exported data records the hierarchy's paths and values. Keep branch names meaningful when you substitute a real collection.

Check an idea with a quiz

A quiz has a prompt, two to eight choices, a zero-based answer index, and an explanation. The explanation should show the reasoning, not just announce a result.

markdown
```interactive
{
"type": "quiz",
"title": "Read the numbers before the chart",
"prompt": "What is the arithmetic mean of 2, 4, 6, and 8?",
"choices": ["4", "5", "6"],
"answer": 1,
"explanation": "The values sum to 20. Dividing by four values gives 5.",
"caption": "Choose a value, then check the explanation. The second choice has index 1."
}
```

Read the numbers before the chart

What is the arithmetic mean of 2, 4, 6, and 8?

Reveal explanation

5

The values sum to 20. Dividing by four values gives 5.

Choose a value, then check the explanation. The second choice has index 1.

In a tutorial like this one, the visible source intentionally reveals the answer. For an exercise article, present only the rendered quiz and keep the source in Studio.

Switch between short plain-text summaries

Use the plain-text tab widget when panels need only text. Choose rich Markdown tabs instead when a panel contains lists, equations, images, or links.

markdown
```interactive
{
"type": "tabs",
"title": "Three ways to approach a visual",
"tabs": [
{"label": "Read", "body": "Start with the title, units, and data source."},
{"label": "Try", "body": "Change one control and observe which relationship changes."},
{"label": "Explain", "body": "Describe what the visual supports and what it leaves uncertain."}
],
"active": 0,
"caption": "Switch views with the controls or arrow keys."
}
```

Three ways to approach a visual

Read

Start with the title, units, and data source.

Try

Change one control and observe which relationship changes.

Explain

Describe what the visual supports and what it leaves uncertain.

Switch views with the controls or arrow keys.

Inspect, export, and keep a static fallback

Charts are compiled to light/dark SVG with exact-value tables before publication. Their interactive engine loads on intent, such as hover, focus, or touch. The static drawing remains useful while the enhancement loads or if it is unavailable.

Try it: activate a chart, open its data table, and compare a tooltip with the corresponding source value. Download CSV for the full dataset, or SVG/PNG for the current chart view. Hidden series and a narrowed zoom range do not remove source rows from CSV.

Without JavaScript, the chart drawings and data tables remain readable, quiz explanations remain available, and tab content has a static representation. Print and PDF use the static presentation. Write titles, captions, and explanations that make sense in those modes too.

When adapting this sample, start with one question and one small dataset. Add interaction only when the reader can use it to answer that question more clearly.