changed graph type to bar and color to bosch dark blue

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2021-01-18 13:22:42 +01:00
parent b65f1126fc
commit 80664740a8

View File

@ -116,24 +116,14 @@ export class HomeComponent implements OnInit {
async initChart() { async initChart() {
const data = await this.getData(); const data = await this.getData();
const canvas = document.getElementById('myChart') as HTMLCanvasElement;
const width = canvas.clientWidth;
const height = canvas.clientHeight;
const ctx = canvas.getContext('2d');
var img = new Image(width, height);
img.src = "/assets/imgs/supergraphic.svg";
img.onload = () => {
const fillPattern = ctx.createPattern(img, 'no-repeat');
this.myChart = new Chart("myChart", { this.myChart = new Chart("myChart", {
type: 'line', type: 'bar',
data: { data: {
labels: data.names, labels: data.names,
datasets: [{ datasets: [{
label: 'Number of samples per group', label: 'Number of samples per group',
data: data.count, data: data.count,
backgroundColor: fillPattern, backgroundColor: 'rgba(0, 86, 145, 1)',
pointRadius: 4, pointRadius: 4,
pointHoverRadius: 7 pointHoverRadius: 7
}] }]
@ -150,4 +140,3 @@ export class HomeComponent implements OnInit {
}); });
} }
} }
}