<vector>
<vector> is a Graphical
component that renders a vector when nested within a <graph>. Outside a graph, it can be used in vector computations.
Attributes and Properties
Attributes for <vector>
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 (19)
addControlskeyword. Whether to render interactive control handles.
| Value | Description |
|---|---|
displacement (default) | Show a control handle for translating the whole vector. |
headAndTail | Show control handles for both the head and the tail. |
headOnly | Show a control handle only at the head. |
tailOnly | Show a control handle only at the tail. |
none | Show no control handles. |
applyStyleToLabelboolean. Default value: false. Whether to apply this component's selected style to its label.
controlOrderinteger. Default value: 0. Slot order for graph controls (1-indexed; 0 means no explicit slot request).
[ coords ]. The vector's displacement (head minus tail).
boolean. Default value: false. Whether to display the vector with angle brackets (e.g. ⟨1,2⟩).
boolean. Default value: true. Whether the vector can be dragged on a graph.
[ point ]. The head (tip) point of the vector.
boolean. Whether the vector's head can be dragged.
labelPositionkeyword. Where the label sits along this line/curve.
| Value | Description |
|---|---|
upperRight | Place the label above and to the right of the line. |
upperLeft | Place the label above and to the left of the line. |
lowerRight | Place the label below and to the right of the line. |
lowerLeft | Place the label below and to the left of the line. |
center (default) | Place the label at the midpoint of the line. |
top | Place the label directly above the line. |
bottom | Place the label directly below the line. |
left | Place the label directly to the left of the line. |
right | Place the label directly to the right of the line. |
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.
showCoordsWhenDraggingboolean. Default value: true. Whether to show coordinate labels while dragging.
[ point ]. The tail (base) point of the vector.
boolean. Whether the vector's tail can be dragged.
math. The first component (x) of the vector's displacement.
mathList. The vector's displacement components as a list.
math. The second component (y) of the vector's displacement.
zmath. The third component (z) of the vector's displacement.
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 <vector name="v">
Number display (5)
$v.avoidScientificNotationboolean. Whether to render numbers in full decimal form rather than scientific notation.
$v.displayDecimalsinteger. Number of decimal places to display when rendering this number.
$v.displayDigitsinteger. Number of significant digits to display when rendering this number.
$v.displaySmallAsZeronumber. Threshold below which numbers are displayed as zero.
$v.padZerosboolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.
Labels (2)
$v.labellabel. The label rendered with this component.
$v.labelIsNameboolean. Whether to use this component's name as its rendered label.
Other (28)
$v.addControlstext. Whether to render interactive control handles.
$v.applyStyleToLabelboolean. Whether to apply this component's selected style to its label.
$v.backgroundColortext. Human-readable name for this component's background color, derived from the active style and theme.
$v.controlOrderinteger. Slot order for graph controls (1-indexed; 0 means no explicit slot request).
$v.disabledboolean. Whether this component is disabled and cannot be interacted with.
$v.displacement[ math ]. The displacement (head − tail) of the vector.
$v.displayWithAngleBracketsboolean. Whether to display the vector with angle brackets (e.g. ⟨1,2⟩).
$v.draggableboolean. Whether the vector can be dragged on a graph.
$v.fixedboolean. Whether this component's value is fixed and cannot be modified.
$v.fixLocationboolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).
$v.head[ math ]. Coordinates of the vector's head.
$v.headDraggableboolean. Whether the vector's head can be dragged independently.
$v.labelPositiontext. Where the label sits along this line/curve.
$v.latexlatex. The vector rendered as a LaTeX string.
$v.layerinteger. Z-order layer index used to stack graphical components (higher values render on top).
$v.magnitudemath. The magnitude (length) of the vector.
number. Number of dimensions of the vector.
$v.showCoordsWhenDraggingboolean. Whether to show coordinate labels while dragging.
$v.styleDescriptiontext. A textual description of the vector's style.
$v.styleDescriptionWithNountext. Style description including the word "vector".
$v.tail[ math ]. Coordinates of the vector's tail.
$v.tailDraggableboolean. Whether the vector's tail can be dragged independently.
$v.textColortext. Human-readable name for this component's text color, derived from the active style and theme.
$v.textStyleDescriptiontext. Human-readable description of this component's text styling (color and any background color).
$v.xmath. The first component (x) of the vector's displacement.
$v.ymath. The second component (y) of the vector's displacement.
$v.zmath. The third component (z) of the vector's displacement.
Common to all components (4)
$v.doenetMLtext. The DoenetML source code that produced this component.
$v.hideboolean. Whether to hide this component from the rendered output.
$v.isResponseboolean. Whether this component is treated as a response for the purposes of assessment.
$v.styleNumberinteger. The style number used to select this component's visual styling from the available style definitions.
Examples
Example: Default <vector>
A default <vector> without any additional attributes has tail at the origin and head at .
Example: <vector> math
A <vector> within a <math> follows vector operations.
Attribute Examples
Attribute Example: x,y
The x and y attributes allow the vector to be specified by its coordinates or row
elements for a vector given by .
Attribute Example: xs
The xs attribute allows the vector to be specified by its displacements in list format. To
access or render the list information, use index notation.
Attribute Example: displacement
Use the displacement property to specify the displacement of the vector in each direction from its tail position.
Attribute Example: head, tail
Use head and tail to specify the head and tail coordinates of the vector directly.
Attribute Example: displayWithAngleBrackets
If this is the desired rendering format, use the attribute displayWithAngleBrackets.
Attribute Example: draggable
The draggable attribute determines whether the <vector> can be dragged around the <graph>. All graphical objects are draggable by default.
Attribute Example: headDraggable, tailDraggable
The head and tail of a <vector> are draggable by default. Use the headDraggable or tailDraggable attribute set to false to disable users from changing the direction and length of the <vector>. The vector as a whole can still be repositioned on the <graph>.
Attribute Example: Standard graphical attributes
The uses of the following standard graphical attributes are illustrated: hide, fixLocation, layer, styleNumber, applyStyleToLabel and labelIsName.
Property Examples
Property Example: numDimensions
The numDimensions property returns the number of dimesions of the <vector>.
Property Example: magnitude
The magnitude property renders the magnitude of the named <vector>.
Property Example: latex
The latex property renders the latex code for rendering the named <vector>.