<cobwebPolyline>
<cobwebPolyline> visualizes the iteration of a one-variable function.
When placed inside a <graph>, the user clicks to add successive vertices
that should alternate between the curve and the diagonal . Each vertex is graded for
correctness against the true iteration, so the component can drive both interactive exploration and answer checking.
Attributes and Properties
Attributes for <cobwebPolyline>
Number display (5)
avoidScientificNotationboolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.
displayDecimalsinteger. Default value: 2. Number of decimal places to display when rendering this number.
displayDigitsinteger. Default value: 3. Number of significant digits to display when rendering this number.
displaySmallAsZeronumber. Default value: 1e-14. Threshold below which numbers are displayed as zero.
padZerosboolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (1)
labelIsNameboolean. Default value: false. Whether to use this component's name as its rendered label.
Other (27)
allowDilationboolean. Default value: true. Whether the shape can be dilated (scaled) under drag.
allowReflectionboolean. Default value: true. Whether the polyline can be reflected under drag.
allowRotationboolean. Default value: true. Whether the polyline can be rotated under drag.
allowTranslationboolean. Default value: true. Whether the polyline can be translated under drag.
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
attractThresholdnumber. Default value: 0.5. Distance within which a dragged vertex snaps to the function curve or diagonal.
defaultPointpoint. The default location for newly added points on the cobweb diagram.
draggableboolean. Default value: true. Whether the polyline can be dragged on a graph.
functionfunction. The function being iterated.
initialPoint[ point ]. The starting point on the diagonal where iteration begins.
layerinteger. Default value: 0. Z-order layer index used to stack graphical components (higher values render on top).
lineStylekeyword. Stroke style for lines.
| Value | Description |
|---|---|
solid | Continuous, unbroken stroke. |
dashed | Stroke composed of evenly-spaced dashes. |
dotted | Stroke composed of evenly-spaced dots. |
lineWidthnumber. Stroke width for lines, in pixels.
lockToSolutionboolean. Default value: false. Whether to constrain dragged vertices to the correct cobweb solution.
minShrinknumber. Default value: 0.1. Minimum scaling factor allowed when dilating.
numIterationsRequirednumber. Default value: 0. Minimum number of iterations the user is required to perform.
numPointsnumber. Default value: 1. Number of points (iterations) currently shown on the cobweb diagram.
preserveSimilarityboolean. Default value: false. Whether the shape is preserved up to similarity (uniform scaling) under drag.
rigidboolean. Default value: false. Whether the polyline is treated as rigid (preserves shape under drag).
rotateAroundkeyword. What point to rotate the shape around.
| Value | Description |
|---|---|
centroid (default) | Rotate around the centroid of the shape. |
vertex | Rotate around the vertex specified by rotationVertex. |
point | Rotate around the explicit point given by rotationCenter. |
rotationCenterpoint. The point to rotate around when rotateAround is 'point'.
rotationHandleVerticesnumberList. Default value: [1]. Vertex indices that should display rotation handles when the shape is rigid or preserves similarity.
rotationVertexinteger. Default value: 1. The vertex index to rotate around when rotateAround is 'vertex'.
showCoordsWhenDraggingboolean. Default value: true. Whether to show coordinate labels while dragging.
_variableName. Default value: . Symbol used as the independent variable when displaying iterate values.
vertices[ pointList ]. The list of vertex points that define the shape.
verticesDraggableboolean. Whether individual vertices may be dragged independently.
Common to all components (9)
copyreference. Create an independent copy of another component by reference. Enter a references a $name.
disabledboolean. Default value: false. Whether this component is disabled and cannot be interacted with.
extendreference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.
fixedboolean. Default value: false. Whether this component's value is fixed and cannot be modified.
fixLocationboolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
hideboolean. Default value: false. Whether to hide this component from the rendered output.
isResponseboolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.
nametext. The name used to reference this component from elsewhere in the document.
styleNumberinteger. Default value: 1. The style number used to select this component's visual styling from the available style definitions.
Properties for <cobwebPolyline name="c">
Number display (5)
$c.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$c.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$c.displayDigitsinteger. Number of significant digits to display when rendering this number.
$c.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$c.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (2)
$c.labellabel. The label rendered with this component.
$c.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (35)
$c.allowDilationboolean. Whether the polyline can be dilated under drag.
$c.allowReflectionboolean. Whether the polyline can be reflected under drag.
$c.allowRotationboolean. Whether the polyline can be rotated under drag.
$c.allowTranslationboolean. Whether the polyline can be translated under drag.
$c.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
$c.attractThresholdnumber. Distance within which a dragged vertex snaps to the function curve or diagonal.
$c.center[ math ]. The centroid of the polyline's vertices.
$c.correctVertices[ boolean ]. Per-vertex flags indicating whether each vertex is positioned at the correct cobweb solution.
$c.disabledboolean. Whether this component is disabled and cannot be interacted with.
$c.draggableboolean. Whether the polyline can be dragged on a graph.
$c.fixedboolean. Whether this component's value is fixed and cannot be modified.
$c.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
number. The fraction of vertices placed at correct cobweb positions.
$c.fractionCorrectVerticesAdjustednumber. The fraction of correct vertices, scaled by the required minimum number of iterations.
$c.initialPoint[ math ]. The starting point on the diagonal where iteration begins.
$c.iterateValues[ math ]. The list of iterate values shown by the cobweb diagram.
$c.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
$c.lengthnumber. The total length of the polyline.
$c.numCorrectVerticesnumber. The number of cobweb vertices placed at correct positions.
$c.numDimensionsnumber. The number of dimensions the polyline lives in.
$c.numGradedVerticesnumber. The number of cobweb vertices that were evaluated for correctness.
$c.numGradedVerticesAdjustednumber. The effective number of graded vertices after adjusting for the required minimum number of iterations.
$c.numIterateValuesnumber. The number of iterate values produced by the cobweb diagram.
$c.numIterationsRequirednumber. Minimum number of iterations the user is required to perform.
$c.numPointsnumber. Number of points (iterations) currently shown on the cobweb diagram.
$c.numVerticesnumber. Number of cobweb vertices currently shown (alias for numPoints).
$c.preserveSimilarityboolean. Whether the polyline preserves its shape (up to similarity).
$c.rigidboolean. Whether the polyline is treated as rigid (preserves shape under drag).
$c.showCoordsWhenDraggingboolean. Whether to show coordinate labels while dragging.
$c.styleDescriptiontext. A textual description of the polyline's style.
$c.styleDescriptionWithNountext. Style description including the word "polyline".
$c.variable_variableName. Symbol used as the independent variable when displaying iterate values.
$c.vertices[ math ]. The vertices of the polyline.
$c.verticesDraggableboolean. Whether each vertex can be dragged independently.
Common to all components (4)
$c.doenetMLtext. The DoenetML source code that produced this component.
$c.hideboolean. Whether to hide this component from the rendered output.
$c.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$c.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Basic cobweb for a quadratic iteration
A <cobwebPolyline> is added to a graph that already shows the function curve and the diagonal. The
function attribute identifies the iterated function, initialPoint sets the starting point on the diagonal,
and numPoints controls how many vertices are currently displayed. As the user drags successive vertices, each
one snaps to either the curve or the diagonal when within attractThreshold of the correct position.
Example: Locked to the correct solution
Setting lockToSolution forces every vertex to lie at the exact cobweb position, ignoring any user drag.
This is useful for demonstrating an iteration deterministically — for instance to illustrate convergence or
divergence from different initial conditions without manual placement.
Example: Reading the iterate values
The iterateValues property is an array of the successive values implied by the
current vertices, with one entry per iteration. Combined with <repeat> this lets the document
render a numeric table of the iteration that stays in sync with the diagram.
Example: Scoring a cobweb answer
For graded use, award credit equal to the fractionCorrectVerticesAdjusted property. That value is the
fraction of correctly placed vertices, scaled by numIterationsRequired so a partial cobweb cannot earn full
credit just by having a few correct vertices. The vertices themselves are recorded as the answer’s responses
via <considerAsResponses>.
Attribute Examples
Attribute Example: variable
The variable attribute sets the symbol used as the independent variable when displaying iterate values. It
does not change the function being iterated; it only affects rendering.
Property Examples
Property Example: fractionCorrectVertices
The fractionCorrectVertices property is the unscaled fraction of placed vertices that are at the correct
cobweb positions. Use this when you do not want to enforce a minimum number of iterations; use
fractionCorrectVerticesAdjusted (illustrated in the scoring example above) when you do.