Ext.define('saas.view.home.charts.MonthIO', { extend: 'saas.view.core.chart.ChartBase', xtype: 'month-io', id: 'month_io', // bind: { // title: '本月收入支出额(万元)
收入:{month_in}支出:{month_out}
' // }, title: '本月收入支出额(万元)', initComponent: function () { var me = this; Ext.apply(me, { items: [{ xtype: 'cartesian', colors: [ '#2C82BE', '#82CCFF' ], bind: { legend: { type: 'dom', docked: 'top', padding: 0, bodyPadding: 0, border: 0, cls: 'x-monthio-legend', html: '
收入:{month_in}支出:{month_out}
' }, insetPadding: '{insetPadding}', store: '{month_io}' }, axes: [{ type: 'numeric', position: 'left', adjustByMajorUnit: true, fields: ['main'], minimum: 0, label: { fontSize: '12px', fillStyle: '#485465' }, grid: { even: { stroke: '#E5EAEF' }, odd: { stroke: '#E5EAEF', } }, style: { fill: '#fff', strokeStyle: 'transparent' }, }, { type: 'category', position: 'bottom', fields: ['x'], label: { fontSize: '12px', fillStyle: '#485465' }, style: { fill: '#E5EAEF', strokeStyle: 'transparent' }, }], series: [{ type: 'bar', title: ['主营业务', '其他业务'], xField: 'x', yField: ['main', 'other'], stacked: true, bind: { style: { lineWidth: 0, strokeStyle: 'transparent', maxBarWidth: '{maxBarWidth}', }, }, 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') + ': ' + Ext.util.Format.number(record.get(item.field), '0,000.00') + '万元'); }, });