- Overview
- shadcn/ui Charts
- Lines and Areas
- Bars and Rankings
- Scatterplots and Relationships
- Distributions
- Heatmaps and Densities
- Intervals and Financial Charts
- Stacked and Composed Charts
- Facets and Multiple Views
- Networks and Hierarchies
- Maps and Spatial Charts
- Polar and Radar Charts
- Annotations and Overlays
- Interactive Charts
- Themes and Motion
Individual Charts
- Apple stock line with seasonal gaps
- Industry unemployment with end labels
- San Francisco temperature range band
- Industry unemployment stacked area
- Sorted vertical bars
- Horizontal ranking with long labels
- Grouped bars
- Stacked bars
- Bubble scatterplot
- Histogram
- Labeled ordinal heatmap
- Anscombe quartet small multiples
- Open-to-close price intervals
- Point estimates with error bars
- Grouped boxplot
- Ranked lollipop chart
- Dumbbell comparison
- Cumulative histogram
- San Francisco temperature moving averages
- Industry share of unemployment
- Streamgraph
- Bollinger band
- Quantitative binned heatmap
- Precipitation calendar heatmap
- Diverging Likert responses
- Parallel coordinates
- Candlestick chart
- Annual gasoline-price waterfall
- Two-period slopegraph
- Scatterplot with linear regression
- Metro inequality change arrows
- Apple close versus moving average
- Pointer-selected tooltip
- Grouped X tooltip
- Tidy hierarchy tree
- Delaunay spatial network
- Filled wind-speed contours
- Point density contours
- Westport House floor plan
- Les Misérables character network
- English letter frequency waffle
- Two-dimensional vector field
- Hexagonally binned density
- Framed guide-free scatterplot
- Empirical cumulative distribution
- Faceted distributions
- Beeswarm distribution
- Log-scale Flare class sizes
- Industry unemployment bump chart
- Indexed industry unemployment
- Directed connected scatterplot
- Scatterplot with marginal histograms
- Annotated AAPL extrema
- Mean penguin mass reducer bars
- AAPL lag-one autocorrelation
- Industry unemployment percentile ribbon
- Ridgeline density comparison
- Violin distribution comparison
- Marimekko survey composition
- Voronoi nearest-point interaction
- Seattle weather with three y axes
- Palmer penguins by species and sex
- Stacked and adjacent Seattle weather bars
- Automobile specifications scatter
- Flare analytics treemap
- Simple radar chart
- English letter frequency pie
- English letter frequency donut
- Survey agreement share gauge
- Snapped axis pointer with grouped tooltip
- Interactive series legend
- Linked chart and data table selection
- Focus and context time window
- Expanding pinned energy tooltip
- Scrollable resource timeline lanes
- Streaming window preservation
- Synchronized cursors across views
- Free cursor over car measurements
- Observed monthly AAPL brush selection
- Wheel zoom and pan over AAPL closes
- AAPL close playback scrubber
- Editable event range
- Letter frequency pie with labels
- Letter frequency donut with total
- Rounded letter frequency donut
- Nested Flare package sizes
- English letter frequency rose
- County unemployment gauge
- Comparative radar chart
- Concentric letter frequency bars
- Flare analytics sunburst
- World learning-poverty choropleth
- World population bubble map
- Orthographic globe with graticule
- HMS Beagle voyage
- Seattle daily high-temperature polar line
- Surface wind polar scatter
- World population-density choropleth
- United States county unemployment choropleth
- Standard world projection gallery
- Basic Sankey
- Sankey
- Staggered entrance motion
- Interrupted spring updates
- Spring line updates
- Definition-owned motion
- Cross-chart geometry morph
- Focus and crosshair motion
- Token use calendar heatmap
- Stacked bars with band and rule cursors
- Themed interactive area card
- Active bar dashboard
- Premium KPI sparklines
- Active donut metric
- Theme palette matrix
- Sales conversion funnel
- Drillable Flare sunburst
- shadcn dashboard
- shadcn Bar Chart - Multiple
- shadcn Pie Chart - Donut with Text
- shadcn Radar Chart - Multiple
- shadcn Radial Chart - Text
- shadcn Tooltip - Advanced
- shadcn Area Chart - Axes
- shadcn Area Chart
- shadcn Area Chart - Gradient
- shadcn Area Chart - Icons
- shadcn Area Chart - Interactive
- shadcn Area Chart - Legend
- shadcn Area Chart - Linear
- shadcn Area Chart - Stacked Expanded
- shadcn Area Chart - Stacked
- shadcn Area Chart - Step
- shadcn Bar Chart - Active
- shadcn Bar Chart
- shadcn Bar Chart - Horizontal
- shadcn Bar Chart - Interactive
- shadcn Bar Chart - Custom Label
- shadcn Bar Chart - Label
- shadcn Bar Chart - Mixed
- shadcn Bar Chart - Negative
- shadcn Bar Chart - Stacked + Legend
- shadcn Line Chart
- shadcn Line Chart - Dots Colors
- shadcn Line Chart - Custom Dots
- shadcn Line Chart - Dots
- shadcn Line Chart - Interactive
- shadcn Line Chart - Custom Label
- shadcn Line Chart - Label
- shadcn Line Chart - Linear
- shadcn Line Chart - Multiple
- shadcn Line Chart - Step
- shadcn Pie Chart - Donut Active
- shadcn Pie Chart - Donut
- shadcn Pie Chart - Interactive
- shadcn Pie Chart - Custom Label
- shadcn Pie Chart - Label List
- shadcn Pie Chart - Label
- shadcn Pie Chart - Legend
- shadcn Pie Chart - Separator None
- shadcn Pie Chart
- shadcn Pie Chart - Stacked
- shadcn Radar Chart
- shadcn Radar Chart - Dots
- shadcn Radar Chart - Grid Circle Filled
- shadcn Radar Chart - Grid Circle - No lines
- shadcn Radar Chart - Grid Circle
- shadcn Radar Chart - Grid Custom
- shadcn Radar Chart - Grid Filled
- shadcn Radar Chart - Grid None
- shadcn Radar Chart - Icons
- shadcn Radar Chart - Custom Label
- shadcn Radar Chart - Legend
- shadcn Radar Chart - Lines Only
- shadcn Radar Chart - Radius Axis
- shadcn Radial Chart - Grid
- shadcn Radial Chart - Label
- shadcn Radial Chart - Shape
- shadcn Radial Chart
- shadcn Radial Chart - Stacked
- shadcn Tooltip - Default
- shadcn Tooltip - Formatter
- shadcn Tooltip - Icons
- shadcn Tooltip - Line Indicator
- shadcn Tooltip - No Indicator
- shadcn Tooltip - Custom label
- shadcn Tooltip - Label Formatter
- shadcn Tooltip - No Label
Facets and Multiple Views
Facets repeat one encoding across groups. Multiple-view compositions place different but related encodings together. Both reduce the amount of data one plot must carry, but they answer different questions.
Use facets when every panel has the same role. Use distinct linked views when one panel provides context, a marginal distribution, controls, or detail for another.
Choose the layout#
| Reader question | Start with |
|---|---|
| How does the same distribution differ across cohorts? | Shared-scale facets |
| How does a bivariate relationship relate to each marginal shape? | Scatterplot with marginal histograms |
| Which portion of a long time domain should the detail view show? | Focus-plus-context views |
| Must every group use a different scale or mark composition? | Independent named chart views |
| Should selecting one view filter or highlight another? | Linked views with shared application state |
Faceting and Composition owns the implementation boundary. This page helps choose a layout and verify its comparison semantics.
Repeat one encoding by group#
Faceted distributions give each cohort its own panel while preserving a common binning and positional scale. The reader can compare both local shape and absolute position without decoding overlapping fills.
Use shared domains when position should be directly comparable. Independent domains can make local variation easier to see, but they can also exaggerate small differences. If independent scales are intentional, give panels their own guides and state the policy.
Keep the denominator visible by grouping both transforms:
const bins = normalize(
binX(rows, {
value: 'body_mass_g',
by: 'species',
thresholds,
outputs: { count: { reduce: 'count' } },
}),
{
value: 'count',
by: 'species',
basis: 'sum',
as: 'proportion',
},
)binX owns aggregate lineage and normalize divides each species by its own count. Omit the second by only when the global population is the intended denominator.
Add marginal context#
A scatterplot with marginal histograms combines three roles:
- The central plot shows the joint relationship.
- The top histogram shows the x distribution.
- The side histogram shows the y distribution.
All regions can derive from the same raw observations, but they do not share the same marks or plot rectangle. This example uses public binX and binY transforms inside three ordinary chart definitions. Place them with composeViews and grid, then use shareX and shareY to match the scatterplot's resolved scales and plot ranges. viewGrid is concise syntax for the same non-overlapping layout.
Use separate chart hosts when each view needs independent interaction or an independent accessible label. See View Composition for the single-figure layout contract.
Overlay a summary#
An inset can use a different coordinate system from the chart behind it. This places a donut summary over a Cartesian detail chart without teaching either child about the other:
import { composeViews, fill, inset, layer } from '@tanstack/charts/view'
const definition = composeViews({
views: {
detail: detailDefinition,
summary: donutDefinition,
},
layout: layer(
fill('detail'),
inset('summary', {
relativeTo: 'detail',
anchor: 'top-right',
width: 160,
height: 160,
offset: 12,
}),
),
})The inset is anchored to the complete detail frame. It is clipped to its own frame and shrinks proportionally when the host is too small. Because the child scenes share one outer interaction model, empty inset space and the donut hole leave detail geometry behind them eligible for focus.
Pair detail with context#
A focus-plus-context layout uses a compact overview to control the explicit domain of a larger detail chart. The selection is semantic application state, not a rectangle stored inside one renderer.
The overview should retain the complete domain. The detail should receive the selected start and end as its configured scale domain. Pointer, touch, and keyboard controls should update the same semantic values, and those values should survive data revisions and resizes.
See Interactions and Selections for controlled brushes, zoom, and linked state.
Coordinate views by values, not pixels#
Shared selection, cursor, category, or domain state belongs in the application:
- A view emits a semantic value through focus, selection, or a controlled gesture.
- Application state validates and stores that value.
- Each view derives its own definition and configured scales.
- Each chart compiles a new scene through its normal update path.
Do not query one SVG for a pixel and apply that pixel directly to another view. Different margins, widths, orientations, and scales can represent the same semantic value at different coordinates.
For focus-driven cursors, createChartCursor provides that application-owned state without an overlay or callback relay:
import { createChartCursor, cursorHost } from '@tanstack/charts/cursor'
const sharedDate = createChartCursor<Date, number>()
const cursor = {
use: cursorHost,
controller: sharedDate,
mode: 'focus' as const,
match: 'x' as const,
pin: true,
}
const current = defineChart(currentSpec, { cursor })
const previous = defineChart(previousSpec, { cursor })Pointer, responder, keyboard, or accessibility focus in either browser or React Native chart stores the semantic date. Every subscriber maps that date through its own x scale, resolves its local focus group, and paints its own crosshair({ y: false }). Widths, margins, and y domains can differ. A pinned cursor remains shared until another activation, an escape action, or a programmatic clear dismisses it.
Use anchor: 'value' when setting a controller programmatically for semantic sync. Normalized or scene anchors intentionally share relative or local pixel coordinates instead.
Production checks#
- Use one repeated encoding for true facets; use named views when roles differ.
- Place every named composed view exactly once.
- Make shared versus independent domains explicit.
- Keep bin boundaries, group order, color meaning, and units comparable.
- Give each independently interactive view its own accessible label.
- Preserve selection and viewport state across data and size updates.
- Avoid duplicating a full axis on every panel when shared outer guides are accurate.
- Verify panel order at narrow widths in Responsive Charts.
- Provide a table or textual summary when exact cross-panel comparison matters.
For the underlying row and channel model, see Data and Channels.