Skip to content

Commit

Permalink
Added total debt sum to piechart.
Browse files Browse the repository at this point in the history
  • Loading branch information
diegonetto committed Sep 20, 2012
1 parent 4094cfc commit 8231847
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion public/javascripts/lib/pie-chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ var app = app || {};
this.title = title;
var chartTitle = new paper.PointText(new paper.Point(paper.view.center.x, paper.view.center.y - radius - 20 ));
chartTitle.content = this.title;
chartTitle.visible = true;
chartTitle.paragraphStyle.justification = 'center';
chartTitle.characterStyle = {
fontSize: 14,
Expand All @@ -208,6 +207,25 @@ var app = app || {};
strokeWidth: 2,
};

// Create a PointText for the total sum
var totalLabel = new paper.PointText(new paper.Point(center.x + radius + 10, paper.view.bounds.bottomRight.y - 20));
totalLabel.content = 'Total Debt'
totalLabel.paragraphStyle.justification = 'center';
totalLabel.characterStyle = {
fontSize: 12,
font: 'Ubuntu',
fillColor: '#333',
};

var total = new paper.PointText(new paper.Point(totalLabel.position.subtract([0, 30])));
total.content = accounting.formatMoney(totalSum);
total.paragraphStyle.justification = 'center';
total.characterStyle = {
fontSize: 12,
font: 'Ubuntu',
fillColor: 'FireBrick',
};

// Draw the view initially. Can be removed if an onFrame handler is used for animation.
paper.view.draw();
},
Expand Down

0 comments on commit 8231847

Please sign in to comment.