Commit a2a6456b authored by Jenny's avatar Jenny

feat: 横向柱状图根据数据动态 resize

parent 9dc543b0
...@@ -115,6 +115,11 @@ ...@@ -115,6 +115,11 @@
option.series = dealSeries option.series = dealSeries
// 重新setOption,使得设置的formatter生效 // 重新setOption,使得设置的formatter生效
chart.setOption(option) chart.setOption(option)
if(Number(dealSeries[0].barWidth)) {
const height = categories.length * (Number(dealSeries[0].barWidth) + 5) + 25
uni.$emit('handleUpdateHeight', height)
chart.resize({ width: chart.getWidth(), height })
}
} }
if(preview) { if(preview) {
this.cacheImages(images) this.cacheImages(images)
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
]" ]"
:style="{ :style="{
width: `${parseInt(element.width * scale)}px`, width: `${parseInt(element.width * scale)}px`,
height: `${parseInt(element.height * scale)}px`, height: `${element.type == 'HorizontalBar' && horizontalBarHeight ? horizontalBarHeight : parseInt(element.height * scale)}px`,
left: `${parseInt(element.left * scale)}px`, left: `${parseInt(element.left * scale)}px`,
top: `${parseInt(element.top * scale)}px`, top: `${parseInt(element.top * scale)}px`,
zIndex: `${element.type == 'NormalTabs' || element.type == 'DateTimePicker' ? 999999 : index + 1}` zIndex: `${element.type == 'NormalTabs' || element.type == 'DateTimePicker' ? 999999 : index + 1}`
...@@ -69,7 +69,8 @@ ...@@ -69,7 +69,8 @@
reportInfo: {}, reportInfo: {},
timename: null, timename: null,
pageScrollTop: 0, pageScrollTop: 0,
stickyTables: [] // 设置了吸顶的table stickyTables: [], // 设置了吸顶的table
horizontalBarHeight: 0
} }
}, },
computed: { computed: {
...@@ -138,12 +139,16 @@ ...@@ -138,12 +139,16 @@
}) })
} }
}) })
uni.$on('handleUpdateHeight', (height) => {
that.horizontalBarHeight = height
})
}, },
onHide() { onHide() {
// 移除监听事件 // 移除监听事件
uni.$off('handleLinkParams') uni.$off('handleLinkParams')
uni.$off('handleLinkComp') uni.$off('handleLinkComp')
uni.$off('handleDataZoomParams') uni.$off('handleDataZoomParams')
uni.$off('handleUpdateHeight')
clearInterval(this.timename) clearInterval(this.timename)
}, },
methods: { methods: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment