Ali Mahmoudi
Posts: 0
Joined: Thu Aug 28, 2014 9:57 am

Problem with model and storage

In my app I have this as a rest result
[
{
"Name":"LEO TEST",
"Profit":1412.87
},
{
"Name":"Trader 3",
"Profit":427.5
},
{
"Name":"Carla Test",
"Profit":335.0
},
{
"Name":"Vlad Sorokin",
"Profit":16.0
}
]
and i want to save these in local storage in order to use them to create pie chart with them.
for my pie chart I need a result like this to put in my js variable.

[['Ali Mahmoudi',100], ['Victor Zachariades',8], ['Vladislav Sorokin',14], ['Leonidas Petrou',20]]

below also you can see my settings in picture

Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Problem with model and storage

Hello Ali,

Your "top4" is an array of object, but it should be an array of arrays,
when you map REST result to localStorage you should convert your objects to arrays with 2 entries.
precode[{
"Name":"LEO TEST",
"Profit":1412.87
},{
"Name":"Trader 3",
"Profit":427.5
}]
will be
[
[ "LEO TEST", 1412.87 ],
[ "Trader 3", 427.5 ]
]/code/pre

Ali Mahmoudi
Posts: 0
Joined: Thu Aug 28, 2014 9:57 am

Problem with model and storage

Hi Evgen,

Please take a look at this new config still result is not correct.

Image

Ali Mahmoudi
Posts: 0
Joined: Thu Aug 28, 2014 9:57 am

Problem with model and storage

anything ?

Ali Mahmoudi
Posts: 0
Joined: Thu Aug 28, 2014 9:57 am

Problem with model and storage

Fixed it thanks ;)

Return to “Issues”