A web component to embed a GeoGebra applet.
It's a wrapper around deployggb.js
provided by GeoGebra.
Write GeoGebra commands inside the tag. These commands are evaluated immediately after the applet loads.
<geogebra-applet>
A = (1,2)
</geogebra-applet>
<geogebra-applet material="sA5Mb4vd" />
<geogebra-applet material="https://www.geogebra.org/m/sA5Mb4vd" />
You can give just the ID, or you can give the full URL of a geogebra material, because that's easier to think about!
The element supports attributes corresponding to most of the embedding parameters provided by the GeoGebra API:
algebraInputPosition
allowStyleBar
allowUpscale
appName
autoHeight
borderColor
buttonBorderColor
buttonRounding
buttonShadows
capturingThreshold
country
customToolBar
editorBackgroundColor
editorForegroundColor
enable3d
enableCAS
enableFileFeatures
enableLabelDrags
enableRightClick
enableShiftDragZoom
enableUndoRedo
errorDialogsActive
filename
ggbBase64
height
keyboardType
language
material
playButton
preventFocus
randomSeed
rounding
scale
scaleContainerClass
showAlgebraInput
showAnimationButton
showFullscreenButton
showLogging
showMenuBar
showResetIcon
showStartTooltip
showSuggestionButtons
showToolBar
showToolBarHelp
showZoomButtons
textmode
transparentGraphics
width
There are also a few extra attributes corresponding to methods in the API, which change settings in the applet:
perspective | Define which views are visible, and in which order. A string of letters corresponding to views, as described in the documentation for SetPerspective |
axes | A comma-separated list of true or false values defining whether each axis is visible, in the order x,y,z . |
xaxis | Is the x axis visible? |
yaxis | Is the y axis visible? |
zaxis | Is the z axis visible? |
pointcapture | The point capturing mode: none , snap , fixed , or automatic . |
rounding | How to round numbers. A number followed by either d for "decimal places", or s for "significant figures". |
hidecursorwhendragging | Hide the cursor when dragging objects? |
repaintingactive | Repaint the applet when anything changes? |
errordialogsactive | Should error dialogs be shown? |
coordsystem | A comma-separated list of coordinates for the viewport of the graphics window, in the order xmin,xmax,ymin,ymax . |
axislabels | A comma-separated list of labels for the axes, in the order x,y,z . |
xaxislabel | The label for the x axis. |
yaxislabel | The label for the y axis. |
zaxislabel | The label for the z axis. |
axissteps | A comma-separated list of the distances between tick marks for each of the axes, in the order x,y,z . |
axisunits | A comma-separated list of strings giving the units for each axis, in the order x,y,z . |
grid | Should the grid be visible? |
editorstate | Initial content for the algebra editor |
rightAngleStyle | The style of right-angles. none , square , dot , or L . |
gridIsBold | Should the grid be drawn a bit thicker? |
gridType | The type of the grid. |
gridDistance | The distance between grid lines in each axis. |
bgColor | The applet's background colour. |
gridColor | The colour of grid lines. |
axesColor | The colour of the axes. |
The following methods from the GeoGebra API are also available on the <geogebra-applet>
element:
debug
deleteObject
enable3D
enableCAS
enableLabelDrags
enableRightClick
enableShiftDragZoom
evalCommand
evalCommandCAS
evalCommandGetLabels
evalXML
exists
exportPDF
exportSVG
getAlgorithmXML
getAllObjectNames
getBase64
getCASObjectNumber
getCaption
getColor
getCommandString
getDefinitionString
getEditorState
getFileJSON
getFilling
getGraphicsOptions
getGridVisible
getLaTeXBase64
getLaTeXString
getLabelStyle
getLabelVisible
getLayer
getLineStyle
getLineThickness
getListValue
getMode
getObjectName
getObjectNumber
getObjectType
getPNGBase64
getPerspectiveXML
getPointSize
getPointStyle
getScreenshotBase64
getValue
getValueString
getVersion
getVisible
getXML
getXcoord
getYcoord
getZcoord
hideCursorWhenDragging
isAnimationRunning
isDefined
isIndependent
isMoveable
newConstruction
openFile
recalculateEnvironments
redo
refreshViews
registerAddListener
registerClearListener
registerClickListener
registerClientListener
registerObjectClickListener
registerObjectUpdateListener
registerRemoveListener
registerRenameListener
registerStoreUndoListener\n
registerUpdateListener
remove
renameObject
reset
setAlgebraOptions
setAnimating
setAnimationSpeed
setAuxiliary
setAxesVisible
setAxisLabels
setAxisSteps
setAxisUnits
setBase64
setCaption
setColor
setCoordSystem
setCoords
setCustomToolBar
setDisplayStyle
setEditorState
setErrorDialogsActive
setFileJSON
setFilling
setFixed
setGraphicsOptions
setGridVisible
setHeight
setLabelStyle
setLabelVisible
setLayer
setLayerVisible
setLineStyle
setLineThickness
setListValue
setMode
setOnTheFlyPointCreationActive
setPerspective
setPointCapture
setPointSize
setPointStyle
setRepaintingActive
setRounding
setSize
setTextValue
setTrace
setUndoPoint
setValue
setVisible
setWidth
setXML
showAlgebraInput
showMenuBar
showResetIcon
showToolBar
startAnimation
stopAnimation
undo
unregisterAddListener
unregisterClearListener
unregisterClickListener
unregisterClientListener
unregisterObjectClickListener
unregisterObjectUpdateListener
unregisterRemoveListener
unregisterRenameListener
unregisterStoreUndoListener
unregisterUpdateListener
writePNGtoFile
The following properties on the <geogebra-applet>
element object have defined setters or getters:
appName
(get & set)animating
(get & set) - corresponds to startAnimation
or stopAnimation
when set, and isAnimationRunning
when got.CASObjectNumber
(get)editorState
(get & set)graphicsOptions
(get & set)height
(get & set)mode
(get & set)objectNames
(get)objectNumber
(get)perspective
(set)scaleX
(get)scaleY
(get)width
(get & set)The GeoGebra API only refers to tool modes by number. This component maps readable names to these values.
You can use these names with the <geogebra-applet>
element's mode
property.
Name | Value |
---|---|
move | 0 |
point | 1 |
join | 2 |
parallel | 3 |
orthogonal | 4 |
intersect | 5 |
delete | 6 |
vector | 7 |
line bisector | 8 |
angular bisector | 9 |
circle two points | 10 |
circle three points | 11 |
conic five points | 12 |
tangents | 13 |
relation | 14 |
segment | 15 |
polygon | 16 |
text | 17 |
ray | 18 |
midpoint | 19 |
circle arc three points | 20 |
circle sector three points | 21 |
circumcircle arc three points | 22 |
circumcircle sector three points | 23 |
semicircle | 24 |
slider | 25 |
image | 26 |
show hide object | 27 |
show hide label | 28 |
mirror at point | 29 |
mirror at line | 30 |
translate by vector | 31 |
rotate by angle | 32 |
dilate from point | 33 |
circle point radius | 34 |
copy visual style | 35 |
angle | 36 |
vector from point | 37 |
distance | 38 |
move rotate | 39 |
translateview | 40 |
zoom in | 41 |
zoom out | 42 |
selection listener | 43 |
polar diameter | 44 |
segment fixed | 45 |
angle fixed | 46 |
locus | 47 |
macro | 48 |
area | 49 |
slope | 50 |
regular polygon | 51 |
show hide checkbox | 52 |
compasses | 53 |
mirror at circle | 54 |
ellipse three points | 55 |
hyperbola three points | 56 |
parabola | 57 |
fitline | 58 |
record to spreadsheet | 59 |
button action | 60 |
textfield action | 61 |
pen | 62 |
rigid polygon | 64 |
polyline | 65 |
probability calculator | 66 |
attach / detach | 67 |
function inspector | 68 |
intersect two surfaces | 69 |
vector polygon | 70 |
create list | 71 |
complex number | 72 |
point on object | 501 |
mode spreadsheet create list | 2001 |
mode spreadsheet create matrix | 2002 |
mode spreadsheet create listofpoints | 2003 |
mode spreadsheet create tabletext | 2004 |
mode spreadsheet create polyline | 2005 |
mode spreadsheet onevarstats | 2020 |
mode spreadsheet twovarstats | 2021 |
mode spreadsheet multivarstats | 2022 |
mode spreadsheet sort | 2030 |
mode spreadsheet sort az | 2031 |
mode spreadsheet sort za | 2032 |
mode spreadsheet sum | 2040 |
mode spreadsheet average | 2041 |
mode spreadsheet count | 2042 |
mode spreadsheet min | 2043 |
mode spreadsheet max | 2044 |
freehand mode | 73 |
view in front of | 502 |
plane three points | 510 |
plane point line | 511 |
orthogonal plane | 512 |
parallel plane | 513 |
perpendicular line (3d) | 514 |
sphere point radius | 520 |
sphere two points | 521 |
cone given by two points and radius | 522 |
cylinder given by two points and radius | 523 |
prism | 531 |
extrude to prism or cylinder | 532 |
pyramid | 533 |
extrude to pyramid or cone | 534 |
net | 535 |
cube | 536 |
tetrahedron | 537 |
rotate view | 540 |
circle point radius direction | 550 |
circle axis point | 551 |
volume | 560 |
rotate around line | 570 |
mirror at plane | 571 |