mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 20:42:07 +08:00
feat(图表): 组合图支持控制纵轴刻度显隐
This commit is contained in:
@@ -1491,6 +1491,7 @@ export default {
|
||||
axis_label_show: 'Label display',
|
||||
axis_label_color: 'Label color',
|
||||
axis_label_fontsize: 'Label size',
|
||||
axis_tick_show: 'Show tick',
|
||||
text_style: 'Font style',
|
||||
bolder: 'Bold',
|
||||
change_ds: 'Change Dataset',
|
||||
|
||||
@@ -1450,6 +1450,7 @@ export default {
|
||||
axis_type_dashed: '虛線',
|
||||
axis_type_dotted: '點',
|
||||
axis_label_show: '標籤顯示',
|
||||
axis_tick_show: '刻度顯示',
|
||||
axis_label_color: '標籤顏色',
|
||||
axis_label_fontsize: '標籤大小',
|
||||
text_style: '字體樣式',
|
||||
|
||||
@@ -1455,6 +1455,7 @@ export default {
|
||||
axis_type_dashed: '虚线',
|
||||
axis_type_dotted: '点',
|
||||
axis_label_show: '标签显示',
|
||||
axis_tick_show: '刻度显示',
|
||||
axis_label_color: '标签颜色',
|
||||
axis_label_fontsize: '标签大小',
|
||||
text_style: '字体样式',
|
||||
|
||||
@@ -217,6 +217,10 @@ declare interface AxisLabel {
|
||||
* 长度限制
|
||||
*/
|
||||
lengthLimit: number
|
||||
/**
|
||||
* 刻度显示
|
||||
*/
|
||||
showTick: boolean
|
||||
}
|
||||
/**
|
||||
* 轴线条设置
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
DEFAULT_YAXIS_EXT_STYLE,
|
||||
DEFAULT_YAXIS_STYLE
|
||||
} from '@/views/chart/components/editor/util/chart'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { cloneDeep, defaultsDeep } from 'lodash-es'
|
||||
import DualYAxisSelectorInner from './DualYAxisSelectorInner.vue'
|
||||
|
||||
const { t } = useI18n()
|
||||
@@ -59,15 +59,15 @@ const init = () => {
|
||||
customStyle = JSON.parse(chart.customStyle)
|
||||
}
|
||||
if (customStyle.yAxis) {
|
||||
state.axisForm = cloneDeep(customStyle.yAxis)
|
||||
state.axisForm = defaultsDeep(cloneDeep(customStyle.yAxis), DEFAULT_YAXIS_STYLE)
|
||||
state.axisForm.position = 'left'
|
||||
}
|
||||
|
||||
if (customStyle.yAxisExt) {
|
||||
state.subAxisForm = cloneDeep(customStyle.yAxisExt)
|
||||
state.subAxisForm = defaultsDeep(cloneDeep(customStyle.yAxisExt), DEFAULT_YAXIS_EXT_STYLE)
|
||||
state.subAxisForm.position = 'right'
|
||||
state.subAxisForm.show = state.axisForm.show
|
||||
}
|
||||
state.subAxisForm.position = 'right'
|
||||
state.subAxisForm.show = state.axisForm.show
|
||||
if (chart.type === 'bidirectional-bar') {
|
||||
state.axisForm.position = customStyle.yAxis.position
|
||||
state.subAxisForm.position = customStyle.yAxisExt.position
|
||||
|
||||
@@ -434,6 +434,17 @@ onMounted(() => {
|
||||
</el-form-item>
|
||||
<div style="padding-left: 22px" v-if="showProperty('axisLabel')">
|
||||
<div style="flex: 1">
|
||||
<el-form-item class="form-item" :class="'form-item-' + themes">
|
||||
<el-checkbox
|
||||
:effect="props.themes"
|
||||
:disabled="!state.axisForm.axisLabel.show"
|
||||
v-model="state.axisForm.axisLabel.showTick"
|
||||
size="small"
|
||||
@change="changeAxisStyle('axisLabel.showTick')"
|
||||
>
|
||||
{{ t('chart.axis_tick_show') }}
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
<div style="display: flex">
|
||||
<el-form-item
|
||||
class="form-item"
|
||||
|
||||
@@ -638,7 +638,8 @@ export const DEFAULT_XAXIS_STYLE: ChartAxisStyle = {
|
||||
fontSize: 12,
|
||||
rotate: 0,
|
||||
formatter: '{value}',
|
||||
lengthLimit: 10
|
||||
lengthLimit: 10,
|
||||
showTick: true
|
||||
},
|
||||
axisLine: {
|
||||
show: true,
|
||||
@@ -685,7 +686,8 @@ export const DEFAULT_YAXIS_STYLE: ChartAxisStyle = {
|
||||
fontSize: 12,
|
||||
rotate: 0,
|
||||
formatter: '{value}',
|
||||
lengthLimit: 10
|
||||
lengthLimit: 10,
|
||||
showTick: true
|
||||
},
|
||||
axisLine: {
|
||||
show: false,
|
||||
@@ -730,7 +732,9 @@ export const DEFAULT_YAXIS_EXT_STYLE: ChartAxisStyle = {
|
||||
color: '#333333',
|
||||
fontSize: 12,
|
||||
rotate: 0,
|
||||
formatter: '{value}'
|
||||
formatter: '{value}',
|
||||
lengthLimit: 10,
|
||||
showTick: true
|
||||
},
|
||||
axisLine: {
|
||||
show: false,
|
||||
@@ -762,7 +766,8 @@ export const DEFAULT_YAXIS_EXT_STYLE: ChartAxisStyle = {
|
||||
suffix: '',
|
||||
decimalCount: 2,
|
||||
thousandSeparator: true
|
||||
}
|
||||
},
|
||||
nameShow: false
|
||||
}
|
||||
export const DEFAULT_BACKGROUND_COLOR = {
|
||||
color: '#ffffff',
|
||||
|
||||
@@ -104,6 +104,7 @@ export abstract class G2ChartView<
|
||||
gridLineDash = [1, 2]
|
||||
}
|
||||
const axisOption = {
|
||||
tick: axis.axisLabel.show && axis.axisLabel.showTick !== false,
|
||||
position: axis.position,
|
||||
title: axis.nameShow === false ? false : isEmpty(axis.name) ? false : axis.name,
|
||||
titleFontSize: axis.fontSize,
|
||||
|
||||
Reference in New Issue
Block a user