# How do I create a chart

Get help using Construct 2

### » Tue May 27, 2014 7:20 pm

So I've been banging my head on this for the last day or so trying to figure out a solution for the following...

I'm creating a simple mobile app. I have most of everything squared away except the chart data in construct2! I'm looking for the following functionality with highcharts.com (line chart) Or is there a way to create a chart in construct 2?

This is how the app will look and work

There's 4 buttons at the top of the page.

Button 1 has a set value of 50, Button 2 = 150, Button 3 = 250, Button 4 = 400

below those buttons I will have two additional buttons that allow the user to choose where those values be plotted to. Either linechart1 or linechart2.(user chooses via button press ) These two lines are placed on the same chart. The line chart is a simple 2D X and Y axis.

This data needs to be stored locally on the mobile device. Is Webdb an option?
B
3
Posts: 1
Reputation: 177

### » Tue May 27, 2014 9:48 pm

Please, let me know what you find out!
B
24
S
4
G
1
Posts: 177
Reputation: 1,827

### » Tue May 27, 2014 9:53 pm

line-charts... well define you chart boundaries, and then take a prototype line image and stretch to the appropriate length to go from your first point to your next point. you also need to get the angle correct. When I did it last, the length comes from the geometric equation for distances sqrt ( (x2-x1)^2 + (y2-y1)^2) . Angle is a bit more complicated. use tan inverse (delta y over delta x). however you need to add some extra code to get the right quadrant. with a little care, it works really well.

it's easier if you have uniform spacing, but user-selected spacing is also manageable.

if you want to do a bar chart, same idea but easier... just stretch a box to the appropriate height, with all boxes having the same bottom position, and perhaps even the same width.
B
7
S
3
G
1
Posts: 184
Reputation: 1,352