|
@@ -292,9 +292,13 @@ function shouldMerge(a, b) {
|
292
|
292
|
*/
|
293
|
293
|
function drawCategoryPieChart(included, incoming) {
|
294
|
294
|
var pieData = getCategoryTotals(included, incoming);
|
|
295
|
+ var total = 0;
|
|
296
|
+
|
|
297
|
+ $.each(pieData, function(_, amount) { total += amount; });
|
|
298
|
+
|
295
|
299
|
var seriesData = [];
|
296
|
300
|
$.each(pieData, function(category, amount) {
|
297
|
|
- seriesData.push({ label: category + ' (' + Math.round(amount) + ')', data: amount });
|
|
301
|
+ seriesData.push({ label: category + ' (£' + amount.toCurrency() + ', ' + Math.floor(100 * amount / total) + '%)', data: amount });
|
298
|
302
|
});
|
299
|
303
|
|
300
|
304
|
seriesData.sort(function(a, b) { return b.data - a.data; });
|
|
@@ -361,7 +365,7 @@ function showSelectedMonths(start, end, incoming, outgoing, categoryFilter, expa
|
361
|
365
|
lastEntry.Amount = Math.round(100 * (lastEntry.Amount + this.Amount)) / 100;
|
362
|
366
|
$('#collapseHandle' + lastEntry.id).data('total', lastEntry.Amount);
|
363
|
367
|
|
364
|
|
- !expanded[lastEntry.id] && tr.hide() && $('.amount', lastEntry.tr).text(lastEntry.Amount);
|
|
368
|
+ !expanded[lastEntry.id] && tr.hide() && $('.amount', lastEntry.tr).text(lastEntry.Amount.toCurrency());
|
365
|
369
|
|
366
|
370
|
tr.addClass('collapsed hidden' + lastEntry.id);
|
367
|
371
|
} else {
|
|
@@ -508,7 +512,7 @@ $(function() {
|
508
|
512
|
});
|
509
|
513
|
|
510
|
514
|
$('#expense').bind('plotclick', function(event, pos, item) {
|
511
|
|
- setState({ categoryFilter: item.series.label.replace(/ \([0-9]+\)$/, '') }, ['expanded']);
|
|
515
|
+ setState({ categoryFilter: item.series.label.replace(/ \(.*$/, '') }, ['expanded']);
|
512
|
516
|
});
|
513
|
517
|
|
514
|
518
|
$.history.init(handleStateChange);
|