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"
|
||||
:rail-color="railColor"
|
||||
:offset-degree="offsetDegree"
|
||||
:show-indicator="showindicator"
|
||||
:border-radius="borderradius"
|
||||
>
|
||||
<n-text
|
||||
:style="{
|
||||
@ -25,7 +27,7 @@ import { PropType, toRefs, watch, shallowReactive } from 'vue'
|
||||
import { useChartDataFetch } from '@/hooks'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
import config, { option as configOption } from './config'
|
||||
import { toNumber } from '@/utils'
|
||||
import { isPreview, isString, isNumber, colorGradientCustomMerge } from '@/utils'
|
||||
|
||||
const props = defineProps({
|
||||
chartConfig: {
|
||||
@ -33,7 +35,12 @@ const props = defineProps({
|
||||
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 {
|
||||
@ -46,19 +53,21 @@ const {
|
||||
indicatorPlacement,
|
||||
indicatorTextSize,
|
||||
offsetDegree,
|
||||
dataset
|
||||
dataset,
|
||||
showindicator,
|
||||
borderradius
|
||||
} = toRefs(props.chartConfig.option)
|
||||
|
||||
const option = shallowReactive({
|
||||
dataset: configOption.dataset
|
||||
dataset: props.chartConfig.option.dataset
|
||||
})
|
||||
|
||||
|
||||
// 手动更新
|
||||
watch(
|
||||
() => props.chartConfig.option.dataset,
|
||||
(newData: any) => {
|
||||
try {
|
||||
option.dataset = toNumber(newData, 2)
|
||||
option.dataset = dataHandle(newData)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
@ -69,6 +78,7 @@ watch(
|
||||
)
|
||||
// 预览更新
|
||||
useChartDataFetch(props.chartConfig, useChartEditStore, (newData: number) => {
|
||||
option.dataset = toNumber(newData, 2)
|
||||
|
||||
option.dataset =dataHandle(newData)
|
||||
})
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user