How to Calculate Weighted Average Exercise Price

Calculate Weighted Average Exercise Price – Options Calculator :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –light-gray: #e9ecef; –white: #fff; } 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(–white); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); border-radius: 8px; } h1, h2, h3 { color: var(–primary-color); text-align: center; margin-bottom: 20px; } .calc-header { text-align: center; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(–light-gray); } .calc-header h1 { margin-bottom: 5px; } .calc-header p { font-size: 1.1em; color: #555; } .loan-calc-container { margin-bottom: 30px; padding: 25px; border: 1px solid var(–light-gray); border-radius: 8px; background-color: var(–white); } .input-group { margin-bottom: 20px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; 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 #ccc; border-radius: 4px; font-size: 1em; 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 3px rgba(0, 74, 153, 0.2); } .input-group .helper-text { display: block; font-size: 0.85em; color: #6c757d; margin-top: 5px; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; justify-content: space-between; margin-top: 25px; } .btn { padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease; color: var(–white); } .btn-primary { background-color: var(–primary-color); } .btn-primary:hover { background-color: #003366; } .btn-secondary { background-color: #6c757d; } .btn-secondary:hover { background-color: #5a6268; } .btn-success { background-color: var(–success-color); margin-left: 10px; } .btn-success:hover { background-color: #218838; } .results-container { margin-top: 30px; padding: 25px; border: 1px solid var(–light-gray); border-radius: 8px; background-color: var(–light-gray); text-align: center; } .results-container h3 { margin-top: 0; color: var(–primary-color); } .result-item { margin-bottom: 15px; } .result-item label { display: block; font-size: 1.1em; color: #555; } .result-value { font-size: 1.8em; font-weight: bold; color: var(–primary-color); display: block; margin-top: 5px; background-color: var(–white); padding: 10px; border-radius: 4px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); } .result-value.primary-result { font-size: 2.2em; color: var(–white); background-color: var(–success-color); padding: 15px; } .formula-explanation { font-size: 0.95em; color: #555; margin-top: 20px; padding: 15px; background-color: var(–white); border-left: 4px solid var(–primary-color); } table { width: 100%; border-collapse: collapse; margin-top: 25px; } th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(–light-gray); } th { background-color: var(–primary-color); color: var(–white); font-weight: bold; } tr:nth-child(even) { background-color: var(–light-gray); } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-top: 20px; margin-bottom: 10px; text-align: left; } #chartContainer { width: 100%; max-width: 600px; margin: 30px auto; background-color: var(–white); padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } .article-section { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(–light-gray); } .article-section h2 { text-align: left; margin-bottom: 15px; } .article-section h3 { text-align: left; margin-top: 20px; margin-bottom: 10px; color: #0056b3; } .article-section p, .article-section ul, .article-section ol { margin-bottom: 15px; } .article-section ul, .article-section ol { padding-left: 25px; } .article-section li { margin-bottom: 8px; } .faq-item { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px dashed var(–light-gray); } .faq-item:last-child { border-bottom: none; } .faq-question { font-weight: bold; color: var(–primary-color); cursor: pointer; display: block; margin-bottom: 5px; } .faq-answer { display: none; padding-left: 10px; font-size: 0.95em; color: #555; } .internal-links-section ul { list-style: none; padding: 0; } .internal-links-section li { margin-bottom: 10px; } .internal-links-section a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links-section a:hover { text-decoration: underline; } .internal-links-section p { font-size: 0.9em; color: #555; margin-top: 5px; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } .button-group { flex-direction: column; align-items: center; } .btn { width: 90%; margin-bottom: 10px; } .btn-success { margin-left: 0; } }

Calculate Weighted Average Exercise Price

Determine your average cost for employee stock options.

Enter the date the options were granted.
The price you pay per share to exercise the option.
The total number of shares covered by this grant.
Enter the date the options become fully vested.
The date the options expire.
The current trading price of the underlying stock.
Any fee charged by your broker for exercising options.

Your Option Grant Details

