Skip to content

Drawing Vectors

aba-b

Props

NameTypeDescriptionDefault
fromPossibleVector2The start position of the vector in local units[0,0]
toPossibleVector2The end position of the vector in local unitsnone
colorstringThe color of the vector#000
dashedbooleanWhether the vector should be drawn with a dashed linefalse
labelstringThe label text for this vector.undefined
label-size"small"| "normal"|"large"The size of the label text"normal"
line-widthnumberThe line width of the vector1.75
arrow-sizenumberThe size of the vector's arrow13

Examples

Basic Vector

-5-4-3-2-1012345543210-1-2-3-4-5
Code
vue
<template>
  <Graph>
    <Vector :to="[3, 2]" />
  </Graph>
</template>

Vector with a label

-5-4-3-2-1012345543210-1-2-3-4-5a
Code
vue
<template>
  <Graph>
    <Vector :to="[-2, -3]" label="a" />
  </Graph>
</template>

Vector not starting at the origin

-5-4-3-2-1012345543210-1-2-3-4-5
Code
vue
<template>
  <Graph>
    <Vector :from="[3, 3]" :to="[1, 1]" />
  </Graph>
</template>

Multiple Vectors

-5-4-3-2-1012345543210-1-2-3-4-5aba-b
Code
vue
<template>
  <Graph>
    <Vector :to="[4, 1]" label="a" />
    <Vector :to="[1, 4]" color="lightseagreen" label="b" />
    <Vector :from="[1, 4]" :to="[4, 1]" color="steelblue" label="a-b" dashed />
  </Graph>
</template>