Ext.define('saas.view.home.charts.MonthIO', { extend: 'saas.view.core.chart.ChartBase', xtype: 'month-io', id: 'month_io', initComponent: function () { var me = this; Ext.apply(me, { items: [{ xtype: 'cartesian', reference: 'chart', colors: [ '#2C82BE', '#82CCFF' ], bind: { captions: { title: { text: '本月收入(万元):{month_in}\n本月支出(万元):{month_out}', style: { 'font-size': '14px', 'color': '#485465', 'letter-spacing': '-0.07px' }, align: 'left' }, }, store: '{month_io}' }, // legend: { // type: 'sprite', // docked: 'bottom' // }, axes: [{ type: 'numeric', position: 'left', adjustByMajorUnit: true, fields: ['main'], minimum: 0, grid: { even: { stroke: '#E7EBEF' }, odd: { stroke: '#E7EBEF', } }, style: { fill: '#fff', strokeStyle: 'transparent' }, }, { type: 'category', position: 'bottom', fields: ['x'], style: { fill: '#E7EBEF', strokeStyle: 'transparent' }, }], series: [{ type: 'bar', title: ['主营业务', '其他业务'], xField: 'x', yField: ['main', 'other'], stacked: true, style: { lineWidth: 0, strokeStyle: 'transparent', maxBarWidth: 50, }, tooltip: { trackMouse: true, renderer: me.onBarTipRender } }] }] }); me.callParent(arguments); }, onBarTipRender: function (tooltip, record, item) { var fieldIndex = Ext.Array.indexOf(item.series.getYField(), item.field), type = item.series.getTitle()[fieldIndex]; tooltip.setHtml(type + record.get('x') + record.get(item.field)); }, });