Formula Used: The Weighted Average Exercise Price (WAEP) is calculated by summing the total cost of exercising all options (exercise price * number of shares + fees) and dividing by the total number of shares exercised. For a single grant, this simplifies to the exercise price plus any per-share fees.

Total Cost = (Exercise Price * Number of Shares) + Commission Fee
WAEP = Total Cost / Number of Shares (for a single grant, this is effectively the Exercise Price + (Commission Fee / Number of Shares))

Comparison of Exercise Price vs. Current Market Price.

What is Weighted Average Exercise Price?

The weighted average exercise price, often abbreviated as WAEP, is a critical metric for individuals holding multiple grants of employee stock options or options acquired at different times and prices. It represents the average cost per share across all exercised options. Understanding your WAEP is fundamental for calculating the cost basis of your shares, determining potential profits or losses, and making informed decisions about when to exercise, hold, or sell your options. It's particularly important when dealing with options that have varying strike prices, grant dates, and vesting schedules. By calculating this average, you simplify the complex financial picture of multiple option grants into a single, understandable figure, aiding in tax reporting and investment strategy.

Who Should Use It: This calculation is primarily for employees who have received multiple stock option grants, especially those with different exercise prices. It is also relevant for investors who have purchased options on the open market at various times and prices. Anyone looking to accurately assess their overall cost of acquiring company stock through options will find this calculation invaluable.

Common Misconceptions: A frequent misunderstanding is that the WAEP is simply the average of all the different exercise prices. This is incorrect because it doesn't account for the *number* of shares associated with each price. A grant with a higher number of shares at a slightly higher price can significantly influence the WAEP. Another misconception is that WAEP only applies when exercising options; however, it's a concept that can be considered even before exercise to understand the potential cost basis.

Weighted Average Exercise Price Formula and Mathematical Explanation

The core idea behind the weighted average exercise price is to aggregate the total cost incurred for all shares acquired through options and then divide that total cost by the total number of shares. This ensures that grants with more shares have a proportionally larger impact on the average, hence the term "weighted."

Let's break down the formula:

Total Cost of Exercising Options = Σ (Exercise Priceᵢ * Number of Sharesᵢ) + Σ (Transaction Feesᵢ)

Where:

  • 'i' represents each individual option grant or purchase.
  • Exercise Priceᵢ is the price per share for grant 'i'.
  • Number of Sharesᵢ is the quantity of shares in grant 'i'.
  • Transaction Feesᵢ are any brokerage fees, commissions, or other costs associated with exercising grant 'i'.

Once the total cost is determined, the Weighted Average Exercise Price is calculated as:

Weighted Average Exercise Price (WAEP) = Total Cost of Exercising Options / Total Number of Shares Exercised

WAEP = [ Σ (Exercise Priceᵢ * Number of Sharesᵢ) + Σ (Transaction Feesᵢ) ] / Σ (Number of Sharesᵢ)

Variables Table:

Variable Meaning Unit Typical Range
Exercise Price (EPᵢ) The predetermined price at which an option holder can purchase one share of the underlying stock. Currency (e.g., USD) $0.01 – $100+ (highly variable based on company valuation and grant terms)
Number of Shares (NSᵢ) The total quantity of shares covered by a specific option grant or purchase. Count 100 – 10,000+ (depends on seniority, company size, and compensation package)
Transaction Fees (TFᵢ) Costs incurred when executing the option exercise, such as brokerage commissions or platform fees. Currency (e.g., USD) $0 – $50+ (can be a flat fee, percentage, or per-share charge)
Total Cost The aggregate amount spent to acquire all shares via options, including exercise prices and fees. Currency (e.g., USD) Variable, depending on inputs.
Total Shares Exercised The sum of all shares acquired across all exercised options. Count Variable, depending on inputs.
Weighted Average Exercise Price (WAEP) The average cost per share across all exercised options. Currency (e.g., USD) Typically close to the average of EPᵢ, adjusted by NSᵢ and TFᵢ.

