Drawing curve or dots (objectless) in a loop in JavaScript

Elias Y. Daoud shared this question 2 years ago
Answered

Please anyone has an idea how to plot a dot or point other than the Point we know, which is an object. I need a dot as Geogebra draws a curve.

I mean not: dotted curve of f(x) for example, and not a parametric curve such Curve(x(t),y(t),t,min,max)

I mean that: In a JS loop, I generate a 'X' and 'Y' for a point in which coordination is not simple in a graph function but in the iteration. So instead to put hundreds of graphical points as we know them as objects, I need a dot in specific X and Y without making it an object-point and won't need it to appear in the main Geogebra editor. DRAW OBJECTLESS

I hope I am clear, thanks

Comments (9)

photo
1

Please explain overall what you are trying to do - JavaScript probably isn't the best solution

photo
1

I am doing a procedure to make iteration to calculate shell or object path points (Projectile) taking into consideration the air resistance it term of F=-KV^2

So no analytical solution for that and need iteration. So the time is dt, where dt is not so small, around not less than 0.4 see.

In each new calculation, I want to put dot or point or any... to draw the path.

Note: In my previous question actually I tried a lot, but I posted for you a few. such showLabel, showLable, . I found some time the use small character and others in the capital.

What I notice using evalCommand I should use a capital letter as ShowLabel

ggb.evalCommand("ShowLabel(P"+String(ti)+",false)"); this worked finaly.

Thanks a lot

photo
1

Dear,

Refer please to the attached file:

each gray dot is a point and added to Geogebra objects as P1, P2....and so on.

Can I avoid that or each run I will get a new series?

photo
1

see sample in attachment (List instead of single point objects)

see also manual SetValue( <List>, <Number>, <Object> )

-------------------------------------------------------------------

But: whenever possible I do NOT use JS

Example: see here or in Resources

photo
1

OK, so you need to start here I think: https://wiki.geogebra.org/e...

photo
1

Sorry, no that is not what I meant. Already I solved it as math. But need to draw without put points or add objects. To reduce objects number in my file and speed-up the process.

Because my program finishes the entire loop, but need twice or 3 times more time to put the points because they are nemerous.

Thanks.

photo
1

But need to draw without put points

Please post your data then

photo
1

OK the following are a shortcut .... the important things about my question

Note: all work as expected, but I need to draw curves with (x,y) without function but each is calculated alone by differential calculation. To solve that I used points instead of dots or curve as a graph


Var ... series and settings

for (var ti=0;ti<=pointsNb;ti++){

... calculations of X2 and Y2 ...


ggb.evalCommand("P"+String(ti)+"="+"("+X2+","+Y2+")"); // Create points of form P#i

ggb.setCaption("P"+String(ti),"");

ggb.setPointSize("P"+String(ti),1);

ggb.evalCommand("ShowLabel(P"+String(ti)+",false)");

...

}

photo
1

yo no entiendo bien el ingles pero creo que ver puntos que en realidad no existen como objetos y que desaparecen cuando se guarda el archivo es lo que se llama trace

Comments have been locked on this page!

© 2023 International GeoGebra Institute