mirror of
https://gitee.com/dromara/go-view.git
synced 2025-02-24 00:02:51 +08:00
feat: echarts公共图例新增详细配置信息
This commit is contained in:
parent
8867a489a2
commit
f9adeac742
@ -257,9 +257,36 @@
|
||||
<n-switch v-model:value="legend.show" size="small"></n-switch>
|
||||
</template>
|
||||
<setting-item-box name="图例文字">
|
||||
<setting-item>
|
||||
<setting-item name="颜色">
|
||||
<n-color-picker size="small" v-model:value="legend.textStyle.color"></n-color-picker>
|
||||
</setting-item>
|
||||
<setting-item name="大小">
|
||||
<n-input-number v-model:value="legend.textStyle.fontSize" :min="1" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="图例位置">
|
||||
<setting-item name="x轴">
|
||||
<n-select v-model:value="legend.x" size="small" :options="legendConfig.lengendX" />
|
||||
</setting-item>
|
||||
<setting-item name="y轴">
|
||||
<n-select v-model:value="legend.y" size="small" :options="legendConfig.lengendY" />
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="图例信息">
|
||||
<setting-item name="方向">
|
||||
<n-select v-model:value="legend.orient" size="small" :options="legendConfig.orient" />
|
||||
</setting-item>
|
||||
<setting-item name="形状">
|
||||
<n-select v-model:value="legend.icon" size="small" :options="legendConfig.shape" />
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
<setting-item-box name="图例大小">
|
||||
<setting-item name="宽">
|
||||
<n-input-number v-model:value="legend.itemWidth" :min="1" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
<setting-item name="高">
|
||||
<n-input-number v-model:value="legend.itemHeight" :min="1" size="small"></n-input-number>
|
||||
</setting-item>
|
||||
</setting-item-box>
|
||||
</collapse-item>
|
||||
|
||||
@ -309,9 +336,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { PropType, computed } from 'vue'
|
||||
import { PropType, computed, watch } from 'vue'
|
||||
import { GlobalThemeJsonType } from '@/settings/chartThemes/index'
|
||||
import { axisConfig } from '@/packages/chartConfiguration/echarts/index'
|
||||
import { axisConfig, legendConfig } from '@/packages/chartConfiguration/echarts/index'
|
||||
import { CollapseItem, SettingItemBox, SettingItem, GlobalSettingPosition } from '@/components/Pages/ChartItemSetting'
|
||||
import { icon } from '@/plugins'
|
||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||
@ -360,4 +387,14 @@ const grid = computed(() => {
|
||||
const visualMap = computed(() => {
|
||||
return props.optionData.visualMap
|
||||
})
|
||||
|
||||
// 监听legend color颜色改变type = scroll的颜色
|
||||
watch(() => legend.value && legend.value.textStyle.color, (newVal) => {
|
||||
if (legend.value && newVal) {
|
||||
legend.value.pageTextStyle.color = newVal
|
||||
}
|
||||
}, {
|
||||
immediate: true,
|
||||
deep: true,
|
||||
})
|
||||
</script>
|
||||
|
@ -1,3 +1,4 @@
|
||||
export * from './axis'
|
||||
export * from './line'
|
||||
export * from './label'
|
||||
export * from './label'
|
||||
export * from './legend'
|
70
src/packages/chartConfiguration/echarts/legend.ts
Normal file
70
src/packages/chartConfiguration/echarts/legend.ts
Normal file
@ -0,0 +1,70 @@
|
||||
export const legendConfig = {
|
||||
// X轴位置
|
||||
lengendX: [
|
||||
{
|
||||
label: '靠左',
|
||||
value: 'left'
|
||||
},
|
||||
{
|
||||
label: '居中',
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
label: '靠右',
|
||||
value: 'right'
|
||||
}
|
||||
],
|
||||
// y轴位置
|
||||
lengendY: [
|
||||
{
|
||||
label: '靠上',
|
||||
value: 'top'
|
||||
},
|
||||
{
|
||||
label: '居中',
|
||||
value: 'center'
|
||||
},
|
||||
{
|
||||
label: '靠下',
|
||||
value: 'bottom'
|
||||
}
|
||||
],
|
||||
// 排列方向
|
||||
orient: [
|
||||
{
|
||||
label: '水平',
|
||||
value: 'horizontal'
|
||||
},
|
||||
{
|
||||
label: '垂直',
|
||||
value: 'vertical'
|
||||
}
|
||||
],
|
||||
// 形状
|
||||
shape: [
|
||||
{
|
||||
label: '圆形',
|
||||
value: 'circle'
|
||||
},
|
||||
{
|
||||
label: '方形',
|
||||
value: 'rect'
|
||||
},
|
||||
{
|
||||
label: '圆角方形',
|
||||
value: 'roundRect'
|
||||
},
|
||||
{
|
||||
label: '三角形',
|
||||
value: 'triangle'
|
||||
},
|
||||
{
|
||||
label: '钢笔形',
|
||||
value: 'pin'
|
||||
},
|
||||
{
|
||||
label: '箭头形',
|
||||
value: 'arrow'
|
||||
}
|
||||
]
|
||||
}
|
@ -86,8 +86,18 @@
|
||||
},
|
||||
"legend": {
|
||||
"show": true,
|
||||
"top": "5%",
|
||||
"type": "scroll",
|
||||
"x": "center",
|
||||
"y": "top",
|
||||
"icon": "circle",
|
||||
"orient": "horizontal",
|
||||
"textStyle": {
|
||||
"color": "#B9B8CE",
|
||||
"fontSize": 18
|
||||
},
|
||||
"itemHeight": 15,
|
||||
"itemWidth": 15,
|
||||
"pageTextStyle": {
|
||||
"color": "#B9B8CE"
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user