解决冲突

This commit is contained in:
wangshiming
2022-04-07 15:33:04 +08:00
parent d2e8926ca6
commit 5f9f2e3861
3 changed files with 55 additions and 26 deletions

View File

@ -20,7 +20,11 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
constructor(private service: DataService, private ngZone: NgZone) {}
ngOnChanges(changes: SimpleChanges): void {
if (this.chartData) {
if (changes.chartData && !changes.chartData.isFirstChange()) {
this.userData = changes.chartData.currentValue;
console.log(this.userView);
this.userView.source(this.userData)
// setTimeout(()=>{
// this.chart.render(true)
// }, 1000)
@ -49,7 +53,7 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
this.chart = new Chart({
container: el,
autoFit: true,
height: 700,
height: 680,
padding: [0, 0]
});
this.chart.tooltip({
@ -87,17 +91,21 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
});
// 可视化用户数据
this.userData = [
{ name: '山东', value: 21 },
{ name: '山东', value: 22},
{ name: '广东', value: 20, },
{ name: '广东', value: 20 },
{ name: '四川', value: 120 },
{ name: '湖南', value: 200 },
{ name: '河北', value: 30 },
];
this.userDv = this.ds.createView().source(this.userData).transform({
this.userData = this.chartData
console.log(this.userData);
// let value: any = []
// this.service.request(this.service.$api_getTransactionDistribution).subscribe((res: any) => {
// if(res) {
// res.forEach((element: any) => {
// value.push({
// name: element.province,
// value: element.weight,
// });
// });
// console.log(value);
// this.userData = value
this.userDv = this.ds.createView().source(this.userData).transform({
geoDataView: this.worldMap,
field: 'name',
type: 'geo.region',
@ -105,6 +113,7 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
}).transform({
type: 'map',
callback: (obj: { trend: string; value: number }) => {
console.log(this.userData);
obj.trend = obj.value > 100 ? '蓝色地区' : '红色地区';
return obj;
@ -117,9 +126,6 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
// alias: '蓝色地区数量'
// }
// });
console.log(this.userView);
console.log('45545');
this.userView.polygon().position('longitude*latitude').color('trend', ['#000', '#76ddb2']).tooltip('').style({fillOpacity: 0.85 })
// .animate({
// leave: {
@ -128,13 +134,10 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges {
// });
this.userView.interaction('element-active');
this.chart.render();
// }
// });
});
console.log('9999');
})
}
}