forked from github/dataease
Merge pull request #10141 from dataease/pr@dev-v2@chart-bidirectional-style
style(图表-对称条形图): 垂直方向时轴线的显示样式优化
This commit is contained in:
commit
b793d379ce
@ -101,6 +101,7 @@ onMounted(() => {
|
|||||||
:themes="themes"
|
:themes="themes"
|
||||||
type="left"
|
type="left"
|
||||||
:chart-type="chart.type"
|
:chart-type="chart.type"
|
||||||
|
:layout="chart.customAttr.basicStyle.layout"
|
||||||
@on-change-y-axis-form="changeAxisStyle"
|
@on-change-y-axis-form="changeAxisStyle"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@ -120,6 +121,7 @@ onMounted(() => {
|
|||||||
:themes="themes"
|
:themes="themes"
|
||||||
type="right"
|
type="right"
|
||||||
:chart-type="chart.type"
|
:chart-type="chart.type"
|
||||||
|
:layout="chart.customAttr.basicStyle.layout"
|
||||||
@on-change-y-axis-form="changeSubAxisStyle"
|
@on-change-y-axis-form="changeSubAxisStyle"
|
||||||
/>
|
/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
@ -14,6 +14,7 @@ const props = withDefaults(
|
|||||||
propertyInner?: Array<string>
|
propertyInner?: Array<string>
|
||||||
type?: 'left' | 'right'
|
type?: 'left' | 'right'
|
||||||
chartType?: string
|
chartType?: string
|
||||||
|
layout?: string
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
themes: 'dark',
|
themes: 'dark',
|
||||||
@ -75,6 +76,14 @@ const init = () => {
|
|||||||
|
|
||||||
const showProperty = prop => props.propertyInner?.includes(prop)
|
const showProperty = prop => props.propertyInner?.includes(prop)
|
||||||
|
|
||||||
|
const isBidirectionalBar = computed(() => {
|
||||||
|
return props.chartType === 'bidirectional-bar'
|
||||||
|
})
|
||||||
|
|
||||||
|
const isVerticalLayout = computed(() => {
|
||||||
|
return props.layout === 'vertical'
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
@ -99,9 +108,19 @@ onMounted(() => {
|
|||||||
size="small"
|
size="small"
|
||||||
@change="changeAxisStyle('position')"
|
@change="changeAxisStyle('position')"
|
||||||
>
|
>
|
||||||
<div v-if="chartType === 'bidirectional-bar'">
|
<div v-if="isBidirectionalBar">
|
||||||
<el-radio :effect="props.themes" label="right">{{ t('chart.text_pos_top') }}</el-radio>
|
<div v-if="isVerticalLayout">
|
||||||
<el-radio :effect="props.themes" label="left">{{ t('chart.text_pos_bottom') }}</el-radio>
|
<el-radio :effect="props.themes" label="left">{{ t('chart.text_pos_left') }}</el-radio>
|
||||||
|
<el-radio :effect="props.themes" label="right">{{
|
||||||
|
t('chart.text_pos_right')
|
||||||
|
}}</el-radio>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<el-radio :effect="props.themes" label="right">{{ t('chart.text_pos_top') }}</el-radio>
|
||||||
|
<el-radio :effect="props.themes" label="left">{{
|
||||||
|
t('chart.text_pos_bottom')
|
||||||
|
}}</el-radio>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-radio :effect="props.themes" label="left">{{ t('chart.text_pos_left') }}</el-radio>
|
<el-radio :effect="props.themes" label="left">{{ t('chart.text_pos_left') }}</el-radio>
|
||||||
|
@ -100,6 +100,14 @@ const init = () => {
|
|||||||
|
|
||||||
const showProperty = prop => props.propertyInner?.includes(prop)
|
const showProperty = prop => props.propertyInner?.includes(prop)
|
||||||
|
|
||||||
|
const isBidirectionalBar = computed(() => {
|
||||||
|
return props.chart.type === 'bidirectional-bar'
|
||||||
|
})
|
||||||
|
|
||||||
|
const isHorizontalLayout = computed(() => {
|
||||||
|
return props.chart.customAttr.basicStyle.layout === 'horizontal'
|
||||||
|
})
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init()
|
init()
|
||||||
})
|
})
|
||||||
@ -124,8 +132,10 @@ onMounted(() => {
|
|||||||
size="small"
|
size="small"
|
||||||
@change="changeAxisStyle('position')"
|
@change="changeAxisStyle('position')"
|
||||||
>
|
>
|
||||||
<div v-if="chart.type === 'bidirectional-bar'">
|
<div v-if="isBidirectionalBar">
|
||||||
<el-radio :effect="props.themes" label="top">{{ t('chart.text_pos_left') }}</el-radio>
|
<el-radio :effect="props.themes" label="top">{{
|
||||||
|
isHorizontalLayout ? t('chart.text_pos_left') : t('chart.text_pos_top')
|
||||||
|
}}</el-radio>
|
||||||
<el-radio :effect="props.themes" label="bottom">{{
|
<el-radio :effect="props.themes" label="bottom">{{
|
||||||
t('chart.text_pos_center')
|
t('chart.text_pos_center')
|
||||||
}}</el-radio>
|
}}</el-radio>
|
||||||
|
@ -325,8 +325,9 @@ export class BidirectionalHorizontalBar extends G2PlotChartView<
|
|||||||
valueExt: undefined
|
valueExt: undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const layoutHorizontal = options.layout === 'horizontal'
|
||||||
// 处理横轴标题方向不对
|
// 处理横轴标题方向不对
|
||||||
if (yAxis && yAxis['title']) {
|
if (yAxis && yAxis['title'] && layoutHorizontal) {
|
||||||
yAxis['title'].autoRotate = false
|
yAxis['title'].autoRotate = false
|
||||||
}
|
}
|
||||||
const yAxisTmp = parseJson(chart.customStyle).yAxis
|
const yAxisTmp = parseJson(chart.customStyle).yAxis
|
||||||
|
Loading…
Reference in New Issue
Block a user