diff --git a/src/app/pages/dashboard/pieChart/pieChart.component.ts b/src/app/pages/dashboard/pieChart/pieChart.component.ts index fa5394e0..a7f7fcca 100644 --- a/src/app/pages/dashboard/pieChart/pieChart.component.ts +++ b/src/app/pages/dashboard/pieChart/pieChart.component.ts @@ -1,44 +1,25 @@ import {Component, ViewEncapsulation} from 'angular2/core'; import {BaCard} from '../../../theme/components'; +import {PieChartService} from './pieChart.service'; + import './pieChart.loader.ts'; @Component({ selector: 'pie-chart', encapsulation: ViewEncapsulation.None, directives: [BaCard], + providers: [PieChartService], styles: [require('./pieChart.scss')], template: require('./pieChart.html') }) export class PieChart { - charts = [ - { - color: 'rgba(255,255,255,0.4)', - description: 'New Visits', - stats: '57,820', - icon: 'person', - }, { - color: 'rgba(255,255,255,0.4)', - description: 'Purchases', - stats: '$ 89,745', - icon: 'money', - }, { - color: 'rgba(255,255,255,0.4)', - description: 'Active Users', - stats: '178,391', - icon: 'face', - }, { - color: 'rgba(255,255,255,0.4)', - description: 'Returned', - stats: '32,592', - icon: 'refresh', - } - ]; - + public charts: Array; private _init = false; - constructor() { + constructor(private _pieChartService: PieChartService) { + this.charts = this._pieChartService.getData(); } ngAfterViewInit() { diff --git a/src/app/pages/dashboard/pieChart/pieChart.service.ts b/src/app/pages/dashboard/pieChart/pieChart.service.ts new file mode 100644 index 00000000..a3acc1e5 --- /dev/null +++ b/src/app/pages/dashboard/pieChart/pieChart.service.ts @@ -0,0 +1,33 @@ +import {Injectable} from 'angular2/core'; + +@Injectable() +export class PieChartService { + + private _data = [ + { + color: 'rgba(255,255,255,0.4)', + description: 'New Visits', + stats: '57,820', + icon: 'person', + }, { + color: 'rgba(255,255,255,0.4)', + description: 'Purchases', + stats: '$ 89,745', + icon: 'money', + }, { + color: 'rgba(255,255,255,0.4)', + description: 'Active Users', + stats: '178,391', + icon: 'face', + }, { + color: 'rgba(255,255,255,0.4)', + description: 'Returned', + stats: '32,592', + icon: 'refresh', + } + ]; + + getData() { + return this._data; + } +}