<graph>
<graph>
is a Graphical
component that renders a 2D cartesian graph.
Attributes and Properties
Attribute | Type | Values |
---|---|---|
aspectRatio = "…" | number | |
displayDecimals = "…" | integer | |
displayDigits = "…" | integer | |
displayMode = "…" | text | "block" "inline" |
displaySmallAsZero = "…" | number | |
displayXAxis = "…" | boolean | "true" "false" |
displayXAxisTickLabels = "…" | boolean | "true" "false" |
displayYAxis = "…" | boolean | "true" "false" |
displayYAxisTickLabels = "…" | boolean | "true" "false" |
fixAxes = "…" | boolean | "true" "false" |
grid = "…" | ||
hideOffGraphIndicators = "…" | boolean | "true" "false" |
horizontalAlign = "…" | text | "center" "left" "right" |
identicalAxisScales = "…" | boolean | "true" "false" |
padZeros = "…" | boolean | "true" "false" |
showBorder = "…" | boolean | "true" "false" |
showNavigation = "…" | boolean | "true" "false" |
size = "…" | text | "tiny" "small" "medium" "large" "full" |
width = "…" | componentSize | |
xLabelPosition = "…" | text | "right" "left" |
xMax = "…" | number | |
xMin = "…" | number | |
xTickScaleFactor = "…" | math | |
yLabelAlignment = "…" | text | "left" "right" |
yLabelPosition = "…" | text | "top" "bottom" |
yMax = "…" | number | |
yMin = "…" | number | |
yTickScaleFactor = "…" | math |
Property | Type |
---|---|
$g.aspectRatio | number |
$g.disabled | boolean |
$g.displayDecimals | integer |
$g.displayDigits | integer |
$g.displayMode | text |
$g.displaySmallAsZero | number |
$g.displayXAxis | boolean |
$g.displayXAxisTickLabels | boolean |
$g.displayYAxis | boolean |
$g.displayYAxisTickLabels | boolean |
$g.fixAxes | boolean |
$g.fixed | boolean |
$g.fixLocation | boolean |
$g.grid | |
$g.hidden | boolean |
$g.hideOffGraphIndicators | boolean |
$g.horizontalAlign | text |
$g.identicalAxisScales | boolean |
$g.padZeros | boolean |
$g.showBorder | boolean |
$g.showNavigation | boolean |
$g.size | text |
$g.width | componentSize |
$g.xLabel | label |
$g.xLabelPosition | text |
$g.xMax | number |
$g.xMin | number |
$g.xscale | number |
$g.xTickScaleFactor | math |
$g.yLabel | label |
$g.yLabelAlignment | text |
$g.yLabelPosition | text |
$g.yMax | number |
$g.yMin | number |
$g.yscale | number |
$g.yTickScaleFactor | math |
Examples Page 1
Example: Default <graph>
Here a default <graph>
is illustrated without any additional attributes.
Example: <graph>
with default grid
A <graph>
with a default grid is illustrated. As you zoom in and out of
the graph the size of the grid adapts to the view. To zoom, use the (+) and (-) buttons
at the bottom of the graph.
Example: Invisible <graph>
with shapes
A <graph>
without border, axes, or navigation buttons appears invisible.
Example: <graph>
with axis labels
Axis labels are specified using the <xLabel>
and <yLabel>
components as
children of the <graph>
.
Example: <graph>
with legend
Legends are constructed by adding a <legend>
child to the <graph>
component. See <legend>
for more examples.
Example: Components that can be placed on a <graph>
Many different components can be placed on a <graph>
. If the anchor
attribute
is included, the rendered object is centered at the point specified. Otherwise, the
component is centered at .
Note that <mathInput/>
components cannot be placed on a <graph>
.
Instead, a <textInput/>
can be included, and basic math expressions can be
performed for math entered into a <textInput/>
.
Attribute Example: xmin, xmax, ymin, ymax
Use the xmin
, xmax
, ymin
and ymax
attributes to adjust the extents of
the axis scales. Note that the relative proportions of the axes will automatically
adjust to keep the <graph>
square unless the identicalAxisScales
attribute
is also specified, as illustrated in the second graph.
Attribute Example: width
The width
attribute specifies the absolute width of the graph. Doenet determines
the size
category that corresponds to that width and sizes the graph accordingly.
Attribute Example: size
The size
attribute specifies one of 5 size categories for the
<graph>
: tiny
, small
, medium
, large
, or full
.
Attribute Example: aspectRatio
The aspectRatio
attribute allows for customization of the graph’s default proportions.
Attribute Example: displayMode
The displayMode
attribute affects how the <graph>
is positioned on screen.
The default mode is “block”, which renders the graph centered on screen. The available
modes are inline
, and block
.
Attribute Example: horizontalAlign
The horizontalAlign
attribute specifies the horizontal position on-screen
for the default block-mode style graph. Valid values are left
, center
, and right
,
with a default of center
.