Practical Examples (Real-World Use Cases)

Example 1: Multiple Option Grants

Sarah has received two stock option grants from her tech startup employer:

  • Grant A: 2,000 shares at an exercise price of $2.00 per share, granted on Jan 1, 2022. Vesting completed on Jan 1, 2024. Brokerage fee of $5.00 for this grant.
  • Grant B: 3,000 shares at an exercise price of $5.00 per share, granted on Jan 1, 2023. Vesting completed on Jan 1, 2025. Brokerage fee of $7.50 for this grant.

Sarah decides to exercise all shares from both grants on Jan 15, 2024. The current market price is $30.00 per share.

Calculation:

  • Cost of Grant A = (2,000 shares * $2.00/share) + $5.00 = $4,000 + $5.00 = $4,005.00
  • Cost of Grant B = (3,000 shares * $5.00/share) + $7.50 = $15,000 + $7.50 = $15,007.50
  • Total Cost = $4,005.00 + $15,007.50 = $19,012.50
  • Total Shares Exercised = 2,000 + 3,000 = 5,000 shares
  • WAEP = $19,012.50 / 5,000 shares = $3.80 per share

Interpretation: Sarah's average cost per share for all 5,000 shares is $3.80. This is her cost basis for tax purposes. Her total potential profit before taxes is (5,000 shares * $30.00 market price) – $19,012.50 total cost = $150,000 – $19,012.50 = $130,987.50.

Example 2: Single Grant with Fees

John received a single stock option grant:

  • Grant C: 500 shares at an exercise price of $10.00 per share.

He decides to exercise all 500 shares today. His broker charges a flat commission fee of $15.00 for the transaction. The current market price is $45.00 per share.

Calculation:

  • Cost of Grant C = (500 shares * $10.00/share) + $15.00 = $5,000 + $15.00 = $5,015.00
  • Total Shares Exercised = 500 shares
  • WAEP = $5,015.00 / 500 shares = $10.03 per share

Interpretation: John's average cost per share is $10.03. This reflects the exercise price adjusted slightly upwards due to the commission fee. His total potential profit is (500 shares * $45.00 market price) – $5,015.00 total cost = $22,500 – $5,015.00 = $17,485.00.

How to Use This Weighted Average Exercise Price Calculator

Our calculator simplifies the process of determining your WAEP. Follow these simple steps:

  1. Enter Grant Details: For each stock option grant you have received, input the following:
    • Grant Date: The date the option grant was issued.
    • Exercise Price per Share: The price you will pay for each share.
    • Number of Shares: The total number of shares covered by that specific grant.
    • Vesting Date: When the options become exercisable.
    • Expiration Date: The deadline to exercise the options.
    • Current Market Price: The stock's price today.
    • Commission/Transaction Fee: Any fee charged by your broker for exercising.
    Note: If you have multiple grants, you will need to add them individually using separate calculations or by summing them up before inputting if the calculator allows for multiple entries. This calculator is designed for a single grant for simplicity, but the principle applies to aggregating multiple grants. For multiple grants, sum the 'Total Cost' and 'Total Shares Exercised' from each grant to find the overall WAEP.
  2. Calculate: As you input the data, the calculator will automatically update the results in real-time.
  3. Review Results:
    • Total Cost to Exercise: The total amount you would pay to exercise all shares in the grant, including fees.
    • Weighted Average Exercise Price per Share: This is your primary result – the average cost per share across all shares in this grant.
    • Total Value at Current Market Price: The potential market value of the shares if exercised today.
    • Unrealized Gain/Loss: The difference between the total value and the total cost.
  4. Make Decisions: Use these figures to understand your investment's cost basis, potential profitability, and to inform decisions about exercising your options. The comparison between your WAEP and the current market price is key to assessing the value proposition.
  5. Copy Results: Click the "Copy Results" button to easily transfer the key figures for your records or reports.

Key Factors That Affect Weighted Average Exercise Price Results

Several elements can influence the calculation and ultimate value of your weighted average exercise price and the profitability of your options:

  1. Varying Exercise Prices: This is the most direct factor. If you have multiple grants with different exercise prices, the WAEP will be a blend. Grants with lower exercise prices will pull the WAEP down, while higher prices will pull it up.
  2. Number of Shares per Grant: The "weighted" aspect is crucial. A grant of 10,000 shares at $1.00 will have a much larger impact on the WAEP than a grant of 100 shares at $0.50, even though the latter has a lower individual price.
  3. Transaction Fees and Commissions: Brokerage fees, even if seemingly small, can increase the total cost and therefore slightly raise the WAEP, especially for grants with fewer shares. These fees add directly to your cost basis.
  4. Stock Price Fluctuations: While the WAEP itself is fixed once options are exercised, the *profitability* is heavily dependent on the current market price of the stock. A high WAEP might still be profitable if the stock price is sufficiently high.
  5. Vesting Schedules: Options cannot be exercised until they vest. Understanding vesting dates is key to knowing *when* you can exercise and start calculating your cost basis. Early exercise might lock in a lower price but requires capital sooner.
  6. Expiration Dates: Options have a limited lifespan. The closer the expiration date, the more pressure there is to exercise, regardless of market conditions. This affects timing decisions related to your overall option strategy.
  7. Dilution and Stock Splits: Corporate actions like stock splits or new share issuances can affect the underlying stock price and the total number of shares outstanding, indirectly influencing the perceived value and decision-making around options.
  8. Tax Implications: The WAEP directly impacts your cost basis, which is essential for calculating capital gains or losses when you eventually sell the shares. Different tax treatments (e.g., ISO vs. NSO) add another layer of complexity.

Frequently Asked Questions (FAQ)

