fix:bug修复

main
liu.tao3 1 year ago
parent 7c0ac00336
commit 1756338f54

@ -268,7 +268,7 @@
:style="{
display: remoteComponentsGridComputed ? 'grid' : 'flex',
justifyContent: remoteComponentsGridComputed ? 'space-around' : 'flex-start',
height: 'calc(100vh - 430px)'
height: 'calc(100vh - 385px)'
}"
>
<div

@ -2,7 +2,7 @@
<div>
<el-dialog
:close-on-click-modal="false"
:title="title ? '编辑' : '新增'"
:title="title ? '编辑大屏' : '新增大屏'"
:visible.sync="formVisible"
:append-to-body="true"
class="bs-dialog-wrap bs-el-dialog"

@ -2,7 +2,7 @@
<div>
<el-dialog
:close-on-click-modal="false"
:title="title ? '编辑' : '新增'"
:title="title ? '编辑组件' : '新增组件'"
:visible.sync="formVisible"
:append-to-body="true"
class="bs-dialog-wrap bs-el-dialog"

@ -32,12 +32,12 @@
:predefine="predefineThemeColors"
/>
</el-form-item>
<el-form-item label="装饰副颜色">
<!-- <el-form-item label="装饰副颜色">
<ColorPicker
v-model="config.customize.decorationColor2"
:predefine="predefineThemeColors"
/>
</el-form-item>
</el-form-item> -->
<el-form-item label="单次动画时长">
<el-input-number
v-model="config.customize.dur"

@ -32,12 +32,12 @@
:predefine="predefineThemeColors"
/>
</el-form-item>
<el-form-item label="装饰副颜色">
<!-- <el-form-item label="装饰副颜色">
<ColorPicker
v-model="config.customize.decorationColor2"
:predefine="predefineThemeColors"
/>
</el-form-item>
</el-form-item> -->
<el-form-item label="单次动画时长">
<el-input-number
v-model="config.customize.dur"

@ -32,7 +32,7 @@
:predefine="predefineThemeColors"
/>
</el-form-item>
<el-form-item label="装饰副颜色">
<el-form-item label="装饰副颜色">
<ColorPicker
v-model="config.customize.decorationColor2"
:predefine="predefineThemeColors"

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

