Javascript 如何在ExtJs中更改图形底轴特定月份的颜色?
我使用ExtJS4.1绘制了图形,我的要求是,在某些月份之后,我需要更改图形底部轴(月份字段)标签的颜色我已经走了很多路,如下所示,但无法实现。有人能告诉我如何实现吗?非常感谢。多谢各位 此方法将从1月到12月将整个标签颜色更改为红色Javascript 如何在ExtJs中更改图形底轴特定月份的颜色?,javascript,extjs,extjs4,extjs4.1,Javascript,Extjs,Extjs4,Extjs4.1,我使用ExtJS4.1绘制了图形,我的要求是,在某些月份之后,我需要更改图形底部轴(月份字段)标签的颜色我已经走了很多路,如下所示,但无法实现。有人能告诉我如何实现吗?非常感谢。多谢各位 此方法将从1月到12月将整个标签颜色更改为红色 { type: 'Category', position: 'bottom', fields: ['month'],
{
type: 'Category',
position: 'bottom',
fields: ['month'],
//dashSize: 0,
label: {
font: '10px Verdana',
fill: 'Red',
}
}
下面的方法不起作用
{
type: 'Category',
position: 'bottom',
fields: ['month'],
//dashSize: 0,
label: {
renderer: function(name, a, b, c,attr) {
Ext.apply(name, {
fill: 'Red'
});
Ext.apply(a, {
fill: 'Red'
});
Ext.apply(b, {
fill: 'Red'
});
Ext.apply(c, {
fill: 'Red'
});
Ext.apply(attr, {
fill: 'Red'
});
return name;
}
},
renderer: function(sprite, record, attr, index, store) {
Ext.apply(attr, {
fill: 'Red'
});
sprite.setAttributes({fill: 'red'}, true);
return attr;
}
}
最后。我做到了。这是解决办法。我在这里检查的条件是,我们可以写开关盒,使特定月份的颜色变化
label: {
renderer: function(v) {
debugger
if(v == 'JAN'){
//this.font = "bold 12px Arial, Helvetica, sans-serif";
this.padding = 5;
this.fill= 'blue';
}
else{
this.fill= 'black';
}
return v;
}
}