Solved

Line Chart in flash

Posted on 2000-04-19
20
257 Views
Last Modified: 2008-03-04
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
0
Comment
Question by:dbelmans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 12
  • 5
  • 2
  • +1
20 Comments
 
LVL 4

Expert Comment

by:RoyKruyshaar
ID: 2731712
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
 
LVL 2

Expert Comment

by:coopa
ID: 2734564
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
 
LVL 4

Expert Comment

by:RoyKruyshaar
ID: 2735450
to coopa: Whoops, You're right! I misunderstand the question.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dbelmans
ID: 2737264
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
 

Expert Comment

by:benchun
ID: 2737286
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
 
LVL 2

Expert Comment

by:coopa
ID: 2746629
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
 
LVL 2

Expert Comment

by:coopa
ID: 2746667
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
 

Author Comment

by:dbelmans
ID: 2746671
If you could make a small example of it, that would be great.
0
 
LVL 2

Expert Comment

by:coopa
ID: 2747032
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
 
LVL 2

Expert Comment

by:coopa
ID: 2747034
0
 
LVL 2

Expert Comment

by:coopa
ID: 2747145
almost done...  Going to lunch now, will give you the finished example in about 3 hours.
0
 
LVL 2

Expert Comment

by:coopa
ID: 2747824
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
 
LVL 2

Expert Comment

by:coopa
ID: 2748255
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
 

Author Comment

by:dbelmans
ID: 2750437
It looks great, it is exactly what I need. If you answer the question, instead of commenting I can give you the points.
0
 
LVL 2

Accepted Solution

by:
coopa earned 200 total points
ID: 2750468
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
 

Author Comment

by:dbelmans
ID: 2750478
The graph is fine for me, I should be able to work with it myself now. Thanks!
0
 
LVL 2

Expert Comment

by:coopa
ID: 2750498
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
 

Author Comment

by:dbelmans
ID: 2755590
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
 
LVL 2

Expert Comment

by:coopa
ID: 2755621
please post your sample in a place i can access your fla...  Then i can attempt to trace when this error is occuring.
0
 
LVL 2

Expert Comment

by:coopa
ID: 2755624
please post your sample in a place i can access your fla...  Then i can attempt to trace when this error is occuring.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question