export class Dataset
{
    constructor (
        public unit: string,
        public data: Data[]
    ) { }

    getLatest()
    {
        if (this.data.length > 0)
        {
            return this.data.toSorted((lower, higher) =>  new Date(higher.label).getTime() - new Date(lower.label).getTime()).at(this.data.length - 1);
        }
        return undefined;
    }
}

export class Data
{
    constructor (
        public value: number,
        public label: Date
    ) { }
}