Increase sample size in dashboard
This commit is contained in:
parent
7e0fc34a3e
commit
84961310c3
@ -1,8 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {LoginService} from '../services/login.service';
|
||||
import { LoginService } from '../services/login.service';
|
||||
import { ApiService } from '../services/api.service';
|
||||
import {Chart} from 'chart.js';
|
||||
|
||||
import { Chart } from 'chart.js';
|
||||
|
||||
|
||||
interface KeyInterface {
|
||||
@ -30,8 +29,7 @@ export class HomeComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
// fetch all available groups
|
||||
this.fetchData('/material/groups', data => this.createGroup(data));
|
||||
//this.initChart();
|
||||
console.log(this.login.username);
|
||||
//console.log(this.login.username);
|
||||
}
|
||||
|
||||
// api access with callback
|
||||
@ -46,12 +44,12 @@ export class HomeComponent implements OnInit {
|
||||
let temp: KeyInterface[] = [];
|
||||
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
temp.push({ id: data[i], count: 0, active: false });
|
||||
temp.push({ id: data[i], count: 0, active: true });
|
||||
}
|
||||
this.keys = temp; // invoke update in rb-multiselect
|
||||
this.calcFieldSelectKeys();
|
||||
// fetch all samples populated with according group
|
||||
this.fetchData('/samples?status%5B%5D=validated&status=new&page-size=10&sort=_id-asc&fields%5B%5D=material.group', data => this.countSamples(data));
|
||||
this.fetchData('/samples?status%5B%5D=validated&status=new&sort=_id-asc&fields%5B%5D=material.group', data => this.countSamples(data));
|
||||
}
|
||||
|
||||
// loop through samples and count
|
||||
@ -95,7 +93,7 @@ export class HomeComponent implements OnInit {
|
||||
dataList.push(key.count);
|
||||
}
|
||||
})
|
||||
return { names: nameList, data: dataList };
|
||||
return { names: nameList, count: dataList };
|
||||
}
|
||||
|
||||
// draw graph
|
||||
@ -118,9 +116,10 @@ export class HomeComponent implements OnInit {
|
||||
labels: data.names,
|
||||
datasets: [{
|
||||
label: 'Number of samples per group',
|
||||
data: data.data,
|
||||
data: data.count,
|
||||
backgroundColor: fillPattern,
|
||||
borderWidth: 2
|
||||
pointRadius: 4,
|
||||
pointHoverRadius: 7
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
|
Loading…
Reference in New Issue
Block a user