mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
feat: 新增图表位置处理
This commit is contained in:
@@ -1,238 +1,233 @@
|
||||
<template>
|
||||
<div class="go-global-setting">
|
||||
<CollapseItem v-if="title" name="标题">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="title.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="标题">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker v-model:value="title.textStyle.color" size="small" />
|
||||
</SettingItem>
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="title.textStyle.fontSize"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="副标题">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
v-model:value="title.subtextStyle.color"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="title.subtextStyle.fontSize"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<CollapseItem v-if="title" name="标题">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="title.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="标题">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker v-model:value="title.textStyle.color" size="small" />
|
||||
</SettingItem>
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="title.textStyle.fontSize"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="副标题">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" v-model:value="title.subtextStyle.color" />
|
||||
</SettingItem>
|
||||
<SettingItem name="大小">
|
||||
<n-input-number
|
||||
v-model:value="title.subtextStyle.fontSize"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
|
||||
<CollapseItem v-if="xAxis" name="X轴">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="xAxis.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="名称">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
v-model:value="xAxis.nameTextStyle.color"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.axisLabel.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" v-model:value="xAxis.axisLabel.color" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="轴线">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="xAxis.axisLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="xAxis.axisLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="对齐零">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.axisLine.onZero" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="刻度">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.axisTick.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="长度">
|
||||
<n-input-number
|
||||
v-model:value="xAxis.axisTick.length"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="分割线">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.splitLine.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="xAxis.splitLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="xAxis.splitLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select
|
||||
v-model:value="xAxis.splitLine.lineStyle.type"
|
||||
size="small"
|
||||
:options="axisConf.splitLint.lineStyle.type"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="位置">
|
||||
<n-select
|
||||
v-model:value="xAxis.position"
|
||||
size="small"
|
||||
:options="axisConf.xposition"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<CollapseItem v-if="xAxis" name="X轴">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="xAxis.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="名称">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
v-model:value="xAxis.nameTextStyle.color"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.axisLabel.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" v-model:value="xAxis.axisLabel.color" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="轴线">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="xAxis.axisLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="xAxis.axisLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="对齐零">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.axisLine.onZero" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="刻度">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.axisTick.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="长度">
|
||||
<n-input-number
|
||||
v-model:value="xAxis.axisTick.length"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="分割线">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="xAxis.splitLine.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="xAxis.splitLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="xAxis.splitLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select
|
||||
v-model:value="xAxis.splitLine.lineStyle.type"
|
||||
size="small"
|
||||
:options="axisConf.splitLint.lineStyle.type"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="位置">
|
||||
<n-select
|
||||
v-model:value="xAxis.position"
|
||||
size="small"
|
||||
:options="axisConf.xposition"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
|
||||
<CollapseItem v-if="yAxis" name="Y轴">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="yAxis.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="名称">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
v-model:value="yAxis.nameTextStyle.color"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisLabel.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" v-model:value="yAxis.axisLabel.color" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="轴线">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisLine.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="yAxis.axisLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="yAxis.axisLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="对齐零">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisLine.onZero" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="刻度">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisTick.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="长度">
|
||||
<n-input-number
|
||||
v-model:value="yAxis.axisTick.length"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="分割线">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.splitLine.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="yAxis.splitLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="yAxis.splitLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select
|
||||
v-model:value="yAxis.splitLine.lineStyle.type"
|
||||
size="small"
|
||||
:options="axisConf.splitLint.lineStyle.type"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="位置">
|
||||
<n-select
|
||||
v-model:value="yAxis.position"
|
||||
size="small"
|
||||
:options="axisConf.yposition"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
<CollapseItem v-if="yAxis" name="Y轴">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="yAxis.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="名称">
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
size="small"
|
||||
v-model:value="yAxis.nameTextStyle.color"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="标签">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisLabel.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker size="small" v-model:value="yAxis.axisLabel.color" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="轴线">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisLine.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="yAxis.axisLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="yAxis.axisLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="对齐零">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisLine.onZero" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="刻度">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.axisTick.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="长度">
|
||||
<n-input-number
|
||||
v-model:value="yAxis.axisTick.length"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
<SettingItemBox name="分割线">
|
||||
<SettingItem v-show="inChart" name="展示">
|
||||
<n-space>
|
||||
<n-switch v-model:value="yAxis.splitLine.show" size="small" />
|
||||
</n-space>
|
||||
</SettingItem>
|
||||
<SettingItem name="颜色">
|
||||
<n-color-picker
|
||||
v-model:value="yAxis.splitLine.lineStyle.color"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="粗细">
|
||||
<n-input-number
|
||||
v-model:value="yAxis.splitLine.lineStyle.width"
|
||||
:min="1"
|
||||
size="small"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="类型">
|
||||
<n-select
|
||||
v-model:value="yAxis.splitLine.lineStyle.type"
|
||||
size="small"
|
||||
:options="axisConf.splitLint.lineStyle.type"
|
||||
/>
|
||||
</SettingItem>
|
||||
<SettingItem name="位置">
|
||||
<n-select
|
||||
v-model:value="yAxis.position"
|
||||
size="small"
|
||||
:options="axisConf.yposition"
|
||||
/>
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
|
||||
<CollapseItem v-if="legend" name="图例">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="legend.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="图例文字">
|
||||
<SettingItem>
|
||||
<n-color-picker size="small" v-model:value="legend.textStyle.color" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</div>
|
||||
<CollapseItem v-if="legend" name="图例">
|
||||
<template #header>
|
||||
<n-switch v-show="inChart" v-model:value="legend.show" size="small" />
|
||||
</template>
|
||||
<SettingItemBox name="图例文字">
|
||||
<SettingItem>
|
||||
<n-color-picker size="small" v-model:value="legend.textStyle.color" />
|
||||
</SettingItem>
|
||||
</SettingItemBox>
|
||||
</CollapseItem>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -246,7 +241,7 @@ import {
|
||||
} from '@/components/ChartItemSetting/index'
|
||||
|
||||
const props = defineProps({
|
||||
optiondata: {
|
||||
optionData: {
|
||||
type: Object as PropType<GlobalThemeJsonType>,
|
||||
required: true
|
||||
},
|
||||
@@ -258,23 +253,18 @@ const props = defineProps({
|
||||
})
|
||||
|
||||
const title = computed(() => {
|
||||
return props.optiondata.title
|
||||
return props.optionData.title
|
||||
})
|
||||
|
||||
const xAxis = computed(() => {
|
||||
return props.optiondata.xAxis
|
||||
return props.optionData.xAxis
|
||||
})
|
||||
|
||||
const yAxis = computed(() => {
|
||||
return props.optiondata.yAxis
|
||||
return props.optionData.yAxis
|
||||
})
|
||||
|
||||
const legend = computed(() => {
|
||||
return props.optiondata.legend
|
||||
return props.optionData.legend
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@include go(global-setting) {
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<SettingItemBox name="边距">
|
||||
<n-input-number
|
||||
v-model:value="chartAttr.y"
|
||||
:min="0"
|
||||
size="small"
|
||||
placeholder="px"
|
||||
>
|
||||
<template #prefix>
|
||||
<n-text depth="3">上边</n-text>
|
||||
</template>
|
||||
</n-input-number>
|
||||
<n-input-number
|
||||
v-model:value="chartAttr.x"
|
||||
:min="0"
|
||||
size="small"
|
||||
placeholder="px"
|
||||
>
|
||||
<template #prefix>
|
||||
<n-text depth="3">左</n-text>
|
||||
</template>
|
||||
</n-input-number>
|
||||
</SettingItemBox>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import { PickCreateComponentType } from '@/packages/index.d'
|
||||
import { SettingItemBox } from '@/components/ChartItemSetting/index'
|
||||
|
||||
const props = defineProps({
|
||||
chartAttr: {
|
||||
type: Object as PropType<Omit<PickCreateComponentType<'attr'>, 'node'>>,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -21,7 +21,7 @@ $leftWidth: 60px;
|
||||
@include go('config-item-box') {
|
||||
position: relative;
|
||||
display: flex;
|
||||
margin-top: 10px;
|
||||
margin: 20px 0;
|
||||
.item-left {
|
||||
width: $leftWidth;
|
||||
text-align: left;
|
||||
|
||||
@@ -5,5 +5,7 @@ import CollapseItem from './CollapseItem.vue'
|
||||
|
||||
// 全局配置属性通用模板
|
||||
import GlobalSetting from './GlobalSetting.vue'
|
||||
// 方向通用模板
|
||||
import PositionSetting from './PositionSetting.vue'
|
||||
|
||||
export { CollapseItem, SettingItemBox, SettingItem, GlobalSetting }
|
||||
export { CollapseItem, SettingItemBox, SettingItem, GlobalSetting, PositionSetting }
|
||||
|
||||
Reference in New Issue
Block a user