Skip to content

Commit

Permalink
Statistics bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
bcastro99 committed Apr 15, 2020
1 parent de31c61 commit cf27a27
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1 class="text-white">Statistics</h1>
<h4>Adoptions in last six Months</h4>
</div>
<canvas baseChart
[datasets]="adoptions"
[datasets]="barCharData"
[labels]="barChartLabels"
[options]="barChartOptions"
[chartType]="barChartType">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@ import { Component, OnInit } from '@angular/core';
import { StatisticsService } from '../../services/statistics/statistics.service';
import { ChartOptions, ChartType, ChartDataSets } from 'chart.js';

import { Label } from 'ng2-charts';



@Component({
selector: 'app-statistics',
templateUrl: './statistics.component.html',
styleUrls: ['./statistics.component.css']
})


export class StatisticsComponent {
actualMonth: any = new Date().getMonth()+1;
meses = ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"];
adoptions: any=[];
adoptions: Array<number>=[];
constructor (private statistics: StatisticsService){}
ngOnInit(): void {
let itera= this.actualMonth;
Expand All @@ -29,22 +31,22 @@ export class StatisticsComponent {
itera=11;
}
this.barChartLabels.push(this.meses[itera]);

salida++;
}
console.log(this.adoptions);

}

public barChartLabels:String []=[];
public barChartOptions: ChartOptions = {
responsive: true,
}
public barCharData : ChartDataSets[] =[
{data: this.adoptions, label: "Animals Adopted"}
];
public barChartType: ChartType = 'bar';

}







Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class StatisticsService {

constructor(private _http: HttpClient) {}
adoptionsMonth(month: any){
return this._http.get(`${this.BASE_URL}/${month}`);
return this._http.get<number>(`${this.BASE_URL}/${month}`);

}
private handleError(error: any) {
Expand Down

0 comments on commit cf27a27

Please sign in to comment.