fix:修复3D组件颜色配置后修改数据集颜色失效问题

main
zhu.yawen 2 years ago
parent 38bf04fd63
commit 789a408c27

@ -74,7 +74,17 @@ export default {
}
},
mounted () {
const dragSelect = document.querySelector('#' + this.chatId)
const resizeObserver = new ResizeObserver(entries => {
if (this.chart) {
this.chart.resize()
let config = this.observeChart(entries)
config = this.seriesStyle(config)
config.option && this.chart.setOption(config.option)
}
// const config = this.observeChart(entries)
})
resizeObserver.observe(dragSelect)
},
beforeDestroy () {
if (this.chart) {
@ -118,31 +128,21 @@ export default {
const chartDom = document.getElementById(this.chatId)
this.chart = echarts.init(chartDom)
config.option && this.chart.setOption(config.option)
this.observeChart(chartDom, this.chart)
},
/**
* 控制底部阴影大小
*/
observeChart (container, myChart) {
const resizeObserver = new ResizeObserver(entries => {
myChart.resize()
// entries[0].contentRect.width:
// entries[0].contentRect.height:
const width = entries[0].contentRect.width
const height = entries[0].contentRect.height
const option = this.config.option
//
option.graphic.children[0].shape.width = width * 0.9
//
option.graphic.children[1].shape.points = [
[width / 10, -height / 6],
[width - width / 6, -height / 6],
[width * 0.9, 0],
[0, 0]
]
myChart.setOption(option)
})
resizeObserver.observe(container)
observeChart (entries) {
// entries[0].contentRect.width:
// entries[0].contentRect.height:
const width = entries[0].contentRect.width
const height = entries[0].contentRect.height
const option = this.config.option
//
option.graphic.children[0].shape.width = width * 0.9
//
option.graphic.children[1].shape.points = [[width / 10, -height / 6], [width - width / 6, -height / 6], [width * 0.9, 0], [0, 0]]
return this.config
},
/**
* 注册事件
@ -237,7 +237,6 @@ export default {
return config
},
dataFormatting (config, data) {
console.log('config', config);
// config = this.config
//
if (data.success) {

Loading…
Cancel
Save