mirror of
https://github.com/dataease/dataease.git
synced 2025-02-24 19:42:56 +08:00
perf(图表): 水波图和仪表盘无数据不渲染
This commit is contained in:
parent
406167735a
commit
d3330e35a4
@ -50,14 +50,15 @@ export class Liquid extends G2PlotChartView<LiquidOptions, G2Liquid> {
|
|||||||
|
|
||||||
drawChart(drawOptions: G2PlotDrawOptions<G2Liquid>): G2Liquid {
|
drawChart(drawOptions: G2PlotDrawOptions<G2Liquid>): G2Liquid {
|
||||||
const { chart, container } = drawOptions
|
const { chart, container } = drawOptions
|
||||||
if (chart?.data) {
|
if (!chart.data?.series) {
|
||||||
const initOptions: LiquidOptions = {
|
return
|
||||||
percent: 0
|
|
||||||
}
|
|
||||||
const options = this.setupOptions(chart, initOptions)
|
|
||||||
// 开始渲染
|
|
||||||
return new G2Liquid(container, options)
|
|
||||||
}
|
}
|
||||||
|
const initOptions: LiquidOptions = {
|
||||||
|
percent: 0
|
||||||
|
}
|
||||||
|
const options = this.setupOptions(chart, initOptions)
|
||||||
|
// 开始渲染
|
||||||
|
return new G2Liquid(container, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected configTheme(chart: Chart, options: LiquidOptions): LiquidOptions {
|
protected configTheme(chart: Chart, options: LiquidOptions): LiquidOptions {
|
||||||
|
@ -65,40 +65,41 @@ export class Gauge extends G2PlotChartView<GaugeOptions, G2Gauge> {
|
|||||||
|
|
||||||
drawChart(drawOptions: G2PlotDrawOptions<G2Gauge>): G2Gauge {
|
drawChart(drawOptions: G2PlotDrawOptions<G2Gauge>): G2Gauge {
|
||||||
const { chart, container, scale } = drawOptions
|
const { chart, container, scale } = drawOptions
|
||||||
if (chart?.data) {
|
if (!chart.data?.series) {
|
||||||
// options
|
return
|
||||||
const initOptions: GaugeOptions = {
|
}
|
||||||
percent: 0,
|
// options
|
||||||
appendPadding: getPadding(chart),
|
const initOptions: GaugeOptions = {
|
||||||
axis: {
|
percent: 0,
|
||||||
tickInterval: 0.2,
|
appendPadding: getPadding(chart),
|
||||||
label: {
|
axis: {
|
||||||
style: {
|
tickInterval: 0.2,
|
||||||
fontSize: getScaleValue(12, scale) // 刻度值字体大小
|
label: {
|
||||||
},
|
style: {
|
||||||
formatter: function (v) {
|
fontSize: getScaleValue(12, scale) // 刻度值字体大小
|
||||||
const r = parseFloat(v)
|
|
||||||
return v === '0' || !r ? v : r * 100 + '%'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
tickLine: {
|
formatter: function (v) {
|
||||||
length: getScaleValue(12, scale) * -1, // 刻度线长度
|
const r = parseFloat(v)
|
||||||
style: {
|
return v === '0' || !r ? v : r * 100 + '%'
|
||||||
lineWidth: getScaleValue(1, scale) // 刻度线宽度
|
}
|
||||||
}
|
},
|
||||||
},
|
tickLine: {
|
||||||
subTickLine: {
|
length: getScaleValue(12, scale) * -1, // 刻度线长度
|
||||||
count: 4, // 子刻度数
|
style: {
|
||||||
length: getScaleValue(6, scale) * -1, // 子刻度线长度
|
lineWidth: getScaleValue(1, scale) // 刻度线宽度
|
||||||
style: {
|
}
|
||||||
lineWidth: getScaleValue(1, scale) // 子刻度线宽度
|
},
|
||||||
}
|
subTickLine: {
|
||||||
|
count: 4, // 子刻度数
|
||||||
|
length: getScaleValue(6, scale) * -1, // 子刻度线长度
|
||||||
|
style: {
|
||||||
|
lineWidth: getScaleValue(1, scale) // 子刻度线宽度
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const options = this.setupOptions(chart, initOptions, scale)
|
|
||||||
return new G2Gauge(container, options)
|
|
||||||
}
|
}
|
||||||
|
const options = this.setupOptions(chart, initOptions, scale)
|
||||||
|
return new G2Gauge(container, options)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected configMisc(chart: Chart, options: GaugeOptions): GaugeOptions {
|
protected configMisc(chart: Chart, options: GaugeOptions): GaugeOptions {
|
||||||
|
Loading…
Reference in New Issue
Block a user