Sparkline

The sparkline component can be used to create simple graphs, like GitHub's contribution chart.

Any SVG attribute may be used in addition to the ones listed below.

用例

The sparkline component comes in 2 variations, trend(default) and bar. Each support a multitude of options for customizing the look and feel of the sparkline.

API

v-sparkline
名称
auto-draw
默认值
false
类型
boolean

Components.Sparklines.

名称
auto-draw-duration
默认值
2000
类型
number

Components.Sparklines.

名称
auto-draw-easing
默认值
'ease'
类型
string

Components.Sparklines.

名称
auto-line-width
默认值
false
类型
boolean

Components.Sparklines.

名称
color
默认值
'primary'
类型
string

将指定的色彩应用与控件

名称
fill
默认值
false
类型
boolean

Components.Sparklines.

名称
gradient
默认值
[]
类型
array

Components.Sparklines.

名称
gradient-direction
默认值
'top'
类型
string

Components.Sparklines.

名称
height
默认值
75
类型
string | number

设置组件高度

名称
label-size
默认值
7
类型
number | string

Components.Sparklines.

名称
labels
默认值
[]
类型
array

Components.Sparklines.

名称
line-width
默认值
4
类型
string | number

Components.Sparklines.

名称
padding
默认值
8
类型
string | number

Components.Sparklines.

名称
show-labels
默认值
false
类型
boolean

Components.Sparklines.

名称
smooth
默认值
false
类型
boolean | number | string

Components.Sparklines.

名称
type
默认值
'trend'
类型
string

Components.Sparklines.

名称
value
默认值
[]
类型
array

控制可见性

名称
width
默认值
300
类型
number | string

内容的宽度

示例

Take a break

For concise information, a complete chart might be overkill. Using a trend line with gradient provides enough detail for the user without showing too much information.

Dashboard card

The v-sparkline component pairs nicely with v-card and v-sheet to create customized information cards, perfect for admin dashboards. Here we use custom labels to provide additional context for the sparkline.

Custom labels

By providing a scoped slot label, we are able to modify the displayed content adding a dollar sign ($). This slot is exclusively for text content. For more information on the svg <text> element, navigate here.

Fill

You can create a v-sparkline with fill using the fill property.

Edit this page | language on Github
Vuetify 3 is now available!The latest version of Vuetify is now available!
Learn about Vuetify 3's new features and functionality for modern Vue applications
Start exploringExplore