mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 22:12:11 +08:00
fix: 修复bug
This commit is contained in:
parent
796995f0d7
commit
4bb7a4ed22
@ -22,6 +22,7 @@ export const PieTypeObject = {
|
|||||||
const otherConfig = {
|
const otherConfig = {
|
||||||
// 轮播动画
|
// 轮播动画
|
||||||
isCarousel: false,
|
isCarousel: false,
|
||||||
|
legendShowValue: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
@ -32,7 +33,10 @@ const option = {
|
|||||||
trigger: 'item'
|
trigger: 'item'
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true,
|
||||||
|
formatter: (name: string) => {
|
||||||
|
return name
|
||||||
|
}
|
||||||
},
|
},
|
||||||
dataset: { ...dataJson },
|
dataset: { ...dataJson },
|
||||||
series: [
|
series: [
|
||||||
|
@ -7,6 +7,14 @@
|
|||||||
<!-- <n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />-->
|
<!-- <n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />-->
|
||||||
<!-- </SettingItem>-->
|
<!-- </SettingItem>-->
|
||||||
<!-- </SettingItemBox>-->
|
<!-- </SettingItemBox>-->
|
||||||
|
<SettingItemBox name="图例" :alone="true">
|
||||||
|
<SettingItem>
|
||||||
|
<n-space>
|
||||||
|
<n-switch v-model:value="optionData.legendShowValue" size="small"></n-switch>
|
||||||
|
<n-text>展示数值</n-text>
|
||||||
|
</n-space>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
<SettingItemBox name="动画" :alone="true">
|
<SettingItemBox name="动画" :alone="true">
|
||||||
<SettingItem>
|
<SettingItem>
|
||||||
<n-space>
|
<n-space>
|
||||||
|
@ -144,6 +144,25 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(() => props.chartConfig.option.legendShowValue, v => {
|
||||||
|
if(v) {
|
||||||
|
let k1 = props.chartConfig.option.dataset?.dimensions?.[0] || ''
|
||||||
|
let k2 = props.chartConfig.option.dataset?.dimensions?.[1] || ''
|
||||||
|
props.chartConfig.option.legend.formatter = (name: string) => {
|
||||||
|
let arr = props.chartConfig.option.dataset?.source || []
|
||||||
|
let obj = arr.find((_: any) => _[k1] === name) || {}
|
||||||
|
return `${name} ${obj[k2]}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
props.chartConfig.option.legend.formatter = (name: string) => {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
immediate: true
|
||||||
|
})
|
||||||
|
|
||||||
// const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
// const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
||||||
// clearPieInterval()
|
// clearPieInterval()
|
||||||
// if (props.chartConfig.option.isCarousel) {
|
// if (props.chartConfig.option.isCarousel) {
|
||||||
|
@ -22,6 +22,7 @@ export const PieTypeObject = {
|
|||||||
const otherConfig = {
|
const otherConfig = {
|
||||||
// 轮播动画
|
// 轮播动画
|
||||||
isCarousel: false,
|
isCarousel: false,
|
||||||
|
legendShowValue: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
@ -30,13 +31,16 @@ const option = {
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
show: true,
|
show: true,
|
||||||
trigger: 'item',
|
trigger: 'item',
|
||||||
formatter: (params: any) => {
|
// formatter: (params: any) => {
|
||||||
let str = `${params.seriesName}<br/>${params.marker}${params.name}`
|
// let str = `${params.seriesName}<br/>${params.marker}${params.name}`
|
||||||
return str
|
// return str
|
||||||
}
|
// }
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true,
|
||||||
|
formatter: (name: string) => {
|
||||||
|
return name
|
||||||
|
}
|
||||||
},
|
},
|
||||||
dataset: { ...dataJson },
|
dataset: { ...dataJson },
|
||||||
series: [
|
series: [
|
||||||
|
@ -7,6 +7,14 @@
|
|||||||
<!-- <n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />-->
|
<!-- <n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />-->
|
||||||
<!-- </SettingItem>-->
|
<!-- </SettingItem>-->
|
||||||
<!-- </SettingItemBox>-->
|
<!-- </SettingItemBox>-->
|
||||||
|
<SettingItemBox name="图例" :alone="true">
|
||||||
|
<SettingItem>
|
||||||
|
<n-space>
|
||||||
|
<n-switch v-model:value="optionData.legendShowValue" size="small"></n-switch>
|
||||||
|
<n-text>展示数值</n-text>
|
||||||
|
</n-space>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
<SettingItemBox name="动画" :alone="true">
|
<SettingItemBox name="动画" :alone="true">
|
||||||
<SettingItem>
|
<SettingItem>
|
||||||
<n-space>
|
<n-space>
|
||||||
|
@ -155,13 +155,13 @@ const { vChartRef } = useChartCommonData(props.chartConfig, useChartEditStore)
|
|||||||
watch(
|
watch(
|
||||||
() => props.chartConfig.option.dataset,
|
() => props.chartConfig.option.dataset,
|
||||||
(v) => {
|
(v) => {
|
||||||
v.source.forEach((item: {[k: string]: any}) => {
|
// v.source.forEach((item: {[k: string]: any}) => {
|
||||||
let k = v.dimensions[0]
|
// let k = v.dimensions[0]
|
||||||
let k1 = v.dimensions[1]
|
// let k1 = v.dimensions[1]
|
||||||
if(item[k].split(' ').length < 2) {
|
// if(item[k].split(' ').length < 2) {
|
||||||
item[k] += ` ${item[k1]}`
|
// item[k] += ` ${item[k1]}`
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
if(vChartRef.value) {
|
if(vChartRef.value) {
|
||||||
vChartRef.value.setOption({
|
vChartRef.value.setOption({
|
||||||
dataset: v
|
dataset: v
|
||||||
@ -172,6 +172,24 @@ watch(
|
|||||||
deep: true
|
deep: true
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
watch(() => props.chartConfig.option.legendShowValue, v => {
|
||||||
|
if(v) {
|
||||||
|
let k1 = props.chartConfig.option.dataset?.dimensions?.[0] || ''
|
||||||
|
let k2 = props.chartConfig.option.dataset?.dimensions?.[1] || ''
|
||||||
|
props.chartConfig.option.legend.formatter = (name: string) => {
|
||||||
|
let arr = props.chartConfig.option.dataset?.source || []
|
||||||
|
let obj = arr.find((_: any) => _[k1] === name) || {}
|
||||||
|
return `${name} ${obj[k2]}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
props.chartConfig.option.legend.formatter = (name: string) => {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
immediate: true
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
seriesDataMaxLength = dataJson.source.length
|
seriesDataMaxLength = dataJson.source.length
|
||||||
|
@ -24,6 +24,7 @@ export const PieTypeObject = {
|
|||||||
const otherConfig = {
|
const otherConfig = {
|
||||||
// 轮播动画
|
// 轮播动画
|
||||||
isCarousel: false,
|
isCarousel: false,
|
||||||
|
legendShowValue: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
@ -34,7 +35,10 @@ const option = {
|
|||||||
trigger: 'item'
|
trigger: 'item'
|
||||||
},
|
},
|
||||||
legend: {
|
legend: {
|
||||||
show: true
|
show: true,
|
||||||
|
formatter: (name: string) => {
|
||||||
|
return name
|
||||||
|
}
|
||||||
},
|
},
|
||||||
dataset: { ...dataJson },
|
dataset: { ...dataJson },
|
||||||
series: [
|
series: [
|
||||||
|
@ -7,6 +7,14 @@
|
|||||||
<n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />
|
<n-select v-model:value="optionData.type" size="small" :options="fontWeightOptions" />
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
|
<SettingItemBox name="图例" :alone="true">
|
||||||
|
<SettingItem>
|
||||||
|
<n-space>
|
||||||
|
<n-switch v-model:value="optionData.legendShowValue" size="small"></n-switch>
|
||||||
|
<n-text>展示数值</n-text>
|
||||||
|
</n-space>
|
||||||
|
</SettingItem>
|
||||||
|
</SettingItemBox>
|
||||||
<SettingItemBox name="动画" :alone="true">
|
<SettingItemBox name="动画" :alone="true">
|
||||||
<SettingItem>
|
<SettingItem>
|
||||||
<n-space>
|
<n-space>
|
||||||
|
@ -147,6 +147,25 @@ watch(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(() => props.chartConfig.option.legendShowValue, v => {
|
||||||
|
if(v) {
|
||||||
|
let k1 = props.chartConfig.option.dataset?.dimensions?.[0] || ''
|
||||||
|
let k2 = props.chartConfig.option.dataset?.dimensions?.[1] || ''
|
||||||
|
props.chartConfig.option.legend.formatter = (name: string) => {
|
||||||
|
let arr = props.chartConfig.option.dataset?.source || []
|
||||||
|
let obj = arr.find((_: any) => _[k1] === name) || {}
|
||||||
|
return `${name} ${obj[k2]}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
props.chartConfig.option.legend.formatter = (name: string) => {
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
immediate: true
|
||||||
|
})
|
||||||
|
|
||||||
// const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
// const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore, (newData: typeof dataJson) => {
|
||||||
// clearPieInterval()
|
// clearPieInterval()
|
||||||
// if (props.chartConfig.option.isCarousel) {
|
// if (props.chartConfig.option.isCarousel) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user