feat: 新增线条配置

This commit is contained in:
奔跑的面条
2025-06-16 17:39:20 +08:00
parent a9bb5e5397
commit 076c174cb7
10 changed files with 292 additions and 9 deletions
@@ -78,5 +78,43 @@ export const labelConfig = {
label: '底部-左',
value: 'bottom-left'
}
],
linePosition: [
{
label: '顶部',
value: 'top'
},
{
label: '底部',
value: 'bottom'
},
{
label: '左侧',
value: 'left'
},
{
label: '右侧',
value: 'right'
},
{
label: '顶部-右',
value: 'top-right'
},
{
label: '顶部-左',
value: 'top-left'
},
{
label: '底部-右',
value: 'bottom-right'
},
{
label: '底部-左',
value: 'bottom-left'
},
{
label: '居中',
value: 'center'
}
]
}
@@ -36,5 +36,115 @@ export const styleConfig = {
label: '格子',
value: 'grid'
}
],
curveType: [
{
label: '线性',
value: 'linear'
},
{
label: '平滑',
value: 'monotone'
},
{
label: '平滑趋近X',
value: 'monotoneX'
},
{
label: '台阶',
value: 'step'
},
{
label: '连线闭合',
value: 'catmullRom'
},
{
label: '顺滑闭合',
value: 'catmullRomClosed'
}
],
lineCap: [
{
label: '默认',
value: 'butt'
},
{
label: '圆形',
value: 'round'
},
{
label: '方形',
value: 'square'
}
],
symbolType: [
{
label: '圆形',
value: 'circle'
},
{
label: '方形',
value: 'rect'
},
{
label: '菱形',
value: 'diamond'
},
{
label: '三角形',
value: 'square'
},
{
label: '指向向上',
value: 'arrow'
},
{
label: '指向向左',
value: 'arrow2Left'
},
{
label: '箭头向右',
value: 'arrow2Right'
},
{
label: '瘦箭头向上',
value: 'wedge'
},
{
label: '箭头向上',
value: 'triangle'
},
{
label: '箭头向下',
value: 'triangleDown'
},
{
label: '箭头向右',
value: 'triangleRight'
},
{
label: '箭头向左',
value: 'triangleLeft'
},
{
label: '星星',
value: 'star'
},
{
label: 'y字形物',
value: 'wye'
},
{
label: '矩形',
value: 'rect'
},
{
label: '圆角矩形',
value: 'rectRound'
},
{
label: '扁平矩形',
value: 'roundLine'
}
]
}
@@ -22,7 +22,7 @@
import { PropType } from 'vue'
import { VChartGlobalSetting, Axis, Label, Bar } from '@/components/Pages/VChartItemSetting'
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
defineProps({
optionData: {
@@ -5,9 +5,9 @@ import { vChartOptionPrefixHandle } from '@/packages/public/vChart'
import data from './data.json'
import cloneDeep from 'lodash/cloneDeep'
import axisThemeJson from '@/settings/vchartThemes/axis.theme.json'
import { ILineOption } from '../../index.d'
import { ChatCategoryEnum, ILineOption } from '../../index.d'
export const includes = ['legends', 'tooltip']
export const includes = ['legends', 'tooltip', 'label', 'line', 'point']
export const option: ILineOption & { dataset?: any } = {
// 图表配置
type: 'line',
@@ -16,8 +16,10 @@ export const option: ILineOption & { dataset?: any } = {
yField: 'value',
seriesField: 'country',
stack: true,
// 开启百分比
percent: false,
// 业务配置(后续会被转换为图表spec)
category: VChartLineConfig.category,
category: VChartLineConfig.category as ChatCategoryEnum.LINE,
xAxis: {
name: 'x轴',
...axisThemeJson,
@@ -25,7 +27,7 @@ export const option: ILineOption & { dataset?: any } = {
...axisThemeJson.grid,
visible: false
}
},
} as any,
yAxis: {
name: 'y轴',
...axisThemeJson,
@@ -36,7 +38,7 @@ export const option: ILineOption & { dataset?: any } = {
lineDash: [3, 3]
}
}
}
} as any
}
export default class Config extends PublicConfigClass implements CreateComponentType {
@@ -3,12 +3,26 @@
<VChartGlobalSetting :optionData="optionData"></VChartGlobalSetting>
<Axis :axis="optionData.xAxis"></Axis>
<Axis :axis="optionData.yAxis"></Axis>
<!-- 开启百分比 -->
<CollapseItem name="百分比堆叠">
<SettingItemBox name="配置" alone>
<n-space>
<span>开启百分比堆叠</span>
<n-switch v-model:value="optionData.percent" size="small"></n-switch>
</n-space>
</SettingItemBox>
</CollapseItem>
<Line :optionData="optionData"></Line>
<Label :optionData="optionData" :positionOptions="labelConfig.linePosition"></Label>
<Point :optionData="optionData"></Point>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import { VChartGlobalSetting, Axis } from '@/components/Pages/VChartItemSetting'
import { VChartGlobalSetting, Axis, Label, Line, Point } from '@/components/Pages/VChartItemSetting'
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
import { labelConfig } from '@/packages/chartConfiguration/vcharts/index'
defineProps({
optionData: {