diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index e70eaaa672..c94aa72b4f 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -31,6 +31,7 @@ :track-menu="trackMenu" :search-count="searchCount" :terminal-type="scaleCoefficientType" + :scale="scale" @onChartClick="chartClick" @onJumpClick="jumpClick" /> @@ -41,6 +42,7 @@ :chart="chart" :track-menu="trackMenu" :search-count="searchCount" + :scale="scale" @onChartClick="chartClick" @onJumpClick="jumpClick" /> @@ -177,7 +179,8 @@ export default { pre: null, preCanvasPanel: null, sourceCustomAttrStr: null, - sourceCustomStyleStr: null + sourceCustomStyleStr: null, + scale: 1 } }, @@ -412,11 +415,11 @@ export default { }, // 根据仪表板的缩放比例,修改视图内部参数 mergeScale() { - const scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient + this.scale = Math.min(this.previewCanvasScale.scalePointWidth, this.previewCanvasScale.scalePointHeight) * this.scaleCoefficient const customAttrChart = JSON.parse(this.sourceCustomAttrStr) const customStyleChart = JSON.parse(this.sourceCustomStyleStr) - recursionTransObj(customAttrTrans, customAttrChart, scale, this.scaleCoefficientType) - recursionTransObj(customStyleTrans, customStyleChart, scale, this.scaleCoefficientType) + recursionTransObj(customAttrTrans, customAttrChart, this.scale, this.scaleCoefficientType) + recursionTransObj(customStyleTrans, customStyleChart, this.scale, this.scaleCoefficientType) // 移动端地图标签不显示 if (this.chart.type === 'map' && this.scaleCoefficientType === 'mobile') { diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 223869fa6b..0789e81d58 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -96,10 +96,10 @@ export function panelInit(componentData, componentStyle) { item.sizey = (item.sizey || 5) // 初始化密度为最高密度 if (componentStyle.aidedDesign.matrixBase !== 4) { - item.x = (item.x - 1) * componentStyle.aidedDesign.matrixBase + 1 - item.y = (item.y - 1) * componentStyle.aidedDesign.matrixBase + 1 - item.sizex = item.sizex * componentStyle.aidedDesign.matrixBase - item.sizey = item.sizey * componentStyle.aidedDesign.matrixBase + item.x = (item.x - 1) * 4 + 1 + item.y = (item.y - 1) * 4 + 1 + item.sizex = item.sizex * 4 + item.sizey = item.sizey * 4 } item.mobileSelected = (item.mobileSelected || false) item.mobileStyle = (item.mobileStyle || deepCopy(BASE_MOBILE_STYLE)) diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index eea7682d64..8786a854ae 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -55,7 +55,8 @@ export const DEFAULT_SIZE = { liquidOutlineDistance: 8, liquidWaveLength: 128, liquidWaveCount: 3, - liquidShape: 'circle' + liquidShape: 'circle', + tablePageMode: 'page' } export const DEFAULT_LABEL = { show: false, diff --git a/frontend/src/views/chart/chart/gauge/gauge.js b/frontend/src/views/chart/chart/gauge/gauge.js index 74922e41e5..477d155d4d 100644 --- a/frontend/src/views/chart/chart/gauge/gauge.js +++ b/frontend/src/views/chart/chart/gauge/gauge.js @@ -1,8 +1,9 @@ import { componentStyle } from '../common/common' import { hexColorToRGBA } from '@/views/chart/chart/util' import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart' +import { getScaleValue } from '@/components/canvas/utils/style' -export function baseGaugeOption(chart_option, chart) { +export function baseGaugeOption(chart_option, chart, scale = 1) { // 处理shape attr let customAttr = {} if (chart.customAttr) { @@ -50,6 +51,25 @@ export function baseGaugeOption(chart_option, chart) { value: chart.data.series[0].data[0] } chart_option.series[0].data.push(y) + + chart_option.series[0].axisTick = { + splitNumber: getScaleValue(5, scale), // 刻度间隔数 + length: getScaleValue(10, scale), // 子刻度线长度 + lineStyle: { + width: getScaleValue(2, scale) // 子刻度线宽度 + } + } + chart_option.series[0].splitLine = { + length: getScaleValue(18, scale), // 刻度线长度 + lineStyle: { + width: getScaleValue(2, scale) // 刻度线宽度 + } + } + chart_option.series[0].axisLabel = { + distance: getScaleValue(20, scale), // 刻度值文字里刻度线距离 + fontSize: getScaleValue(20, scale)// 刻度值字体大小 + } + // threshold if (chart.senior) { const range = [] @@ -87,29 +107,30 @@ export function baseGaugeOption(chart_option, chart) { show: false } chart_option.series[0].axisTick = { - splitNumber: 5, // TODO 刻度间隔数 - length: 10, // TODO 子刻度线长度 + splitNumber: getScaleValue(5, scale), // 刻度间隔数 + length: getScaleValue(10, scale), // 子刻度线长度 lineStyle: { color: 'auto', - width: 2// TODO 子刻度线宽度 + width: getScaleValue(2, scale) // 子刻度线宽度 } } chart_option.series[0].splitLine = { - length: 18, // TODO 刻度线长度 + length: getScaleValue(18, scale), // 刻度线长度 lineStyle: { color: 'auto', - width: 2// TODO 刻度线宽度 + width: getScaleValue(2, scale) // 刻度线宽度 } } chart_option.series[0].axisLabel = { color: 'auto', - distance: 20, // TODO 刻度值文字里刻度线距离 - fontSize: 20// TODO 刻度值字体大小 + distance: getScaleValue(20, scale), // 刻度值文字里刻度线距离 + fontSize: getScaleValue(20, scale)// 刻度值字体大小 } } } } } + console.log(chart_option.series[0]) // console.log(chart_option); componentStyle(chart_option, chart) return chart_option diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index c492061a2a..d444678c36 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -1,8 +1,9 @@ import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv' import { Gauge } from '@antv/g2plot' import { DEFAULT_SIZE, DEFAULT_THRESHOLD } from '@/views/chart/chart/chart' +import { getScaleValue } from '@/components/canvas/utils/style' -export function baseGaugeOptionAntV(plot, container, chart, action) { +export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) { let max, labelContent, startAngel, endAngel // theme const theme = getTheme(chart) @@ -76,20 +77,20 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { axis: { label: { style: { - fontSize: 14// TODO 刻度值字体大小 + fontSize: getScaleValue(14, scale) // 刻度值字体大小 } }, tickLine: { - length: -12, // TODO 刻度线长度 + length: getScaleValue(12, scale) * -1, // 刻度线长度 style: { - lineWidth: 1// TODO 刻度线宽度 + lineWidth: getScaleValue(1, scale)// 刻度线宽度 } }, subTickLine: { - count: 4, // TODO 子刻度数 - length: -6, // TODO 子刻度线长度 + count: 4, // 子刻度数 + length: getScaleValue(6, scale) * -1, // 子刻度线长度 style: { - lineWidth: 1// TODO 子刻度线宽度 + lineWidth: getScaleValue(1, scale)// 子刻度线宽度 } } } @@ -113,11 +114,21 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { }, pin: { style: { - stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length] + stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length], + r: getScaleValue(10, scale) + } + } + } + } else { + options.indicator = { + pin: { + style: { + r: getScaleValue(10, scale) } } } } + console.log(options.indicator.pin) // 开始渲染 if (plot) { diff --git a/frontend/src/views/chart/components/ChartComponent.vue b/frontend/src/views/chart/components/ChartComponent.vue index b60db2e98b..335798fc3f 100644 --- a/frontend/src/views/chart/components/ChartComponent.vue +++ b/frontend/src/views/chart/components/ChartComponent.vue @@ -115,6 +115,11 @@ export default { terminalType: { type: String, default: 'pc' + }, + scale: { + type: Number, + required: false, + default: 1 } }, data() { @@ -210,7 +215,7 @@ export default { } else if (chart.type === 'radar') { chart_option = baseRadarOption(JSON.parse(JSON.stringify(BASE_RADAR)), chart) } else if (chart.type === 'gauge') { - chart_option = baseGaugeOption(JSON.parse(JSON.stringify(BASE_GAUGE)), chart) + chart_option = baseGaugeOption(JSON.parse(JSON.stringify(BASE_GAUGE)), chart, this.scale) } else if (chart.type === 'scatter') { chart_option = baseScatterOption(JSON.parse(JSON.stringify(BASE_SCATTER)), chart, this.terminalType) } else if (chart.type === 'treemap') { diff --git a/frontend/src/views/chart/components/ChartComponentG2.vue b/frontend/src/views/chart/components/ChartComponentG2.vue index 66c9437c86..d4a1d07092 100644 --- a/frontend/src/views/chart/components/ChartComponentG2.vue +++ b/frontend/src/views/chart/components/ChartComponentG2.vue @@ -50,6 +50,11 @@ export default { type: Number, required: false, default: 0 + }, + scale: { + type: Number, + required: false, + default: 1 } }, data() { @@ -153,7 +158,7 @@ export default { } else if (chart.type === 'radar') { this.myChart = baseRadarOptionAntV(this.myChart, this.chartId, chart, this.antVAction) } else if (chart.type === 'gauge') { - this.myChart = baseGaugeOptionAntV(this.myChart, this.chartId, chart, this.antVAction) + this.myChart = baseGaugeOptionAntV(this.myChart, this.chartId, chart, this.antVAction, this.scale) } else if (chart.type === 'pie') { this.myChart = basePieOptionAntV(this.myChart, this.chartId, chart, this.antVAction) } else if (chart.type === 'pie-rose') { diff --git a/frontend/src/views/chart/components/ChartComponentS2.vue b/frontend/src/views/chart/components/ChartComponentS2.vue index 2ff39b4179..47b07eb64a 100644 --- a/frontend/src/views/chart/components/ChartComponentS2.vue +++ b/frontend/src/views/chart/components/ChartComponentS2.vue @@ -6,9 +6,9 @@