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', insetPadding: '28 0 0 0', colors: [ '#2C82BE', '#82CCFF' ], bind: { captions: { title: { text: '本月收入支出额(万元)\n收入:{month_in}\t支出:{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, label: { fillStyle: '#485465' }, grid: { even: { stroke: '#F7F8FA' }, odd: { stroke: '#F7F8FA', } }, style: { fill: '#fff', strokeStyle: 'transparent' }, }, { type: 'category', position: 'bottom', fields: ['x'], label: { fillStyle: '#485465' }, style: { fill: '#F7F8FA', 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)); }, });