|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
import fontList from 'data-room-ui/js/utils/fontList'
|
|
|
|
|
// 配置版本号
|
|
|
|
|
const version = '2023101401'
|
|
|
|
|
const version = '2023101403'
|
|
|
|
|
// 分类
|
|
|
|
|
const category = 'Gauge'
|
|
|
|
|
// 标题
|
|
|
|
@ -32,13 +32,25 @@ const setting = [
|
|
|
|
|
// 设置组件类型
|
|
|
|
|
type: 'gradual',
|
|
|
|
|
// 字段
|
|
|
|
|
field: 'range_color',
|
|
|
|
|
field: 'color1',
|
|
|
|
|
// 对应options中的字段
|
|
|
|
|
optionField: 'range.color',
|
|
|
|
|
optionField: 'color1',
|
|
|
|
|
value: 'l(0) 0:#6b74e4 1:#4391f4',
|
|
|
|
|
tabName: 'custom',
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '表盘背景颜色',
|
|
|
|
|
// 设置组件类型
|
|
|
|
|
type: 'colorPicker',
|
|
|
|
|
// 字段
|
|
|
|
|
field: 'color2',
|
|
|
|
|
// 对应options中的字段
|
|
|
|
|
optionField: 'color2',
|
|
|
|
|
value: '#d0d0d0',
|
|
|
|
|
tabName: 'custom',
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '指标颜色',
|
|
|
|
|
// 设置组件类型
|
|
|
|
@ -78,19 +90,6 @@ const setting = [
|
|
|
|
|
options: fontList,
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '指标位置',
|
|
|
|
|
// 设置组件类型
|
|
|
|
|
type: 'inputNumber',
|
|
|
|
|
// 字段
|
|
|
|
|
field: 'statistic_title_offsetY',
|
|
|
|
|
// 对应options中的字段
|
|
|
|
|
optionField: 'statistic.title.offsetY',
|
|
|
|
|
value: -36,
|
|
|
|
|
min: -100,
|
|
|
|
|
tabName: 'custom',
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '标签内容',
|
|
|
|
|
// 设置组件类型
|
|
|
|
@ -126,6 +125,32 @@ const setting = [
|
|
|
|
|
value: 20,
|
|
|
|
|
tabName: 'custom',
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '标签间距大小',
|
|
|
|
|
// 设置组件类型
|
|
|
|
|
type: 'inputNumber',
|
|
|
|
|
// 字段
|
|
|
|
|
field: 'statistic_content_offsetY',
|
|
|
|
|
// 对应options中的字段
|
|
|
|
|
optionField: 'statistic.content.offsetY',
|
|
|
|
|
value: -30,
|
|
|
|
|
min:-100,
|
|
|
|
|
tabName: 'custom',
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: '指标间距大小',
|
|
|
|
|
// 设置组件类型
|
|
|
|
|
type: 'inputNumber',
|
|
|
|
|
// 字段
|
|
|
|
|
field: 'statistic_title_offsetY',
|
|
|
|
|
// 对应options中的字段
|
|
|
|
|
optionField: 'statistic.title.offsetY',
|
|
|
|
|
value: 0,
|
|
|
|
|
min:-100,
|
|
|
|
|
tabName: 'custom',
|
|
|
|
|
groupName: 'graph'
|
|
|
|
|
}
|
|
|
|
|
// 边距 padding
|
|
|
|
|
]
|
|
|
|
@ -134,6 +159,8 @@ const data = [
|
|
|
|
|
percent: 0.75
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
// 配置处理脚本
|
|
|
|
|
const optionHandler ='option.range.color = [option.color1, option.color2]'
|
|
|
|
|
// 数据处理脚本
|
|
|
|
|
const dataHandler = '// 取返回数据列表的第一项指标值\noption.percent = data[0][setting.filter(settingItem=>settingItem.field === \'percent\')[0].value]'
|
|
|
|
|
|
|
|
|
@ -143,15 +170,17 @@ const option = {
|
|
|
|
|
dataKey: 'percent',
|
|
|
|
|
data,
|
|
|
|
|
percent: 0.75,
|
|
|
|
|
color1: 'l(0) 0:#6b74e4 1:#4391f4',
|
|
|
|
|
color2: '#d0d0d0',
|
|
|
|
|
range: {
|
|
|
|
|
color: 'l(0) 0:#6b74e4 1:#4391f4'
|
|
|
|
|
color: ['l(0) 0:#6b74e4 1:#4391f4','#d0d0d0']
|
|
|
|
|
},
|
|
|
|
|
startAngle: Math.PI,
|
|
|
|
|
endAngle: 2 * Math.PI,
|
|
|
|
|
indicator: null,
|
|
|
|
|
statistic: {
|
|
|
|
|
title: {
|
|
|
|
|
offsetY: -36,
|
|
|
|
|
offsetY: 0,
|
|
|
|
|
style: {
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
lineHeight: 2,
|
|
|
|
@ -161,6 +190,7 @@ const option = {
|
|
|
|
|
formatter: ({ percent }) => `${(percent * 100).toFixed(0)}%`
|
|
|
|
|
},
|
|
|
|
|
content: {
|
|
|
|
|
offsetY: -30,
|
|
|
|
|
content: '占比',
|
|
|
|
|
style: {
|
|
|
|
|
fontSize: 20,
|
|
|
|
@ -178,5 +208,6 @@ export default {
|
|
|
|
|
name,
|
|
|
|
|
option,
|
|
|
|
|
setting,
|
|
|
|
|
dataHandler
|
|
|
|
|
dataHandler,
|
|
|
|
|
optionHandler
|
|
|
|
|
}
|
|
|
|
|