mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-21 18:00:13 +01:00
lineChart component
This commit is contained in:
parent
82eefd9124
commit
769c115c13
8 changed files with 179 additions and 5 deletions
36
src/app/pages/dashboard/lineChart/lineChart.component.ts
Normal file
36
src/app/pages/dashboard/lineChart/lineChart.component.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import {Component, ViewEncapsulation} from 'angular2/core';
|
||||
|
||||
import './lineChart.loader.ts';
|
||||
import {LineChartService} from './lineChart.service';
|
||||
|
||||
@Component({
|
||||
selector: 'line-chart',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
providers: [LineChartService],
|
||||
styles: [require('./lineChart.scss')],
|
||||
template: require('./lineChart.html')
|
||||
})
|
||||
export class LineChart {
|
||||
|
||||
constructor(private _lineChartService:LineChartService) {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this._loadLineChart();
|
||||
}
|
||||
|
||||
// TODO: load proper AmCharts theme
|
||||
private _loadLineChart() {
|
||||
let chart = AmCharts.makeChart('amchart', this._lineChartService.getData());
|
||||
|
||||
let zoomChart = () => {
|
||||
chart.zoomToDates(new Date(2013, 3), new Date(2014, 0));
|
||||
};
|
||||
|
||||
chart.addListener('rendered', zoomChart);
|
||||
|
||||
if (chart.zoomChart) {
|
||||
chart.zoomChart();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue