Merge pull request #7454 from dataease/pr@dev@fix_template
fix: 修复部分有告警线模版复用视图无法显示问题
This commit is contained in:
commit
310be1771d
@ -282,7 +282,7 @@ const data = {
|
||||
state.componentData.push(component)
|
||||
state.currentCanvasNewId.push(component.id)
|
||||
}
|
||||
this.commit('setCurComponent', { component: component, index: index || state.componentData.length - 1 })
|
||||
this.commit('setCurComponent', { component: component, index: index === undefined ? state.componentData.length - 1 : index })
|
||||
},
|
||||
removeViewFilter(state, componentId) {
|
||||
state.componentData = state.componentData.map(item => {
|
||||
|
||||
@ -340,50 +340,52 @@ export function seniorCfg(chart_option, chart) {
|
||||
const lines = fixedLines.concat(dynamicLines)
|
||||
|
||||
lines.forEach(ele => {
|
||||
if (chart.type.includes('horizontal')) {
|
||||
chart_option.series[0].markLine.data.push({
|
||||
symbol: 'none',
|
||||
xAxis: parseFloat(ele.value),
|
||||
name: ele.name,
|
||||
lineStyle: {
|
||||
color: ele.color,
|
||||
type: ele.lineType
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
color: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10,
|
||||
position: xAxis.position === 'bottom' ? 'insideStartTop' : 'insideEndTop',
|
||||
formatter: function(param) {
|
||||
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
|
||||
if (ele) {
|
||||
if (chart.type.includes('horizontal')) {
|
||||
chart_option.series[0].markLine.data.push({
|
||||
symbol: 'none',
|
||||
xAxis: parseFloat(ele.value),
|
||||
name: ele.name,
|
||||
lineStyle: {
|
||||
color: ele.color,
|
||||
type: ele.lineType
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
color: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10,
|
||||
position: xAxis.position === 'bottom' ? 'insideStartTop' : 'insideEndTop',
|
||||
formatter: function(param) {
|
||||
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: false
|
||||
}
|
||||
})
|
||||
} else {
|
||||
chart_option.series[0].markLine.data.push({
|
||||
symbol: 'none',
|
||||
yAxis: parseFloat(ele.value),
|
||||
name: ele.name,
|
||||
lineStyle: {
|
||||
color: ele.color,
|
||||
type: ele.lineType
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
color: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10,
|
||||
position: yAxis.position === 'left' ? 'insideStartTop' : 'insideEndTop',
|
||||
formatter: function(param) {
|
||||
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
|
||||
})
|
||||
} else {
|
||||
chart_option.series[0].markLine.data.push({
|
||||
symbol: 'none',
|
||||
yAxis: parseFloat(ele.value),
|
||||
name: ele.name,
|
||||
lineStyle: {
|
||||
color: ele.color,
|
||||
type: ele.lineType
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
color: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10,
|
||||
position: yAxis.position === 'left' ? 'insideStartTop' : 'insideEndTop',
|
||||
formatter: function(param) {
|
||||
return ele.name + ' : ' + valueFormatter(param.value, axisFormatterCfg)
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
show: false
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -1068,44 +1068,46 @@ export function getAnalyse(chart) {
|
||||
const lines = fixedLines.concat(dynamicLines)
|
||||
|
||||
lines.forEach(ele => {
|
||||
const value = parseFloat(ele.value)
|
||||
const content = ele.name + ' : ' + valueFormatter(value, axisFormatterCfg)
|
||||
assistLine.push({
|
||||
type: 'line',
|
||||
start: ['start', value],
|
||||
end: ['end', value],
|
||||
style: {
|
||||
stroke: ele.color,
|
||||
lineDash: getLineDash(ele.lineType)
|
||||
if (ele) {
|
||||
const value = parseFloat(ele.value)
|
||||
const content = ele.name + ' : ' + valueFormatter(value, axisFormatterCfg)
|
||||
assistLine.push({
|
||||
type: 'line',
|
||||
start: ['start', value],
|
||||
end: ['end', value],
|
||||
style: {
|
||||
stroke: ele.color,
|
||||
lineDash: getLineDash(ele.lineType)
|
||||
}
|
||||
})
|
||||
if (!chart.type.includes('horizontal')) {
|
||||
assistLine.push({
|
||||
type: 'text',
|
||||
position: [yAxisPosition === 'left' ? 'start' : 'end', value],
|
||||
content: content,
|
||||
offsetY: -2,
|
||||
offsetX: yAxisPosition === 'left' ? 2 : -10 * (content.length - 2),
|
||||
style: {
|
||||
textBaseline: 'bottom',
|
||||
fill: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10
|
||||
}
|
||||
})
|
||||
} else {
|
||||
assistLine.push({
|
||||
type: 'text',
|
||||
position: [xAxisPosition === 'left' ? 'start' : 'end', value],
|
||||
content: content,
|
||||
offsetY: xAxisPosition === 'left' ? -2 : -10 * (content.length - 2),
|
||||
offsetX: 2,
|
||||
rotate: Math.PI / 2,
|
||||
style: {
|
||||
textBaseline: 'bottom',
|
||||
fill: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
if (!chart.type.includes('horizontal')) {
|
||||
assistLine.push({
|
||||
type: 'text',
|
||||
position: [yAxisPosition === 'left' ? 'start' : 'end', value],
|
||||
content: content,
|
||||
offsetY: -2,
|
||||
offsetX: yAxisPosition === 'left' ? 2 : -10 * (content.length - 2),
|
||||
style: {
|
||||
textBaseline: 'bottom',
|
||||
fill: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10
|
||||
}
|
||||
})
|
||||
} else {
|
||||
assistLine.push({
|
||||
type: 'text',
|
||||
position: [xAxisPosition === 'left' ? 'start' : 'end', value],
|
||||
content: content,
|
||||
offsetY: xAxisPosition === 'left' ? -2 : -10 * (content.length - 2),
|
||||
offsetX: 2,
|
||||
rotate: Math.PI / 2,
|
||||
style: {
|
||||
textBaseline: 'bottom',
|
||||
fill: ele.color,
|
||||
fontSize: ele.fontSize ? parseInt(ele.fontSize) : 10
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import {
|
||||
} from '@/components/canvas/utils/utils'
|
||||
import { mapState } from 'vuex'
|
||||
import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||
import store from "@/store";
|
||||
export default {
|
||||
components: { DeCanvas, CanvasOptBar },
|
||||
data() {
|
||||
@ -35,7 +36,7 @@ export default {
|
||||
computed: {
|
||||
...mapState(['canvasStyleData', 'mobileLayoutStatus', 'componentData']),
|
||||
mainCanvasComponentData() {
|
||||
return getNowCanvasComponentData(this.canvasId)
|
||||
return this.componentData.filter(item => item.canvasId === 'canvas-main')
|
||||
},
|
||||
mobileCanvasStyle() {
|
||||
let style
|
||||
|
||||
Loading…
Reference in New Issue
Block a user