多彩柱状完成
This commit is contained in:
@@ -258,6 +258,43 @@ export const barChart9 = {
|
|||||||
backgroundStyle: {color: 'rgba(123, 165, 255, .2)'}
|
backgroundStyle: {color: 'rgba(123, 165, 255, .2)'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export const barChart10 = {
|
||||||
|
yAxis: {
|
||||||
|
nameGap: 23,
|
||||||
|
minInterval: 1,
|
||||||
|
splitLine: {lineStyle: {color: 'rgba(255,255,255,.2)', type: 'dashed'}},
|
||||||
|
axisLabel: {color: '#C3C4C4'},
|
||||||
|
axisPointer: {show: false}
|
||||||
|
},
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow',
|
||||||
|
triggerTooltip: false,
|
||||||
|
shadowStyle: {color: 'rgba(46, 153, 255, .2)'}
|
||||||
|
},
|
||||||
|
daemon: {
|
||||||
|
type: 'bar',
|
||||||
|
barWidth: 20,
|
||||||
|
barCategoryGap: 40,
|
||||||
|
itemStyle: {
|
||||||
|
borderRadius: 20,
|
||||||
|
color(params) {
|
||||||
|
console.log(params)
|
||||||
|
const color = ['#DBB36E', '#2C97E8', '#00EFFF', '#BFEAFF'][params.dataIndex]
|
||||||
|
return {
|
||||||
|
type: 'linear',
|
||||||
|
x: 0,
|
||||||
|
x2: 0,
|
||||||
|
y: 0,
|
||||||
|
y2: 1,
|
||||||
|
colorStops: [
|
||||||
|
{offset: 0, color},
|
||||||
|
{offset: 1, color: tools.$colorUtils.Hex2RGBA(color, .1)}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
barChart1,
|
barChart1,
|
||||||
@@ -267,4 +304,5 @@ export default {
|
|||||||
barChart7,
|
barChart7,
|
||||||
barChart8,
|
barChart8,
|
||||||
barChart9,
|
barChart9,
|
||||||
|
barChart10
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
|
color: white;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 6px 14px;
|
padding: 6px 14px;
|
||||||
font-family: DIN;
|
font-family: DIN;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<ai-dialog-btn :modal="false" dialog-title="选择图表模板" :customFooter="false"
|
<ai-dialog-btn :modal="false" dialog-title="选择图表模板" :customFooter="false"
|
||||||
@confirm="handleConfirm" @open="handleOpenDialog">
|
@confirm="handleConfirm" @open="handleOpenDialog">
|
||||||
<template #btn>
|
<template #btn>
|
||||||
<img class="pointer" v-if="current.thumb" :src="current.thumb"/>
|
<img class="pointer thumb" v-if="current.thumb" :src="current.thumb"/>
|
||||||
<el-button v-else type="text">选择图表</el-button>
|
<el-button v-else type="text">选择图表</el-button>
|
||||||
</template>
|
</template>
|
||||||
<div class="charts">
|
<div class="charts">
|
||||||
@@ -62,6 +62,11 @@ export default {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thumb {
|
||||||
|
width: 200px;
|
||||||
|
height: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
.charts {
|
.charts {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
||||||
@@ -74,6 +79,7 @@ export default {
|
|||||||
|
|
||||||
& > img {
|
& > img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 90px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.selected, &:hover {
|
&.selected, &:hover {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</config-item>
|
</config-item>
|
||||||
<template v-if="/Chart/.test(config.type)">
|
<template v-if="/Chart/.test(config.type)">
|
||||||
<config-item label="图表模板">
|
<config-item label="图表模板">
|
||||||
<chart-picker v-model="config.config" @input="v=>config.echartOps=$copy($echartTpls[v])"/>
|
<chart-picker v-model="config.config" @input="v=>config.echartOps=$echartTpls[v]"/>
|
||||||
</config-item>
|
</config-item>
|
||||||
<config-item label="图表配置项" top-label>
|
<config-item label="图表配置项" top-label>
|
||||||
<json-editor v-model="config.echartOps"/>
|
<json-editor v-model="config.echartOps"/>
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
<config-item label="表格行数" v-if="config.type !== 'AiDvTable'">
|
<config-item label="表格行数" v-if="config.type !== 'AiDvTable'">
|
||||||
<el-input-number size="mini" style="width: 232px" :min="0" v-model="config.rowNum" controls-position="right"/>
|
<el-input-number size="mini" style="width: 232px" :min="0" v-model="config.rowNum" controls-position="right"/>
|
||||||
</config-item>
|
</config-item>
|
||||||
<config-item v-if="config.type === 'AiDvTable'" v-for="(item, i) in config.config" :label="`第${i+1}列`">
|
<config-item v-if="config.type === 'AiDvTable'" v-for="(item, i) in config.config" :key="i" :label="`第${i+1}列`">
|
||||||
<el-select size="mini" style="width: 80px;" v-model="item.align" placeholder="请选择" clearable>
|
<el-select size="mini" style="width: 80px;" v-model="item.align" placeholder="请选择" clearable>
|
||||||
<el-option label="居中" value="center"></el-option>
|
<el-option label="居中" value="center"></el-option>
|
||||||
<el-option label="居左" value="left"></el-option>
|
<el-option label="居左" value="left"></el-option>
|
||||||
|
|||||||
@@ -163,7 +163,19 @@ export const chartTpl = [{
|
|||||||
staticData: [{name: '阿斯达', v1: 23}, {name: '水电费', v1: 12}, {name: '凡哥', v1: 67}, {name: '党费', v1: 98}],
|
staticData: [{name: '阿斯达', v1: 23}, {name: '水电费', v1: 12}, {name: '凡哥', v1: 67}, {name: '党费', v1: 98}],
|
||||||
config: 'barChart9',
|
config: 'barChart9',
|
||||||
dynamicData: []
|
dynamicData: []
|
||||||
}]
|
}, {
|
||||||
|
type: 'barChart10',
|
||||||
|
label: '柱状图8',
|
||||||
|
title: '柱状图8',
|
||||||
|
border: 'border13',
|
||||||
|
width: 500,
|
||||||
|
thumb: 'https://cdn.cunwuyun.cn/dvcp/dv/tpl/bar10.png',
|
||||||
|
height: 300,
|
||||||
|
dataType: 'staticData',
|
||||||
|
staticData: [{name: '阿斯达', v1: 23}, {name: '水电费', v1: 12}, {name: '凡哥', v1: 67}, {name: '党费', v1: 98}],
|
||||||
|
config: 'barChart10'
|
||||||
|
},
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
label: '折线图', type: 'line', list: [{
|
label: '折线图', type: 'line', list: [{
|
||||||
code: 'widget-linechart',
|
code: 'widget-linechart',
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export default {
|
|||||||
return ['#FFBA44', '#EC6666', '#FF3E18', '#C9FF82', '#29D7FA', '#ea7ccc']
|
return ['#FFBA44', '#EC6666', '#FF3E18', '#C9FF82', '#29D7FA', '#ea7ccc']
|
||||||
},
|
},
|
||||||
chartOptions() {
|
chartOptions() {
|
||||||
|
const {daemon} = this.$echartTpls[this.tpl]
|
||||||
let {type, data, ops: options = {}} = this,
|
let {type, data, ops: options = {}} = this,
|
||||||
style = this.series ? this.series : this.ops.daemon ? this.ops.daemon : {},
|
style = this.series ? this.series : this.ops.daemon ? this.ops.daemon : {},
|
||||||
colors = this.theme === '1' ? this.colors : (options.color || this.colors),
|
colors = this.theme === '1' ? this.colors : (options.color || this.colors),
|
||||||
@@ -98,7 +99,7 @@ export default {
|
|||||||
top: '26px',
|
top: '26px',
|
||||||
containLabel: true
|
containLabel: true
|
||||||
},
|
},
|
||||||
legend, series, ...options,
|
legend, series: {...daemon, ...series}, ...options,
|
||||||
color: colors
|
color: colors
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user