我想使用extjs条形图将自定义颜色和其他样式添加到条形图中,我期望在插件属性中进行样式的处理。 这里是我的代码如何将自定义颜色添加到extjs条形图
Ext.require([
'Ext.chart.Chart'
]);
Ext.define('CricketScore', {
extend: 'Ext.data.Model',
fields: ['month', 'data1' ]
});
var store = Ext.create('Ext.data.Store', {
model: 'CricketScore',
data: [
{ month: 'Jan', data1: 20 },
{ month: 'Feb', data1: 20 },
{ month: 'Mar', data1: 19 },
{ month: 'Apr', data1: 18 },
{ month: 'May', data1: 18 },
{ month: 'Jun', data1: 17 },
{ month: 'Jul', data1: 16 },
{ month: 'Aug', data1: 16 },
{ month: 'Sep', data1: 16 },
{ month: 'Oct', data1: 16 },
{ month: 'Nov', data1: 15 },
{ month: 'Dec', data1: 15 }
]
});
Ext.create('Ext.chart.Chart', {
//renderTo: Ext.getBody(),
renderTo: "demoChart",
width: 400,
height: 300,
store: store,
animate: true,
axes: [
{
type: 'Numeric',
position: 'bottom',
fields: ['data1'],
minimum: 0,
maximum:100
}, {
type: 'Category',
position: 'top',
fields: ['month'],
}
],
series: [
{
type: 'column',
axis: 'left',
xField: 'month',
yField: 'data1',
style :{
fill : '#343234',
'stroke-width': 30
},
highlight: {
fill: '#cd1c5f',
'stroke-width': 10,
stroke: '#ed2b74'
},
tips: {
trackMouse: true,
style: 'background: #FFF',
height: 20,
renderer: function(storeItem, item) {
this.setTitle(storeItem.get('month') + ': ' + storeItem.get('data1') + '%');
}
}
}
]
});
这里是Jisfiddle
http://jsfiddle.net/djaydxnd/54/
你正在使用哪个ExtJS版本? –