forked from github/dataease
fix(视图-对称条形图): 修复对称条形图类别轴字段类型为时间时排序异常
https://www.tapd.cn/55578866/bugtrace/bugs/view/1155578866001026505
This commit is contained in:
parent
e5aea4df89
commit
4a25debcbb
@ -9,7 +9,8 @@ import {
|
||||
getPadding,
|
||||
getSlider,
|
||||
getAnalyse,
|
||||
setGradientColor
|
||||
setGradientColor,
|
||||
getMeta
|
||||
} from '@/views/chart/chart/common/common_antv'
|
||||
import { antVCustomColor, handleEmptyDataStrategy } from '@/views/chart/chart/util'
|
||||
import _ from 'lodash'
|
||||
@ -319,6 +320,11 @@ export function baseBidirectionalBarOptionAntV(plot, container, chart, action, i
|
||||
handleEmptyDataStrategy(emptyDataStrategy, chart, data, options)
|
||||
}
|
||||
|
||||
// meta,处理类别轴数据类型为时间时排序失效
|
||||
const meta = getMeta(chart)
|
||||
if (meta) {
|
||||
options.meta = meta
|
||||
}
|
||||
// 开始渲染
|
||||
if (plot) {
|
||||
plot.destroy()
|
||||
|
@ -966,3 +966,20 @@ export function setGradientColor(rawColor, show = false, angle = 0) {
|
||||
item.splice(3, 1, '0.3)')
|
||||
return show ? `l(${angle}) 0:${item.join(',')} 1:${rawColor}` : rawColor
|
||||
}
|
||||
|
||||
export function getMeta(chart) {
|
||||
let meta
|
||||
if (chart.type === 'bidirectional-bar') {
|
||||
const xAxis = JSON.parse(chart.xaxis)
|
||||
if (xAxis?.length === 1 && xAxis[0].deType === 1) {
|
||||
const values = chart.data.data.map(item => item.field)
|
||||
meta = {
|
||||
field: {
|
||||
type: 'cat',
|
||||
values: values.reverse()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return meta
|
||||
}
|
||||
|
@ -1582,7 +1582,6 @@ export const TYPE_CONFIGS = [
|
||||
'x-axis-selector-ant-v': [
|
||||
'show',
|
||||
'position',
|
||||
'name',
|
||||
'nameTextStyle',
|
||||
'splitLine',
|
||||
'axisForm',
|
||||
|
@ -983,12 +983,7 @@
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row
|
||||
v-if="view.type
|
||||
&& !(view.type.includes('table') && view.render === 'echarts')
|
||||
&& !view.type.includes('text') && !view.type.includes('gauge')
|
||||
&& view.type !== 'liquid' && view.type !== 'word-cloud'
|
||||
&& view.type !== 'table-pivot' && view.type !=='label'
|
||||
&& view.type !=='richTextView' && view.type !== 'flow-map'"
|
||||
v-if="showDrill"
|
||||
class="padding-lr"
|
||||
style="margin-top: 6px;"
|
||||
>
|
||||
@ -1990,6 +1985,13 @@ export default {
|
||||
equalsAny(this.view.type, 'text', 'label') ||
|
||||
(this.view.render === 'antv' && this.view.type.includes('table'))
|
||||
},
|
||||
showDrill() {
|
||||
return this.view.type &&
|
||||
!(this.view.type.includes('table') && this.view.render === 'echarts') &&
|
||||
!includesAny(this.view.type, 'text', 'gauge') &&
|
||||
!equalsAny(this.view.type, 'liquid', 'bidirectional-bar',
|
||||
'word-cloud', 'table-pivot', 'label', 'richTextView', 'flow-map')
|
||||
},
|
||||
...mapState([
|
||||
'curComponent',
|
||||
'panelViewEditInfo',
|
||||
|
Loading…
Reference in New Issue
Block a user