UNPKG

ng-apexcharts

Version:
264 lines (257 loc) 6.98 kB
import { Component, Input, ViewChild, NgModule } from '@angular/core'; import { asapScheduler } from 'rxjs'; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class ChartComponent { constructor() { this.dataLabels = { enabled: false }; this.stroke = { curve: 'straight' }; this.grid = { row: { colors: ['#f3f3f3', 'transparent'], opacity: 0.5 } }; this.autoUpdateSeries = true; } /** * @return {?} */ ngOnInit() { asapScheduler.schedule((/** * @return {?} */ () => { this.createElement(); })); } /** * @param {?} changes * @return {?} */ ngOnChanges(changes) { asapScheduler.schedule((/** * @return {?} */ () => { if (this.autoUpdateSeries && Object.keys(changes).filter((/** * @param {?} c * @return {?} */ c => c !== 'series')).length === 0) { this.updateSeries(this.series, true); return; } this.createElement(); })); } /** * @private * @return {?} */ createElement() { /** @type {?} */ const options = {}; if (this.annotations) { options.annotations = this.annotations; } if (this.chart) { options.chart = this.chart; } if (this.colors) { options.colors = this.colors; } if (this.dataLabels) { options.dataLabels = this.dataLabels; } if (this.series) { options.series = this.series; } if (this.stroke) { options.stroke = this.stroke; } if (this.labels) { options.labels = this.labels; } if (this.legend) { options.legend = this.legend; } if (this.fill) { options.fill = this.fill; } if (this.tooltip) { options.tooltip = this.tooltip; } if (this.plotOptions) { options.plotOptions = this.plotOptions; } if (this.responsive) { options.responsive = this.responsive; } if (this.xaxis) { options.xaxis = this.xaxis; } if (this.yaxis) { options.yaxis = this.yaxis; } if (this.grid) { options.grid = this.grid; } if (this.states) { options.states = this.states; } if (this.title) { options.title = this.title; } if (this.subtitle) { options.subtitle = this.subtitle; } if (this.theme) { options.theme = this.theme; } if (this.chartObj) { this.chartObj.destroy(); } this.chartObj = new ApexCharts(this.chartElement.nativeElement, options); this.render(); } /** * @return {?} */ render() { return this.chartObj.render(); } /** * @param {?} options * @param {?} redrawPaths * @param {?} animate * @return {?} */ updateOptions(options, redrawPaths, animate) { return this.chartObj.updateOptions(options, redrawPaths, animate); } /** * @param {?} newSeries * @param {?} animate * @return {?} */ updateSeries(newSeries, animate) { this.chartObj.updateSeries(newSeries, animate); } /** * @param {?} seriesName * @return {?} */ toggleSeries(seriesName) { this.chartObj.toggleSeries(seriesName); } /** * @param {?} options * @param {?=} pushToMemory * @param {?=} context * @return {?} */ addXaxisAnnotation(options, pushToMemory, context) { this.chartObj.addXaxisAnnotation(options, pushToMemory, context); } /** * @param {?} options * @param {?=} pushToMemory * @param {?=} context * @return {?} */ addYaxisAnnotation(options, pushToMemory, context) { this.chartObj.addYaxisAnnotation(options, pushToMemory, context); } /** * @param {?} options * @param {?=} pushToMemory * @param {?=} context * @return {?} */ addPointAnnotation(options, pushToMemory, context) { this.chartObj.addPointAnnotation(options, pushToMemory, context); } /** * @param {?} options * @param {?=} pushToMemory * @param {?=} context * @return {?} */ addText(options, pushToMemory, context) { this.chartObj.addText(options, pushToMemory, context); } /** * @return {?} */ dataURI() { return this.chartObj.dataURI(); } } ChartComponent.decorators = [ { type: Component, args: [{ selector: 'apx-chart', template: "<div #chart></div>\n", styles: [""] }] } ]; ChartComponent.propDecorators = { chart: [{ type: Input }], annotations: [{ type: Input }], colors: [{ type: Input }], dataLabels: [{ type: Input }], series: [{ type: Input }], stroke: [{ type: Input }], labels: [{ type: Input }], legend: [{ type: Input }], fill: [{ type: Input }], tooltip: [{ type: Input }], plotOptions: [{ type: Input }], responsive: [{ type: Input }], xaxis: [{ type: Input }], yaxis: [{ type: Input }], grid: [{ type: Input }], states: [{ type: Input }], title: [{ type: Input }], subtitle: [{ type: Input }], theme: [{ type: Input }], autoUpdateSeries: [{ type: Input }], chartElement: [{ type: ViewChild, args: ['chart',] }] }; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const declerations = [ ChartComponent ]; class NgApexchartsModule { } NgApexchartsModule.decorators = [ { type: NgModule, args: [{ declarations: [ ...declerations ], imports: [], exports: [ ...declerations ] },] } ]; /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ export { NgApexchartsModule, ChartComponent }; //# sourceMappingURL=ng-apexcharts.js.map