@ministryofjustice/hmpps-digital-prison-reporting-frontend
Version:
The Digital Prison Reporting Frontend contains templates and code to help display data effectively in UI applications.
39 lines (38 loc) • 1.59 kB
TypeScript
import { ScorecardDefinitionType } from '../../../_dashboards/scorecard/types';
import { ScorecardGroupDefinitionType } from '../../../_dashboards/scorecard-group/types';
import { DashboardDataResponse } from '../../../../types/Metrics';
import { DashboardVisualisationBucket } from '../../../_dashboards/dashboard-visualisation/types';
import { MatrixTimeseriesDefinitionType } from '../heatmap/types';
type DefinitionsWithBuckets = MatrixTimeseriesDefinitionType | ScorecardGroupDefinitionType | ScorecardDefinitionType;
declare class Buckets {
private baseColour;
private ragColours;
private buckets;
private useRagColour;
private bucketCount;
private onlyBucketColoursDefined;
private autoBucketing;
private hasRagScore;
private valueKey;
private options;
responseData: DashboardDataResponse[];
constructor(responseData: DashboardDataResponse[], definition: DefinitionsWithBuckets, valueKey: string, autoBucketing?: boolean, ragColours?: string[]);
private initFromOptions;
private initBuckets;
private initCustomThresholdBuckets;
/**
* Initialises the bucket thresholds by defining the range between the min and max
* and dividing into 3 equal parts
*/
private initAutomaticThresholdBucket;
private initBucketColours;
private setAutomaticThresholdSize;
private setBucketCount;
getBucketForValue: (value: number, ragScore?: number) => {
colour: string;
score: number;
};
getBuckets: () => DashboardVisualisationBucket[];
}
export { Buckets };
export default Buckets;