diff --git a/core/frontend/src/store/index.js b/core/frontend/src/store/index.js index bc3cc351e0..89156f462a 100644 --- a/core/frontend/src/store/index.js +++ b/core/frontend/src/store/index.js @@ -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 => { diff --git a/core/frontend/src/views/chart/chart/common/common.js b/core/frontend/src/views/chart/chart/common/common.js index cf72c62397..f56cbca3fd 100644 --- a/core/frontend/src/views/chart/chart/common/common.js +++ b/core/frontend/src/views/chart/chart/common/common.js @@ -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 - } - }) + }) + } } }) } diff --git a/core/frontend/src/views/chart/chart/common/common_antv.js b/core/frontend/src/views/chart/chart/common/common_antv.js index b112f96a25..1ff5ca4c05 100644 --- a/core/frontend/src/views/chart/chart/common/common_antv.js +++ b/core/frontend/src/views/chart/chart/common/common_antv.js @@ -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 - } - }) } }) } diff --git a/core/frontend/src/views/mobile/index.vue b/core/frontend/src/views/mobile/index.vue index b50d543e94..547a9a6847 100644 --- a/core/frontend/src/views/mobile/index.vue +++ b/core/frontend/src/views/mobile/index.vue @@ -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