Dynamic Graph

Please check the following link.

if you click on update chart, you will see the bars setting up as per the field value.

this guy who created the chart has given a maths equation to set the bar height according to field value.

duplicateMovieClip(“y”, bar, m);
setProperty(bar, _width, Number(Lenght)/Number(NoOfValues));
setProperty(bar, _x, Number(getProperty(XAxis, _x))+Number((2n-1)/2(Number(getProperty(bar, _width))+10)));
setProperty(bar, _height, (eval(“y” add n)/max)*Hight);
setProperty(bar, _y, Number(getProperty(yAxis, _y))-Number(getProperty(bar, _height))/2);

Since i am not that familiar with actionscript, i am confused how he calculates the bar height.

he has taken the major source help from flash kit tutorial, dynamic flash chart.

I need a simple code to calculate the bar height.
thanks for your help.

I checked your duplicate movie tutorial. it was really helpful. this is similar kind but instead of passing random values, i am passing text values. also i need to make sure that the x-axis and y axis remains the same and only the height changes.

Please do help. this is very urgent.

You’re not telling us everything, Windy. There are two things that are not clear in this : how does he take the values from the HTML page, and the duplication must be part of a loop, or it won’t do all the bars.

About the bar height : quite obviously, it’s this line that deals with it

setProperty(bar, _height, (eval("y" add n)/max)*Hight);

This puts the property _height of the bar to the value indicated. This value should be the number you entered in the HTML divided by the maximum of all the values entered. Proportionnality. But the notations are not clear here.

Last but not least, it’s an old syntax. You should really try to change it.

duplicateMovieClip("y", bar, m); 
bar. _width=Lenght/NoOfValues; 
and so on...

pom :asian:


please be informed that he took the major help from the above eg in flash kit. in this eg, instead of using the text data file, he is passing the values from html.
also to adjust the height of the bar,
he has used bar height/max value * hight, what is this hight??

i am familiar with passing values from html form/fields in flash but that actionscript involved in calculating the height of the bar after passing the value is quite challenging!

please help me…

That’s Flash 4, man…
Anyway, this hight has got to be initialized somewhere, and it’s simply a constant. It means that if your ratio increases by 1, the size of your bar will increase by hight.

pom :asian: