How do I create this...

Get help using Construct 2

Post » Thu Feb 02, 2017 3:12 am

how can i create a line graph from localstorage? any idea?
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Thu Feb 02, 2017 11:44 am

Store values that represent the line on an array, store the Array.AsJSON in a localstorage value. When you re-load the data into the array, draw the line :)
<iframe frameborder="0" src="https://itch.io/embed/146124?linkback=true&dark=true" width="552" height="167"></iframe>
B
26
S
7
Posts: 254
Reputation: 2,389

Post » Fri Feb 03, 2017 1:47 am

mrtumbles wrote:Store values that represent the line on an array, store the Array.AsJSON in a localstorage value. When you re-load the data into the array, draw the line :)


You have sample capx there? :D Because I don't know how to use Array.Json :D
B
79
S
31
G
7
Posts: 148
Reputation: 9,179

Post » Fri Feb 03, 2017 10:58 am

Array.AsJSON is a string of text in JSON format that described the data in an array. You can download a JSON of an array using the Array's action 'Download'. You can store the JSON by storing Array.AsJSON. You can load data into an array by using the Array's 'Load' action, in which you must specify a string of data in JSON format.

So to save data simply set a localstorage value to Array.AsJSON
And to load data, get the localstorage value, and pass it to Array>Load

No sample capx as no upload capability, sorry :(

https://www.scirra.com/manual/108/array
<iframe frameborder="0" src="https://itch.io/embed/146124?linkback=true&dark=true" width="552" height="167"></iframe>
B
26
S
7
Posts: 254
Reputation: 2,389


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 11 guests