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] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=94=B9=E4=B8=BA=E5=A4=A9?= =?UTF-8?q?=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'); }