跳到主要内容

如何自定义一个大屏组件

本文介绍怎样快速自定义一个大屏的内置组件。

一、添加组件配置

1. 新增组件

1.1 组件库新增组件

1.2 组件基础配置

Echart组件说明

组件名组件code组件名组件code
基础柱形图JBar堆叠柱形图JStackBar
对比柱形图JMultipleBar折柱图JMixLineBar
饼图JPie基础折线图JLine
双轴图DoubleLineBar对比折线图JMultipleLine
字符云JWordCloud基础仪表盘JGauge
普通散点图JScatter普通漏斗图JFunnel
普通雷达图JRadar

2. 组件配置项数据准备

2.1 属性说明

属性含义
w标识栅格初始宽度,总计24
h标识栅格初始高度
dataType数据类型:1静态数据 2动态数据
timeOut定时任务 0不开启
dataMapping动态数据映射
chartData静态数据
option图表的配置项,参考echarts配置项

示例: 将柱体颜色设置成绿色 "color": "#7ED321";

{
“w”: 12,
“h”: 30,
"dataType": 1,
"timeOut": 0,
"dataMapping": [
{
"filed": "维度",
"mapping": ""
},
{
"filed": "数值",
"mapping": ""
}
],
"chartData": [
{
"name": "苹果",
"value": 1000879,
"type": "手机品牌"
},
{
"name": "三星",
"value": 3400879,
"type": "手机品牌"
}
],
"option": {
"grid": {
"show": false,
"top": 90,
"bottom": 115,
"containLabel": true
},
"title": {
"text": "绿色柱形图",
"show": true,
"textStyle": {
"fontWeight": "blod"
}
},
"series": [
{
"data": [],
"type": "bar",
"barWidth": 40,
"itemStyle": {
"color": "#7ED321",
"borderRadius": 0
}
}
]
}
}

3 开启

页面效果: