Merge branch 'master' of https://github.com/kennyboy55/smarthome
# Conflicts: # mean-app/dist/inline.bundle.map # mean-app/dist/main.bundle.map
This commit is contained in:
@@ -17,6 +17,8 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
public data1:LineData;
|
||||
public data2:LineData;
|
||||
|
||||
public label:LabelData;
|
||||
|
||||
public mloaded:boolean = false;
|
||||
public kloaded:boolean = false;
|
||||
|
||||
@@ -39,17 +41,13 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
refreshData()
|
||||
{
|
||||
console.log("Refreshing data");
|
||||
this.label = <LabelData> ({data: ["Huidig opgenomen", "Huidig terug"]});
|
||||
|
||||
this.dataService
|
||||
.usage("4530303035303031353538313833363134")
|
||||
.subscribe(res => {
|
||||
|
||||
//this.data1 = <LineData> ({data: [res.HOV, res.HTV], label: "Verbruik Martijn"});
|
||||
this.data1 = <LineData> ({data: [21, 25], label: "Verbruik Martijn"});
|
||||
|
||||
console.log("data ");
|
||||
console.log(this.data1);
|
||||
|
||||
this.data1 = <LineData> ({data: [res.HOV, res.HTV], label: "Verbruik Martijn"});
|
||||
this.mloaded = true;
|
||||
|
||||
});
|
||||
@@ -58,9 +56,7 @@ export class DashboardComponent implements OnInit, OnDestroy {
|
||||
.usage("4530303235303030303636383733323136")
|
||||
.subscribe(res => {
|
||||
|
||||
//this.data1 = <LineData> ({data: [res.HOV, res.HTV], label: "Verbruik Kenneth"});
|
||||
this.data2 = <LineData> ({data: [18, 13], label: "Verbruik Kenneth"});
|
||||
|
||||
this.data2 = <LineData> ({data: [res.HOV, res.HTV], label: "Verbruik Kenneth"});
|
||||
this.kloaded = true;
|
||||
|
||||
});
|
||||
|
||||
@@ -29,5 +29,20 @@
|
||||
<div class="col-md-6">
|
||||
<line-chart [label]="label" [data]="data4"></line-chart>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<span *ngIf="pieloaded">
|
||||
|
||||
<div class="col-md-4">
|
||||
<pie-chart [label]="labelpie1" [data]="datapie1"></pie-chart>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<pie-chart [label]="labelpie2" [data]="datapie2"></pie-chart>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<pie-chart [label]="labelpie3" [data]="datapie3"></pie-chart>
|
||||
</div>
|
||||
|
||||
</span>
|
||||
|
||||
@@ -26,12 +26,21 @@ export class DetailComponent implements OnInit, OnDestroy {
|
||||
public data3:LineData;
|
||||
public data4:LineData;
|
||||
|
||||
public datapie1:LineData;
|
||||
public datapie2:LineData;
|
||||
public datapie3:LineData;
|
||||
|
||||
public labelpie1:LabelData;
|
||||
public labelpie2:LabelData;
|
||||
public labelpie3:LabelData;
|
||||
|
||||
public hov:number = 0;
|
||||
public htv:number = 0;
|
||||
public ht:string = "loading";
|
||||
public money:number = 0;
|
||||
|
||||
public loaded:boolean = false;
|
||||
public pieloaded:boolean = false;
|
||||
|
||||
public subscription:Subscription;
|
||||
|
||||
@@ -55,6 +64,9 @@ export class DetailComponent implements OnInit, OnDestroy {
|
||||
refreshData(id:string)
|
||||
{
|
||||
console.log("Refreshing data for ", this.id);
|
||||
this.labelpie1 = <LabelData> ({data: ["Huidig opgenomen", "Huidig terug"]});
|
||||
this.labelpie2 = <LabelData> ({data: ["Totaal opgenomen 2", "Totaal terug 2"]});
|
||||
this.labelpie3 = <LabelData> ({data: ["Totaal opgenomen 1", "Totaal terug 1"]});
|
||||
|
||||
this.dataService
|
||||
.get(id)
|
||||
@@ -81,6 +93,12 @@ export class DetailComponent implements OnInit, OnDestroy {
|
||||
|
||||
this.money = ((res.TOE1 - res.TTE1) * res.tarief1) + ((res.TOE2 - res.TTE2) * res.tarief2);
|
||||
|
||||
this.datapie1 = <LineData> ({data: [res.HOV, res.HTV], label: "Huidig verbruik"});
|
||||
this.datapie2 = <LineData> ({data: [res.TOE2, res.TTE2], label: "Totaal 2"});
|
||||
this.datapie3 = <LineData> ({data: [res.TOE1, res.TTE1], label: "Totaal 1"});
|
||||
|
||||
this.pieloaded = true;
|
||||
|
||||
});
|
||||
|
||||
this.dataService
|
||||
|
||||
@@ -24,10 +24,6 @@ export class PieChartComponent implements OnInit, OnChanges {
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
console.log("Data in piechart");
|
||||
console.log(this.data);
|
||||
console.log(this.label);
|
||||
|
||||
this.pieChartLabels = this.label.data.slice();
|
||||
this.pieChartData = this.data.data.slice();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user