tencent cloud

腾讯云智能体开发平台

动态与公告
产品动态
产品公告
产品简介
产品概述
产品优势
应用场景
模型介绍
购买指南
套餐订阅
旧版计费
快速入门
智能体应用及其三种模式
基于“标准模式”创建“内容总结助手”
基于“单工作流模式”创建“网页内容抓取助手”
基于“Multi-Agent 模式”创建“脱口秀素材创作助手”
操作指南
应用开发
工作流
Multi-Agent
知识库
Widget
插件广场
模型列表
提示词模板
应用模板
平台管理
企业、工作空间与权限
API 文档
History
API Category
Making API Requests
Atomic Capability APIs
Operation Optimization APIs
Document Library APIs
Q&A Database APIs
Knowledge Tag APIs
Application Management APIs
Enterprise Management APIs
Billing APIs
Release Management APIs
Dialogue Endpoint APIs
Data Statistics APIs
Data Types
Error Codes
应用接口文档
对话接口总体概述
对话端接口文档(WebSocket)
对话端接口文档(HTTP SSE)
图片对话或文件对话(实时文档解析+对话)
离线文档上传
腾讯云智能体开发平台操作 cos 指南
ADP 文档解析协议
常见问题
产品常见问题
技术常见问题
相关协议
腾讯云智能体开发平台服务等级协议
腾讯云智能体开发平台服务特别条款
腾讯云智能体开发平台隐私政策
腾讯云智能体开发平台数据处理和安全协议
开源许可声明
联系我们
词汇表

Chart 图表

PDF
聚焦模式
字号
最后更新时间: 2026-02-03 16:52:04

组件功能

数据可视化组件,用于以图形方式展示结构化数据,支持柱状图、折线图和面积图等常见图表类型,适用于趋势分析、对比展示和统计汇总等场景。

基础用法

通过 type 指定图表类型,data 提供数据源,series 定义数据系列的展示方式,xAxis 用于配置横轴字段或显示规则。
Template 示例:
<Card>
<Chart
xAxis="month"
data={[
{ month: '1月', sales: 120 },
{ month: '2月', sales: 200 },
{ month: '3月', sales: 150 },
]}
series={[
{ type: 'bar', dataKey: 'sales', label: '销售额', color: '#0052D9' },
]}
/>
</Card>
效果展示如下:




属性说明

属性名
类型
描述
默认值
data
ChartDataRow[]
图表数据数组
-
series
SeriesConfig[]
系列配置数组
-
xAxis
string | XAxisConfig
X 轴配置或数据字段名
-
width
number | string
图表宽度
-
size
number | string
图表尺寸
-
minWidth
number | string
最小宽度
-
maxWidth
number | string
最大宽度
-
showTooltip
boolean
显示提示框
true
showYAxis
boolean
显示 Y 轴
false
showLegend
boolean
显示图例
true
barGap
number | string
柱状图间距
-
barCategoryGap
number | string
柱状图分类间距
-
flex
number | string
Flex 值
-
aspectRatio
number | string
宽高比 (如 16/9)
4/3
注意:
★ 标记为必填属性。

尺寸说明

在容器内(有 data-w-container 属性的父元素):图表宽度默认为 100%,自适应容器。
不在容器内且未设置 width/size:图表宽度默认为 260px
高度控制:默认由 aspectRatio 决定(4:3)。

ChartDataRow 类型

数据对象支持任意字段:
{
[key: string]: any; // 如 date, Desktop, Mobile 等
}

SeriesConfig 类型

每个系列配置通过 type 属性指定图表类型。如果所有系列类型相同,使用对应的图表容器;如果类型不同,则使用混合图表模式。
柱状图系列:
{
type: "bar";
dataKey: string; // 数据字段名
label?: string; // 系列标签
color?: string; // 柱子颜色
stack?: string; // 堆叠分组ID
}
折线图系列:
{
type: "line";
dataKey: string;
label?: string;
color?: string;
curveType?: CurveType; // 曲线类型
}
面积图系列:
{
type: "area";
dataKey: string;
label?: string;
color?: string;
curveType?: CurveType;
stack?: string;
}

XAxisConfig 对象

用于对 X 轴进行精细化控制。
属性名
类型
描述
默认值
dataKey
string
数据字段名
-
label
string | number | object
坐标轴标签
-
type
"number" | "category"
坐标轴类型
"category"
hide
boolean
是否隐藏
false
angle
number
Tick 旋转角度
-
tickMargin
number
Tick 间距
-
allowDuplicatedCategory
boolean
允许重复分类
false

CurveType 类型

折线图和面积图支持以下曲线类型:
"basis" - 基础曲线
"linear" - 直线
"natural" - 自然曲线
"monotoneX" - X 轴单调曲线
"monotoneY" - Y 轴单调曲线
"step" - 阶梯曲线
"stepBefore" - 前阶梯
"stepAfter" - 后阶梯

使用示例

柱状图

Template 示例:
<Chart
xAxis="month"
data={[
{ month: "1月", sales: 120, profit: 80 },
{ month: "2月", sales: 200, profit: 150 }
]}
series={[
{ type: "bar", dataKey: "sales", label: "销售额", color: "#0052D9" },
{ type: "bar", dataKey: "profit", label: "利润", color: "#00A870" }
]}
/>
效果展示如下:



折线图

Template 示例:
<Chart
xAxis="date"
data={[
{ date: '2024-01', value: 100 },
{ date: '2024-02', value: 150 },
]}
series={[
{
type: 'line',
dataKey: 'value',
label: '趋势',
color: '#0052D9',
},
]}
/>
效果展示如下:


面积图

Template 示例:
<Chart
xAxis="time"
data={[
{ time: "00:00", visitors: 100 },
{ time: "12:00", visitors: 300 }
]}
series={[
{
type: "area",
dataKey: "visitors",
label: "访问量",
color: "#0052D9"
}
]}
/>
效果展示如下:


混合图表

可以在同一个图表中混合使用不同类型的图表进行展示。
Template 示例:
<Chart
xAxis="month"
data={[
{ month: "1月", sales: 120, target: 100 },
{ month: "2月", sales: 200, target: 150 }
]}
series={[
{ type: "bar", dataKey: "sales", label: "实际销售", color: "#0052D9" },
{ type: "line", dataKey: "target", label: "目标", color: "#00A870" }
]}
/>
效果展示如下:




帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