Use scale in legend
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-04-07 08:51:31 +02:00
parent 1b165c3575
commit dd138f1168
3 changed files with 10 additions and 1 deletions

View File

@ -15,7 +15,7 @@
</tr>
<tr *ngFor="let entry of layer.renderer.colorMap.entries; let i = index ">
<td class="legend-items"><span [style.background-color]="getHex(entry.color)" class="color"></span></td>
<td class="legend-items-text"><span *ngIf="!entry.label">{{entry.value | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
<td class="legend-items-text"><span *ngIf="!entry.label">{{getValue(entry.value,layer.scale) | number:'1.0-2'}} {{legendunit}}</span><span *ngIf="entry.label">{{entry.label}}</span></td>
<td class="histogram-items">
<div *ngIf="showHistogram()">
<span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">

View File

@ -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;

View File

@ -67,6 +67,7 @@ export interface ILayer {
name: string,
unit: string,
index: number,
scale: number,
renderer: IRenderer,
rendering: IRenderoutput
}