<chart>
A line, area, bar or sparkline chart drawn from a list of values; a tap shows a point's value.
<chart type="line"
labels="Mon,Tue,Wed,Thu,Fri"
format="money"
highlight="last"
style="text-gray-500">
<series name="This week"
data="[1200, 3400, 2800, 4100, 3900]"
color="blue-600 dark:blue-300"/>
<series name="Last week"
data="[900, 2600, 3100, 2900, 3300]"
color="gray-400"
dashed/>
</chart>
Attributes
| Name | What it does | Default |
|---|---|---|
animate |
When a series' values change, the lines and bars glide from the old values to the new over this many ms. number |
|
axis |
Y values and x labels (a sparkline: false). Their color is the text color: style="text-gray-500". boolean |
true |
color |
As on <series>. string |
|
data |
A one-series chart without <series>: as on <series>. string |
|
format |
How a picked value shows: a format() pattern (money, money:EUR, number:2, percent:1, compact …). string |
|
grid |
Horizontal grid lines (a sparkline: false). boolean |
true |
height |
Height in px (200; a sparkline 40). The width is the space it is given. number |
|
highlight |
A point picked from the start: last, an index (0 is the first), or none. Default none (a sparkline: last). string |
|
in |
As on <series>. string |
|
label |
As on <series>. string |
|
labels |
X labels: a JSON array, a comma list (Mon,Tue,Wed), or a $var. A model series can give them with label=. string |
|
limit |
As on <series>. number |
|
locale |
Locale for format= (en-US by default). string |
|
max |
Top of the y axis (default: the data). number |
|
min |
Bottom of the y axis (default: the data, and 0 for bars). number |
|
name |
What the chart shows, for screen readers. string |
|
order |
As on <series>. string |
|
tap |
false: taps and drags do not pick points. boolean |
true |
type |
area fills under each line; bar groups the series side by side; sparkline is a small line with no axis or grid that marks its last point. line, area, bar, sparkline |
line |
value |
As on <series>. string |
|
where |
As on <series>. string |
Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.