forked from github/dataease
Merge branch 'dev' of github.com:dataease/dataease into dev
This commit is contained in:
commit
aa690ff8cc
@ -100,7 +100,7 @@
|
||||
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
|
||||
<span>{{ $t('chart.filter') }}...</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="chart.render === 'antv' && chart.type.includes('table')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
|
||||
<el-dropdown-item v-if="chart.render === 'antv' && (chart.type.includes('table') || chart.type === 'text')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
|
||||
<span>{{ $t('chart.value_formatter') }}...</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
|
||||
@ -177,7 +177,6 @@ export default {
|
||||
this.init()
|
||||
this.isEnableCompare()
|
||||
bus.$on('reset-change-table', () => this.getItemTagType())
|
||||
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
|
@ -100,7 +100,7 @@
|
||||
<el-dropdown-item icon="el-icon-files" :command="beforeClickItem('filter')">
|
||||
<span>{{ $t('chart.filter') }}...</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="chart.render === 'antv' && chart.type.includes('table')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
|
||||
<el-dropdown-item v-if="chart.render === 'antv' && (chart.type.includes('table') || chart.type === 'text')" icon="el-icon-notebook-2" divided :command="beforeClickItem('formatter')">
|
||||
<span>{{ $t('chart.value_formatter') }}...</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item icon="el-icon-edit-outline" divided :command="beforeClickItem('rename')">
|
||||
|
@ -7,8 +7,8 @@
|
||||
:style="content_class"
|
||||
>
|
||||
<span :style="label_class">
|
||||
<p v-for="item in chart.data.series" :key="item.name" :style="label_content_class">
|
||||
{{ item.data[0] }}
|
||||
<p :style="label_content_class">
|
||||
{{ result }}
|
||||
</p>
|
||||
</span>
|
||||
<span v-if="dimensionShow" :style="label_space">
|
||||
@ -23,6 +23,7 @@
|
||||
<script>
|
||||
import { hexColorToRGBA } from '../../chart/util'
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
import { formatterItem, valueFormatter } from '@/views/chart/chart/formatter'
|
||||
|
||||
export default {
|
||||
name: 'LabelNormal',
|
||||
@ -76,7 +77,8 @@ export default {
|
||||
background: hexColorToRGBA('#ffffff', 0)
|
||||
},
|
||||
title_show: true,
|
||||
borderRadius: '0px'
|
||||
borderRadius: '0px',
|
||||
result: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -105,6 +107,7 @@ export default {
|
||||
init() {
|
||||
const that = this
|
||||
this.initStyle()
|
||||
this.resultFormat()
|
||||
window.onresize = function() {
|
||||
that.calcHeight()
|
||||
}
|
||||
@ -220,6 +223,24 @@ export default {
|
||||
this.label_content_class.color = valueColor
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
resultFormat() {
|
||||
const value = this.chart.data.series[0].data[0]
|
||||
let yAxis = []
|
||||
try {
|
||||
yAxis = JSON.parse(this.chart.yaxis)
|
||||
} catch (err) {
|
||||
yAxis = JSON.parse(JSON.stringify(this.chart.yaxis))
|
||||
}
|
||||
const f = yAxis[0]
|
||||
if (f && f.formatterCfg) {
|
||||
const v = valueFormatter(value, f.formatterCfg)
|
||||
this.result = v.includes('NaN') ? value : v
|
||||
} else {
|
||||
const v = valueFormatter(value, formatterItem)
|
||||
this.result = v.includes('NaN') ? value : v
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user