Skip to Content
ReferencevectorList

<vectorList>

A list of vectors

<vectorList> is a graphical-list component that holds a collection of vectors. Each vector is drawn as a <vector> is, and can be dragged on its own.

A vector written as (x, y) in the list’s text is its displacement, with its tail at the origin until its tail, or the whole vector, is dragged. A <vector> among its children, or a reference such as $v, is one of its vectors too, with its own tail and head, label and style. Taken on its own, as $vs[1] in a graph, such a vector keeps its label, and is fixed, undraggable (as a whole, by its head or by its tail) or has fixLocation when that vector does. It is also fixed in a fixed graph.

When creating a <vectorList>, separate items by spaces, not commas. The component will default to displaying the list with commas. (The commas inside each vector’s (x, y) component tuple are part of the vector itself, not separators between vectors.)

Attributes and Properties

Attributes for <vectorList>

Highlighted (1)

boolean. Default value: true. Whether to render the items separated by commas (true) or with no separator (false).

Number display (5)
avoidScientificNotationAdded in 0.7.16

boolean. Default value: false. Whether to render numbers in full decimal form rather than scientific notation.

displayDecimals

integer. Default value: 2. Number of decimal places to display when rendering this number.

displayDigits

integer. Default value: 3. Number of significant digits to display when rendering this number.

displaySmallAsZero

number. Default value: 1e-14. Threshold below which numbers are displayed as zero.

padZeros

boolean. Default value: false. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Other (2)

number. Default value: Infinity. Maximum number of items to retain in the list.

boolean. Default value: false. Whether the order of items in this list should be treated as unordered (e.g. for matching).

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <vectorList name="v">

Number display (5)
$v.avoidScientificNotationIn development

boolean. Whether to render numbers in full decimal form rather than scientific notation.

$v.displayDecimalsIn development

integer. Number of decimal places to display when rendering this number.

$v.displayDigitsIn development

integer. Number of significant digits to display when rendering this number.

$v.displaySmallAsZeroIn development

number. Threshold below which numbers are displayed as zero.

$v.padZerosIn development

boolean. Whether to pad displayed numbers with trailing zeros to fill the requested digits/decimals.

Other (6)
$v.maxNumber

number. Maximum number of items to retain in the list.

$v.numComponentsIn development

number. The number of items in the list.

$v.numDimensionsIn development

integer. The number of dimensions of the items, the largest among them.

$v.numValues

number. The number of values in the list.

number. The number of vectors in the list.

$v.unordered

boolean. Whether the order of items in this list should be treated as unordered (e.g. for matching).

Common to all components (8)
$v.disabledIn development

boolean. Whether this component is disabled and cannot be interacted with.

$v.doenetML

text. The DoenetML source code that produced this component.

$v.fixedIn development

boolean. Whether this component's value is fixed and cannot be modified.

$v.fixLocationIn development

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$v.hiddenIn development

boolean. Whether this component is hidden from the rendered output.

$v.hide

boolean. Whether to hide this component from the rendered output.

$v.isResponseIn development

boolean. Whether this component is treated as a response for the purposes of assessment.

$v.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: Defining a <vectorList> and accessing an item

Each vector is written as (x, y). Spaces between the parenthesized tuples separate the vectors; the comma between x and y is part of a single vector. Individual vectors are addressable with array notation.


Example: A <vectorList> on a graph

When placed inside a <graph>, a <vectorList> renders each of its vectors; a vector written as text, as here, starts at the origin. Drag a vector’s head to change its components, its tail to move the tail and keep the head, or the vector itself to move it.


Example: 3-component vectors

Vectors may have any number of components; all vectors in the list have the same number (the most any of them has), and a vector with fewer has 0 in the components it lacks.

Attribute Examples

Attribute Example: unordered

The unordered attribute makes comparisons (e.g., inside a <boolean> or an <award>) ignore the order of vectors.


Attribute Example: maxNumber

The maxNumber attribute imposes a limit on the number of vectors retained in the list, regardless of how many are supplied.


Attribute Example: asList

By default a <vectorList> renders its items joined by commas. Setting asList="false" removes the separator so the items render concatenated.

Property Examples

Property Example: numVectors

The numVectors property returns the number of vectors in the list. The alias numValues returns the same value.

Last updated on