var data = [
{ month: '1월', sales: 42000000, target: 40000000, orders: 320 },
{ month: '2월', sales: 38500000, target: 40000000, orders: 295 },
{ month: '3월', sales: 51200000, target: 45000000, orders: 410 },
{ month: '4월', sales: 47800000, target: 45000000, orders: 380 },
{ month: '5월', sales: 55300000, target: 50000000, orders: 445 },
{ month: '6월', sales: 49100000, target: 50000000, orders: 390 }
];
var chart = new wijmo.chart.FlexChart('#salesChart', {
chartType: wijmo.chart.ChartType.Column,
itemsSource: data,
bindingX: 'month',
series: [
{ name: '매출', binding: 'sales' },
{ name: '목표', binding: 'target' }
],
header: '월별 매출 현황'
});
chart.tooltip.content = function (ht) {
var item = ht.item;
var fmt = function (v) { return wijmo.Globalize.format(v, 'n0'); };
if (ht.series.name === '목표') {
return '<b>' + item.month + ' 목표</b><br/>' + fmt(item.target) + '원';
}
var rate = (item.sales / item.target * 100).toFixed(1);
var color = item.sales >= item.target ? '#2e9e5b' : '#d64545';
return '<b>' + item.month + ' 매출</b><br/>' +
fmt(item.sales) + '원<br/>' +
'<span>주문 ' + fmt(item.orders) + '건</span><br/>' +
'<span style="color:' + color + '">목표 달성률 ' + rate + '%</span>';
};