0

I am using JCanvas for drawing some arc. But I am not able to define label for arc. Please suggest on how to define arc's label in Jcanvas.

Here is my arc code.

$('canvas').drawArc({
  strokeStyle: 'red',
  strokeWidth: 4,
  rounded: true,
  endArrow: true,
  arrowRadius: 15,
  arrowAngle: 90,
  x: 175, y: 175,
  start: 90,
  end: 160,
  radius: 150
});

1 Answers1

1

If you wish to create a text label to accompany your arc, you'll need to use the drawText() method (documented here) to place your desired text alongside the arc.

For instance:

$('canvas')
.drawArc({
  strokeStyle: 'red',
  strokeWidth: 4,
  rounded: true,
  endArrow: true,
  arrowRadius: 15,
  arrowAngle: 90,
  x: 175, y: 175,
  start: 90,
  end: 160,
  radius: 150
})
.drawText({
  fillStyle: 'red',
  fontFamily: 'sans-serif',
  fontSize: 24,
  text: 'My arc label',
  x: 140, y: 320
});

The above code renders the following:

jCanvas arc with label

caleb531
  • 4,111
  • 6
  • 31
  • 41