Skip to content

Drawing Labels

-5-4-3-2-1012345543210-1-2-3-4-5(0,0)Such wow!

Props

NameTypeDefaultDescription
textstringnoneThe text of the label.
positionPossibleVector2[0,0]The position of the label. Relative to the label's center.
colorstring#000The color of the label.
size"small"|"normal"|"large"normalThe size of the label.
rotationnumber0The counter-clockwise rotation of the label in degrees.
borderbooleantrueWhether the label should be drawn with a border.

Examples

Basic Label

Hello, World!
Code
vue
<template>
  <Graph :units="false">
    <Label :position="[2, 3]" text="Hello, World!" />
  </Graph>
</template>

Different sizes

SmallNormalLarge
Code
vue
<template>
  <Graph :units="false" :grid="false" :axis="false">
    <Label :position="[0, 2]" text="Small" size="small" />
    <Label :position="[0, 0]" text="Normal" size="normal" />
    <Label :position="[0, -2]" text="Large" size="large" />
  </Graph>
</template>

Custom colors

Hot Pink!Light Sea Green!Dark Slate Blue!
Code
vue
<template>
  <Graph :units="false" :grid="false" :axis="false">
    <Label :position="[0, 2]" text="Hot Pink!" color="hotpink" />
    <Label :position="[0, 0]" text="Light Sea Green!" color="lightseagreen" />
    <Label :position="[0, -2]" text="Dark Slate Blue!" color="darkslateblue" />
  </Graph>
</template>

Rotated Label

30° rotation!
Code
vue
<template>
  <Graph :units="false" :grid="false" :axis="false">
    <Label :position="[0, 2]" text="30° rotation!" :rotation="30" />
  </Graph>
</template>

Label Without Border

Just Text
Code
vue
<template>
  <Graph :units="false" :grid="false" :axis="false">
    <Label text="Just Text" :border="false" />
  </Graph>
</template>