refactor(图表): 雷达图样式大小修改为坐标轴

This commit is contained in:
wisonic-s 2024-04-23 15:57:57 +08:00
parent 37fa8eda6d
commit 0c2a55bba3
5 changed files with 27 additions and 2 deletions

View File

@ -28,6 +28,11 @@ declare type EditorPropertyInner = {
[key in EditorProperty]?: string[] [key in EditorProperty]?: string[]
} }
declare type EditorSelectorSpec = {
[key in EditorProperty]?: {
title: string
}
}
/** /**
* 轴类型 * 轴类型
*/ */

View File

@ -68,10 +68,18 @@ const props = defineProps({
default: () => { default: () => {
return {} return {}
} }
},
selectorSpec: {
type: Object as PropType<EditorSelectorSpec>,
required: false,
default: () => {
return {}
}
} }
}) })
const { chart, themes, properties, propertyInnerAll, commonBackgroundPop } = toRefs(props) const { chart, themes, properties, propertyInnerAll, commonBackgroundPop, selectorSpec } =
toRefs(props)
const emit = defineEmits([ const emit = defineEmits([
'onColorChange', 'onColorChange',
'onMiscChange', 'onMiscChange',
@ -316,7 +324,7 @@ watch(
:effect="themes" :effect="themes"
v-if="showProperties('misc-style-selector')" v-if="showProperties('misc-style-selector')"
name="size" name="size"
title="大小" :title="selectorSpec['misc-style-selector']?.title"
> >
<misc-style-selector <misc-style-selector
:property-inner="propertyInnerAll['misc-style-selector']" :property-inner="propertyInnerAll['misc-style-selector']"

View File

@ -2074,6 +2074,7 @@ const drop = (ev: MouseEvent, type = 'xAxis') => {
v-if="chartStyleShow" v-if="chartStyleShow"
:properties="chartViewInstance.properties" :properties="chartViewInstance.properties"
:property-inner-all="chartViewInstance.propertyInner" :property-inner-all="chartViewInstance.propertyInner"
:selector-spec="chartViewInstance.selectorSpec"
:common-background-pop="curComponent?.commonBackground" :common-background-pop="curComponent?.commonBackground"
:chart="view" :chart="view"
:themes="themes" :themes="themes"

View File

@ -41,6 +41,11 @@ export class Radar extends G2PlotChartView<RadarOptions, G2Radar> {
], ],
'legend-selector': ['icon', 'orient', 'color', 'fontSize', 'hPosition', 'vPosition'] 'legend-selector': ['icon', 'orient', 'color', 'fontSize', 'hPosition', 'vPosition']
} }
selectorSpec: EditorSelectorSpec = {
'misc-style-selector': {
title: `${t('chart.tooltip_axis')}`
}
}
axis: AxisType[] = ['xAxis', 'yAxis', 'drill', 'filter', 'extLabel', 'extTooltip'] axis: AxisType[] = ['xAxis', 'yAxis', 'drill', 'filter', 'extLabel', 'extTooltip']
axisConfig: AxisConfig = { axisConfig: AxisConfig = {
xAxis: { xAxis: {

View File

@ -26,6 +26,7 @@ export abstract class AbstractChartView {
abstract propertyInner: EditorPropertyInner abstract propertyInner: EditorPropertyInner
abstract axis: AxisType[] abstract axis: AxisType[]
abstract axisConfig: AxisConfig abstract axisConfig: AxisConfig
abstract selectorSpec: EditorSelectorSpec
/** /**
* 在新建和切换图表的时候处理默认值 * 在新建和切换图表的时候处理默认值
* @param chart 数据库图表对象 * @param chart 数据库图表对象
@ -91,6 +92,11 @@ export abstract class AntVAbstractChartView extends AbstractChartView {
limit: 1 limit: 1
} }
} }
selectorDesc: EditorSelectorSpec = {
'misc-style-selector': {
title: `${t('chart.size')}`
}
}
protected constructor(library: ChartLibraryType, name: string, defaultData?: any[]) { protected constructor(library: ChartLibraryType, name: string, defaultData?: any[]) {
super(ChartRenderType.ANT_V, library, name, defaultData) super(ChartRenderType.ANT_V, library, name, defaultData)
} }