From dae5ad2fc75e2c964297c1547e533e05dea6a6d5 Mon Sep 17 00:00:00 2001 From: jingbowen <970029315@qq.com> Date: Fri, 3 Mar 2023 16:07:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=A4=A9=E5=9C=B0=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statistic-analysis/home/home.component.ts | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/app/home/statistic-analysis/home/home.component.ts b/src/app/home/statistic-analysis/home/home.component.ts index 3e26292..b1d9561 100644 --- a/src/app/home/statistic-analysis/home/home.component.ts +++ b/src/app/home/statistic-analysis/home/home.component.ts @@ -834,8 +834,8 @@ export class HomeComponent implements OnInit { // }); // }); // } - countries = []; map; + mapInit() { var T = window['T']; var d3 = window['d3']; @@ -855,6 +855,31 @@ export class HomeComponent implements OnInit { ); function init(sel, transform) { + let colors = [ + {h:'319',s:0.85,l:0.56}, + {h:'268',s:0.79,l:0.71}, + {h:'287',s:0.79,l:0.54}, + {h:'247',s:0.80,l:0.67}, + {h:'206',s:0.85,l:0.57}, + {h:'220',s:0.43,l:0.64}, + {h:'176',s:0.86,l:0.89}, + {h:'186',s:0.72,l:0.57}, + {h:'200',s:0.8,l:0.69}, + {h:'319',s:0.85,l:0.56}, + {h:'268',s:0.79,l:0.71}, + {h:'287',s:0.79,l:0.54}, + ]; + // let colors = [ + // '#EE30B3', + // '#B37CF0', + // '#BD2CE6', + // '#7768EE', + // '#359EEF', + // '#7B95CA', + // '#CAFBF8', + // '#43D0E1', + // '#72C6EF', + // ]; var upd = sel.selectAll('path.geojson').data(countries); upd .enter() @@ -862,7 +887,7 @@ export class HomeComponent implements OnInit { .attr('class', 'geojson') .attr('stroke', 'black') .attr('fill', function (d, i) { - return d3.hsl(Math.random() * 360, 0.9, 0.5); + return d3.hsl(colors[i].h, colors[i].s, colors[i].l); }) .attr('fill-opacity', '0.5'); } From ed2b617e77fe3ca94daba6f9680391ddf7a6fa80 Mon Sep 17 00:00:00 2001 From: jingbowen <970029315@qq.com> Date: Sat, 4 Mar 2023 08:00:24 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E6=94=B9=E4=B8=BA=E5=9B=BA=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/statistic-analysis/home/home.component.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/app/home/statistic-analysis/home/home.component.ts b/src/app/home/statistic-analysis/home/home.component.ts index b1d9561..eb5c939 100644 --- a/src/app/home/statistic-analysis/home/home.component.ts +++ b/src/app/home/statistic-analysis/home/home.component.ts @@ -869,17 +869,7 @@ export class HomeComponent implements OnInit { {h:'268',s:0.79,l:0.71}, {h:'287',s:0.79,l:0.54}, ]; - // let colors = [ - // '#EE30B3', - // '#B37CF0', - // '#BD2CE6', - // '#7768EE', - // '#359EEF', - // '#7B95CA', - // '#CAFBF8', - // '#43D0E1', - // '#72C6EF', - // ]; + var upd = sel.selectAll('path.geojson').data(countries); upd .enter()