Compare commits

..

No commits in common. "880eb26a994f0573380b0ec95ea0818044f15224" and "6f77df0f61ed641fe36ec829f9e9a449a5c37d54" have entirely different histories.

2 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,7 @@
<div *ngIf="showHistogram()">
<span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">
</span>
<span *ngIf="getPercentage(layer.renderer,i) as percentage" class="bar-label">{{percentage | number:'1.0-2'}}</span>
<span class="bar-label">{{getLabel(layer.renderer,i)}}</span>
</div>
</td>
</tr>

View File

@ -78,10 +78,10 @@ export class LegendComponent implements OnInit,AfterViewInit {
return v;
}
public getPercentage(renderer: IRenderer, index: number): number {
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;
return percent < 0.1 ? null : percent;
return percent < 0.1 ? "" : percent.toFixed(1) + " %";
}
showLegend(): boolean {