APS Excellence in Physics Education Award
November 2019

Education Prize Logo
Science SPORE Prize
November 2011

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

How to Change EJSS_5.0 PlottlingPanel Corrdinate Format (Javascript) post and replies

Return to the How to Change EJSS_5.0 PlottlingPanel Corrdinate Format (Javascript) thread
Login to post to this thread

How to change PlottlingPanel Coordinate Format (EJSS_5.0 ,Javascript)?
Chi-Feng Lin
28 Posts

Dear All

I need help.

Is there any body know how to change PlottlingPanel's coordinate format?

for example

1. 1234567 ==> 1.23e6
2. 0.0012345  ==> 1.2345e-3
3. 1.2345  ==> 1.2

Thanks a lot.

Chi-Feng Lin


Replies to How to change PlottlingPanel Coordinate Format (EJSS_5.0 ,Javascript)?

Re: How to change PlottlingPanel Coordinate Format (EJSS_5.0 ,Javascript)? -
lookang Avatar
lookang
245 Posts

try

_view.plottingPanel.getAxisY().setScalePrecision(3);
_view.popdist.getAxisY().setScalePrecision(3);

we learnt this when Paco and Wolfgang are in Singapore!

enjoy!

attached is a source produced by a Math teacher Boon Leong NG.
http://weelookang.blogspot.sg/2014/11/distribution-of-sample-means-from.html

Attached File: ejss_src_RandomProbabilityFunction.zip


OSP@SG blog
OSP@SG Digital Library


Re: Re: How to change PlottlingPanel Coordinate Format (EJSS_5.0 ,Javascript)? -
Mariusz Krasinski
17 Posts

Hi

I am using this thread to return to one of my previous post which is still without answer.

I have made simple simulations in java and javascript. Just graph and possibility to change minimum and maximum values on both axis. In ejss version I added the setting described in the post above.

ejs vs ejss

Compare results. Whatever you do in java version axis label are rounded numbers. In javascript one can see almost chaos. On vertical axis 1.79, 3.58, 5.37 etc. I always saying to ma student not to describe axis this way. So, I would be happy to use proper description in my simulations for the same students. But I am not able.

Has anybody any idea how to produce better description of axis also in javascript?

Help!

I am including also codes ob both versions.

 

Attached File: ejs_vs_ejss_graph.zip



Re: Re: How to change PlottlingPanel Coordinate Format (EJSS_5.0 ,Javascript)? -
Wolfgang
192 Posts

Here are additional scale parameters that can help you customize the axis labels.

var xAxis = _view.plottingPanel.getAxisX();
xAxis.setAutoTicks(false);
xAxis.setTicks(10);            // divide the axis to give 10 tick marks
xAxis.setScalePrecision(0); // Don't show any decimals



Re: Re: Re: How to change PlottlingPanel Coordinate Format (EJSS_5.0 ,Javascript)? -
Mariusz Krasinski
17 Posts

Thank you.
Now, thanks to possibility to change number of ticks, I can make axis labels like in Java version with rounded numbers.

Maybe there is also a hidden command to show ticks or maybe labels on sliders?



OSP Projects:
Open Source Physics - EJS Modeling
Tracker
Physlet Physics
Physlet Quantum Physics
STP Book