From b252145bb04c6ee769bd6cbc9c4afca221a27fd4 Mon Sep 17 00:00:00 2001 From: nixa <4dmitr@gmail.com> Date: Tue, 3 May 2016 14:58:57 +0300 Subject: [PATCH] first bunch of chart.js charts with ba-card --- .../components/chartJs/chartJs.component.ts | 19 ++++++++-------- .../charts/components/chartJs/chartJs.html | 22 ++++++++++++++++--- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/app/pages/charts/components/chartJs/chartJs.component.ts b/src/app/pages/charts/components/chartJs/chartJs.component.ts index dc38ffd2..76641b0d 100644 --- a/src/app/pages/charts/components/chartJs/chartJs.component.ts +++ b/src/app/pages/charts/components/chartJs/chartJs.component.ts @@ -16,11 +16,12 @@ import {chartColors} from "../../../../theme/theme.constants"; 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 = { + + public labels = ["Sleeping", "Designing", "Coding", "Cycling"]; + public data = [20, 40, 5, 35]; + public colours = chartColors; + public options = { + scaleShowLabelBackdrop : false, segmentShowStroke : false, // responsive: true, scaleFontColor: "rgba(255,255,255,.7)", @@ -31,16 +32,16 @@ export class ChartJs { constructor(private _chartJsService:ChartJsService) { } - ngAfterViewInit() { - + chartType(type) { + return type; } - pieChangeData () { + changeData ($event) { 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); + this.data = shuffle(this.data); } } diff --git a/src/app/pages/charts/components/chartJs/chartJs.html b/src/app/pages/charts/components/chartJs/chartJs.html index daf9a249..95c8887e 100644 --- a/src/app/pages/charts/components/chartJs/chartJs.html +++ b/src/app/pages/charts/components/chartJs/chartJs.html @@ -1,9 +1,25 @@