-
Notifications
You must be signed in to change notification settings - Fork 0
/
PieChartHelper.js
35 lines (33 loc) · 1.17 KB
/
PieChartHelper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
({
draw : function(component) {
var labelset=["Loan payment","Property tax","Homeowner's insurance"] ;
let loan = component.get("v.monthly") - component.get("v.mortgage.property_tax__c")
- component.get("v.mortgage.homeowners_insurance__c");
var dataset=[loan,component.get("v.mortgage.property_tax__c"),
component.get("v.mortgage.homeowners_insurance__c")] ;
for (let i = 0; i < dataset.length; i++){
dataset[i] = (dataset[i]/1).toFixed(2);
}
new Chart(document.getElementById("pie-chart"), {
type: 'pie',
data: {
labels:labelset,
datasets: [{
backgroundColor: ["#438bbf", "#ad7ecd","#ff6b90"],
data: dataset
}]
},
options: {
legend: {
display: true,
position: 'right'
}
,
title: {
display: false,
text: 'monthly payment'
}
}
});
}
})