@ -66,7 +66,7 @@ export function getCustomPlots () {
category: config.category,
name: config.name,
title: config.title,
border:{ type: '', titleHeight: 60, fontSize: 16, isTitle: true, padding: [16, 16, 16, 16] },
border:{ type: '', titleHeight: 60, fontSize: 16 , isTitle: true, padding: [16, 16, 16, 16] },
icon: null,
img: config.img,
className:

@ -8,6 +8,7 @@ export default [
'折线趋势填充图',
'多阶梯折线图',
'迷你基础折线图',
'迷你面积图',
@ -42,5 +43,6 @@ export default [
'基础漏斗图',
'对比漏斗图',
'分面漏斗图'
'分面漏斗图',
'柱线混合图'
]

@ -0,0 +1,600 @@
/*
* @description: 配置参考https://g2plot.antv.antgroup.com/examples
* @Date: 2023-03-27 14:38:23
* @Author: xing.heng
*/
// 配置版本号
const version = '2023092201'
// 分类
const category = 'DualAxes'
// 标题
const title = '柱线混合图'
// 类别, new Line()
const chartType = 'DualAxes'
// 用于标识,唯一,和文件夹名称一致
const name = 'ZhuXianHunHeTu'
// 右侧配置项
const setting = [
{
label: '维度',
type: 'select', // 设置组件类型
field: 'xField', // 字段
optionField: 'xField', // 对应options中的字段
// 是否多选
multiple: false,
value: '',
tabName: 'data'
},
{
label: '指标',
type: 'select', // 设置组件类型
field: 'yField', // 字段
optionField: 'yField', // 对应options中的字段
// 是否多选
multiple: true,
value: [],
tabName: 'data'
},
{
label: '数据标签',
type: 'switch', // 设置组件类型
field: 'label_style_opacity', // 字段
optionField: 'label.style.opacity', // 对应options中的字段
value: 0,
active: 1,
inactive: 0,
tabName: 'custom',
groupName: 'graph'
},
{
label: '数据标签位置',
type: 'select', // 设置组件类型
field: 'label_position', // 字段
optionField: 'label.position', // 对应options中的字段
// 是否多选
multiple: false,
value: 'middle',
tabName: 'custom',
options: [
{
label: '顶部',
value: 'top'
},
{
label: '居中',
value: 'middle'
},
{
label: '底部',
value: 'bottom'
}
],
groupName: 'graph'
},
{
label: '数据标签颜色',
type: 'colorPicker', // 设置组件类型
field: 'label_style_fill', // 字段
optionField: 'label.style.fill', // 对应options中的字段
value: '#ffffff',
tabName: 'custom',
groupName: 'graph'
},
{
label: '数据标签大小',
// 设置组件类型
type: 'inputNumber',
// 字段
field: 'label_style_fontSize',
// 对应options中的字段
optionField: 'label.style.fontSize',
value: 12,
tabName: 'custom',
groupName: 'graph'
},
{
label: '柱子颜色',
// 设置组件类型
type: 'colorSelect',
// 字段
field: 'color',
// 对应options中的字段
optionField: 'color',
value: ['#5B8FF9', '#61DDAA', '#5D7092', '#F6BD16', '#6F5EF9', '#6DC8EC', '#945FB9', '#FF9845', '#1E9493', '#FF99C3'],
tabName: 'custom',
groupName: 'graph'
},
// 网格线 grid
{
label: '虚线',
type: 'switch',
field: 'yAxis_grid_line_style_lineDash',
optionField: 'yAxis.grid.line.style.lineDash',
value: 0,
active: 5,
inactive: 0,
tabName: 'custom',
groupName: 'grid'
},
{
label: '宽度',
type: 'inputNumber',
field: 'yAxis_grid_line_style_lineWidth',
optionField: 'yAxis.grid.line.style.lineWidth',
value: 1,
tabName: 'custom',
groupName: 'grid'
},
{
label: '颜色',
type: 'colorPicker',
field: 'yAxis_grid_line_style_stroke',
optionField: 'yAxis.grid.line.style.stroke',
value: '#d0d0d0',
tabName: 'custom',
groupName: 'grid'
},
// 图例 legend
{
label: '显示',
type: 'switch', // 设置组件类型
field: 'legendEnable', // 字段
optionField: 'legendEnable', // 对应options中的字段
value: false,
active: true,
inactive: false,
tabName: 'custom',
groupName: 'legend'
},
{
label: '位置',
type: 'select', // 设置组件类型
field: 'legendPosition', // 字段
optionField: 'legendPosition', // 对应options中的字段
// 是否多选
multiple: false,
value: 'top',
tabName: 'custom',
options: [
{ label: '顶部', value: 'top' },
{ label: '左上角', value: 'top-left' },
{ label: '右上角', value: 'top-right' },
{ label: '左侧', value: 'left' },
// { label: '左上方', value: 'left-top' },
// { label: '左下方', value: 'left-bottom' },
{ label: '右侧', value: 'right' },
// { label: '右上方', value: 'right-top' },
// { label: '右下方', value: 'right-bottom' },
{ label: '底部', value: 'bottom' },
{ label: '左下角', value: 'bottom-left' },
{ label: '右下角', value: 'bottom-right' }
],
groupName: 'legend'
},
{
label: '字体大小',
type: 'inputNumber',
field: 'legendItemName_style_fontSize',
optionField: 'legendItemName.style.fontSize',
value: 12,
tabName: 'custom',
groupName: 'legend'
},
{
label: '字体权重',
type: 'inputNumber',
step: 100,
max: 900,
field: 'legendItemName_style_fontWeight',
optionField: 'legendItemName.style.fontWeight',
value: 400,
tabName: 'custom',
groupName: 'legend'
},
{
label: '字体颜色',
type: 'colorPicker',
field: 'legendItemName_style_fill',
optionField: 'legendItemName.style.fill',
value: '#595959',
tabName: 'custom',
groupName: 'legend'
},
// X轴 xAxis
{
label: '标题',
type: 'input',
field: 'xAxis_title_text',
optionField: 'xAxis.title.text',
value: '',
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标题位置',
type: 'select',
field: 'xAxis_title_position',
optionField: 'xAxis.title.position',
value: 'end',
tabName: 'custom',
options: [
{
label: '左',
value: 'start'
},
{
label: '中',
value: 'center'
},
{
label: '右',
value: 'end'
}],
groupName: 'xAxis'
},
{
label: '标题字体大小',
type: 'inputNumber',
field: 'xAxis_title_style_fontSize',
optionField: 'xAxis.title.style.fontSize',
value: 12,
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标题颜色',
type: 'colorPicker',
field: 'xAxis_title_style_fill',
optionField: 'xAxis.title.style.fill',
// 是否多选
multiple: false,
value: '#8C8C8C',
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标签大小',
type: 'inputNumber',
field: 'xAxis_label_style_fontSize',
optionField: 'xAxis.label.style.fontSize',
value: 12,
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标签颜色',
type: 'colorPicker',
field: 'xAxis_label_style_fill',
optionField: 'xAxis.label.style.fill',
// 是否多选
multiple: false,
value: '#8C8C8C',
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '轴线宽度',
type: 'inputNumber',
field: 'xAxis_line_style_lineWidth',
optionField: 'xAxis.line.style.lineWidth',
value: 1,
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '轴线颜色',
type: 'colorPicker',
field: 'xAxis_line_style_stroke',
optionField: 'xAxis.line.style.stroke',
// 是否多选
multiple: false,
value: '#d0d0d0',
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '刻度线宽度',
type: 'inputNumber',
field: 'xAxis_tickLine_style_lineWidth',
optionField: 'xAxis.tickLine.style.lineWidth',
value: 1,
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '刻度线颜色',
type: 'colorPicker',
field: 'xAxis_tickLine_style_stroke',
optionField: 'xAxis.tickLine.style.stroke',
// 是否多选
multiple: false,
value: '#d0d0d0',
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标签过多时旋转',
type: 'switch',
field: 'xAxis_label_autoRotate',
optionField: 'xAxis.label.autoRotate',
value: true,
active: true,
inactive: false,
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标签过多时隐藏',
type: 'switch',
field: 'xAxis_label_autoHide',
optionField: 'xAxis.label.autoHide',
value: true,
tabName: 'custom',
groupName: 'xAxis'
},
{
label: '标签过长时省略',
type: 'switch',
field: 'xAxis_label_autoEllipsis',
optionField: 'xAxis.label.autoEllipsis',
value: true,
tabName: 'custom',
groupName: 'xAxis'
},
// Y轴 yAxis
{
label: '标题',
type: 'input',
field: 'yAxis_title_text',
optionField: 'yAxis.title.text',
value: '',
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '标题过长时旋转',
type: 'switch',
field: 'yAxis_title_autoRotate',
optionField: 'yAxis.title.autoRotate',
value: true,
active: true,
inactive: false,
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '标题位置',
type: 'select',
field: 'yAxis_title_position',
optionField: 'yAxis.title.position',
value: 'end',
tabName: 'custom',
options: [
{
label: '上',
value: 'end'
},
{
label: '中',
value: 'center'
},
{
label: '下',
value: 'start'
}],
groupName: 'yAxis'
},
{
label: '标题字体大小',
type: 'inputNumber',
field: 'yAxis_title_style_fontSize',
optionField: 'yAxis.title.style.fontSize',
value: 12,
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '标题颜色',
type: 'colorPicker',
field: 'yAxis_title_style_fill',
optionField: 'yAxis.title.style.fill',
// 是否多选
multiple: false,
value: '#8C8C8C',
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '显示标签',
type: 'switch',
field: 'yAxis_label_style_opacity',
optionField: 'yAxis.label.style.opacity',
value: 1,
active: 1,
inactive: 0,
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '标签字体大小',
type: 'inputNumber',
field: 'yAxis_label_style_fontSize',
optionField: 'yAxis.label.style.fontSize',
value: 12,
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '标签字体颜色',
type: 'colorPicker',
field: 'yAxis_label_style_fill',
optionField: 'yAxis.label.style.fill',
// 是否多选
multiple: false,
value: '#8C8C8C',
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '轴线宽度',
type: 'inputNumber',
field: 'yAxis_line_lineWidth',
optionField: 'yAxis.line.style.lineWidth',
value: 0,
tabName: 'custom',
groupName: 'yAxis'
},
{
label: '轴线颜色',
type: 'colorPicker',
field: 'yAxis_line_stroke',
optionField: 'yAxis.line.style.stroke',
// 是否多选
multiple: false,
value: '#d0d0d0',
tabName: 'custom',
groupName: 'yAxis'
},
]
// 模拟数据
const data = [
{ time: '2019-03', value: 350, count: 800 },
{ time: '2019-04', value: 900, count: 600 },
{ time: '2019-05', value: 300, count: 400 },
{ time: '2019-06', value: 450, count: 380 },
{ time: '2019-07', value: 470, count: 220 },
]
// 图表配置 new Line('domName', option)
const option = {
// 数据将要放入到哪个字段中
dataKey: 'data',
data:[data,data],
xField: 'time',
yField: ['value', 'count'],
geometryOptions: [
{
geometry: 'column',
},
{
geometry: 'line',
lineStyle: {
lineWidth: 2,
},
},
],
isStack: true,
seriesField: 'type',
legendEnable: false,
legendItemName: {
style: {
fill: '#595959',
fontSize: 12,
fontWeight: 400
}
},
legendLayout: 'vertical',
legendPosition: 'top',
legend: false,
pattern: {
type: ''
},
color: ['#5B8FF9', '#61DDAA', '#5D7092', '#F6BD16', '#6F5EF9', '#6DC8EC', '#945FB9', '#FF9845', '#1E9493', '#FF99C3'],
label: {
// 可手动配置 label 数据标签位置
position: 'middle', // 'top', 'bottom', 'middle'
// 配置样式
style: {
fill: '#59F25F',
opacity: 0,
fontSize: 12
},
},
xAxis: {
title: {
text: '',
position: 'end',
style: {
fill: '#8C8C8C',
fontSize: 12
}
},
label: {
autoRotate: false,
autoHide: true,
autoEllipsis: true,
style: {
fill: '#8C8C8C',
fontSize: 12
}
},
line: {
style: {
stroke: '#d0d0d0',
lineWidth: 1
}
},
tickLine: {
style: {
stroke: '#d0d0d0',
lineWidth: 1
}
}
},
yAxis: {
title: {
text: '',
position: 'end',
autoRotate: false,
// rotation: Math.PI / 2,
style: {
fill: '#8C8C8C',
fontSize: 12
}
},
grid: {
line: {
style: {
stroke: '#d0d0d0',
lineWidth: 1,
lineDash: [4, 5],
strokeOpacity: 0.7
}
}
},
label: {
formatter: (v) => {
if (v < 1e3) return v
// 数值格式化为千分位
if (v >= 1e3 && v < 1e6) return `${v}`.replace(/\d{1,3}(?=(\d{3})+$)/g, (s) => `${s},`)
if (v >= 1e6 && v < 1e9) return `${(v / 1e6).toFixed(1)} M`
if (v >= 1e9 && v < 1e12) return `${(v / 1e9).toFixed(1)} B`
return `${(v / 10e8).toFixed(1)} B`
},
style: {
fill: '#8C8C8C',
fontSize: 12,
opacity: 1
}
},
line: {
style: {
stroke: '#d0d0d0',
lineWidth: 0
}
}
}
}
export default {
category,
version,
title,
chartType,
name,
option,
setting,
}

@ -180,14 +180,27 @@ export default {
console.error(e)
}
}
// g2plot
const xAxis = config.setting.find(item => item.field === 'xField')?.value
config.option.data = data?.map(item => {
if (xAxis && typeof item[xAxis] === 'number') {
item[xAxis] = (item[xAxis]).toString()
}
return item
})
if(config.chartType=='Treemap'){
console.log(data)
const xAxis = config.setting.find(item => item.field === 'xField')?.value
const listData = data.children.map(item => {
if (xAxis && typeof item[xAxis] === 'number') {
item[xAxis] = (item[xAxis]).toString()
}
return item
})
config.option.data={name:'root',children:[...listData]}
console.log(config.option.data)
}else{
// g2plot
const xAxis = config.setting.find(item => item.field === 'xField')?.value
config.option.data = data?.map(item => {
if (xAxis && typeof item[xAxis] === 'number') {
item[xAxis] = (item[xAxis]).toString()
}
return item
})
}
} else {
//
config.option.data = this.plotList?.find(plot => plot.name === config.name)?.option?.data || config?.option?.data

@ -27,8 +27,7 @@
/>
</el-select>
<el-button
size="small"
style="margin-right: 20px"
style="margin-right: 10px"
type="primary"
@click="reSearch"
>
@ -48,7 +47,6 @@
:show-file-list="false"
>
<el-button
size="small"
type="primary"
>
上传资源

Loading…
Cancel
Save