Merge pull request #4317 from dataease/pr@dev@feat_assist

feat(视图): 辅助线支持字体大小设置
This commit is contained in:
Junjun 2023-01-09 13:08:21 +08:00 committed by GitHub
commit 525523743c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 11 deletions

View File

@ -352,7 +352,7 @@ export function seniorCfg(chart_option, chart) {
label: { label: {
show: true, show: true,
color: ele.color, color: ele.color,
fontSize: 10, fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10,
position: xAxis.position === 'bottom' ? 'insideStartTop' : 'insideEndTop', position: xAxis.position === 'bottom' ? 'insideStartTop' : 'insideEndTop',
formatter: function(param) { formatter: function(param) {
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg) return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
@ -374,7 +374,7 @@ export function seniorCfg(chart_option, chart) {
label: { label: {
show: true, show: true,
color: ele.color, color: ele.color,
fontSize: 10, fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10,
position: yAxis.position === 'left' ? 'insideStartTop' : 'insideEndTop', position: yAxis.position === 'left' ? 'insideStartTop' : 'insideEndTop',
formatter: function(param) { formatter: function(param) {
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg) return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)

View File

@ -850,7 +850,7 @@ export function getAnalyse(chart) {
style: { style: {
textBaseline: 'bottom', textBaseline: 'bottom',
fill: ele.color, fill: ele.color,
fontSize: 10 fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10
} }
}) })
} else { } else {
@ -864,7 +864,7 @@ export function getAnalyse(chart) {
style: { style: {
textBaseline: 'bottom', textBaseline: 'bottom',
fill: ele.color, fill: ele.color,
fontSize: 10 fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10
} }
}) })
} }

View File

@ -121,6 +121,11 @@ export default {
senior = JSON.parse(chart.senior) senior = JSON.parse(chart.senior)
} }
if (senior.assistLine) { if (senior.assistLine) {
for (let i = 0; i < senior.assistLine.length; i++) {
if (!senior.assistLine[i].fontSize) {
senior.assistLine[i].fontSize = '10'
}
}
this.assistLine = senior.assistLine this.assistLine = senior.assistLine
} else { } else {
this.assistLine = [] this.assistLine = []

View File

@ -41,7 +41,7 @@
</el-col> </el-col>
<el-col <el-col
v-if="item.field === '0'" v-if="item.field === '0'"
:span="8" :span="6"
> >
<el-input <el-input
v-model="item.value" v-model="item.value"
@ -54,7 +54,7 @@
</el-col> </el-col>
<el-col <el-col
v-if="item.field === '1'" v-if="item.field === '1'"
:span="8" :span="6"
> >
<el-select <el-select
v-model="item.fieldId" v-model="item.fieldId"
@ -119,7 +119,24 @@
/> />
</el-select> </el-select>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="3">
<el-select
v-model="item.fontSize"
size="mini"
class="select-item"
style="margin-left: 10px;"
:placeholder="$t('chart.text_fontsize')"
@change="changeAssistLine"
>
<el-option
v-for="option in fontSize"
:key="option.value"
:label="option.name"
:value="option.value"
/>
</el-select>
</el-col>
<el-col :span="3">
<el-select <el-select
v-model="item.lineType" v-model="item.lineType"
size="mini" size="mini"
@ -135,7 +152,7 @@
</el-select> </el-select>
</el-col> </el-col>
<el-col <el-col
:span="2" :span="1"
style="text-align: center;" style="text-align: center;"
> >
<el-color-picker <el-color-picker
@ -145,7 +162,7 @@
@change="changeAssistLine" @change="changeAssistLine"
/> />
</el-col> </el-col>
<el-col :span="2"> <el-col :span="1">
<el-button <el-button
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@ -186,7 +203,8 @@ export default {
value: '0', value: '0',
lineType: 'solid', lineType: 'solid',
color: '#ff0000', color: '#ff0000',
curField: {} curField: {},
fontSize: '10'
}, },
fieldOptions: [ fieldOptions: [
{ label: this.$t('chart.field_fixed'), value: '0' }, { label: this.$t('chart.field_fixed'), value: '0' },
@ -198,7 +216,8 @@ export default {
{ label: this.$t('chart.line_type_dotted'), value: 'dotted' } { label: this.$t('chart.line_type_dotted'), value: 'dotted' }
], ],
predefineColors: COLOR_PANEL, predefineColors: COLOR_PANEL,
quotaData: [] quotaData: [],
fontSize: []
} }
}, },
watch: { watch: {
@ -216,6 +235,15 @@ export default {
}, },
init() { init() {
this.lineArr = JSON.parse(JSON.stringify(this.line)) this.lineArr = JSON.parse(JSON.stringify(this.line))
const arr = []
for (let i = 10; i <= 60; i = i + 2) {
arr.push({
name: i + '',
value: i + ''
})
}
this.fontSize = arr
}, },
addLine() { addLine() {
const obj = { ...this.lineObj, const obj = { ...this.lineObj,