- 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
Distributions
Distribution charts answer where observations lie, how widely they vary, and whether groups differ in shape or rank. The right encoding depends on whether the reader needs familiar bins, compact summaries, cumulative probability, or the detailed shape of each group.
Choose the comparison#
| Reader question | Start with |
|---|---|
| How often do values fall within fixed ranges? | Histogram |
| How do center, spread, and outliers compare across groups? | Boxplot |
| What proportion of observations is at or below each value? | Empirical cumulative distribution |
| How do several binned profiles compare in limited space? | Ridgeline |
| How do several mirrored distribution profiles compare? | Violin |
| Must every observation remain visible? | A beeswarm or strip layout |
Binning, standalone quantiles, and density estimation are data preparation. boxX and boxY own their complete Tukey summaries because independently prepared quartiles, fences, whiskers, and outliers can drift. Dot collision placement belongs to the chart because it depends on final scales, plot bounds, and pixel radii.
Preserve observations with a beeswarm#
Use a dodge layout when every observation should remain visible without moving its measured coordinate.
dot(rows, {
x: 'economy (mpg)',
key: 'id',
r: 4,
layout: dodgeY({ anchor: 'middle', padding: 1 }),
})The Dodge Layouts reference covers anchors, variable radii, identity, and facets.
Inspect frequency with a histogram#
A histogram groups quantitative observations into intervals. Keep thresholds stable when comparing revisions or groups; otherwise a changed binning decision can look like a changed distribution.
import { binX, defineChart, rect } from '@tanstack/charts'
import { scaleLinear } from '@tanstack/charts/scales/linear'
const responseTimes = [
82, 91, 96, 103, 108, 112, 118, 121, 127, 131, 138, 144, 149, 153, 162, 171,
184, 196,
]
const bins = binX(responseTimes, {
value: (datum) => datum,
thresholds: [80, 100, 120, 140, 160, 180, 200],
outputs: { count: { reduce: 'count' } },
})
const chart = defineChart({
marks: [
rect(bins, {
x1: 'x1',
x2: 'x2',
y1: () => 0,
y2: 'count',
inset: 1,
fill: '#2563eb',
}),
],
scales: {
x: { scale: scaleLinear, axis: { label: 'Response time (ms)' } },
y: { scale: scaleLinear, grid: true, axis: { label: 'Requests' } },
},
})
export default chartOpen the catalog histogram for the complete vehicle dataset and update behavior.
The prepared rows should carry each bin's lower bound, upper bound, and count or proportion. Render those intervals with Bar and Rect Marks. The Scales explains how the application chooses thresholds and reductions.
Compare compact summaries#
A boxplot summarizes quartiles, a median, whiskers, and optional outliers. It is compact and comparable, but it does not reveal modes, gaps, or sample size on its own.
Pass the raw observations to boxY, or use boxX for horizontal boxes:
boxY(morley, {
x: 'Expt',
y: 'Speed',
key: 'Run',
fill: '#bfdbfe',
stroke: '#2563eb',
})The mark owns quartiles, 1.5-IQR Tukey fences, observed whiskers, outlier partitioning, and direct source lineage. Its tooltip datum discriminates kind: 'summary' from kind: 'outlier'. The Box Marks reference documents the exact statistics, styling, and interaction targets.
Preserve every rank with an ECDF#
An empirical cumulative distribution shows the proportion of observations at or below each observed value. It avoids bin-width decisions and supports direct percentile comparisons.
Use a step curve because the empirical proportion changes at observations, not continuously between them. State whether ties share a rank and format the vertical axis as a proportion.
Compare binned profiles#
Use a ridgeline when several prepared profiles need a shared quantitative axis and compact categorical baselines.
const profiles = normalize(
binX(episodes, {
value: 'imdb_rating',
by: 'season',
thresholds: ratingBoundaries,
outputs: { count: { reduce: 'count' } },
}),
{
value: 'count',
by: 'season',
basis: 'max',
as: 'height',
},
)
ridgelineY(profiles, {
x: 'x',
y: 'season',
height: 'height',
overlap: 0.78,
color: 'season',
})binX retains the episodes in each bin, normalize retains each bin as its immediate source, and ridgelineY owns only the responsive category-step offset. This example is a normalized histogram profile, not a kernel density estimate. The Ridgeline Marks reference documents overlap, category scales, curves, and interaction.
Compare detailed group shapes#
A violin mirrors a prepared normalized profile around each category. It can show modes and shape that a boxplot hides. Its interpretation still depends on the authored bins or density estimator.
const profiles = normalize(
binY(observations, {
value: 'body_mass_g',
by: 'species',
thresholds: massBoundaries,
outputs: { count: { reduce: 'count' } },
}),
{
value: 'count',
by: 'species',
basis: 'max',
as: 'width',
},
)
const summaries = groupBy(observations, {
by: 'species',
outputs: {
median: { value: 'body_mass_g', reduce: median },
},
})
violinY(profiles, {
x: 'species',
y: 'y',
width: 'width',
span: 0.76,
color: 'species',
curve: d3AreaXCurve(curveBasis),
})
tickY(summaries, { x: 'species', y: 'median', span: 0.36 })
dot(summaries, { x: 'species', y: 'median' })violinY owns only mirrored category-step geometry. binY, max normalization, and the median stay visible and retain source lineage. This catalog example is a smoothed normalized histogram, not a kernel density estimate. The Violin Marks reference documents category scales, spans, curves, and interaction.
Production checks#
- Use counts when sample size matters and proportions when comparing groups of different sizes.
- Keep thresholds and density parameters consistent across comparable views.
- Show sample size or raw observations when a summary could hide sparse data.
- Supply exact values through tooltips, tables, or textual summaries; see Tooltips and Focus and Accessibility.
- Use facets when each group needs its own complete distribution view. See Faceting and Composition.
Area channel details are in Line and Area Marks.