fix bug
This commit is contained in:
@ -75,6 +75,11 @@ export class DatatableBusiindexComponent implements OnInit {
|
||||
} else if(this.mode === 'month') {
|
||||
type = 2
|
||||
}
|
||||
if(this.modeNext === 'year') {
|
||||
type = 1
|
||||
} else if(this.modeNext === 'month') {
|
||||
type = 2
|
||||
}
|
||||
const params: any = {
|
||||
time: this.timeNext,
|
||||
type
|
||||
@ -83,8 +88,8 @@ export class DatatableBusiindexComponent implements OnInit {
|
||||
if (res) {
|
||||
this.chartData = res
|
||||
if(flag) {
|
||||
this.pillar.reRender()
|
||||
this.curve.reRender()
|
||||
// this.pillar.reRender()
|
||||
// this.curve.reRender()
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -112,9 +117,9 @@ export class DatatableBusiindexComponent implements OnInit {
|
||||
}
|
||||
|
||||
changeDataNext() {
|
||||
if(this.mode === 'year') {
|
||||
if(this.modeNext === 'year') {
|
||||
this.dateFormat = 'yyyy'
|
||||
} else if(this.mode === 'month') {
|
||||
} else if(this.modeNext === 'month') {
|
||||
this.dateFormat = 'yyyy-MM'
|
||||
}
|
||||
}
|
||||
@ -122,10 +127,15 @@ export class DatatableBusiindexComponent implements OnInit {
|
||||
if(result === null) {
|
||||
return
|
||||
}
|
||||
if(this.mode === 'year') {
|
||||
console.log(this.mode);
|
||||
if(this.modeNext === 'year') {
|
||||
this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy') + '-01-01 00:00:00']
|
||||
} else if(this.mode === 'month') {
|
||||
} else if(this.modeNext === 'month') {
|
||||
this.timeNext = [this.datePipe.transform(this.dateNext, 'yyyy-MM') + '-01 00:00:00']
|
||||
|
||||
console.log(this.dateNext);
|
||||
console.log(this.timeNext);
|
||||
|
||||
}
|
||||
this.initData(true)
|
||||
}
|
||||
|
||||
@ -15,9 +15,9 @@ export class BusitableCurveComponent implements OnInit, OnChanges {
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (this.chartData) {
|
||||
// setTimeout(()=>{
|
||||
// this.chart.render(true)
|
||||
// }, 1000)
|
||||
setTimeout(()=>{
|
||||
this.chart.render(true)
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
}
|
||||
@ -48,25 +48,23 @@ export class BusitableCurveComponent implements OnInit, OnChanges {
|
||||
year: {
|
||||
range: [0, 1],
|
||||
},
|
||||
value: {
|
||||
min: 0,
|
||||
number: {
|
||||
min: -9999,
|
||||
nice: true,
|
||||
},
|
||||
});
|
||||
this.chart.axis('value', {
|
||||
label: {
|
||||
formatter: (val: any) => {
|
||||
return val;
|
||||
},
|
||||
},
|
||||
});
|
||||
const itemTpl = `
|
||||
<div style="padding: 15px; color: red">
|
||||
环比: {value}%
|
||||
</div>
|
||||
`
|
||||
this.chart.tooltip({
|
||||
showCrosshairs: true, // 展示 Tooltip 辅助线
|
||||
shared: true,
|
||||
});
|
||||
|
||||
this.chart.line().position('time*value').label('value');
|
||||
this.chart.point().position('time*value');
|
||||
itemTpl: itemTpl
|
||||
});
|
||||
this.chart.line().position('time*number').label('number');
|
||||
this.chart.point().position('time*number');
|
||||
|
||||
this.chart.render();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user