mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 13:32:18 +08:00
fix(图表): 优化堆叠图为仅支持圆角
This commit is contained in:
committed by
jianneng-fit2cloud
parent
88d41b947b
commit
89e390c662
@@ -149,6 +149,12 @@ const init = () => {
|
||||
}
|
||||
}
|
||||
initTableColumnWidth()
|
||||
if (
|
||||
props.chart.type.includes('-stack') &&
|
||||
state.basicStyleForm.radiusColumnBar === 'topRoundAngle'
|
||||
) {
|
||||
state.basicStyleForm.radiusColumnBar = 'roundAngle'
|
||||
}
|
||||
}
|
||||
const debouncedInit = debounce(init, 500)
|
||||
watch(
|
||||
@@ -494,7 +500,12 @@ onMounted(() => {
|
||||
>
|
||||
<el-radio label="rightAngle" :effect="themes">{{ t('chart.rightAngle') }}</el-radio>
|
||||
<el-radio label="roundAngle" :effect="themes">{{ t('chart.roundAngle') }}</el-radio>
|
||||
<el-radio label="topRoundAngle" :effect="themes">{{ t('chart.topRoundAngle') }}</el-radio>
|
||||
<el-radio
|
||||
v-if="!props.chart.type.includes('-stack')"
|
||||
label="topRoundAngle"
|
||||
:effect="themes"
|
||||
>{{ t('chart.topRoundAngle') }}</el-radio
|
||||
>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
@@ -128,6 +128,12 @@ const init = () => {
|
||||
state.customColor = state.basicStyleForm.colors[0]
|
||||
state.colorIndex = 0
|
||||
}
|
||||
if (
|
||||
props.chart.type.includes('-stack') &&
|
||||
state.basicStyleForm.radiusColumnBar === 'topRoundAngle'
|
||||
) {
|
||||
state.basicStyleForm.radiusColumnBar = 'roundAngle'
|
||||
}
|
||||
}
|
||||
const configCompat = (basicStyle: ChartBasicStyle) => {
|
||||
// 悬浮改为图例和缩放按钮
|
||||
@@ -228,9 +234,13 @@ onMounted(() => {
|
||||
>
|
||||
<el-radio label="rightAngle" :effect="themes">{{ t('chart.rightAngle') }}</el-radio>
|
||||
<el-radio label="roundAngle" :effect="themes">{{ t('chart.roundAngle') }}</el-radio>
|
||||
<el-radio label="topRoundAngle" :effect="themes">{{
|
||||
t('chart.topRoundAngle')
|
||||
}}</el-radio>
|
||||
<el-radio
|
||||
v-if="!props.chart.type.includes('-stack')"
|
||||
label="topRoundAngle"
|
||||
:effect="themes"
|
||||
>
|
||||
{{ t('chart.topRoundAngle') }}</el-radio
|
||||
>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<div class="alpha-setting" v-if="showProperty('columnWidthRatio')">
|
||||
|
||||
@@ -84,7 +84,8 @@ export class Bar extends G2PlotChartView<ColumnOptions, Column> {
|
||||
return
|
||||
}
|
||||
const isGroup = 'bar-group' === this.name && chart.xAxisExt?.length > 0
|
||||
const isStack = 'bar-group-stack' === this.name && chart.extStack?.length > 0
|
||||
const isStack =
|
||||
['bar-stack', 'bar-group-stack'].includes(this.name) && chart.extStack?.length > 0
|
||||
const data = cloneDeep(drawOptions.chart.data?.data)
|
||||
const initOptions: ColumnOptions = {
|
||||
...this.baseOptions,
|
||||
|
||||
@@ -2405,6 +2405,14 @@ export const configRoundAngle = (chart: Chart, styleName: string, callBack?: (da
|
||||
const topRadius = [0, 0, ...radius]
|
||||
const bottomRadius = [...radius, 0, 0]
|
||||
const finalRadius = [...radius, ...radius]
|
||||
if (chart.type.includes('-stack')) {
|
||||
return {
|
||||
[styleName]: datum => {
|
||||
if (!datum.value) return { radius: [], ...(callBack ? callBack(datum) : {}) }
|
||||
return { radius: finalRadius, ...(callBack ? callBack(datum) : {}) }
|
||||
}
|
||||
}
|
||||
}
|
||||
const isTopRound = basicStyle.radiusColumnBar === 'topRoundAngle'
|
||||
// 对称条形图
|
||||
if (chart.type === 'bidirectional-bar') {
|
||||
|
||||
Reference in New Issue
Block a user