Browse Source

Scaling fix in Chart.

pull/65/head
Sebastian Stehle 9 years ago
parent
commit
f901388d3d
  1. 15
      src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts

15
src/Squidex/app/features/dashboard/pages/dashboard-page.component.ts

@ -46,7 +46,12 @@ export class DashboardPageComponent extends AppComponentBase implements OnInit,
{ {
display: true display: true
} }
] ],
yAxes: [{
ticks: {
beginAtZero: true
}
}]
}, },
maintainAspectRatio: false maintainAspectRatio: false
}; };
@ -84,7 +89,7 @@ export class DashboardPageComponent extends AppComponentBase implements OnInit,
}); });
this.appName() this.appName()
.switchMap(app => this.usagesService.getStorageUsages(app, DateTime.today().addDays(-30), DateTime.today())) .switchMap(app => this.usagesService.getStorageUsages(app, DateTime.today().addDays(-20), DateTime.today()))
.subscribe(dtos => { .subscribe(dtos => {
this.chartStorageCount = { this.chartStorageCount = {
labels: createLabels(dtos), labels: createLabels(dtos),
@ -118,7 +123,7 @@ export class DashboardPageComponent extends AppComponentBase implements OnInit,
}); });
this.appName() this.appName()
.switchMap(app => this.usagesService.getCallsUsages(app, DateTime.today().addDays(-30), DateTime.today())) .switchMap(app => this.usagesService.getCallsUsages(app, DateTime.today().addDays(-20), DateTime.today()))
.subscribe(dtos => { .subscribe(dtos => {
this.chartCallsCount = { this.chartCallsCount = {
labels: createLabels(dtos), labels: createLabels(dtos),
@ -184,10 +189,8 @@ function createLabels(dtos: { date: DateTime }[]): string[] {
const labels: string[] = []; const labels: string[] = [];
for (let dto of dtos) { for (let dto of dtos) {
if (dto.date.weekDay === 1 || dto.date.weekDay === 4) { if (true || dto.date.weekDay === 1 || dto.date.weekDay === 4) {
labels.push(dto.date.toStringFormat('M-DD')); labels.push(dto.date.toStringFormat('M-DD'));
} else {
labels.push('');
} }
} }

Loading…
Cancel
Save