I’m using Ionic and I have a CRUD that creates a list of name “Item”:
![image]()
See how the data is stored in firebase:
![image]()
So, how to connect the list data created in my chart done in Chart.js?
I can create a static graph only, I would like the graphic to be dynamic and with the data stored in Firebase. On the X axis I want to put the variable “data” and on the Y axis the variable “numero”.
.HTML CODE:
![image]()
.TS CODE:
import { Item } from ‘…/…/models/item/item.models’;
public lineChartData:Array = [
{data: [-34, -78, 45, 65], label: ‘Humor’}
];
public lineChartLabels:Array = [‘19/jun’, ‘20/jun’, ‘21/jun’, ‘22/jun’ ];
public lineChartColors:Array = [
{ // grey
backgroundColor: ‘rgba(148,159,177,0.2)’,
borderColor: ‘rgba(148,159,177,1)’,
pointBackgroundColor: ‘rgba(148,159,177,1)’,
pointBorderColor: ‘#fff’,
pointHoverBackgroundColor: ‘#fff’,
pointHoverBorderColor: ‘rgba(148,159,177,0.8)’
}
];
public lineChartLegend:boolean = true;
public lineChartType:string = ‘line’;
![image]()
Could someone please help me connect Firebase to my chart?