forked from github/dataease
refactor(图表): 堆叠柱状图总计标签和主标签分开控制
This commit is contained in:
parent
eb92ff2737
commit
b22890f662
@ -432,12 +432,9 @@ watch(
|
|||||||
@onChangeMiscStyleForm="onChangeMiscStyleForm"
|
@onChangeMiscStyleForm="onChangeMiscStyleForm"
|
||||||
/>
|
/>
|
||||||
</el-collapse-item>
|
</el-collapse-item>
|
||||||
<collapse-switch-item
|
<el-collapse-item
|
||||||
:themes="themes"
|
:themes="themes"
|
||||||
v-if="showProperties('label-selector')"
|
v-if="showProperties('label-selector')"
|
||||||
v-model="chart.customAttr.label.show"
|
|
||||||
:change-model="chart.customAttr.label"
|
|
||||||
@modelChange="val => onLabelChange({ data: val }, 'show')"
|
|
||||||
:title="t('chart.label')"
|
:title="t('chart.label')"
|
||||||
name="label"
|
name="label"
|
||||||
>
|
>
|
||||||
@ -449,7 +446,7 @@ watch(
|
|||||||
:all-fields="props.allFields"
|
:all-fields="props.allFields"
|
||||||
@onLabelChange="onLabelChange"
|
@onLabelChange="onLabelChange"
|
||||||
/>
|
/>
|
||||||
</collapse-switch-item>
|
</el-collapse-item>
|
||||||
<collapse-switch-item
|
<collapse-switch-item
|
||||||
v-if="showProperties('tooltip-selector')"
|
v-if="showProperties('tooltip-selector')"
|
||||||
v-model="chart.customAttr.tooltip.show"
|
v-model="chart.customAttr.tooltip.show"
|
||||||
|
@ -396,6 +396,15 @@ const conversionPrecision = [
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<el-form-item class="form-item" :class="'form-item-' + themes">
|
||||||
|
<el-checkbox
|
||||||
|
size="small"
|
||||||
|
:effect="themes"
|
||||||
|
v-model="state.labelForm.show"
|
||||||
|
@change="changeLabelAttr('show')"
|
||||||
|
:label="t('chart.show')"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
<el-form
|
<el-form
|
||||||
ref="labelForm"
|
ref="labelForm"
|
||||||
:disabled="!state.labelForm.show"
|
:disabled="!state.labelForm.show"
|
||||||
@ -665,15 +674,6 @@ const conversionPrecision = [
|
|||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
<el-form-item v-if="showProperty('showTotal')" class="form-item" :class="'form-item-' + themes">
|
|
||||||
<el-checkbox
|
|
||||||
size="small"
|
|
||||||
:effect="themes"
|
|
||||||
v-model="state.labelForm.showTotal"
|
|
||||||
@change="changeLabelAttr('showTotal')"
|
|
||||||
:label="t('chart.total_show')"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<template v-if="false && showProperty('totalFormatter')">
|
<template v-if="false && showProperty('totalFormatter')">
|
||||||
<el-divider class="m-divider" :class="{ 'divider-dark': themes === 'dark' }" />
|
<el-divider class="m-divider" :class="{ 'divider-dark': themes === 'dark' }" />
|
||||||
<div v-show="state.labelForm.showTotal">
|
<div v-show="state.labelForm.showTotal">
|
||||||
@ -1470,6 +1470,16 @@ const conversionPrecision = [
|
|||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
<el-form-item v-if="showProperty('showTotal')" class="form-item" :class="'form-item-' + themes">
|
||||||
|
<el-checkbox
|
||||||
|
size="small"
|
||||||
|
:effect="themes"
|
||||||
|
:disabled="false"
|
||||||
|
v-model="state.labelForm.showTotal"
|
||||||
|
@change="changeLabelAttr('showTotal')"
|
||||||
|
:label="t('chart.total_show')"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
@ -348,9 +348,6 @@ export class StackBar extends Bar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected configTotalLabel(chart: Chart, options: ColumnOptions): ColumnOptions {
|
protected configTotalLabel(chart: Chart, options: ColumnOptions): ColumnOptions {
|
||||||
if (!options.label) {
|
|
||||||
return options
|
|
||||||
}
|
|
||||||
const { label } = parseJson(chart.customAttr)
|
const { label } = parseJson(chart.customAttr)
|
||||||
if (label.showTotal) {
|
if (label.showTotal) {
|
||||||
const formatterCfg = label.labelFormatter ?? formatterItem
|
const formatterCfg = label.labelFormatter ?? formatterItem
|
||||||
|
Loading…
Reference in New Issue
Block a user