forked from github/dataease
Merge pull request #10114 from dataease/pr@dev-v2@refactor_area_null_data
refactor(图表): 面积图无数据不渲染
This commit is contained in:
commit
b42c06c4df
@ -86,24 +86,25 @@ export class Area extends G2PlotChartView<AreaOptions, G2Area> {
|
||||
|
||||
drawChart(drawOptions: G2PlotDrawOptions<G2Area>): G2Area {
|
||||
const { chart, container, action } = drawOptions
|
||||
if (chart?.data) {
|
||||
// data
|
||||
const data = cloneDeep(chart.data.data)
|
||||
|
||||
const initOptions: AreaOptions = {
|
||||
...this.baseOptions,
|
||||
data,
|
||||
appendPadding: getPadding(chart)
|
||||
}
|
||||
// options
|
||||
const options = this.setupOptions(chart, initOptions)
|
||||
// 开始渲染
|
||||
const newChart = new G2Area(container, options)
|
||||
|
||||
newChart.on('point:click', action)
|
||||
|
||||
return newChart
|
||||
if (!chart.data.data?.length) {
|
||||
return
|
||||
}
|
||||
// data
|
||||
const data = cloneDeep(chart.data.data)
|
||||
|
||||
const initOptions: AreaOptions = {
|
||||
...this.baseOptions,
|
||||
data,
|
||||
appendPadding: getPadding(chart)
|
||||
}
|
||||
// options
|
||||
const options = this.setupOptions(chart, initOptions)
|
||||
// 开始渲染
|
||||
const newChart = new G2Area(container, options)
|
||||
|
||||
newChart.on('point:click', action)
|
||||
|
||||
return newChart
|
||||
}
|
||||
|
||||
protected configLabel(chart: Chart, options: AreaOptions): AreaOptions {
|
||||
|
Loading…
Reference in New Issue
Block a user