Solved

Line Chart in flash

Posted on 2000-04-19
20
241 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to record live broadcast.

786 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