What is the difference between exercise price and weighted average exercise price?
The exercise price is the fixed amount per share you pay for a *specific* grant of options. The weighted average exercise price is the *average* cost per share across *all* the options you have exercised, taking into account the number of shares in each grant and any associated fees.
Do I need to calculate WAEP if I only have one option grant?
If you have only one grant, your WAEP is simply the exercise price per share for that grant, plus any per-share cost from transaction fees. The concept becomes more critical when you have multiple grants with different exercise prices and share quantities.
How do transaction fees affect my WAEP?
Transaction fees (like brokerage commissions) increase the total cost of exercising your options. This total cost is then divided by the total number of shares, so fees will slightly increase your WAEP.
When should I calculate my WAEP?
You should calculate your WAEP when you decide to exercise your options. It's essential for determining your cost basis for tax purposes and for evaluating the profitability of your exercise decision.
Is WAEP the same as the current market price?
No, the WAEP is your cost basis per share, representing what you paid. The current market price is the stock's trading value at a given moment. The difference between the market price and your WAEP indicates your potential profit or loss.
Does WAEP account for taxes?
The WAEP calculation itself does not include income taxes or capital gains taxes. However, it forms the basis for calculating your cost basis, which is then used to determine taxable gains or losses when you sell the shares. Tax implications can be complex and may vary based on option type (e.g., ISOs vs. NSOs) and jurisdiction.
What if I exercise options at different times? Does that matter for WAEP?
Yes, exercising options at different times might mean exercising different grants with different exercise prices and share quantities. You would calculate the WAEP based on all shares exercised up to that point, summing the total costs and total shares. If you exercise incrementally, your overall WAEP can change over time as you add more shares at potentially different prices.
Can exercising options at a loss impact my WAEP calculation?
Yes. If you exercise options where the market price is below your exercise price (you'd be exercising "at a loss"), your WAEP will still be calculated based on the actual exercise price paid plus fees. This WAEP then becomes your cost basis, and the difference between this cost basis and the selling price determines your capital loss.

Related Tools and Internal Resources

© 2023 Your Company Name. All rights reserved. This calculator and information are for educational purposes only.
function getElement(id) { return document.getElementById(id); } function setStyle(element, property, value) { element.style[property] = value; } function displayError(elementId, message, shouldShow) { var errorElement = getElement(elementId); if (errorElement) { if (shouldShow && message) { errorElement.textContent = message; setStyle(errorElement, 'display', 'block'); } else { errorElement.textContent = "; setStyle(errorElement, 'display', 'none'); } } } function isValidDate(dateString) { if (!/^\d{4}-\d{2}-\d{2}$/.test(dateString)) return false; var date = new Date(dateString); return date instanceof Date && !isNaN(date) && date.toISOString().split('T')[0] === dateString; } function calculateWeightedAverageExercisePrice() { var grantDate = getElement("grantDate").value; var exercisePrice = parseFloat(getElement("exercisePrice").value); var numberOfShares = parseFloat(getElement("numberOfShares").value); var vestingDate = getElement("vestingDate").value; var expirationDate = getElement("expirationDate").value; var marketPrice = parseFloat(getElement("marketPrice").value); var commissionFee = parseFloat(getElement("commissionFee").value); var errors = false; // Date validation if (grantDate && !isValidDate(grantDate)) { displayError("grantDateError", "Invalid date format. Use YYYY-MM-DD.", true); errors = true; } else { displayError("grantDateError", "", false); } if (vestingDate && !isValidDate(vestingDate)) { displayError("vestingDateError", "Invalid date format. Use YYYY-MM-DD.", true); errors = true; } else { displayError("vestingDateError", "", false); } if (expirationDate && !isValidDate(expirationDate)) { displayError("expirationDateError", "Invalid date format. Use YYYY-MM-DD.", true); errors = true; } else { displayError("expirationDateError", "", false); } // Numeric validation if (isNaN(exercisePrice) || exercisePrice < 0) { displayError("exercisePriceError", "Please enter a valid non-negative exercise price.", true); errors = true; } else { displayError("exercisePriceError", "", false); } if (isNaN(numberOfShares) || numberOfShares <= 0) { displayError("numberOfSharesError", "Please enter a valid positive number of shares.", true); errors = true; } else { displayError("numberOfSharesError", "", false); } if (isNaN(marketPrice) || marketPrice < 0) { displayError("marketPriceError", "Please enter a valid non-negative market price.", true); errors = true; } else { displayError("marketPriceError", "", false); } if (isNaN(commissionFee) || commissionFee < 0) { displayError("commissionFeeError", "Please enter a valid non-negative commission fee.", true); errors = true; } else { displayError("commissionFeeError", "", false); } if (errors) { getElement("totalCostToExercise").textContent = "–"; getElement("weightedAverageExercisePrice").textContent = "–"; getElement("totalValueAtMarketPrice").textContent = "–"; getElement("unrealizedGainLoss").textContent = "–"; updateChart([], []); return; } // Calculations var totalCostToExercise = (exercisePrice * numberOfShares) + commissionFee; var weightedAverageExercisePrice = totalCostToExercise / numberOfShares; var totalValueAtMarketPrice = marketPrice * numberOfShares; var unrealizedGainLoss = totalValueAtMarketPrice – totalCostToExercise; getElement("totalCostToExercise").textContent = formatCurrency(totalCostToExercise); getElement("weightedAverageExercisePrice").textContent = formatCurrency(weightedAverageExercisePrice); getElement("totalValueAtMarketPrice").textContent = formatCurrency(totalValueAtMarketPrice); getElement("unrealizedGainLoss").textContent = formatCurrency(unrealizedGainLoss); updateChart(exercisePrice, marketPrice); } function formatCurrency(amount) { return "$" + amount.toFixed(2); } function formatNumber(num) { return num.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }); } function resetForm() { getElement("grantDate").value = ""; getElement("exercisePrice").value = ""; getElement("numberOfShares").value = ""; getElement("vestingDate").value = ""; getElement("expirationDate").value = ""; getElement("marketPrice").value = ""; getElement("commissionFee").value = ""; getElement("totalCostToExercise").textContent = "–"; getElement("weightedAverageExercisePrice").textContent = "–"; getElement("totalValueAtMarketPrice").textContent = "–"; getElement("unrealizedGainLoss").textContent = "–"; displayError("grantDateError", "", false); displayError("exercisePriceError", "", false); displayError("numberOfSharesError", "", false); displayError("vestingDateError", "", false); displayError("expirationDateError", "", false); displayError("marketPriceError", "", false); displayError("commissionFeeError", "", false); updateChart([], []); } function copyResults() { var totalCost = getElement("totalCostToExercise").textContent; var waep = getElement("weightedAverageExercisePrice").textContent; var totalValue = getElement("totalValueAtMarketPrice").textContent; var gainLoss = getElement("unrealizedGainLoss").textContent; var textToCopy = "Weighted Average Exercise Price Calculation:\n\n"; textToCopy += "Total Cost to Exercise: " + totalCost + "\n"; textToCopy += "Weighted Average Exercise Price: " + waep + "\n"; textToCopy += "Total Value at Current Market Price: " + totalValue + "\n"; textToCopy += "Unrealized Gain/Loss: " + gainLoss + "\n\n"; textToCopy += "Key Assumptions:\n"; textToCopy += "- Exercise Price: $" + formatNumber(parseFloat(getElement("exercisePrice").value || 0)) + "\n"; textToCopy += "- Number of Shares: " + formatNumber(parseFloat(getElement("numberOfShares").value || 0)) + "\n"; textToCopy += "- Commission Fee: $" + formatNumber(parseFloat(getElement("commissionFee").value || 0)) + "\n"; textToCopy += "- Current Market Price: $" + formatNumber(parseFloat(getElement("marketPrice").value || 0)) + "\n"; var tempTextArea = document.createElement("textarea"); tempTextArea.value = textToCopy; setStyle(tempTextArea, 'position', 'absolute'); setStyle(tempTextArea, 'left', '-9999px'); document.body.appendChild(tempTextArea); tempTextArea.select(); document.execCommand("copy"); document.body.removeChild(tempTextArea); alert("Results copied to clipboard!"); } // Charting Logic var myChart; function updateChart(exercisePrice, marketPrice) { var ctx = getElement('exercisePriceChart').getContext('2d'); if (myChart) { myChart.destroy(); } var data = { labels: ['Exercise Price', 'Current Market Price'], datasets: [{ label: 'Price per Share ($)', data: [exercisePrice || 0, marketPrice || 0], backgroundColor: [ 'rgba(0, 74, 153, 0.6)', // Primary color for exercise price 'rgba(40, 167, 69, 0.6)' // Success color for market price ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(40, 167, 69, 1)' ], borderWidth: 1 }] }; myChart = new Chart(ctx, { type: 'bar', data: data, options: { responsive: true, maintainAspectRatio: true, scales: { y: { beginAtZero: true, ticks: { callback: function(value) { return '$' + value.toFixed(2); } } } }, plugins: { legend: { display: true, position: 'top', }, title: { display: true, text: 'Exercise Price vs. Current Market Price' } } } }); } // Initial chart setup document.addEventListener('DOMContentLoaded', function() { updateChart([], []); // Initialize with empty data // Initialize FAQ accordions var faqQuestions = document.querySelectorAll('.faq-question'); faqQuestions.forEach(function(question) { question.addEventListener('click', function() { var answer = this.nextElementSibling; if (answer.style.display === 'block') { answer.style.display = 'none'; } else { answer.style.display = 'block'; } }); }); }); // Add placeholder for Chart.js if not available if (typeof Chart === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js@3.7.0/dist/chart.min.js'; script.onload = function() { console.log('Chart.js loaded.'); // Re-initialize chart after Chart.js is loaded if needed // calculateWeightedAverageExercisePrice(); // Call if initial calculation is desired on load }; script.onerror = function() { console.error('Failed to load Chart.js.'); getElement('chartContainer').innerHTML = 'Error loading chart component.'; }; document.head.appendChild(script); }

Leave a Comment