Ну, если вы делаете математику:
the x of the circle is: 100
the y of the circle is: 75
So, the text should be around (95, 80)
Примечание: координата (x, y) text
зависит от координаты круга. Как уже было сказано, вы можете сделать его более динамичным:
const circleCords = { x: 100, y: 75 }
// You can adjust the x, y of the text. Because `5` is just for testing.
// I mean by that, that you would have to get the width of the text and then calculate how much you'd subtract from the circleCords!
const textCords = { x: circleCords - 5, y: circleCords + 5 }
ctx.arc(circleCords.x, circleCords.y, 50, 0,2*Math.PI);
ctx.fillText("hey", textCords.x, textCords.y);
Если ширина вашего текста всегда постоянна, все будет в порядке, вычитая случайное число по желанию. В этом случае 5
.
Надеюсь, что это может помочь!