Page 1 of 1

Problem with model and storage

Posted: Fri Oct 24, 2014 2:41 pm
by Ali Mahmoudi

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


Problem with model and storage

Posted: Fri Oct 24, 2014 3:47 pm
by Evgene Karachevtsev

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


Problem with model and storage

Posted: Sun Oct 26, 2014 8:27 am
by Ali Mahmoudi

Hi Evgen,

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

Image


Problem with model and storage

Posted: Mon Oct 27, 2014 9:27 am
by Ali Mahmoudi

anything ?


Problem with model and storage

Posted: Mon Oct 27, 2014 9:39 am
by Ali Mahmoudi

Fixed it thanks ;)