Renamed prefixes in angular.json
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
|
||||
import { IColorMap, IColor, IColorEntry,ILayer } from '../../models';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'fm-map-layer-legend',
|
||||
templateUrl: './legend.component.html',
|
||||
styleUrls: ['./legend.component.scss']
|
||||
})
|
||||
export class LegendComponent implements OnInit,AfterViewInit {
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
}
|
||||
|
||||
@Input()
|
||||
layer: ILayer;
|
||||
|
||||
@Input()
|
||||
legend: string;
|
||||
|
||||
@Input()
|
||||
histogram: string;
|
||||
|
||||
@Input()
|
||||
showTitle: boolean = true;
|
||||
|
||||
@Input()
|
||||
histogramenabled: boolean;
|
||||
|
||||
@Input()
|
||||
legendunit: string;
|
||||
|
||||
@Input()
|
||||
histogramunit: string;
|
||||
|
||||
|
||||
onClickHistoGram(): void {
|
||||
this.histogramenabled = !this.histogramenabled;
|
||||
}
|
||||
|
||||
public getHex(color: IColor): string {
|
||||
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
|
||||
}
|
||||
|
||||
public componentToHex(c: number): string {
|
||||
const hex = c.toString(16);
|
||||
return hex.length === 1 ? `0${hex}` : hex;
|
||||
}
|
||||
|
||||
private getPart(colorMap: IColorMap, colorEntry: IColorEntry): string {
|
||||
let sumOfValue = colorMap.entries.reduce((sum, item) => sum + item.value, 0);
|
||||
let part = ((colorEntry.value / sumOfValue) * 100) + "%";
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user