AW-2388 Fixed mixed decimal in histogram
This commit is contained in:
parent
6f77df0f61
commit
bcfa13de60
@ -23,7 +23,7 @@
|
|||||||
<div *ngIf="showHistogram()">
|
<div *ngIf="showHistogram()">
|
||||||
<span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">
|
<span class="bar" [style.background-color]="getHex(entry.color)" [style.width]="getPart(layer.renderer, i)">
|
||||||
</span>
|
</span>
|
||||||
<span class="bar-label">{{getLabel(layer.renderer,i)}}</span>
|
<span *ngIf="getPercentage(layer.renderer,i) as percentage" class="bar-label">{{percentage | number:'1.0-2'}}</span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -78,10 +78,10 @@ export class LegendComponent implements OnInit,AfterViewInit {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getLabel(renderer: IRenderer, index: number): string {
|
public getLabel(renderer: IRenderer, index: number): number {
|
||||||
let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
|
let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
|
||||||
let percent = renderer.band.histogram.entries[index].freqency * scale;
|
let percent = renderer.band.histogram.entries[index].freqency * scale;
|
||||||
return percent < 0.1 ? "" : percent.toFixed(1) + " %";
|
return percent < 0.1 ? null : percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
showLegend(): boolean {
|
showLegend(): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user