forked from github/dataease
commit
a4817900ef
@ -108,7 +108,7 @@ declare interface AssistLine {
|
|||||||
*/
|
*/
|
||||||
summary: string
|
summary: string
|
||||||
|
|
||||||
axisType: 'left' | 'right'
|
yAxisType: 'left' | 'right'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,11 +54,6 @@ const state = reactive({
|
|||||||
quotaFields: []
|
quotaFields: []
|
||||||
})
|
})
|
||||||
|
|
||||||
const axisType = [
|
|
||||||
{ type: 'left', name: t('chart.drag_block_value_axis_left') },
|
|
||||||
{ type: 'right', name: t('chart.drag_block_value_axis_right') }
|
|
||||||
]
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.chart.senior.assistLineCfg,
|
() => props.chart.senior.assistLineCfg,
|
||||||
() => {
|
() => {
|
||||||
|
@ -26,7 +26,7 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const axisTypes = [
|
const yAxisTypes = [
|
||||||
{ type: 'left', name: t('chart.drag_block_value_axis_left') },
|
{ type: 'left', name: t('chart.drag_block_value_axis_left') },
|
||||||
{ type: 'right', name: t('chart.drag_block_value_axis_right') }
|
{ type: 'right', name: t('chart.drag_block_value_axis_right') }
|
||||||
]
|
]
|
||||||
@ -39,7 +39,7 @@ const state = reactive({
|
|||||||
fieldId: '',
|
fieldId: '',
|
||||||
summary: 'avg',
|
summary: 'avg',
|
||||||
axis: 'y', // 主轴
|
axis: 'y', // 主轴
|
||||||
axisType: 'left',
|
yAxisType: 'left',
|
||||||
value: '0',
|
value: '0',
|
||||||
lineType: 'solid',
|
lineType: 'solid',
|
||||||
color: '#ff0000',
|
color: '#ff0000',
|
||||||
@ -98,8 +98,8 @@ const removeLine = index => {
|
|||||||
changeAssistLine()
|
changeAssistLine()
|
||||||
}
|
}
|
||||||
|
|
||||||
const changeAxisType = item => {
|
const changeYAxisType = item => {
|
||||||
if (props.useQuotaExt && item.axisType === 'right') {
|
if (props.useQuotaExt && item.yAxisType === 'right') {
|
||||||
item.fieldId = props.quotaExtFields ? props.quotaExtFields[0]?.id : null
|
item.fieldId = props.quotaExtFields ? props.quotaExtFields[0]?.id : null
|
||||||
item.curField = getQuotaExtField(item.fieldId)
|
item.curField = getQuotaExtField(item.fieldId)
|
||||||
} else {
|
} else {
|
||||||
@ -113,7 +113,7 @@ const changeAssistLine = () => {
|
|||||||
emit('onAssistLineChange', state.lineArr)
|
emit('onAssistLineChange', state.lineArr)
|
||||||
}
|
}
|
||||||
const changeAssistLineField = item => {
|
const changeAssistLineField = item => {
|
||||||
if (props.useQuotaExt && item.axisType === 'right') {
|
if (props.useQuotaExt && item.yAxisType === 'right') {
|
||||||
item.curField = getQuotaExtField(item.fieldId)
|
item.curField = getQuotaExtField(item.fieldId)
|
||||||
} else {
|
} else {
|
||||||
item.curField = getQuotaField(item.fieldId)
|
item.curField = getQuotaField(item.fieldId)
|
||||||
@ -169,9 +169,9 @@ onMounted(() => {
|
|||||||
/>
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-if="useQuotaExt" :span="3">
|
<el-col v-if="useQuotaExt" :span="3">
|
||||||
<el-select v-model="item.axisType" class="select-item" @change="changeAxisType(item)">
|
<el-select v-model="item.yAxisType" class="select-item" @change="changeYAxisType(item)">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="opt in axisTypes"
|
v-for="opt in yAxisTypes"
|
||||||
:key="opt.type"
|
:key="opt.type"
|
||||||
:label="opt.name"
|
:label="opt.name"
|
||||||
:value="opt.type"
|
:value="opt.type"
|
||||||
@ -206,7 +206,7 @@ onMounted(() => {
|
|||||||
@change="changeAssistLineField(item)"
|
@change="changeAssistLineField(item)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="quota in useQuotaExt && item.axisType === 'right'
|
v-for="quota in useQuotaExt && item.yAxisType === 'right'
|
||||||
? quotaExtFields
|
? quotaExtFields
|
||||||
: quotaFields"
|
: quotaFields"
|
||||||
:key="quota.id"
|
:key="quota.id"
|
||||||
|
@ -365,8 +365,8 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
|
|||||||
protected configAnalyse(chart: Chart, options: DualAxesOptions): DualAxesOptions {
|
protected configAnalyse(chart: Chart, options: DualAxesOptions): DualAxesOptions {
|
||||||
const list = getAnalyse(chart)
|
const list = getAnalyse(chart)
|
||||||
const annotations = {
|
const annotations = {
|
||||||
value: filter(list, l => l.axisType === 'left'),
|
value: filter(list, l => l.yAxisType === 'left'),
|
||||||
valueExt: filter(list, l => l.axisType === 'right')
|
valueExt: filter(list, l => l.yAxisType === 'right')
|
||||||
}
|
}
|
||||||
return { ...options, annotations }
|
return { ...options, annotations }
|
||||||
}
|
}
|
||||||
|
@ -681,10 +681,10 @@ export function getAnalyse(chart: Chart) {
|
|||||||
const content =
|
const content =
|
||||||
ele.name +
|
ele.name +
|
||||||
' : ' +
|
' : ' +
|
||||||
valueFormatter(value, ele.axisType === 'left' ? axisFormatterCfg : axisExtFormatterCfg)
|
valueFormatter(value, ele.yAxisType === 'left' ? axisFormatterCfg : axisExtFormatterCfg)
|
||||||
assistLine.push({
|
assistLine.push({
|
||||||
type: 'line',
|
type: 'line',
|
||||||
axisType: ele.axisType,
|
yAxisType: ele.yAxisType,
|
||||||
start: ['start', value],
|
start: ['start', value],
|
||||||
end: ['end', value],
|
end: ['end', value],
|
||||||
style: {
|
style: {
|
||||||
@ -694,15 +694,17 @@ export function getAnalyse(chart: Chart) {
|
|||||||
})
|
})
|
||||||
assistLine.push({
|
assistLine.push({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
axisType: ele.axisType,
|
yAxisType: ele.yAxisType,
|
||||||
position: [
|
position: [
|
||||||
(ele.axisType === 'left' ? yAxisPosition : yAxisExtPosition) === 'left' ? 'start' : 'end',
|
(ele.yAxisType === 'left' ? yAxisPosition : yAxisExtPosition) === 'left'
|
||||||
|
? 'start'
|
||||||
|
: 'end',
|
||||||
value
|
value
|
||||||
],
|
],
|
||||||
content: content,
|
content: content,
|
||||||
offsetY: -2,
|
offsetY: -2,
|
||||||
offsetX:
|
offsetX:
|
||||||
(ele.axisType === 'left' ? yAxisPosition : yAxisExtPosition) === 'left'
|
(ele.yAxisType === 'left' ? yAxisPosition : yAxisExtPosition) === 'left'
|
||||||
? 2
|
? 2
|
||||||
: -10 * (content.length - 2),
|
: -10 * (content.length - 2),
|
||||||
style: {
|
style: {
|
||||||
|
@ -15,7 +15,7 @@ public class ChartSeniorAssistDTO {
|
|||||||
private Long fieldId;
|
private Long fieldId;
|
||||||
private String summary;
|
private String summary;
|
||||||
private String axis;
|
private String axis;
|
||||||
private String axisType;
|
private String yAxisType;
|
||||||
private String value;
|
private String value;
|
||||||
private String lineType;
|
private String lineType;
|
||||||
private String color;
|
private String color;
|
||||||
|
Loading…
Reference in New Issue
Block a user