mirror of
https://gitee.com/dromara/go-view.git
synced 2025-10-13 22:12:11 +08:00
Pre Merge pull request !168 from Admin/N/A
This commit is contained in:
commit
3d82c66754
@ -8,6 +8,8 @@
|
|||||||
:color="color"
|
:color="color"
|
||||||
:rail-color="railColor"
|
:rail-color="railColor"
|
||||||
:offset-degree="offsetDegree"
|
:offset-degree="offsetDegree"
|
||||||
|
:show-indicator="showindicator"
|
||||||
|
:border-radius="borderradius"
|
||||||
>
|
>
|
||||||
<n-text
|
<n-text
|
||||||
:style="{
|
:style="{
|
||||||
@ -25,7 +27,7 @@ import { PropType, toRefs, watch, shallowReactive } from 'vue'
|
|||||||
import { useChartDataFetch } from '@/hooks'
|
import { useChartDataFetch } from '@/hooks'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import config, { option as configOption } from './config'
|
import config, { option as configOption } from './config'
|
||||||
import { toNumber } from '@/utils'
|
import { isPreview, isString, isNumber, colorGradientCustomMerge } from '@/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
chartConfig: {
|
chartConfig: {
|
||||||
@ -33,7 +35,12 @@ const props = defineProps({
|
|||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
// 数据处理
|
||||||
|
const dataHandle = (newData: number | string) => {
|
||||||
|
|
||||||
|
newData = isString(newData) ? parseFloat(newData) : newData
|
||||||
|
return parseFloat(newData.toFixed(2))
|
||||||
|
}
|
||||||
// 取配置数据
|
// 取配置数据
|
||||||
const { w, h } = toRefs(props.chartConfig.attr)
|
const { w, h } = toRefs(props.chartConfig.attr)
|
||||||
const {
|
const {
|
||||||
@ -46,19 +53,21 @@ const {
|
|||||||
indicatorPlacement,
|
indicatorPlacement,
|
||||||
indicatorTextSize,
|
indicatorTextSize,
|
||||||
offsetDegree,
|
offsetDegree,
|
||||||
dataset
|
dataset,
|
||||||
|
showindicator,
|
||||||
|
borderradius
|
||||||
} = toRefs(props.chartConfig.option)
|
} = toRefs(props.chartConfig.option)
|
||||||
|
|
||||||
const option = shallowReactive({
|
const option = shallowReactive({
|
||||||
dataset: configOption.dataset
|
dataset: props.chartConfig.option.dataset
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
// 手动更新
|
// 手动更新
|
||||||
watch(
|
watch(
|
||||||
() => props.chartConfig.option.dataset,
|
() => props.chartConfig.option.dataset,
|
||||||
(newData: any) => {
|
(newData: any) => {
|
||||||
try {
|
try {
|
||||||
option.dataset = toNumber(newData, 2)
|
option.dataset = dataHandle(newData)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
@ -69,6 +78,7 @@ watch(
|
|||||||
)
|
)
|
||||||
// 预览更新
|
// 预览更新
|
||||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
|
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
|
||||||
option.dataset = toNumber(newData, 2)
|
|
||||||
|
option.dataset =dataHandle(newData)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user