联动表问题修复
This commit is contained in:
@@ -39,10 +39,11 @@ export default {
|
|||||||
},
|
},
|
||||||
labelLine: {},
|
labelLine: {},
|
||||||
labelLayout: function (params) {
|
labelLayout: function (params) {
|
||||||
let points = params.labelLinePoints,
|
let points = params.labelLinePoints
|
||||||
isLeft = points[2][0] < points[1][0]
|
if (points) {
|
||||||
points[2][0] =
|
const isLeft = points[2][0] < points[1][0]
|
||||||
points[2][0] + (params.labelRect.width + 4) * (isLeft ? -1 : 1)
|
points[2][0] += (params.labelRect.width + 4) * (isLeft ? -1 : 1)
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
labelLinePoints: points
|
labelLinePoints: points
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export default {
|
|||||||
this.handleChangeChart()
|
this.handleChangeChart()
|
||||||
},
|
},
|
||||||
handleChangeChart() {
|
handleChangeChart() {
|
||||||
const series = Array(this.plot.dimensions.length - 1).fill(this.tpl.daemon)
|
const series = this.tpl.series || Array(this.plot.dimensions.length - 1).fill(this.tpl.daemon)
|
||||||
this.chart.setOption({
|
this.chart.setOption({
|
||||||
tooltip: {},
|
tooltip: {},
|
||||||
xAxis: {
|
xAxis: {
|
||||||
@@ -73,11 +73,20 @@ export default {
|
|||||||
},
|
},
|
||||||
getChartData() {
|
getChartData() {
|
||||||
return new DvCompData(this.plot.dataType, this.plot, this.instance).getData().then(source => {
|
return new DvCompData(this.plot.dataType, this.plot, this.instance).getData().then(source => {
|
||||||
const dataset = {
|
if (this.tpl.series?.type == 'pie') {
|
||||||
source,
|
let data
|
||||||
dimensions: this.plot.dimensions.filter(Boolean) || []
|
if (source?.length == 1) {
|
||||||
|
data = this.plot.dimensions.filter(Boolean).map(name => ({name, value: source[0][name]}))
|
||||||
|
} else {
|
||||||
|
const ds = this.plot.dimensions.filter(Boolean)
|
||||||
|
data = source.map(e => ({name: e[ds[0]], value: e[ds[1]]}))
|
||||||
}
|
}
|
||||||
|
this.chart.setOption({series: {data}})
|
||||||
|
} else {
|
||||||
|
const dataset = {source}
|
||||||
|
dataset.dimensions = this.plot.dimensions.filter(Boolean) || []
|
||||||
this.chart.setOption({dataset})
|
this.chart.setOption({dataset})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
position: relative;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
backdrop-filter: blur(1px);
|
backdrop-filter: blur(5px);
|
||||||
|
|
||||||
.right {
|
.right {
|
||||||
min-width: 90px;
|
min-width: 90px;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
</ai-dialog-btn>
|
</ai-dialog-btn>
|
||||||
</ai-fold>
|
</ai-fold>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="options.type=='plot'">
|
<template v-else-if="isPlot">
|
||||||
<ai-fold v-for="(chart,i) in options.charts" :key="i">
|
<ai-fold v-for="(chart,i) in options.charts" :key="i">
|
||||||
<div slot="title" class="flex w100">
|
<div slot="title" class="flex w100">
|
||||||
<span class="layoutTitle fill" v-text="chart.title"/>
|
<span class="layoutTitle fill" v-text="chart.title"/>
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<config-item label="图表模板">
|
<config-item label="图表模板">
|
||||||
<chart-picker v-model="chart.chart"/>
|
<chart-picker v-model="chart.chart"/>
|
||||||
</config-item>
|
</config-item>
|
||||||
<datasource-picker v-model="chart.ds" :instance="instance"
|
<datasource-picker v-model="chart.ds" :instance="instance" class="mar-b10"
|
||||||
@input="chart={...chart,...chart.ds},$emit('change',options)"/>
|
@input="chart={...chart,...chart.ds},$emit('change',options)"/>
|
||||||
<config-item label="数据维度" v-if="chart.dataType !== 'staticData'">
|
<config-item label="数据维度" v-if="chart.dataType !== 'staticData'">
|
||||||
<code-editor v-model="chart.djson" lang="json" theme="github" width="100%" height="100"
|
<code-editor v-model="chart.djson" lang="json" theme="github" width="100%" height="100"
|
||||||
@@ -165,7 +165,8 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
markers: v => v.options.staticData?.markers || [],
|
markers: v => v.options.staticData?.markers || [],
|
||||||
isTable: v => v.options.type == 'table'
|
isTable: v => v.options.type == 'table',
|
||||||
|
isPlot: v => v.options.type == 'plot'
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
DatasourcePicker,
|
DatasourcePicker,
|
||||||
@@ -182,6 +183,8 @@ export default {
|
|||||||
this.$emit("change", values)
|
this.$emit("change", values)
|
||||||
} else if (this.isTable) {
|
} else if (this.isTable) {
|
||||||
this.json = JSON.stringify(this.options.tableConfig)
|
this.json = JSON.stringify(this.options.tableConfig)
|
||||||
|
} else if (this.isPlot) {
|
||||||
|
this.options.charts = this.options.charts.map(e => ({...e, ds: e}))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|||||||
Reference in New Issue
Block a user