mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-20 17:30:14 +01:00
starting with charts
This commit is contained in:
parent
6445388f76
commit
0c416a6d3e
13 changed files with 224 additions and 30 deletions
46
src/app/pages/charts/components/chartJs/chartJs.component.ts
Normal file
46
src/app/pages/charts/components/chartJs/chartJs.component.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import {Component, ViewEncapsulation} from 'angular2/core';
|
||||
import {BaCard} from '../../../../theme';
|
||||
|
||||
import {ChartJsService} from "./chartJs.service";
|
||||
|
||||
import {CHART_DIRECTIVES} from 'ng2-charts';
|
||||
import {chartColors} from "../../../../theme/theme.constants";
|
||||
|
||||
@Component({
|
||||
selector: 'chart-js',
|
||||
pipes: [],
|
||||
providers: [ChartJsService],
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
styles: [require('./chartJs.scss')],
|
||||
directives: [BaCard, CHART_DIRECTIVES],
|
||||
template: require('./chartJs.html'),
|
||||
})
|
||||
export class ChartJs {
|
||||
public pieLabels = ["Sleeping", "Designing", "Coding", "Cycling"];
|
||||
public pieChartType = 'Pie';
|
||||
public pieData = [20, 40, 5, 35];
|
||||
public pieColours = chartColors;
|
||||
public pieOptions = {
|
||||
segmentShowStroke : false,
|
||||
// responsive: true,
|
||||
scaleFontColor: "rgba(255,255,255,.7)",
|
||||
scaleLineColor: "rgba(255,255,255,.7)",
|
||||
pointLabelFontColor: "rgba(255,255,255,.7)"
|
||||
};
|
||||
|
||||
constructor(private _chartJsService:ChartJsService) {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
}
|
||||
|
||||
pieChangeData () {
|
||||
let shuffle = (o) => {
|
||||
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x){}
|
||||
return o;
|
||||
};
|
||||
|
||||
this.pieData = shuffle(this.pieData);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue