Is it possible to add title to charts?

后端 未结 5 1402
傲寒
傲寒 2021-02-13 12:39

I want to add a title to a chart, like in the gauge example or a pie chart. I want to display a title under or on top of the chart. Is this possible? I\'ve been looking and can\

5条回答
  •  情书的邮戳
    2021-02-13 13:22

    I'd recommend not using a sprite since you'll likely want the title centered. Any changes to the container size or your text length won't be automatically handled since the sprite approaches described in other answers here all hardcode the location. Centering with a sprite can be done with some effort but I'd consider leveraging the layout system. This way your page contents can automatically be positioned nicely when your page resizes.

    // Use a vbox layout with whatever options you need
    layout: {
        type: 'vbox',
        align: 'center'
    },
    items: [{
        type: 'container',
        html: 'My Title'
    },{
        type: 'chart',
        flex: 1,
        // ...etc
    }];
    

提交回复
热议问题