我現在使用的是extjs 4,它的Ext.chart.axis.Category
。extjs4:如何在每個單詞中定製軸標籤
但是如何自定義每個單詞中的標籤?
說,我在軸的底部標籤中有72個數字,我只想要粗體24和48。
我檢查了Ext.chart.Label
,發現有一個有用的函數叫做renderer
。但它僅用於文本更改,而不是樣式更改。
我的示例代碼片段:
{
xtype: 'chart',
id: 'monitorAmmeter72chart',
animate: false,
region: 'center',
store:Ext.data.StoreManager.lookup('monitorAmmeter72Store'),
axes: [
{
type: 'Category',
fields: ['hourDis'],
position: 'bottom',
title: 'blablabla',
grid: true,
label:{
renderer:function(v){
if(v == '24'){
return '<b>24</b>';//Note, this won't work.
}else{
return v;
}
}
}
},
{
type: 'Numeric',
fields: ['data'],
position: 'left',
title: 'another blablabla',
grid: true,
minimum: 0
}
],
series: [
{
type: 'column',
axis: 'left',
highlight: false,
tips: {
trackMouse: false,
width: 50,
height: 28,
renderer: function(storeItem, item) {
this.setTitle(storeItem.get('data') + ' xx');
}
},
style: {
fill: '#38B8BF'
},
gutter: 20,
xField: 'hour',
yField: 'data'
}
]
}
我已經嘗試過像''代碼,但它不工作。也許這是因爲它使用SVG渲染,但是我對SVG一無所知。 – liuyanghejerry 2012-03-06 15:08:12