Is it possible to add title to charts?

后端 未结 5 1363
傲寒
傲寒 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:29

    You can simply add a sprite to the cart.surface:

    var chart = Ext.create('Ext.chart.Chart', {
        ... default chart settings here ...
    });
    var sprite = Ext.create('Ext.draw.Sprite', {
        type: 'text',
        surface: chart.surface,
        text: 'Simple text',
        font: '12px Arial',
        x: 50,
        y: 0,
        width: 100,
        height: 100 
    });
    sprite.show(true);
    chart.surface.add(sprite);
    

    Hope it helps.

提交回复
热议问题