refactor chart and list component structure

This commit is contained in:
Jesse Lucas
2020-03-29 16:51:12 -04:00
parent 37f2f2cdf6
commit eaffbc0f92
27 changed files with 108 additions and 20 deletions
@@ -0,0 +1,47 @@
import { Component, OnInit, AfterViewInit, Input } from '@angular/core';
import { Chart } from 'chart.js'
import { flatMap } from 'rxjs/operators';
@Component({
selector: 'app-donut-chart',
templateUrl: './donut-chart.component.html',
styleUrls: ['./donut-chart.component.scss']
})
export class DonutChartComponent implements OnInit {
@Input() elementID: string;
private canvas: any;
private ctx: any;
constructor() { }
ngOnInit(): void {
}
ngAfterViewInit(): void {
this.canvas = document.getElementById(this.elementID);
this.ctx = this.canvas.getContext('2d');
const myChart = new Chart(this.ctx, {
type: 'doughnut',
data: {
labels: ["Up to Date", "Syncing", "Waiting to Sync", "Out of Sync", "Failed Items"],
datasets: [{
data: [100, 200, 300, 0, 0],
backgroundColor: [
'#56C568',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)'
],
borderWidth: 1
}]
},
options: {
responsive: false,
display: false,
legend: {
display: false
}
}
});
}
}