|
|
@@ -4,6 +4,7 @@ import * as echarts from 'echarts'
|
|
|
import { useThemeStore } from '@/stores/modules/theme'
|
|
|
import { onMounted, ref, reactive, watch, computed } from 'vue'
|
|
|
import { formatNumber } from '@/utils/tools'
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
PieData: Object
|
|
|
})
|
|
|
@@ -46,6 +47,25 @@ const downloadName = computed(() => {
|
|
|
})
|
|
|
|
|
|
const initOption: any = reactive({
|
|
|
+ graphic: {
|
|
|
+ elements: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ right: '16',
|
|
|
+ bottom: '16',
|
|
|
+ style: {
|
|
|
+ text: 'Total: $12,500',
|
|
|
+ fontSize: 14,
|
|
|
+ fill: '#666'
|
|
|
+ },
|
|
|
+ // 直接设置 onclick 回调
|
|
|
+ onclick: function () {
|
|
|
+ alert('Total clicked!')
|
|
|
+ // 或者执行其他逻辑
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
//标题
|
|
|
title: {
|
|
|
text: pie_title.value || '', //主标题
|
|
|
@@ -90,6 +110,8 @@ const initOption: any = reactive({
|
|
|
}
|
|
|
},
|
|
|
toolbox: {
|
|
|
+ top: 6,
|
|
|
+ right: 8,
|
|
|
iconStyle: {
|
|
|
borderColor: '#2B2F36'
|
|
|
},
|
|
|
@@ -98,10 +120,10 @@ const initOption: any = reactive({
|
|
|
borderColor: '#ff7500'
|
|
|
} // hover上去时的颜色
|
|
|
},
|
|
|
- show: false, // 显示工具箱
|
|
|
+ show: true, // 显示工具箱
|
|
|
feature: {
|
|
|
- restore: { show: true },
|
|
|
- saveAsImage: { show: true, name: downloadName.value }
|
|
|
+ // restore: { show: true },
|
|
|
+ saveAsImage: { show: true, name: downloadName.value, type: 'png', backgroundColor: '#fff' }
|
|
|
},
|
|
|
showTitle: false
|
|
|
},
|
|
|
@@ -180,12 +202,16 @@ onMounted(() => {
|
|
|
initOption.series.label.rich.time.color = 'rgba(240,241,243,0.7)'
|
|
|
initOption.series.label.rich.name.color = 'rgba(240,241,243,0.7)'
|
|
|
initOption.legend.textStyle.color = 'rgba(240,241,243,0.7)'
|
|
|
+ initOption.toolbox.iconStyle.borderColor = '#f0f1f3'
|
|
|
+ initOption.toolbox.feature.saveAsImage.backgroundColor = '#2B2F36'
|
|
|
initChart()
|
|
|
} else {
|
|
|
initOption.title.textStyle.color = '#2B2F36'
|
|
|
initOption.series.label.rich.time.color = '#999'
|
|
|
initOption.series.label.rich.name.color = '#646A73'
|
|
|
initOption.legend.textStyle.color = '#646A73'
|
|
|
+ initOption.toolbox.iconStyle.borderColor = '#2B2F36'
|
|
|
+ initOption.toolbox.feature.saveAsImage.backgroundColor = '#fff'
|
|
|
initChart()
|
|
|
}
|
|
|
},
|