mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-20 09:20:12 +01:00
amchart moved to own component
This commit is contained in:
parent
0ae41588a9
commit
1cc807d733
8 changed files with 48 additions and 14 deletions
|
|
@ -2,36 +2,34 @@ import {Component, ViewEncapsulation} from 'angular2/core';
|
|||
|
||||
import './lineChart.loader.ts';
|
||||
import {LineChartService} from './lineChart.service';
|
||||
import {BaAmChart} from '../../../theme/components';
|
||||
|
||||
@Component({
|
||||
selector: 'line-chart',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
providers: [LineChartService],
|
||||
directives: [BaAmChart],
|
||||
styles: [require('./lineChart.scss')],
|
||||
template: require('./lineChart.html')
|
||||
})
|
||||
export class LineChart {
|
||||
|
||||
chartData:Object;
|
||||
|
||||
constructor(private _lineChartService:LineChartService) {
|
||||
this.chartData = this._lineChartService.getData();
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this._loadLineChart();
|
||||
}
|
||||
|
||||
// TODO: load proper AmCharts theme
|
||||
private _loadLineChart() {
|
||||
let chart = AmCharts.makeChart('amchart', this._lineChartService.getData());
|
||||
|
||||
initChart(chart:any) {
|
||||
let zoomChart = () => {
|
||||
chart.zoomToDates(new Date(2013, 3), new Date(2014, 0));
|
||||
};
|
||||
|
||||
chart.addListener('rendered', zoomChart);
|
||||
zoomChart();
|
||||
|
||||
if (chart.zoomChart) {
|
||||
chart.zoomChart();
|
||||
}
|
||||
// zoomChart();
|
||||
//
|
||||
// if (chart.zoomChart) {
|
||||
// chart.zoomChart();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue