Sparkline
Simplified area chart to show trends
Import
Source
Docs
Package
Usage
Sparkline
is a simplified version of AreaChart. It can be used
to display a single series of data in a small space.
Color
Fill opacity
Stroke width
Change area color depending on color scheme
You can use CSS variables in color
property. To define a CSS variable that
changes depending on the color scheme, use light/dark mixins
or light-dark function. Example
of area that is dark orange in light mode and lime in dark mode:
Trend colors
Use trendColors
prop instead of color
to change chart color depending on the trend.
The prop accepts an object with positive
, negative
and neutral
properties:
positive
- color for positive trend (first value is less than the last value indata
array)negative
- color for negative trend (first value is greater than the last value indata
array)neutral
- color for neutral trend (first and last values are equal)
neutral
is optional, if not provided, the color will be the same as positive
.
Positive trend:
Negative trend:
Neutral trend: