Bar
Alpha条形图通过不同长度的矩形条直观呈现数据,用于比较不同类别或组之间的数量差异。
安装指南
仅支持 Vue 3.3 以上版本
API
Prop
data
Record<string, any>[]Required*The source data, in which each entry is a dictionary.
categories
string[]Required*Select the categories from your data. Used to populate the legend and tooltip.
index
stringRequired*Sets the key to map the data to the axis.
colors
string[]Change the default colors.
margin
SpacingMargin of each the container
filterOpacity
numberChange the opacity of the non-selected field
xFormatter
((tick: number | Date, i: number, ticks: number[] | Date[]) => string)Function to format X label
yFormatter
((tick: number | Date, i: number, ticks: number[] | Date[]) => string)Function to format Y label
showXAxis
booleanControls the visibility of the X axis.
showYAxis
booleanControls the visibility of the Y axis.
showTooltip
booleanControls the visibility of tooltip.
showLegend
booleanControls the visibility of legend.
showGridLine
booleanControls the visibility of gridline.
customTooltip
ComponentRender custom tooltip component.
type
'stacked' | 'grouped'Change the type of the chart
roundedCorners
numberRounded bar corners
Emit
legendItemClick
[d: BulletLegendItemInterface, i: number]示例
堆叠条形图
通过设置属性 type 为 stacked 可实现条形图堆叠效果。
圆角样式
自定义提示框
如需渲染自定义提示框,可直接传入自定义组件。具体属性定义请参考此文档。
(注:严格保持原始格式,包括代码块、缩进、组件标签和链接结构,仅对符合规则的自然语言内容进行翻译)