Amended for possible undefined error

This commit is contained in:
piratefinn 2018-04-16 15:41:45 +01:00
parent daff33657f
commit 4f3e0aa22d

View file

@ -240,6 +240,8 @@ export class DashboardCustomerComponent implements OnInit {
this.barChartDataCategory = [ this.barChartDataCategory = [
{data: barChartDataCategoryInitial, label: 'Series A'}, {data: barChartDataCategoryInitial, label: 'Series A'},
]; ];
this.showCategoryBarChart = true;
if (this.weekList1) {
let doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value;}); let doughnutChartDataCategoryInitial = this.weekList1.map(function(a) {return a.value;});
this.doughnutChartDataCategory = [ this.doughnutChartDataCategory = [
{data: doughnutChartDataCategoryInitial, label: 'Series A'}, {data: doughnutChartDataCategoryInitial, label: 'Series A'},
@ -247,7 +249,7 @@ export class DashboardCustomerComponent implements OnInit {
// setTimeout is currently a workaround for ng2-charts labels // setTimeout is currently a workaround for ng2-charts labels
setTimeout(() => this.doughnutChartLabelsCategory = this.weekList1.map(function(a) {return a.category;}), 0); setTimeout(() => this.doughnutChartLabelsCategory = this.weekList1.map(function(a) {return a.category;}), 0);
this.showCategoryDoughnutChart = true; this.showCategoryDoughnutChart = true;
this.showCategoryBarChart = true; }
} }
private setDate () { private setDate () {