I am using Chart.js with her I show a graph where I will show the amount and transactions of an account that includes that she must have her dates and the transactions that made that date, that is, those variables come in an array, but I do not know how to apply them. down some of the built code.
// try to make the array but it did not work out this part of the code does not work
this.listTrans=[];
this.listTrans=[{
fecha:'2018-08-01',
amount:200000,
count:3,
formatted_amount=2000,00;
},{
fecha:'2018-08-02',
amount:500000,
count:8,
formatted_amount=5000,00;
}]
var i;
for(i = 0; i < listTrans.length; i++){
list += listTrans[i];
list[i].hasOwnProperty('amount'){
var amount mes.push(list[i].amount);
}
// this part if it works but not as I want these variables have values but I want to come in the array from the top and shown in the graphic
var mes = ["01/02/18","01/03/18","01/03/18"]; //esto quiero que me venga en array
var amount = [1000,2000,2500];// esto serian los valores que incluiria el rray
var count = [5,6,3];// igualmente este..
var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: mes,
datasets: [
{
data: amount,
label: "Monto",
borderColor: "#3e95cd",
fill: false
},
{
data: count,
label: "Transacciones",
borderColor: "#8e5ea2",
fill: false
}
]
}
});