Skip to content

DualBarCompareChart 双柱对比图 ​

DualBarCompareChart 双柱对比图 的基础用法、公开 API 与示例。

基础示例 ​

使用正向与负向数据展示计划和实际值对比。

示例使用本地演示数据;上传、校验和提交不会连接业务后端。

显示图例和数据标签 ​

开启图例、数据标签和坐标轴辅助线,适合需要读数对比的业务看板。

示例使用本地演示数据;上传、校验和提交不会连接业务后端。

引入方式 ​

ts
import { DualBarCompareChart } from "@/components/chart/dual-bar-compare-chart";

Props ​

参数说明类型默认值必填
height图表高度stringDEFAULT_CHART_HEIGHT否
loading是否加载中booleanfalse否
isEmpty是否为空数据booleanfalse否
colors颜色配置string[]-否
showAxisLabel是否显示坐标轴标签booleantrue否
showAxisLine是否显示坐标轴线booleanfalse否
showSplitLine是否显示分割线booleanfalse否
showTooltip是否显示提示框booleantrue否
showLegend是否显示图例booleanfalse否
legendPosition图例位置LegendPosition"bottom"否
legendOptions自定义图例配置,会与默认配置合并ChartCustomOptions-否
positiveData正向数据number[][]否
negativeData负向数据number[][]否
xAxisDataX 轴标签数据string[][]否
positiveName正向数据名称string"正向数据"否
negativeName负向数据名称string"负向数据"否
barWidth柱状图宽度string | number16否
yAxisMinY 轴最小值number-100否
yAxisMaxY 轴最大值number100否
showDataLabel是否显示数据标签booleanfalse否
positiveBorderRadius正向数据圆角配置number | number[][10, 10, 0, 0]否
negativeBorderRadius负向数据圆角配置number | number[][0, 0, 10, 10]否

Events ​

事件名说明回调参数
-该组件未声明 Events。-

Slots ​

插槽名说明参数
-该组件未声明 Slots。-

Expose ​

名称说明类型
-该组件未声明 Expose。-

Module API ​

名称说明类型
DualBarCompareChart导出 DualBarCompareChart 供业务侧复用。useInstall(index)

Types ​

BidirectionalBarChartProps ​

双向堆叠柱状图 Props

字段说明类型默认值必填
height图表高度string-否
loading是否加载中boolean-否
isEmpty是否为空数据boolean-否
colors颜色配置string[]-否
showAxisLabel是否显示坐标轴标签boolean-否
showAxisLine是否显示坐标轴线boolean-否
showSplitLine是否显示分割线boolean-否
showTooltip是否显示提示框boolean-否
showLegend是否显示图例boolean-否
legendPosition图例位置LegendPosition-否
legendOptions自定义图例配置,会与默认配置合并ChartCustomOptions-否
positiveData正向数据number[]-是
negativeData负向数据number[]-是
xAxisDataX 轴标签数据string[]-否
positiveName正向数据名称string-否
negativeName负向数据名称string-否
barWidth柱状图宽度string | number-否
yAxisMinY 轴最小值number-否
yAxisMaxY 轴最大值number-否
showDataLabel是否显示数据标签boolean-否
positiveBorderRadius正向数据圆角配置number | number[]-否
negativeBorderRadius负向数据圆角配置number | number[]-否

API 根据当前组件源码生成;同步版本与验证记录见维护说明。