是否可以在图表中添加标题? [英] 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.draw 上的标题或任何标签创建 text sprites包.但我无法理解如何使用它..
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..
这里有人做过吗?
推荐答案
由于 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屋!