简体   繁体   中英

amCharts 5 how to add text value inside Rectangle bullet?

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

带项目符号的矩形

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'),
          }),
        });
      });

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM