mirror of
https://gitee.com/dromara/go-view.git
synced 2025-06-18 11:59:14 +08:00
feat: 新增线条配置
This commit is contained in:
parent
a9bb5e5397
commit
076c174cb7
@ -7,7 +7,11 @@
|
|||||||
|
|
||||||
<setting-item-box name="布局">
|
<setting-item-box name="布局">
|
||||||
<setting-item name="位置">
|
<setting-item name="位置">
|
||||||
<n-select v-model:value="optionData.label.position" size="small" :options="labelConfig.barPosition" />
|
<n-select
|
||||||
|
v-model:value="optionData.label.position"
|
||||||
|
size="small"
|
||||||
|
:options="positionOptions || labelConfig.barPosition"
|
||||||
|
/>
|
||||||
</setting-item>
|
</setting-item>
|
||||||
|
|
||||||
<setting-item name="间距">
|
<setting-item name="间距">
|
||||||
@ -33,6 +37,10 @@ defineProps({
|
|||||||
optionData: {
|
optionData: {
|
||||||
type: Object as PropType<vChartGlobalThemeJsonType>,
|
type: Object as PropType<vChartGlobalThemeJsonType>,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
positionOptions: {
|
||||||
|
type: Array,
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
33
src/components/Pages/VChartItemSetting/Line.vue
Normal file
33
src/components/Pages/VChartItemSetting/Line.vue
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<collapse-item name="线条" v-if="optionData.line">
|
||||||
|
<SettingItemBox name="样式">
|
||||||
|
<setting-item name="宽度">
|
||||||
|
<n-input-number v-model:value="optionData.line.style.lineWidth" size="small" :min="1"></n-input-number>
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="线条类型">
|
||||||
|
<n-select
|
||||||
|
v-model:value="optionData.line.style.curveType"
|
||||||
|
:options="styleConfig.curveType"
|
||||||
|
size="small"
|
||||||
|
></n-select>
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="末端样式">
|
||||||
|
<n-select v-model:value="optionData.line.style.lineCap" :options="styleConfig.lineCap" size="small"></n-select>
|
||||||
|
</setting-item>
|
||||||
|
</SettingItemBox>
|
||||||
|
</collapse-item>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType } from 'vue'
|
||||||
|
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
|
||||||
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { styleConfig } from '@/packages/chartConfiguration/vcharts/index'
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<vChartGlobalThemeJsonType>,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
56
src/components/Pages/VChartItemSetting/Point.vue
Normal file
56
src/components/Pages/VChartItemSetting/Point.vue
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<template>
|
||||||
|
<template v-if="optionData.point">
|
||||||
|
<collapse-item name="实心点(图元)">
|
||||||
|
<template #header>
|
||||||
|
<n-switch v-model:value="optionData.point.visible" size="small"></n-switch>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<setting-item-box name="样式">
|
||||||
|
<setting-item name="位置">
|
||||||
|
<n-select v-model:value="optionData.point.style.symbolType" size="small" :options="styleConfig.symbolType" />
|
||||||
|
</setting-item>
|
||||||
|
|
||||||
|
<setting-item name="大小">
|
||||||
|
<n-input-number v-model:value="optionData.point.style.size" :min="0" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="填充透明度">
|
||||||
|
<n-input-number v-model:value="optionData.point.style.fillOpacity" :step="0.1" :min="0" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="边框宽度">
|
||||||
|
<n-input-number v-model:value="optionData.point.style.lineWidth" :min="0" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="边框颜色">
|
||||||
|
<n-color-picker v-model:value="optionData.point.style.stroke" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="边框透明度">
|
||||||
|
<n-input-number v-model:value="optionData.point.style.strokeOpacity" :step="0.1" :min="0" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="偏移X">
|
||||||
|
<n-input-number v-model:value="optionData.point.style.dx" :min="0" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
<setting-item name="偏移Y">
|
||||||
|
<n-input-number v-model:value="optionData.point.style.dy" :min="0" size="small" />
|
||||||
|
</setting-item>
|
||||||
|
</setting-item-box>
|
||||||
|
</collapse-item>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { PropType, toRefs } from 'vue'
|
||||||
|
import { styleConfig } from '@/packages/chartConfiguration/vcharts/index'
|
||||||
|
import FontStyle from './common/FontStyle.vue'
|
||||||
|
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
|
||||||
|
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
||||||
|
|
||||||
|
defineProps({
|
||||||
|
optionData: {
|
||||||
|
type: Object as PropType<vChartGlobalThemeJsonType>,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
positionOptions: {
|
||||||
|
type: Array,
|
||||||
|
required: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
@ -2,5 +2,7 @@ import VChartGlobalSetting from './VChartGlobalSetting.vue'
|
|||||||
import Axis from './Axis.vue'
|
import Axis from './Axis.vue'
|
||||||
import Label from './Label.vue'
|
import Label from './Label.vue'
|
||||||
import Bar from './Bar.vue'
|
import Bar from './Bar.vue'
|
||||||
|
import Line from './Line.vue'
|
||||||
|
import Point from './Point.vue'
|
||||||
|
|
||||||
export { VChartGlobalSetting, Axis, Label, Bar }
|
export { VChartGlobalSetting, Axis, Label, Bar, Line, Point }
|
||||||
|
@ -78,5 +78,43 @@ export const labelConfig = {
|
|||||||
label: '底部-左',
|
label: '底部-左',
|
||||||
value: 'bottom-left'
|
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: '格子',
|
label: '格子',
|
||||||
value: 'grid'
|
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 { PropType } from 'vue'
|
||||||
import { VChartGlobalSetting, Axis, Label, Bar } from '@/components/Pages/VChartItemSetting'
|
import { VChartGlobalSetting, Axis, Label, Bar } from '@/components/Pages/VChartItemSetting'
|
||||||
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
|
import { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
|
||||||
import { CollapseItem, SettingItemBox, SettingItem } from '@/components/Pages/ChartItemSetting'
|
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
optionData: {
|
optionData: {
|
||||||
|
@ -5,9 +5,9 @@ import { vChartOptionPrefixHandle } from '@/packages/public/vChart'
|
|||||||
import data from './data.json'
|
import data from './data.json'
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import axisThemeJson from '@/settings/vchartThemes/axis.theme.json'
|
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 } = {
|
export const option: ILineOption & { dataset?: any } = {
|
||||||
// 图表配置
|
// 图表配置
|
||||||
type: 'line',
|
type: 'line',
|
||||||
@ -16,8 +16,10 @@ export const option: ILineOption & { dataset?: any } = {
|
|||||||
yField: 'value',
|
yField: 'value',
|
||||||
seriesField: 'country',
|
seriesField: 'country',
|
||||||
stack: true,
|
stack: true,
|
||||||
|
// 开启百分比
|
||||||
|
percent: false,
|
||||||
// 业务配置(后续会被转换为图表spec)
|
// 业务配置(后续会被转换为图表spec)
|
||||||
category: VChartLineConfig.category,
|
category: VChartLineConfig.category as ChatCategoryEnum.LINE,
|
||||||
xAxis: {
|
xAxis: {
|
||||||
name: 'x轴',
|
name: 'x轴',
|
||||||
...axisThemeJson,
|
...axisThemeJson,
|
||||||
@ -25,7 +27,7 @@ export const option: ILineOption & { dataset?: any } = {
|
|||||||
...axisThemeJson.grid,
|
...axisThemeJson.grid,
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
},
|
} as any,
|
||||||
yAxis: {
|
yAxis: {
|
||||||
name: 'y轴',
|
name: 'y轴',
|
||||||
...axisThemeJson,
|
...axisThemeJson,
|
||||||
@ -36,7 +38,7 @@ export const option: ILineOption & { dataset?: any } = {
|
|||||||
lineDash: [3, 3]
|
lineDash: [3, 3]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} as any
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class Config extends PublicConfigClass implements CreateComponentType {
|
export default class Config extends PublicConfigClass implements CreateComponentType {
|
||||||
|
@ -3,12 +3,26 @@
|
|||||||
<VChartGlobalSetting :optionData="optionData"></VChartGlobalSetting>
|
<VChartGlobalSetting :optionData="optionData"></VChartGlobalSetting>
|
||||||
<Axis :axis="optionData.xAxis"></Axis>
|
<Axis :axis="optionData.xAxis"></Axis>
|
||||||
<Axis :axis="optionData.yAxis"></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>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { PropType } from 'vue'
|
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 { vChartGlobalThemeJsonType } from '@/settings/vchartThemes/index'
|
||||||
|
import { CollapseItem, SettingItemBox } from '@/components/Pages/ChartItemSetting'
|
||||||
|
import { labelConfig } from '@/packages/chartConfiguration/vcharts/index'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
optionData: {
|
optionData: {
|
||||||
|
@ -98,5 +98,25 @@
|
|||||||
"opacity": 1,
|
"opacity": 1,
|
||||||
"texture": ""
|
"texture": ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"line": {
|
||||||
|
"style": {
|
||||||
|
"lineWidth": 1,
|
||||||
|
"lineCap": "butt",
|
||||||
|
"curveType": "linear"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"point": {
|
||||||
|
"visible": true,
|
||||||
|
"style": {
|
||||||
|
"symbolType": "circle",
|
||||||
|
"size": 10,
|
||||||
|
"fillOpacity": 1,
|
||||||
|
"lineWidth": 2,
|
||||||
|
"stroke": "#ffffff",
|
||||||
|
"strokeOpacity": 1,
|
||||||
|
"dx": 0,
|
||||||
|
"dy": 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user