UNPKG

5.13 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var __metadata = (this && this.__metadata) || function (k, v) {
9 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10};
11var core_1 = require("@angular/core");
12var ChartSeriesComponent_1 = require("./ChartSeriesComponent");
13var ChartXAxisComponent_1 = require("./ChartXAxisComponent");
14var ChartYAxisComponent_1 = require("./ChartYAxisComponent");
15var HighchartsService_1 = require("./HighchartsService");
16var initChart_1 = require("./initChart");
17var createBaseOpts_1 = require("./createBaseOpts");
18var ChartComponent = (function () {
19 function ChartComponent(element, highchartsService) {
20 this.create = new core_1.EventEmitter();
21 this.click = new core_1.EventEmitter();
22 this.addSeries = new core_1.EventEmitter();
23 this.afterPrint = new core_1.EventEmitter();
24 this.beforePrint = new core_1.EventEmitter();
25 this.drilldown = new core_1.EventEmitter();
26 this.drillup = new core_1.EventEmitter();
27 this.load = new core_1.EventEmitter();
28 this.redraw = new core_1.EventEmitter();
29 this.selection = new core_1.EventEmitter();
30 this.type = 'Chart';
31 this.element = element;
32 this.highchartsService = highchartsService;
33 }
34 Object.defineProperty(ChartComponent.prototype, "options", {
35 set: function (opts) {
36 this.userOpts = opts;
37 this.init();
38 },
39 enumerable: true,
40 configurable: true
41 });
42 ;
43 ChartComponent.prototype.init = function () {
44 if (this.userOpts && this.baseOpts) {
45 this.chart = initChart_1.initChart(this.highchartsService, this.userOpts, this.baseOpts, this.type);
46 this.create.emit(this.chart);
47 }
48 };
49 ChartComponent.prototype.ngAfterViewInit = function () {
50 this.baseOpts = createBaseOpts_1.createBaseOpts(this, this.series, this.series ? this.series.point : null, this.xAxis, this.yAxis, this.element.nativeElement);
51 this.init();
52 };
53 return ChartComponent;
54}());
55__decorate([
56 core_1.ContentChild(ChartSeriesComponent_1.ChartSeriesComponent),
57 __metadata("design:type", ChartSeriesComponent_1.ChartSeriesComponent)
58], ChartComponent.prototype, "series", void 0);
59__decorate([
60 core_1.ContentChild(ChartXAxisComponent_1.ChartXAxisComponent),
61 __metadata("design:type", ChartXAxisComponent_1.ChartXAxisComponent)
62], ChartComponent.prototype, "xAxis", void 0);
63__decorate([
64 core_1.ContentChild(ChartYAxisComponent_1.ChartYAxisComponent),
65 __metadata("design:type", ChartYAxisComponent_1.ChartYAxisComponent)
66], ChartComponent.prototype, "yAxis", void 0);
67__decorate([
68 core_1.Output(),
69 __metadata("design:type", Object)
70], ChartComponent.prototype, "create", void 0);
71__decorate([
72 core_1.Output(),
73 __metadata("design:type", Object)
74], ChartComponent.prototype, "click", void 0);
75__decorate([
76 core_1.Output(),
77 __metadata("design:type", Object)
78], ChartComponent.prototype, "addSeries", void 0);
79__decorate([
80 core_1.Output(),
81 __metadata("design:type", Object)
82], ChartComponent.prototype, "afterPrint", void 0);
83__decorate([
84 core_1.Output(),
85 __metadata("design:type", Object)
86], ChartComponent.prototype, "beforePrint", void 0);
87__decorate([
88 core_1.Output(),
89 __metadata("design:type", Object)
90], ChartComponent.prototype, "drilldown", void 0);
91__decorate([
92 core_1.Output(),
93 __metadata("design:type", Object)
94], ChartComponent.prototype, "drillup", void 0);
95__decorate([
96 core_1.Output(),
97 __metadata("design:type", Object)
98], ChartComponent.prototype, "load", void 0);
99__decorate([
100 core_1.Output(),
101 __metadata("design:type", Object)
102], ChartComponent.prototype, "redraw", void 0);
103__decorate([
104 core_1.Output(),
105 __metadata("design:type", Object)
106], ChartComponent.prototype, "selection", void 0);
107__decorate([
108 core_1.Input(),
109 __metadata("design:type", String)
110], ChartComponent.prototype, "type", void 0);
111__decorate([
112 core_1.Input(),
113 __metadata("design:type", Object),
114 __metadata("design:paramtypes", [Object])
115], ChartComponent.prototype, "options", null);
116ChartComponent = __decorate([
117 core_1.Component({
118 selector: 'chart',
119 template: '&nbsp;',
120 providers: [HighchartsService_1.HighchartsService],
121 }),
122 __metadata("design:paramtypes", [core_1.ElementRef, HighchartsService_1.HighchartsService])
123], ChartComponent);
124exports.ChartComponent = ChartComponent;
125//# sourceMappingURL=ChartComponent.js.map
\No newline at end of file