nts-ng2-components
Version:
Paquete de componentes para Angular2 desarrollado por NITSNETS.
40 lines (29 loc) • 1.19 kB
text/typescript
import { Component, EventEmitter, Input, OnChanges, Output, ViewContainerRef } from '@angular/core';
import { Color } from './../../../directives/base-chart.directive';
({
selector: 'nts-chart',
templateUrl: 'chart.component.html',
styleUrls: ['chart.component.scss'],
})
export class NtsChartComponent implements OnChanges {
() chartTitle: string;
() size: 'tiny' | 'small' | 'medium' | 'large' = 'medium';
() type: 'line' | 'bar' | 'pie' | 'radar' | 'doughnut' | 'polarArea' | 'horizontalBar';
() series: Array<{ label: string, data: [number], color: Color }> = [];
() labels: string[] = [];
() options = {};
() chartHover = new EventEmitter();
() chartClick = new EventEmitter();
tooltip: any = {};
defaultOptions = {
maintainAspectRatio: false,
tooltips: { enabled: false, custom: tooltip => this.tooltip = tooltip }
};
ngOnChanges(changes) {
if (changes.type || changes.options) {
this.options = Object.assign(this.options, this.defaultOptions);
}
}
constructor(private view: ViewContainerRef) {
}
}