# [LON-CAPA-users] background image in geogebra

Jacob Bond bond13 at purdue.edu
Fri May 6 08:55:17 EDT 2016

```Carl,

Happy to help.  Another issue with the current setup (I don't know if this was an issue before) is that the problems are rather slow to load.  I don't know how much it affects students, but debugging the problems becomes a pain.  Also, after you change the source for each problem, it won't reload immediately, you have to click either reset submissions, new randomization, or leave the problem and come back in.

It could be done, though I don't know that my solution is very elegant.  Keep in mind that all of my knowledge on this topic is from googling and experimenting.

I have found that it works best to just have the applet output all of its data to LON-CAPA so that LON-CAPA knows how to redraw the applet after submission.  This is somewhat complicated by the fact that one doesn't technically know what GeoGebra will name things.  However, they generally name them alphabetically, points are a,b,c,... and lines are A,B,C,...; it might be useful to use this for your problem to make it easier to keep the parts separate.

Anyhow, I think you could start by having two customresponses and setting your update listener to have both (assuming <customresponse id="11"> and id="12")

document.lonhomework.elements["HWVAL_11"].value = array_of_data
document.lonhomework.elements["HWVAL_12"].value = array_of_data

where array_of_data is basically a dump of all the coordinates of points, whether lines were drawn, etc. delimited in someway (commas, semicolons, etc.).  Note that LON-CAPA will receive this a string.  Then have the first customresponse algorithm operate on the data corresponding to the first 3 points and if there was a line (calculate slope, etc.) and the second customresponse operate on the rest.  Maybe something like
x1,y1;x2,y2;x3,y3;is_line_1_drawn:x4,y4;x5,y5;is_line_2_drawn
and have the algorithms start by splitting the string, starting with colons.

Again, this would be rather tedious, and there may be a much better way.

Jacob

________________________________________
From: lon-capa-users-bounces at mail.lon-capa.org <lon-capa-users-bounces at mail.lon-capa.org> on behalf of Carl Lira <lira at egr.msu.edu>
Sent: Thursday, May 5, 2016 11:14:36 PM
To: 'Discussion list for LON-CAPA users'
Subject: Re: [LON-CAPA-users] background image in geogebra

Thank you. Until your help I was unaware of the option to embed custom
problems in loncapa. Bummer that they removed the option to export to html.
I don't like assignments on one server that are dependent on another server
working.

A follow up question. Your example shows a single submission. Can multiple
parts be constructed where students complete one part of a graphical
construction and then move on to a second part that they add to the graph?
How would you suggest I approach that type of multiple part problem? To be
specific, I would like to guide students to first find a particular point
and then draw a line through that point and then add a second line with a
different slope through the same point, so they end up with a distorted X,
where the slope and endpoints of each leg are important.

Carl

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org
[mailto:lon-capa-users-bounces at mail.lon-capa.org] On Behalf Of Jacob Bond
Sent: Thursday, May 05, 2016 10:45 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] background image in geogebra

Carl,

I wanted to mention some things that I wish I'd known (and didn't pop up on

Since the videos were made, GeoGebra removed the option to export as a
webpage.  This option is still in the menu, but it will just make you upload
GeoGebraTube (tube.geogebra.org) and told LON-CAPA where to find the
worksheet.  Once the worksheet is uploaded to GeoGebraTube, to embed the

https://www.geogebra.org/manual/en/Reference:Applet_Embedding

http://archive.geogebra.org/source/program/applet/geogebra_applet_javascript
_test.htm

http://www.geogebra.org/manual/en/Reference:JavaScript
http://www.geogebra.org/manual/en/Reference:Applet_Parameters

Good luck,
Jacob
________________________________________
From: lon-capa-users-bounces at mail.lon-capa.org
<lon-capa-users-bounces at mail.lon-capa.org> on behalf of Carl Lira
<lira at egr.msu.edu>
Sent: Thursday, May 5, 2016 9:59:56 PM
To: 'Discussion list for LON-CAPA users'
Subject: Re: [LON-CAPA-users] background image in geogebra

Jacob,

Thank you for the links! I will study these.

Carl

-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org
[mailto:lon-capa-users-bounces at mail.lon-capa.org] On Behalf Of Jacob Bond
Sent: Thursday, May 05, 2016 9:27 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] background image in geogebra

Carl,

I just realized that you might not have been talking about a "custom" applet
(http://www.lon-capa.org/geogebraTutorial.html; though I had to modify the
procedure a little to get it to work).  You can insert an image into a
"custom" applet.

Jacob
________________________________________
From: lon-capa-users-bounces at mail.lon-capa.org
<lon-capa-users-bounces at mail.lon-capa.org> on behalf of Carl Lira
<lira at egr.msu.edu>
Sent: Thursday, May 5, 2016 7:39:44 PM
To: 'Discussion list for LON-CAPA users'
Subject: [LON-CAPA-users] background image in geogebra

Is it possible to insert a background image in goegebra loncapa problems? I
can think of some problems where I would like students to draw on top a
background diagram. The background diagrams are complicated enough that it
is currently impractical to generate them with a simple function (phase
diagrams).

Thanks,

Carl Lira

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users

_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
```