ng-chartjs
Version:
This is a Angular chart.js library.
61 lines (60 loc) • 2.58 kB
TypeScript
import { OnDestroy, OnInit, OnChanges, EventEmitter, ElementRef, SimpleChanges, NgZone } from '@angular/core';
import Chart, { ChartEvent, ChartConfiguration, ChartData } from 'chart.js/auto';
import { StoreService } from './store.service';
import { NgChartjsService } from './ng-chartjs.service';
import { Colors } from './colors';
import * as i0 from "@angular/core";
export type Labels = Array<string | string[] | number | number[] | Date | Date[] | any | any[]>;
export type Orientation = 'oldest' | 'latest';
export interface NgChartjsEvent {
event: ChartEvent;
active: Array<{}>;
}
export declare class NgChartjsDirective implements OnDestroy, OnChanges, OnInit {
private ngChartjsService;
private storeService;
private zone;
data: number[] | any[];
datasets: ChartData['datasets'];
labels: Labels;
options?: ChartConfiguration['options'];
inlinePlugins?: any[];
chartType: ChartConfiguration['type'];
colors: Colors[];
legend: boolean;
adding: {
labels: Labels[];
data: any[][];
};
removing: {
orientation: Orientation;
};
resetOption?: ChartConfiguration['options'];
noZone: boolean;
id: string;
chartClick: EventEmitter<NgChartjsEvent>;
chartHover: EventEmitter<NgChartjsEvent>;
chart: Chart;
private ctx;
private initFlag;
private hasChanges;
private element;
constructor(element: ElementRef, ngChartjsService: NgChartjsService, storeService: StoreService, zone: NgZone);
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
ngOnDestroy(): void;
update(): void;
addData(labels: Labels[], data: any[][]): void;
removeData(orientation: Orientation): void;
private refresh;
private removeChart;
private addChart;
private updateChartData;
private getChartBuilder;
private getDatasets;
private updateColors;
private addData_;
private removeData_;
static ɵfac: i0.ɵɵFactoryDeclaration<NgChartjsDirective, never>;
static ɵdir: i0.ɵɵDirectiveDeclaration<NgChartjsDirective, "canvas[ngChartjs]", ["ngChartjs"], { "data": "data"; "datasets": "datasets"; "labels": "labels"; "options": "options"; "inlinePlugins": "inlinePlugins"; "chartType": "chartType"; "colors": "colors"; "legend": "legend"; "adding": "adding"; "removing": "removing"; "resetOption": "resetOption"; "noZone": "noZone"; "id": "id"; }, { "chartClick": "chartClick"; "chartHover": "chartHover"; }, never, never, false, never>;
}