amCharts 5 how to add text value inside Rectangle bullet?

Viewed 21

In my amcharts i like to add a text inside the Rectangle bullet. how to add? this is what I need:

rectangle with bullet

here is my bullet part of code: ( using amchart5)

series2.bullets.push(function () {
        return am5.Bullet.new(root, {
          sprite: am5.Rectangle.new(root, {
            height: 10,
            width: 10,
            centerX: 5,
            centerY: 10,
            stroke: am5.color('#f00'),
          }),
        });
      });
1 Answers

I added using label:

` series2.bullets.push(function () {
        return am5.Bullet.new(root, {
          sprite: am5.Label.new(root, {
            text: 'H',
            fontSize: 8,
            centerX: am5.percent(50),
            centerY: am5.percent(70),
            textAlign: 'center',
            populateText: true,
          }),
        });

`

works fine.

Related