@obliczeniowo/elementary
Version:
Library made in Angular version 20
99 lines (94 loc) • 3.63 kB
TypeScript
import * as i0 from '@angular/core';
import { Renderer2, EventEmitter, ElementRef, SimpleChanges } from '@angular/core';
import { DrawingContextInterface, DrawingSvgInterface } from '@obliczeniowo/elementary/drawing';
import { Point2D, ColorType } from '@obliczeniowo/elementary/classes';
import { ControlValueAccessor } from '@angular/forms';
import * as i2 from '@angular/common';
interface RadarGroup {
values: number[];
stroke: number;
color: ColorType | 'none';
fill: ColorType | 'none';
opacity?: number;
}
declare class Radar {
private ctx;
private levels;
private categories;
private groups;
private size;
private greedColor;
closestSet?: {
closest: Point2D;
category: number;
newLevel: number;
};
constructor(ctx: DrawingContextInterface, levels?: number | (string | number)[], categories?: string[], groups?: RadarGroup[], size?: number);
getCenter(): Point2D;
getRay(): number;
getMaxLevel(): number;
getDRawy(): number;
getDAngle(): number;
draw(ctx?: DrawingContextInterface): void;
onMove(point: Point2D): void;
getClosest(point: Point2D): {
closest: Point2D;
category: number;
newLevel: number;
};
clicked(point: Point2D): null | RadarGroup;
}
declare class RadarPickerComponent implements ControlValueAccessor {
protected renderer: Renderer2;
protected dc: DrawingSvgInterface;
protected radar: Radar;
protected mousePos?: Point2D;
/**
* as number describe how many of levels should exist and then build levels from 1 to given number
* as array length describe number of levels that starts from 1 to levels.length and value inside of
* array is something to display
*/
levels: number | (number | string)[];
/**
* Categories list as string
*/
categories: string[];
/**
* values and connected to them colors
* values.values.length must be equal categories.length
*/
values: RadarGroup;
changed: EventEmitter<RadarGroup>;
readonly size = 500;
diagram: ElementRef<SVGSVGElement>;
disabled?: any;
onChange: (set: {
values: RadarGroup;
categories: string[];
levels: number | (string | number)[];
}) => void;
onTouched: () => void;
constructor(renderer: Renderer2);
ngAfterViewInit(): void;
draw(dc?: DrawingContextInterface): void;
ngOnChanges(changes: SimpleChanges): void;
move(event: any): void;
clicked(event: any): void;
writeValue(set: {
values: RadarGroup;
categories: string[];
levels: number;
}): void;
registerOnChange(onChange: any): void;
registerOnTouched(onTouched: any): void;
setDisabledState(isDisabled: boolean): void;
onMouseLeave(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<RadarPickerComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<RadarPickerComponent, "obl-radar-picker", never, { "levels": { "alias": "levels"; "required": false; }; "categories": { "alias": "categories"; "required": false; }; "values": { "alias": "values"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "changed": "changed"; }, never, never, false, never>;
}
declare class RadarModule {
static ɵfac: i0.ɵɵFactoryDeclaration<RadarModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<RadarModule, [typeof RadarPickerComponent], [typeof i2.CommonModule], [typeof RadarPickerComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<RadarModule>;
}
export { RadarModule, RadarPickerComponent };