You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

236 lines
4.8 KiB
JavaScript

// 配置版本号
const version = '2023071001'
// 分类
const category = 'Radar'
// 标题
const title = '基础雷达图'
// 类别, new Line()
const chartType = 'Radar'
// 用于标识唯一title的中文转拼音
const name = 'JiChuLeiDaTu'
// 右侧配置项
const setting = [
{
label: '维度',
// 设置组件类型, select / input / colorPicker
type: 'select',
// 字段
field: 'xField',
optionField: 'xField', // 对应options中的字段
// 是否多选
multiple: false,
// 绑定的值
value: '',
// tab页。 data: 数据, custom: 自定义
tabName: 'data'
},
{
label: '指标',
// 设置组件类型
type: 'select',
// 字段
field: 'yField',
// 对应options中的字段
optionField: 'yField',
// 是否多选
multiple: false,
value: '',
tabName: 'data'
},
/** 样式配置 **/
// 图表 graph
{
label: '底色',
type: 'colorPicker', // 设置组件类型
field: 'yAxis_grid_alternateColor', // 字段
optionField: 'yAxis.grid.alternateColor', // 对应options中的字段
value: 'rgba(0, 0, 0, 0.04)',
tabName: 'custom',
groupName: 'graph'
},
{
label: '面积填充',
type: 'switchNumber', // 设置组件类型
field: 'area', // 字段
optionField: 'area', // 对应options中的字段
value: 1,
tabName: 'custom',
groupName: 'graph'
},
{
label: '是否平滑',
type: 'switch', // 设置组件类型
field: 'smooth', // 字段
optionField: 'smooth', // 对应options中的字段
value: false,
tabName: 'custom',
groupName: 'graph'
},
{
label: '颜色',
type: 'gradual', // 设置组件类型
field: 'color', // 字段
optionField: 'color', // 对应options中的字段
value: 'l(0) 0:#648ff7 1:#648ff7',
tabName: 'custom',
groupName: 'graph'
},
{
label: '数据点形状',
type: 'select', // 设置组件类型
field: 'point_shape', // 字段
optionField: 'point.shape', // 对应options中的字段
// 是否多选
multiple: false,
value: 'circle',
tabName: 'custom',
options: [
{
label: '无',
value: false
},
{
label: '空心圆',
value: 'hollow-circle'
},
{
label: '圆形',
value: 'circle'
},
{
label: '正方形',
value: 'square'
},
{
label: '菱形',
value: 'diamond'
},
{
label: '三角形',
value: 'triangle'
},
{
label: '六边形',
value: 'hexagon'
},
{
label: '菱形交叉',
value: 'bowtie'
},
{
label: '十字形',
value: 'cross'
},
{
label: 'I形',
value: 'tick'
},
{
label: '加号',
value: 'plus'
},
{
label: '连字号',
value: 'hyphen'
}
],
groupName: 'graph'
},
{
label: '数据点颜色',
type: 'colorPicker', // 设置组件类型
field: 'point_color', // 字段
optionField: 'point.color', // 对应options中的字段
value: '#ffffff',
tabName: 'custom',
groupName: 'graph'
},
{
label: '数据点大小',
type: 'inputNumber', // 设置组件类型
field: 'point_size', // 字段
optionField: 'point.size', // 对应options中的字段
value: 2,
tabName: 'custom',
groupName: 'graph'
},
// 边距 padding
{
label: '图表边距',
type: 'padding', // 设置组件类型
field: 'appendPadding', // 字段
optionField: 'appendPadding', // 对应options中的字段
value: [16, 16, 16, 16],
tabName: 'custom',
groupName: 'padding'
}
]
// 模拟数据
const data = [
{ name: 'G2', star: 10371 },
{ name: 'G6', star: 7380 },
{ name: 'F2', star: 7414 },
{ name: 'L7', star: 2140 },
{ name: 'X6', star: 660 },
{ name: 'AVA', star: 885 },
{ name: 'G2Plot', star: 1626 }
]
// 数据处理脚本
const dataHandler = ''
// 图表配置 new Line('domName', option)
const option = {
// 数据将要放入到哪个字段中
dataKey: 'data',
data,
xField: 'name',
yField: 'star',
smooth: false,
color: 'l(90) 0:#648ff7 1:#648ff7',
appendPadding: [16, 16, 16, 16], // 设置图标的边距
theme: {
styleSheet: {
backgroundColor: ''
}
},
meta: {
star: {
alias: 'star 数量',
min: 0,
nice: true,
formatter: (v) => Number(v).toFixed(2)
}
},
xAxis: {
tickLine: null
},
yAxis: {
label: false,
grid: {
alternateColor: 'rgba(0, 0, 0, 0.04)'
}
},
// 开启辅助点
point: {
color: '',
shape: '',
size: 2
},
area: 1
}
export default {
category,
version,
title,
chartType,
name,
option,
setting,
dataHandler
}