Cost of Loan Calculator & Guide | Cost of Loan Calculator
:root {
–primary-color: #004a99;
–success-color: #28a745;
–background-color: #f8f9fa;
–text-color: #333;
–border-color: #ddd;
–card-background: #fff;
–shadow: 0 2px 5px rgba(0,0,0,0.1);
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background-color: var(–background-color);
color: var(–text-color);
line-height: 1.6;
margin: 0;
padding: 0;
}
.container {
max-width: 960px;
margin: 20px auto;
padding: 20px;
background-color: var(–card-background);
border-radius: 8px;
box-shadow: var(–shadow);
}
h1, h2, h3 {
color: var(–primary-color);
text-align: center;
}
h1 {
margin-bottom: 20px;
}
h2 {
margin-top: 30px;
margin-bottom: 15px;
border-bottom: 2px solid var(–primary-color);
padding-bottom: 5px;
}
h3 {
margin-top: 20px;
margin-bottom: 10px;
}
.loan-calc-container {
background-color: var(–card-background);
padding: 25px;
border-radius: 8px;
box-shadow: var(–shadow);
margin-bottom: 30px;
}
.input-group {
margin-bottom: 15px;
text-align: left;
}
.input-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: var(–primary-color);
}
.input-group input[type="number"],
.input-group input[type="text"],
.input-group select {
width: calc(100% – 22px);
padding: 10px;
border: 1px solid var(–border-color);
border-radius: 4px;
font-size: 1rem;
box-sizing: border-box;
}
.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus,
.input-group select:focus {
border-color: var(–primary-color);
outline: none;
box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.2);
}
.input-group .helper-text {
font-size: 0.85rem;
color: #666;
margin-top: 5px;
display: block;
}
.error-message {
color: #dc3545;
font-size: 0.85rem;
margin-top: 5px;
display: none; /* Hidden by default */
}
.button-group {
display: flex;
justify-content: space-between;
margin-top: 20px;
gap: 10px;
}
button {
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
transition: background-color 0.3s ease;
flex: 1;
}
button.primary {
background-color: var(–primary-color);
color: white;
}
button.primary:hover {
background-color: #003366;
}
button.secondary {
background-color: #6c757d;
color: white;
}
button.secondary:hover {
background-color: #5a6268;
}
#results {
margin-top: 30px;
padding: 20px;
background-color: var(–primary-color);
color: white;
border-radius: 8px;
text-align: center;
box-shadow: var(–shadow);
}
#results h3 {
color: white;
margin-bottom: 15px;
}
.result-item {
margin-bottom: 10px;
font-size: 1.1rem;
}
.result-item strong {
display: block;
font-size: 1.3rem;
color: #ffc107; /* Highlight color */
}
.result-explanation {
font-size: 0.9rem;
color: rgba(255, 255, 255, 0.8);
margin-top: 10px;
}
.intermediate-results {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
margin-top: 20px;
gap: 15px;
}
.intermediate-results .result-card {
background-color: rgba(255, 255, 255, 0.1);
padding: 15px;
border-radius: 6px;
text-align: center;
flex: 1;
min-width: 150px;
}
.intermediate-results .result-card h4 {
margin: 0 0 5px 0;
color: white;
font-size: 1rem;
}
.intermediate-results .result-card p {
margin: 0;
font-size: 1.2rem;
font-weight: bold;
color: #ffc107;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
margin-bottom: 30px;
box-shadow: var(–shadow);
}
th, td {
padding: 10px;
text-align: left;
border: 1px solid var(–border-color);
}
thead {
background-color: var(–primary-color);
color: white;
}
tbody tr:nth-child(even) {
background-color: #e9ecef;
}
caption {
font-size: 1.1rem;
font-weight: bold;
color: var(–primary-color);
margin-bottom: 10px;
text-align: left;
}
canvas {
display: block;
margin: 20px auto;
background-color: var(–card-background);
border-radius: 8px;
box-shadow: var(–shadow);
}
.article-content {
margin-top: 40px;
background-color: var(–card-background);
padding: 30px;
border-radius: 8px;
box-shadow: var(–shadow);
}
.article-content p, .article-content ul, .article-content ol {
margin-bottom: 15px;
}
.article-content li {
margin-bottom: 8px;
}
.article-content a {
color: var(–primary-color);
text-decoration: none;
}
.article-content a:hover {
text-decoration: underline;
}
.faq-item {
margin-bottom: 15px;
border-left: 3px solid var(–primary-color);
padding-left: 10px;
}
.faq-item h4 {
margin: 0 0 5px 0;
color: var(–primary-color);
font-size: 1.1rem;
}
.faq-item p {
margin: 0;
font-size: 0.95rem;
}
.related-links ul {
list-style: none;
padding: 0;
}
.related-links li {
margin-bottom: 10px;
}
.related-links a {
font-weight: bold;
}
.related-links span {
font-size: 0.9rem;
color: #666;
display: block;
margin-top: 3px;
}
.highlight {
background-color: var(–primary-color);
color: white;
padding: 2px 5px;
border-radius: 3px;
}
.loan-cost-summary {
background-color: rgba(0, 74, 153, 0.05);
padding: 15px;
border-radius: 5px;
margin-top: 15px;
border-left: 4px solid var(–primary-color);
}
.loan-cost-summary p {
margin: 0;
font-size: 0.95rem;
}
.loan-cost-summary strong {
color: var(–primary-color);
}
Loan Cost Calculator
Loan Cost Summary
Total Cost of Loan: $0.00
This is the total amount you'll pay back, including principal, interest, and all fees.
Key Assumptions: Fixed interest rate, regular payments, no prepayments.
What is the Cost of Loan Calculator?
The Cost of Loan Calculator is a vital financial tool designed to provide a comprehensive understanding of the total expense associated with borrowing money. It goes beyond the simple principal amount to reveal the true financial burden by factoring in interest, various fees, and other associated charges over the life of the loan. This calculator is essential for anyone considering taking out a loan, whether it's a mortgage, auto loan, personal loan, or business financing. By using this tool, borrowers can make more informed decisions, compare different loan offers effectively, and avoid unexpected financial strain.
Many individuals mistakenly focus only on the monthly payment or the advertised interest rate when evaluating a loan. However, the cost of loan calculator highlights that origination fees, closing costs, service charges, and even late payment penalties can significantly inflate the overall expense. Understanding these components helps in negotiating better terms and choosing the most cost-effective borrowing option. It's particularly useful for comparing loans with similar principal amounts but different fee structures or interest rates.
Common misconceptions about loan costs often revolve around the idea that a lower interest rate automatically means a cheaper loan. While interest rate is a major factor, the cost of loan calculator demonstrates how substantial upfront fees or ongoing charges can sometimes outweigh a slightly lower interest rate. For instance, a loan with a 5% interest rate and $1,000 in fees might be more expensive overall than a loan with a 5.5% interest rate and only $200 in fees, especially for shorter loan terms. This calculator helps to quantify these differences, providing clarity for borrowers.
Cost of Loan Calculator Formula and Mathematical Explanation
The Cost of Loan Calculator primarily relies on the standard loan amortization formula to determine the monthly payment, and then aggregates all costs. The total cost is the sum of the loan principal, total interest paid, total upfront fees, and total other recurring costs.
1. Monthly Payment Calculation
The monthly payment (M) is calculated using the following formula:
M = P [ i(1 + i)^n ] / [ (1 + i)^n – 1]
Where:
- P = Principal Loan Amount
- i = Monthly Interest Rate (Annual Rate / 12)
- n = Total Number of Payments (Loan Term in Years * 12)
2. Total Interest Paid Calculation
Total Interest = (Monthly Payment * Total Number of Payments) – Principal Loan Amount
3. Total Fees Paid Calculation
Total Fees = Upfront Fees + (Other Recurring Costs Per Month * Total Number of Payments)
4. Total Cost of Loan Calculation
Total Cost of Loan = Principal Loan Amount + Total Interest Paid + Total Fees Paid
Variables Table:
| Variable |
Meaning |
Unit |
Typical Range |
| P (Principal) |
The initial amount borrowed. |
Currency ($) |
$1,000 – $1,000,000+ |
| Annual Interest Rate |
The yearly percentage charged on the loan balance. |
% |
1% – 30%+ |
| i (Monthly Interest Rate) |
The interest rate applied each month. |
Decimal (e.g., 0.05 / 12) |
0.00083 – 0.025+ |
| Loan Term (Years) |
The duration over which the loan is repaid. |
Years |
1 – 30+ |
| n (Total Payments) |
The total number of monthly payments. |
Count |
12 – 360+ |
| Upfront Fees |
One-time charges paid at loan origination. |
Currency ($) |
$0 – $10,000+ |
| Other Recurring Costs |
Monthly charges associated with the loan. |
Currency ($) |
$0 – $500+ |
| M (Monthly Payment) |
The fixed amount paid each month towards principal and interest. |
Currency ($) |
Varies greatly |
| Total Interest Paid |
The sum of all interest paid over the loan term. |
Currency ($) |
Varies greatly |
| Total Fees Paid |
The sum of all upfront and recurring fees. |
Currency ($) |
Varies greatly |
| Total Cost of Loan |
The ultimate expense of borrowing. |
Currency ($) |
P + Total Interest + Total Fees |
The cost of loan calculator uses these formulas to break down the total financial commitment.
Practical Examples (Real-World Use Cases)
Example 1: Auto Loan
Sarah is looking to buy a car and needs a $20,000 auto loan. She's offered a 5-year loan (60 months) at an 8% annual interest rate. The lender charges a $300 origination fee and a $15 monthly service fee.
Inputs:
- Loan Principal: $20,000
- Annual Interest Rate: 8%
- Loan Term: 5 years (60 months)
- Upfront Fees: $300
- Other Recurring Costs: $15/month
Calculation using the Cost of Loan Calculator:
- Monthly Payment (Principal & Interest): ~$405.52
- Total Interest Paid: ~$4,331.20
- Total Fees Paid: $300 + ($15 * 60) = $1,200
- Total Cost of Loan: $20,000 + $4,331.20 + $1,200 = $25,531.20
Interpretation: Sarah will pay an additional $5,531.20 over the life of the loan beyond the principal amount. This includes $4,331.20 in interest and $1,200 in fees. This detailed view helps her understand the true cost of financing her car.
Example 2: Personal Loan for Debt Consolidation
John wants to consolidate $15,000 in credit card debt with a personal loan. He is offered a 3-year loan (36 months) at a 12% annual interest rate. There's an upfront processing fee of $500.
Inputs:
- Loan Principal: $15,000
- Annual Interest Rate: 12%
- Loan Term: 3 years (36 months)
- Upfront Fees: $500
- Other Recurring Costs: $0/month
Calculation using the Cost of Loan Calculator:
- Monthly Payment (Principal & Interest): ~$495.08
- Total Interest Paid: ~$2,822.88
- Total Fees Paid: $500
- Total Cost of Loan: $15,000 + $2,822.88 + $500 = $18,322.88
Interpretation: John's $15,000 loan will ultimately cost him $3,322.88. This includes $2,822.88 in interest and $500 in fees. Knowing this helps him confirm if debt consolidation is the most financially sound strategy compared to managing individual debts.
These examples illustrate how the cost of loan calculator provides crucial insights for financial planning.
How to Use This Cost of Loan Calculator
Using the Cost of Loan Calculator is straightforward. Follow these steps to get a clear picture of your borrowing expenses:
- Enter Loan Principal: Input the exact amount you intend to borrow in the "Loan Principal Amount" field.
- Specify Annual Interest Rate: Enter the annual interest rate offered for the loan. Ensure it's the correct percentage.
- Define Loan Term: Input the total duration of the loan in years.
- Add Upfront Fees: Enter any one-time fees charged at the beginning of the loan, such as origination or application fees. If there are none, enter $0.
- Include Other Recurring Costs: If the loan has monthly service fees or other ongoing charges, enter the monthly amount here. If not, enter $0.
- Click 'Calculate Cost': Once all fields are populated, click the "Calculate Cost" button.
How to Read Results:
- Total Cost of Loan: This is the most critical figure, representing the absolute maximum you will pay back.
- Total Interest Paid: Shows the cumulative interest charges over the loan's life.
- Total Fees Paid: Sums up all upfront and recurring fees.
- Monthly Payment: Displays the estimated fixed payment required each month, covering both principal and interest.
Decision-Making Guidance:
Use the results to compare different loan offers. A loan with a lower total cost is generally preferable, even if its monthly payment is slightly higher. Consider if the total interest and fees align with your budget and financial goals. If the total cost seems too high, you might explore options like negotiating rates, seeking loans with lower fees, or considering a shorter loan term if feasible. This cost of loan calculator empowers you to make financially sound borrowing decisions.
Key Factors That Affect Cost of Loan Results
Several factors significantly influence the total cost of a loan. Understanding these can help you manage borrowing expenses:
- Interest Rate: This is the most significant factor. A higher annual interest rate directly increases the total interest paid over the loan term. Even a small difference in rate can lead to substantial cost variations, especially for long-term loans.
- Loan Principal Amount: A larger principal means more money to repay, leading to higher interest charges and potentially larger fees, thus increasing the overall cost.
- Loan Term (Duration): Longer loan terms generally result in lower monthly payments but significantly increase the total interest paid because the principal is outstanding for a longer period. Shorter terms mean higher monthly payments but less total interest.
- Fees (Upfront and Recurring): Origination fees, application fees, processing fees, late fees, and monthly service charges all add directly to the total cost of the loan. These can sometimes be negotiable.
- Loan Type and Lender Policies: Different loan types (e.g., secured vs. unsecured) carry different risk profiles for lenders, affecting interest rates and fees. Lender-specific policies on grace periods, prepayment penalties, and fee structures also play a crucial role.
- Credit Score: Your creditworthiness heavily influences the interest rate and fees you'll be offered. A higher credit score typically leads to lower borrowing costs, while a lower score often results in higher rates and fees, increasing the overall cost of the loan.
- Economic Conditions (Inflation & Market Rates): Broader economic factors like inflation and prevailing market interest rates set by central banks can influence the rates lenders offer. While not directly input into the calculator, they form the basis of the rates you'll encounter.
- Payment Frequency and Timing: While this calculator assumes monthly payments, variations in payment schedules or making payments late can incur penalties or affect interest accrual, indirectly increasing the total cost.
The cost of loan calculator helps quantify the impact of many of these factors.
Frequently Asked Questions (FAQ)
Q1: What is the difference between total interest and total fees?
A1: Total interest is the cost of borrowing the money itself, calculated based on the principal, rate, and term. Total fees are charges levied by the lender for services related to originating and managing the loan, such as application or processing fees.
Q2: Does the calculator account for early repayment?
A2: This calculator assumes a standard repayment schedule without early repayment. If you plan to pay off your loan early, your total interest paid will likely be lower. Some loans may also have prepayment penalties, which are not included here.
Q3: Can I use this calculator for mortgages?
A3: Yes, you can use this calculator for mortgages, but remember that mortgage loans often involve additional costs like property taxes, homeowner's insurance, and PMI (Private Mortgage Insurance), which are not factored into this specific calculator.
Q4: What if my interest rate changes over time?
A4: This calculator assumes a fixed interest rate. If you have an adjustable-rate loan, your monthly payment and total cost could change as market rates fluctuate.
Q5: How do upfront fees affect the total cost?
A5: Upfront fees are added directly to the total cost of the loan. They increase the overall amount you pay back, even if they don't affect your monthly principal and interest payment directly.
Q6: Is a lower monthly payment always better?
A6: Not necessarily. A lower monthly payment often comes with a longer loan term, which usually results in paying significantly more interest over time. The cost of loan calculator helps you see the trade-off.
Q7: What does "Total Cost of Loan" represent?
A7: The "Total Cost of Loan" is the sum of the original loan principal, all interest paid over the loan term, and all fees associated with the loan. It represents the true expense of borrowing the money.
Q8: Can I compare two different loan offers using this calculator?
A8: Absolutely. Input the details for each loan offer separately into the calculator. Compare the "Total Cost of Loan," "Total Interest Paid," and "Total Fees Paid" to determine which offer is more financially advantageous.
function validateInput(id, errorId, min, max, isRequired) {
var input = document.getElementById(id);
var errorElement = document.getElementById(errorId);
var value = parseFloat(input.value);
errorElement.style.display = 'none';
input.style.borderColor = '#ddd';
if (isRequired && (input.value === null || input.value.trim() === ")) {
errorElement.textContent = 'This field is required.';
errorElement.style.display = 'block';
input.style.borderColor = '#dc3545';
return false;
}
if (!isNaN(value)) {
if (min !== null && value max) {
errorElement.textContent = 'Value cannot be greater than ' + max + '.';
errorElement.style.display = 'block';
input.style.borderColor = '#dc3545';
return false;
}
} else if (isRequired) {
errorElement.textContent = 'Please enter a valid number.';
errorElement.style.display = 'block';
input.style.borderColor = '#dc3545';
return false;
}
return true;
}
function calculateLoanCost() {
var loanAmount = parseFloat(document.getElementById('loanAmount').value);
var annualInterestRate = parseFloat(document.getElementById('interestRate').value);
var loanTermYears = parseFloat(document.getElementById('loanTerm').value);
var loanFees = parseFloat(document.getElementById('loanFees').value);
var otherCosts = parseFloat(document.getElementById('otherCosts').value);
var isValid = true;
isValid = validateInput('loanAmount', 'loanAmountError', 0, null, true) && isValid;
isValid = validateInput('interestRate', 'interestRateError', 0, 100, true) && isValid;
isValid = validateInput('loanTerm', 'loanTermError', 1, null, true) && isValid;
isValid = validateInput('loanFees', 'loanFeesError', 0, null, true) && isValid;
isValid = validateInput('otherCosts', 'otherCostsError', 0, null, true) && isValid;
if (!isValid) {
document.getElementById('results').style.display = 'none';
return;
}
var monthlyInterestRate = annualInterestRate / 100 / 12;
var numberOfPayments = loanTermYears * 12;
var monthlyPayment = 0;
var totalInterestPaid = 0;
var totalFeesPaid = 0;
var totalCost = 0;
if (monthlyInterestRate > 0) {
monthlyPayment = loanAmount * (monthlyInterestRate * Math.pow(1 + monthlyInterestRate, numberOfPayments)) / (Math.pow(1 + monthlyInterestRate, numberOfPayments) – 1);
} else {
monthlyPayment = loanAmount / numberOfPayments;
}
var totalRepayment = monthlyPayment * numberOfPayments;
totalInterestPaid = totalRepayment – loanAmount;
totalFeesPaid = loanFees + (otherCosts * numberOfPayments);
totalCost = loanAmount + totalInterestPaid + totalFeesPaid;
document.getElementById('totalCostResult').textContent = '$' + totalCost.toFixed(2);
document.getElementById('totalInterestResult').textContent = '$' + totalInterestPaid.toFixed(2);
document.getElementById('totalFeesResult').textContent = '$' + totalFeesPaid.toFixed(2);
document.getElementById('monthlyPaymentResult').textContent = '$' + monthlyPayment.toFixed(2);
document.getElementById('results').style.display = 'block';
updateChart(loanAmount, totalInterestPaid, totalFeesPaid, numberOfPayments);
}
function resetCalculator() {
document.getElementById('loanAmount').value = '10000';
document.getElementById('interestRate').value = '5';
document.getElementById('loanTerm').value = '5';
document.getElementById('loanFees').value = '200';
document.getElementById('otherCosts').value = '10';
document.getElementById('loanAmountError').style.display = 'none';
document.getElementById('interestRateError').style.display = 'none';
document.getElementById('loanTermError').style.display = 'none';
document.getElementById('loanFeesError').style.display = 'none';
document.getElementById('otherCostsError').style.display = 'none';
document.getElementById('results').style.display = 'none';
if (window.myChart instanceof Chart) {
window.myChart.destroy();
}
}
function copyResults() {
var totalCost = document.getElementById('totalCostResult').textContent;
var totalInterest = document.getElementById('totalInterestResult').textContent;
var totalFees = document.getElementById('totalFeesResult').textContent;
var monthlyPayment = document.getElementById('monthlyPaymentResult').textContent;
var assumptions = "Key Assumptions: Fixed interest rate, regular payments, no prepayments.";
var textToCopy = "Loan Cost Summary:\n" +
"Total Cost of Loan: " + totalCost + "\n" +
"Total Interest Paid: " + totalInterest + "\n" +
"Total Fees Paid: " + totalFees + "\n" +
"Monthly Payment: " + monthlyPayment + "\n\n" +
assumptions;
navigator.clipboard.writeText(textToCopy).then(function() {
alert('Results copied to clipboard!');
}).catch(function(err) {
console.error('Failed to copy: ', err);
alert('Failed to copy results. Please copy manually.');
});
}
function updateChart(principal, interest, fees, periods) {
var ctx = document.getElementById('loanCostChart').getContext('2d');
if (window.myChart) {
window.myChart.destroy();
}
var totalFeesPerPeriod = fees / periods;
var monthlyPayment = parseFloat(document.getElementById('monthlyPaymentResult').textContent.replace('$', "));
var monthlyInterestRate = parseFloat(document.getElementById('interestRate').value) / 100 / 12;
var labels = [];
var principalPayments = [];
var interestPayments = [];
var feePayments = [];
var remainingBalance = principal;
var currentInterest = 0;
var currentPrincipal = 0;
var currentFees = 0;
for (var i = 1; i 0) {
currentInterest = remainingBalance * monthlyInterestRate;
} else {
currentInterest = 0;
}
var paymentAmount = monthlyPayment;
var principalPortion = paymentAmount – currentInterest;
// Adjust for potential rounding errors or if principal portion exceeds remaining balance
if (principalPortion > remainingBalance) {
principalPortion = remainingBalance;
paymentAmount = principalPortion + currentInterest; // Adjust payment if needed
}
remainingBalance -= principalPortion;
currentPrincipal += principalPortion;
currentFees += totalFeesPerPeriod;
principalPayments.push(principalPortion);
interestPayments.push(currentInterest);
feePayments.push(totalFeesPerPeriod);
}
window.myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: labels,
datasets: [{
label: 'Principal Paid',
data: principalPayments,
backgroundColor: 'rgba(0, 74, 153, 0.6)',
borderColor: 'rgba(0, 74, 153, 1)',
borderWidth: 1,
stack: 'Stack 0'
}, {
label: 'Interest Paid',
data: interestPayments,
backgroundColor: 'rgba(40, 167, 69, 0.6)',
borderColor: 'rgba(40, 167, 69, 1)',
borderWidth: 1,
stack: 'Stack 0'
}, {
label: 'Fees Paid',
data: feePayments,
backgroundColor: 'rgba(255, 193, 7, 0.6)',
borderColor: 'rgba(255, 193, 7, 1)',
borderWidth: 1,
stack: 'Stack 0'
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
stacked: true,
title: {
display: true,
text: 'Loan Period (Months)'
}
},
y: {
stacked: true,
title: {
display: true,
text: 'Amount ($)'
},
beginAtZero: true
}
},
plugins: {
tooltip: {
mode: 'index',
intersect: false
},
legend: {
position: 'top',
}
}
}
});
}
// Initial chart setup placeholder (will be updated on first calculation)
function setupInitialChart() {
var canvas = document.createElement('canvas');
canvas.id = 'loanCostChart';
canvas.style.maxWidth = '100%';
canvas.style.height = '400px'; // Default height
document.querySelector('.loan-calc-container').appendChild(canvas);
}
// Add a placeholder canvas for the chart
document.addEventListener('DOMContentLoaded', function() {
setupInitialChart();
// Optionally, pre-calculate with default values to show initial chart
// calculateLoanCost();
});
// Dummy Chart.js library for demonstration purposes if not available
// In a real scenario, you'd include the Chart.js library via a CDN or local file.
if (typeof Chart === 'undefined') {
var Chart = function() {
this.destroy = function() { console.log('Chart destroyed (mock)'); };
console.log('Chart.js not found, using mock.');
};
Chart.defaults = {};
Chart.defaults.font = { family: "'Segoe UI', Tahoma, Geneva, Verdana, sans-serif" };
Chart.controllers = {};
Chart.controllers.bar = function() {};
Chart.defaults.plugins = { legend: { display: true } };
Chart.defaults.scales = { x: { stacked: true }, y: { stacked: true, beginAtZero: true } };
}