联动表问题修复
This commit is contained in:
@@ -39,10 +39,11 @@ export default {
|
||||
},
|
||||
labelLine: {},
|
||||
labelLayout: function (params) {
|
||||
let points = params.labelLinePoints,
|
||||
isLeft = points[2][0] < points[1][0]
|
||||
points[2][0] =
|
||||
points[2][0] + (params.labelRect.width + 4) * (isLeft ? -1 : 1)
|
||||
let points = params.labelLinePoints
|
||||
if (points) {
|
||||
const isLeft = points[2][0] < points[1][0]
|
||||
points[2][0] += (params.labelRect.width + 4) * (isLeft ? -1 : 1)
|
||||
}
|
||||
return {
|
||||
labelLinePoints: points
|
||||
}
|
||||
@@ -65,32 +66,32 @@ export default {
|
||||
return t + Number(Object.values(e)?.[1] || 0)
|
||||
}, 0)
|
||||
return h(
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
height: "162px",
|
||||
width: "162px",
|
||||
color: "#8BCCFF",
|
||||
left: "50%",
|
||||
top: "50%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexDirection: "column",
|
||||
position: "absolute",
|
||||
transform: "translate(-50%,-50%)",
|
||||
backgroundImage: `url('https://cdn.cunwuyun.cn/dvcp/dv/tpl/pie2Circle.png')`,
|
||||
backgroundPosition: "center"
|
||||
}
|
||||
},
|
||||
[
|
||||
h(
|
||||
"span",
|
||||
{style: {fontSize: "28px", color: "#fff", fontFamily: "DIN"}},
|
||||
formatNum(total)
|
||||
),
|
||||
h("span", null, "总量")
|
||||
]
|
||||
"div",
|
||||
{
|
||||
style: {
|
||||
height: "162px",
|
||||
width: "162px",
|
||||
color: "#8BCCFF",
|
||||
left: "50%",
|
||||
top: "50%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
flexDirection: "column",
|
||||
position: "absolute",
|
||||
transform: "translate(-50%,-50%)",
|
||||
backgroundImage: `url('https://cdn.cunwuyun.cn/dvcp/dv/tpl/pie2Circle.png')`,
|
||||
backgroundPosition: "center"
|
||||
}
|
||||
},
|
||||
[
|
||||
h(
|
||||
"span",
|
||||
{style: {fontSize: "28px", color: "#fff", fontFamily: "DIN"}},
|
||||
formatNum(total)
|
||||
),
|
||||
h("span", null, "总量")
|
||||
]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default {
|
||||
this.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({
|
||||
tooltip: {},
|
||||
xAxis: {
|
||||
@@ -73,11 +73,20 @@ export default {
|
||||
},
|
||||
getChartData() {
|
||||
return new DvCompData(this.plot.dataType, this.plot, this.instance).getData().then(source => {
|
||||
const dataset = {
|
||||
source,
|
||||
dimensions: this.plot.dimensions.filter(Boolean) || []
|
||||
if (this.tpl.series?.type == 'pie') {
|
||||
let data
|
||||
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;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
backdrop-filter: blur(1px);
|
||||
backdrop-filter: blur(5px);
|
||||
|
||||
.right {
|
||||
min-width: 90px;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</ai-dialog-btn>
|
||||
</ai-fold>
|
||||
</template>
|
||||
<template v-else-if="options.type=='plot'">
|
||||
<template v-else-if="isPlot">
|
||||
<ai-fold v-for="(chart,i) in options.charts" :key="i">
|
||||
<div slot="title" class="flex w100">
|
||||
<span class="layoutTitle fill" v-text="chart.title"/>
|
||||
@@ -36,7 +36,7 @@
|
||||
<config-item label="图表模板">
|
||||
<chart-picker v-model="chart.chart"/>
|
||||
</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)"/>
|
||||
<config-item label="数据维度" v-if="chart.dataType !== 'staticData'">
|
||||
<code-editor v-model="chart.djson" lang="json" theme="github" width="100%" height="100"
|
||||
@@ -165,7 +165,8 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
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: {
|
||||
DatasourcePicker,
|
||||
@@ -182,6 +183,8 @@ export default {
|
||||
this.$emit("change", values)
|
||||
} else if (this.isTable) {
|
||||
this.json = JSON.stringify(this.options.tableConfig)
|
||||
} else if (this.isPlot) {
|
||||
this.options.charts = this.options.charts.map(e => ({...e, ds: e}))
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
Reference in New Issue
Block a user