aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar/model/binRanges/VisualBinRange.ts
blob: 449a22e9101ba307362bd29d4785b3919ffa1d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { BinLabel } from '../../model/idea/idea';

export abstract class VisualBinRange {

    public abstract AddStep(value: number): number;

    public abstract GetValueFromIndex(index: number): number;

    public abstract GetBins(): Array<number>;

    public GetLabel(value: number): string {
        return value.toString();
    }

    public GetLabels(): Array<BinLabel> {
        var labels = new Array<BinLabel>();
        var bins = this.GetBins();
        bins.forEach(b => {
            labels.push(new BinLabel({
                value: b,
                minValue: b,
                maxValue: this.AddStep(b),
                label: this.GetLabel(b)
            }));
        });
        return labels;
    }
}

export enum ChartType {
    HorizontalBar = 0, VerticalBar = 1, HeatMap = 2, SinglePoint = 3
}