是否可以添加图表的标题? [英] Is it possible to add title to charts?
问题描述
我想向图表添加标题,例如规格示例或饼图。我想在图表下方或顶部显示一个标题。这可能吗?我一直在寻找,找不到任何关于这个。如果是,任何提示分享?
它将是这样的东西
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't find anything about this. if so , any tip to share? it would be something like this
编辑 :我发现有一个属性为 Ex的标题或任何标签创建文本精灵绘制包。
但我不明白如何使用它..
EDIT: i found there is a property to create text sprites for the title or any labels at the Ex.draw package. but i couldnt understand how to use it..
anybdy这里做的一样?
anybdy here have done the same?
推荐答案
由于Ext.chart.Chart是Ext.draw.Component,您可以添加精灵作为项目。尝试使用这个:
Since Ext.chart.Chart is an Ext.draw.Component, you can add sprites as items of it. Try to use this:
Ext.create('Ext.chart.Chart', {
default chart settings here
...
items: [{
type : 'text',
text : 'Simple Title',
font : '14px Arial',
width : 100,
height: 30,
x : 50, //the sprite x position
y : 10 //the sprite y position
}]
})
这篇关于是否可以添加图表的标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!