- Docs
- Components
- Interface
- Data & Media
- Particle Chart
A bar chart of sand that pours into glass tubes and flows between bars
| Name | Type | Default | Description |
|---|---|---|---|
series | ParticleSeries[] | three quarters of channel data | Datasets to switch between. Each is { name, data } and data is a list of { label, value }. Switching moves grains from bars that shrink to bars that grow. |
data | ParticleDatum[] | — | A single dataset instead of series. Changing it animates the grains to the new values. |
defaultSeries | number | 0 | Series shown first. |
switcher | boolean | true | Shows tabs for the series when there is more than one. |
autoplay | boolean | true | Moves to the next series on its own while the chart is in view. Pauses while the pointer is over it. |
interval | number | 5200 | Milliseconds between series while autoplaying. |
height | number | 240 | Height of the plot area in pixels. |
barWidth | number | 72 | Largest bar width in pixels. Bars narrow to fit small containers. |
grain | number | 2.2 | Diameter of one grain in pixels. |
spacing | number | 2.8 | Distance between grain centres in pixels. |
jitter | number | 0.35 | How loosely grains are packed. 0 is a perfect grid. |
mound | number | 0.6 | How rounded the top of each pile is, like a heap of sand. |
shape | "circle" | "square" | "circle" | Shape of each grain. |
pour | "stream" | "rain" | "stream" | Stream pours each bar from a thin column above it. Rain drops grains straight down. |
arc | number | 0.5 | How long grains stay in the air between bars, which sets how high they arc. |
speed | number | 1 | Speed of every pour, transfer and bounce. |
gravity | number | 1 | Strength of gravity on falling and kicked grains. |
max | number | auto | Value at the top of the plot. By default it fits the largest value across all series. |
prefix | string | "" | Text before each value, like a currency sign. |
suffix | string | "k" | Text after each value. |
decimals | number | auto | Decimal places for values. |
summary | boolean | true | Shows the series total, with the change from the previous series, above the chart. |
summaryLabel | string | "Total visits" | Caption under the total. |
values | boolean | true | Shows each value above its bar, counting with the grains. |
track | boolean | true | Draws each bar's full height as faint empty grains, like a glass the sand fills. |
interactive | boolean | true | Moving the pointer through a bar sloshes its sand outward from the pointer, harder the faster you move. Clicking a bar bursts its top layer. |
labels | boolean | true | Shows category names under the bars. |
surface | boolean | true | Sets the chart on a subtle rounded panel. Off leaves it straight on the page. |
radius | number | 20 | Corner radius of the panel in pixels. The tab pill keeps a concentric corner. |
baseline | boolean | false | Draws a hairline under the bars. |
theme | "auto" | "light" | "dark" | "auto" | Auto picks light or dark colours from the background behind the chart. |
accentColor | string | theme violet | Colour of the grains. Lighter and darker grains are mixed from it. |
textColor | string | from theme | Colour of values and the active tab. |
surfaceColor | string | from theme | Fill of the panel behind the chart. |
onSeriesChange | (index: number) => void | — | Called when the chart moves to another series. |
ref | { next, prev, goTo } | — | Switches series from outside, for example from your own controls. |
className | string | — | Classes for the root element. |
style | CSSProperties | — | Inline styles for the root element. |
seriesParticleSeries[]Datasets to switch between. Each is { name, data } and data is a list of { label, value }. Switching moves grains from bars that shrink to bars that grow.
three quarters of channel datadataParticleDatum[]A single dataset instead of series. Changing it animates the grains to the new values.
—defaultSeriesnumberSeries shown first.
0switcherbooleanShows tabs for the series when there is more than one.
trueautoplaybooleanMoves to the next series on its own while the chart is in view. Pauses while the pointer is over it.
trueintervalnumberMilliseconds between series while autoplaying.
5200heightnumberHeight of the plot area in pixels.
240barWidthnumberLargest bar width in pixels. Bars narrow to fit small containers.
72grainnumberDiameter of one grain in pixels.
2.2spacingnumberDistance between grain centres in pixels.
2.8jitternumberHow loosely grains are packed. 0 is a perfect grid.
0.35moundnumberHow rounded the top of each pile is, like a heap of sand.
0.6shape"circle" | "square"Shape of each grain.
"circle"pour"stream" | "rain"Stream pours each bar from a thin column above it. Rain drops grains straight down.
"stream"arcnumberHow long grains stay in the air between bars, which sets how high they arc.
0.5speednumberSpeed of every pour, transfer and bounce.
1gravitynumberStrength of gravity on falling and kicked grains.
1maxnumberValue at the top of the plot. By default it fits the largest value across all series.
autoprefixstringText before each value, like a currency sign.
""suffixstringText after each value.
"k"decimalsnumberDecimal places for values.
autosummarybooleanShows the series total, with the change from the previous series, above the chart.
truesummaryLabelstringCaption under the total.
"Total visits"valuesbooleanShows each value above its bar, counting with the grains.
truetrackbooleanDraws each bar's full height as faint empty grains, like a glass the sand fills.
trueinteractivebooleanMoving the pointer through a bar sloshes its sand outward from the pointer, harder the faster you move. Clicking a bar bursts its top layer.
truelabelsbooleanShows category names under the bars.
truesurfacebooleanSets the chart on a subtle rounded panel. Off leaves it straight on the page.
trueradiusnumberCorner radius of the panel in pixels. The tab pill keeps a concentric corner.
20baselinebooleanDraws a hairline under the bars.
falsetheme"auto" | "light" | "dark"Auto picks light or dark colours from the background behind the chart.
"auto"accentColorstringColour of the grains. Lighter and darker grains are mixed from it.
theme violettextColorstringColour of values and the active tab.
from themesurfaceColorstringFill of the panel behind the chart.
from themeonSeriesChange(index: number) => voidCalled when the chart moves to another series.
—ref{ next, prev, goTo }Switches series from outside, for example from your own controls.
—classNamestringClasses for the root element.
—styleCSSPropertiesInline styles for the root element.
—