Line Chart in flash

I need to create a line chart in flash. The points of the line chart should come from a java servlet. I know how to get variables from the servlet into flash, but I can't seem to figure out a way to dynamically make my chart. Does anybody know how this could be done?
Thanks!

Davy
dbelmansAsked:
Who is Participating?
 
coopaConnect With a Mentor Commented:
I'm still working to make this more dynamic...  I want the scale to draw itself, and the points now mouseover to tell you their value.

If you would like the graph to stay as it is now then let me know, otherwise I'm gonna keep on improving it and making it easier for you to import and use.

Thanks dbelmans.
0
 
RoyKruyshaarCommented:
Make a movieclip (movChart) with only a box in it.
Than when you get the variables from your servlet, use the following command:
Set Property ("movChart", Y Scale) = "200"
Now your movieclip's height is 200% of his original size.
After then you say        
Set Property ("movChart", X Scale) = "50", your movieclip will be 50% of hir original height.
Good Luck and when you have further questions, feel free to ask.

Roy


0
 
coopaCommented:
I understand what you are trying to acheive...  But unfortunately yuo cannot specify a begin point and an end point of a line in flash...  So this may be difficult.

It would however be very easy to produce a bar chart.

Rich.

P.S.  RoyKruyshaar, What do you mean?  
It sounds like you were beginning to explain a bar chart.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
RoyKruyshaarCommented:
to coopa: Whoops, You're right! I misunderstand the question.
0
 
dbelmansAuthor Commented:
It really needs to be a line chart. Are there any other tools available to accomplish it? I believe generator could make charts, but generator is a bit to pricy for me.
0
 
benchunCommented:
there are alternatives to generator.

http://www.swift-tools.com/
http://www.blue-pac.com/

you should also check out
http://www.popchart.com/

0
 
coopaCommented:
I have had a re-think....
This is very possible using some heavy maths.

Here is a simplified example:

a) create a symbol

b) from the centre draw a line upwards... Close symbol.

c) create an instance of the line symbol, position line in the correct location of the first point on the graph

d) Rotate and scale the line so that it connects with the next point (to do this you must use the x and y distances between the two points to calculate the angle and length of hypotenuse using Pythagoras' theorum)

e) create another instance of the line symbol, position line in the correct location of the next point on the graph

I can work up an example for you but it will take a while.
Let me know...
0
 
coopaCommented:
I've thought of a way of making this dynamic as well...  (i.e. looping through all the variables until there are none left).
0
 
dbelmansAuthor Commented:
If you could make a small example of it, that would be great.
0
 
coopaCommented:
Here is the start....

now all i need to do is the rotation and size (the difficult bit)

www.coopa.demon.co.uk/ee/graph/grapth.html
www.coopa.demon.co.uk/ee/graph/grapth.swf
www.coopa.demon.co.uk/ee/graph/grapth.fla
0
 
coopaCommented:
almost done...  Going to lunch now, will give you the finished example in about 3 hours.
0
 
coopaCommented:
Take another look....

It now works for downward lines....

www.coopa.demon.co.uk/ee/graph/graph.html 

Just have to make it work for lines going in the other direction.
0
 
coopaCommented:
Finished !

I'm off home now but I'll explain how it was done tomorrow...

www.coopa.demon.co.uk/ee/graph/graph.html 


0
 
dbelmansAuthor Commented:
It looks great, it is exactly what I need. If you answer the question, instead of commenting I can give you the points.
0
 
dbelmansAuthor Commented:
The graph is fine for me, I should be able to work with it myself now. Thanks!
0
 
coopaCommented:
Okay...

If you want to see the latest version... (which includes more comments and useful stuff)

Have a look at
www.coopa.demon.co.uk/ee/graph/graph2.swf 
www.coopa.demon.co.uk/ee/graph/graph2.fla

Thanks again.
0
 
dbelmansAuthor Commented:
Coopa, I have incororated the graph into my flash movie. Works really great, only one problem. When I have too much points (sometimes even with 20 points) on the x axis, the movie stops with the error:
More than 200000 actions were executed in one action list.
This is probably an infinite loop.
Further execution of actions has been disabled in this movie.

Is there anything that can be done against this?

I'll also ask this question as a separate question, so that some points can be earned :)
0
 
coopaCommented:
please post your sample in a place i can access your fla...  Then i can attempt to trace when this error is occuring.
0
 
coopaCommented:
please post your sample in a place i can access your fla...  Then i can attempt to trace when this error is occuring.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.