Is it possible to create a chart?

Discussion and feedback on Construct 2

Post » Mon Aug 26, 2013 5:53 pm

I was wondering if this is possible with construct. An ability to draw chart base on the data or variables.
B
8
Posts: 4
Reputation: 370

Post » Mon Aug 26, 2013 10:32 pm

Hi @gerpausnet,

Yes it is.
Bear in mind that creating a flexible, data driven chart with legend, axes, autoscaling etc is not a trival task to be achieved in a couple of lines of code.

For a simple barchart, try e.g. load your data as array, dictionary, csv, or simply a string (and use tokencount + tokenat expressions).

Using a string data (eg. "2,4,3,5") do a loop
for (loopindex("x") = 0 to (tokencount(string,separator) - 1))
+ create/spawn a bar sprite
+ position the bar/scale it horizontally offsetting by loopindex("x")
+ scale the bar vertically eg. to int(tokenat(string,separator,offset))


Cheers,
Greg
CJK2013-08-26 22:32:58
B
18
S
3
G
3
Posts: 83
Reputation: 3,736

Post » Tue Aug 27, 2013 2:54 am

Oh thanks a lot...
B
8
Posts: 4
Reputation: 370


Return to Construct 2 General

Who is online

Users browsing this forum: Google [Bot] and 17 guests