Education Prize Logo
Science SPORE Prize
November 2011

NSF Logo
The Open Source Physics Project is supported by NSF DUE-0442581.

Number formatting in 2D Text Drawable

Return to the EJS Modeling forum
Login to post to this thread

Number formatting in 2D text drawable - Aug 14, 2014 at 10:43AM
Tze Ko
1 Posts

I've created a 2D text drawable inside a plotting panel.
This field is intended to move around following the moving object.
I want to display the velocity of the object using this 2D text drawable so I typed "v="+v in the text field.
The prompt and value of v were displayed but the problem is it automatically gives the full decimal of v, such as giving v=2.1354816846815 which moves around the plotting area.

There is no format field in the properties for 2D text drawable. How can I format the value of v to be displayed in 2 decimal places?

Post edited August 14, 2014 at 10:43 AM EST.

Post edited August 14, 2014 at 10:47 AM EST.

Current Replies - View all
Re: Number formatting in ...   (Francisco Esquembre - Aug 15, 2014 at 12:31AM)
The OSP Network:
Open Source Physics - Tracker - EJS Modeling
Physlet Physics
Physlet Quantum Physics