mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-16 07:16:32 +08:00
pie_circle:修改配置界面显式问题
This commit is contained in:
parent
af7a048da6
commit
e1aa82288d
@ -11,9 +11,9 @@ const option = {
|
|||||||
legend: {
|
legend: {
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
dataset: 45,
|
dataset: 0.25,
|
||||||
title: {
|
title: {
|
||||||
text: 0 + "%",
|
text: 25 + "%",
|
||||||
x: "center",
|
x: "center",
|
||||||
y: "center",
|
y: "center",
|
||||||
textStyle: {
|
textStyle: {
|
||||||
@ -45,7 +45,7 @@ const option = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 75,
|
value: [75],
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
color: "#00bcd44a",
|
color: "#00bcd44a",
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<!-- 遍历 seriesList -->
|
<!-- 遍历 seriesList -->
|
||||||
<CollapseItem v-for="(item, index) in seriesList" :key="index" :name="`圆环-${index + 1}`" :expanded="true">
|
<CollapseItem v-for="(item, index) in config.series" :key="index" :name="`圆环-${index + 1}`" :expanded="true">
|
||||||
<SettingItemBox name="数据">
|
<SettingItemBox name="数据">
|
||||||
<SettingItem name="数值">
|
<SettingItem name="数值">
|
||||||
<n-input-number v-model:value="item.data[0].value" :min="0" :step="0.01" size="small" placeholder="数值">
|
<n-input-number v-model:value="config.dataset" :min="0" :max="1" :step="0.01" size="small" placeholder="数值">
|
||||||
</n-input-number>
|
</n-input-number>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
<!-- Echarts 全局设置 -->
|
<!-- Echarts 全局设置 -->
|
||||||
<SettingItemBox name="样式">
|
<SettingItemBox name="进度条样式">
|
||||||
<SettingItem name="颜色">
|
<SettingItem name="颜色">
|
||||||
<n-color-picker
|
<n-color-picker
|
||||||
size="small"
|
size="small"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
></n-color-picker>
|
></n-color-picker>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
<SettingItem name="阴影模糊等级">
|
<SettingItem name="阴影模糊等级">
|
||||||
<n-input-number v-model:value="item.data[0].itemStyle.normal.shadowBlur" :min="0" :step="1" size="small" placeholder="阴影模糊等级">
|
<n-input-number v-model:value="item.data[0].itemStyle.normal.shadowBlur" :min="0" :max="50" :step="1" size="small" placeholder="阴影模糊等级">
|
||||||
</n-input-number>
|
</n-input-number>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
<SettingItem name="阴影颜色">
|
<SettingItem name="阴影颜色">
|
||||||
@ -34,16 +34,16 @@
|
|||||||
<n-color-picker
|
<n-color-picker
|
||||||
size="small"
|
size="small"
|
||||||
:modes="['hex']"
|
:modes="['hex']"
|
||||||
v-model:value="title.textStyle.color"
|
v-model:value="config.title.textStyle.color"
|
||||||
></n-color-picker>
|
></n-color-picker>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
<SettingItem name="字体大小">
|
<SettingItem name="字体大小">
|
||||||
<n-input-number v-model:value="title.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="字体大小">
|
<n-input-number v-model:value="config.title.textStyle.fontSize" :min="0" :step="1" size="small" placeholder="字体大小">
|
||||||
</n-input-number>
|
</n-input-number>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
<!-- 其他样式 -->
|
<!-- 其他样式 -->
|
||||||
<SettingItemBox name="其它样式">
|
<SettingItemBox name="轨道样式">
|
||||||
<SettingItem name="颜色">
|
<SettingItem name="颜色">
|
||||||
<n-color-picker
|
<n-color-picker
|
||||||
size="small"
|
size="small"
|
||||||
@ -63,8 +63,6 @@
|
|||||||
></n-color-picker>
|
></n-color-picker>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
</SettingItemBox>
|
</SettingItemBox>
|
||||||
<!-- Echarts 全局设置 -->
|
|
||||||
<global-setting :optionData="optionData" :in-chart="true"></global-setting>
|
|
||||||
</CollapseItem>
|
</CollapseItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -72,7 +70,6 @@
|
|||||||
import { PropType, computed } from 'vue'
|
import { PropType, computed } from 'vue'
|
||||||
// 以下是封装的设置模块布局组件,具体效果可在官网查看
|
// 以下是封装的设置模块布局组件,具体效果可在官网查看
|
||||||
import {
|
import {
|
||||||
GlobalSetting,
|
|
||||||
CollapseItem,
|
CollapseItem,
|
||||||
SettingItemBox,
|
SettingItemBox,
|
||||||
SettingItem
|
SettingItem
|
||||||
@ -83,18 +80,10 @@ const props = defineProps({
|
|||||||
optionData: {
|
optionData: {
|
||||||
type: Object as PropType<GlobalThemeJsonType>,
|
type: Object as PropType<GlobalThemeJsonType>,
|
||||||
required: true
|
required: true
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: Object as PropType<GlobalThemeJsonType>,
|
|
||||||
required: true
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const seriesList = computed(() => {
|
const config = computed(() => {
|
||||||
return props.optionData.series
|
return props.optionData
|
||||||
})
|
|
||||||
|
|
||||||
const title = computed(() => {
|
|
||||||
return props.optionData.title
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-chart ref="vChartRef" :theme="themeColor" :option="option" :manual-update="isPreview()" autoresize></v-chart>
|
<v-chart ref="vChartRef" :theme="themeColor" :option="option.value" :manual-update="isPreview()" autoresize></v-chart>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, PropType, watch } from 'vue'
|
import {computed, PropType, reactive, watch} from 'vue'
|
||||||
import VChart from 'vue-echarts'
|
import VChart from 'vue-echarts'
|
||||||
import { use } from 'echarts/core'
|
import { use } from 'echarts/core'
|
||||||
import { CanvasRenderer } from 'echarts/renderers'
|
import { CanvasRenderer } from 'echarts/renderers'
|
||||||
@ -46,18 +46,26 @@ use([
|
|||||||
TitleComponent
|
TitleComponent
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const option = reactive({
|
||||||
|
value: {}
|
||||||
|
})
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.chartConfig.option.dataset,
|
() => props.chartConfig.option.dataset,
|
||||||
(newData) => {
|
(newData) => {
|
||||||
props.chartConfig.option.title.text = newData + "%"
|
// console.log('update:'+newData)
|
||||||
props.chartConfig.option.series[0].data[0].value = newData
|
const d = parseFloat(`${newData}`) * 100
|
||||||
props.chartConfig.option.series[0].data[1].value = 100 - newData
|
let config = props.chartConfig.option
|
||||||
|
config.title.text = d.toFixed(2) + "%"
|
||||||
|
config.series[0].data[0].value[0] = d
|
||||||
|
config.series[0].data[1].value[0] = 100 - d
|
||||||
|
option.value = mergeTheme(config, props.themeSetting, includes)
|
||||||
|
option.value = config
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
const option = computed(() => {
|
|
||||||
return mergeTheme(props.chartConfig.option, props.themeSetting, includes)
|
|
||||||
})
|
|
||||||
|
|
||||||
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
|
const { vChartRef } = useChartDataFetch(props.chartConfig, useChartEditStore)
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user