From dd138f1168f38ec1dcd7d3d1292a6ee9e6e13a36 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Tue, 7 Apr 2020 08:51:31 +0200 Subject: [PATCH] Use scale in legend --- .../src/fm-map/components/legend/legend.component.html | 2 +- .../src/fm-map/components/legend/legend.component.ts | 8 ++++++++ projects/common-map/src/fm-map/models/color.map.ts | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/common-map/src/fm-map/components/legend/legend.component.html b/projects/common-map/src/fm-map/components/legend/legend.component.html index b9f79fa..a4abe42 100644 --- a/projects/common-map/src/fm-map/components/legend/legend.component.html +++ b/projects/common-map/src/fm-map/components/legend/legend.component.html @@ -15,7 +15,7 @@ - {{entry.value | number:'1.0-2'}} {{legendunit}}{{entry.label}} + {{getValue(entry.value,layer.scale) | number:'1.0-2'}} {{legendunit}}{{entry.label}}
diff --git a/projects/common-map/src/fm-map/components/legend/legend.component.ts b/projects/common-map/src/fm-map/components/legend/legend.component.ts index 27b8af8..305ecb7 100644 --- a/projects/common-map/src/fm-map/components/legend/legend.component.ts +++ b/projects/common-map/src/fm-map/components/legend/legend.component.ts @@ -65,6 +65,14 @@ export class LegendComponent implements OnInit,AfterViewInit { return part; } + public getValue(value:number,scale:number):number { + let v = value; + if(scale && scale != 0) { + v=scale*value; + } + return v; + } + public getLabel(renderer: IRenderer, index: number): string { let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0); let percent = renderer.band.histogram.entries[index].freqency * scale; diff --git a/projects/common-map/src/fm-map/models/color.map.ts b/projects/common-map/src/fm-map/models/color.map.ts index 6cd8ddd..caa9642 100644 --- a/projects/common-map/src/fm-map/models/color.map.ts +++ b/projects/common-map/src/fm-map/models/color.map.ts @@ -67,6 +67,7 @@ export interface ILayer { name: string, unit: string, index: number, + scale: number, renderer: IRenderer, rendering: IRenderoutput }