Creating bar charts in ionic by taking the values from local storage


#1

I want to create a chart showing the different accounts and their balances.
The accounts and balance are stored in local storage
Now I want to use these values and represent in the chart form,also the balance is updating after every transaction.
so my question is how to create chart which takes values from the local storage and represent them in the chart form …


#2
Promise.all([
  storage.get('thing1'),
  storage.get('thing2')
]).then((things) => {
  makeChart(things[0], things[1]);
});

#3

ok…

If thing1,thing2 are different are different account name i think,if so how do i make sure that how many accounts are there??
Like till where should i make my n updated…
Please elaborate it


#4

Promise.all takes an array. It can be as big as you want it to be.


#5

ok…
this.barChart=new Chart(this.barCanvas.nativeElement,
{
type:‘line’,
data:{

Promise.all([
  this.store.get('accountname1'),
  this.store.get('accountname2')
]).then((accountname) => {
  Chart(accountname[0], accountname[1]);
});
}
    
}
)};



It gives me error,
also how to write labels and data separtely,which are dynamic,
My labels are accountname which are stored in the local storage,while the data are the balances which are also stored in local storage,

how to represent these values in the bar chart…

Thanks…