This commit is contained in:
wangshiming
2022-04-14 14:52:48 +08:00
parent e6a451c0a5
commit 461bf39813
9 changed files with 61 additions and 72 deletions

View File

@ -95,8 +95,8 @@ export class DatatableCustomindexMapComponent implements OnInit, OnChanges, Afte
if(res) {
res.forEach((element: any) => {
value.push({
name: element.province,
value: element.weight,
'省份': element.province,
'订单数': element.weight,
});
});
console.log(value);
@ -107,17 +107,19 @@ if (!(this.userData instanceof Array) || this.userData.length === 0) {
}
this.userDv = this.ds.createView().source(this.userData).transform({
geoDataView: this.worldMap,
field: 'name',
field: '省份',
type: 'geo.region',
as: ['longitude', 'latitude']
}).transform({
type: 'map',
callback: (obj: { trend: string; value: number }) => {
if(obj.value < 500) {
callback: (obj: { trend: string; 订单数: number }) => {
console.log(obj);
if(obj. < 500) {
obj.trend = '500以下';
} else if(obj.value >= 500 && obj.value < 1000){
} else if(obj. >= 500 && obj. < 1000){
obj.trend = '500-1000';
} else if(obj.value >= 1000 ){
} else if(obj. >= 1000 ){
obj.trend = '>1000';
}
return obj;
@ -127,13 +129,13 @@ if (!(this.userData instanceof Array) || this.userData.length === 0) {
this.userView.data(this.userDv.rows);
this.userView.scale({
trend: {
alias: '蓝色地区数量'
alias: '订单交易数量'
}
});
console.log(this.userView);
console.log('45545');
this.userView.polygon().position('longitude*latitude').color('trend', ['#0a3f80', '#1b6aca', '#5d93d4']).tooltip('name*trend*value').style({fillOpacity: 0.85 })
this.userView.polygon().position('longitude*latitude').color('trend', ['#0a3f80', '#1b6aca', '#5d93d4']).tooltip('省份*订单数').style({fillOpacity: 0.85 })
.animate({
leave: {
animation: 'fade-out'