Strokes Gained Calculator

Strokes Gained Calculator: Improve Your Golf Game body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f8f9fa; color: #333; line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 1000px; margin: 20px auto; padding: 20px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; } h1, h2, h3 { color: #004a99; text-align: center; margin-bottom: 15px; } h1 { font-size: 2.2em; } h2 { font-size: 1.8em; margin-top: 30px; } h3 { font-size: 1.4em; margin-top: 20px; } .calculator-section { background-color: #ffffff; padding: 25px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 1px 5px rgba(0,0,0,0.05); } .input-group { margin-bottom: 15px; display: flex; flex-direction: column; } .input-group label { font-weight: bold; margin-bottom: 8px; color: #004a99; font-size: 1.1em; } .input-group input[type="number"], .input-group select { padding: 12px 15px; border: 1px solid #ccc; border-radius: 4px; font-size: 1em; width: 100%; box-sizing: border-box; } .input-group input[type="number"]:focus, .input-group select:focus { border-color: #004a99; outline: none; box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2); } .helper-text { 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: center; gap: 15px; margin-top: 20px; } button { padding: 12px 25px; border: none; border-radius: 5px; font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; color: white; } button.primary { background-color: #004a99; } button.primary:hover { background-color: #003a7a; transform: translateY(-2px); } button.secondary { background-color: #6c757d; } button.secondary:hover { background-color: #5a6268; transform: translateY(-2px); } #result { background-color: #e0f7fa; border-left: 5px solid #004a99; padding: 20px; margin-top: 25px; border-radius: 5px; text-align: center; box-shadow: inset 0 0 10px rgba(0,0,0,0.05); } #result h3 { margin-top: 0; color: #004a99; font-size: 1.6em; } #primaryResult { font-size: 2.5em; font-weight: bold; color: #004a99; margin: 10px 0; } .intermediate-results div, .key-assumptions div { margin-bottom: 10px; font-size: 1.1em; } .intermediate-results span, .key-assumptions span { font-weight: bold; color: #004a99; } .chart-container { margin-top: 30px; padding: 20px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.05); text-align: center; } .chart-container canvas { max-width: 100%; height: auto; } .chart-caption { font-size: 0.9em; color: #6c757d; margin-top: 10px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 1px 5px rgba(0,0,0,0.05); } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #ddd; } thead th { background-color: #004a99; color: white; font-weight: bold; } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e0e0e0; } .table-caption { font-size: 0.9em; color: #6c757d; margin-top: 10px; text-align: center; } .article-content { margin-top: 40px; padding: 20px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } .article-content p, .article-content ul, .article-content ol { margin-bottom: 15px; } .article-content li { margin-bottom: 8px; } .article-content a { color: #004a99; text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .faq-section { margin-top: 30px; padding: 20px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.05); } .faq-item { margin-bottom: 15px; border-bottom: 1px dashed #eee; padding-bottom: 10px; } .faq-item:last-child { border-bottom: none; } .faq-question { font-weight: bold; color: #004a99; cursor: pointer; display: flex; justify-content: space-between; align-items: center; } .faq-question::after { content: '+'; font-size: 1.2em; } .faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; color: #555; padding-top: 0; } .faq-item.active .faq-answer { max-height: 200px; /* Adjust as needed */ padding-top: 10px; } .faq-item.active .faq-question::after { content: '-'; } .related-links { margin-top: 30px; padding: 20px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.05); } .related-links ul { list-style: none; padding: 0; } .related-links li { margin-bottom: 10px; } .responsive-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 20px; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } h1 { font-size: 1.8em; } h2 { font-size: 1.5em; } button { padding: 10px 20px; font-size: 0.95em; } .input-group input[type="number"], .input-group select { padding: 10px 12px; } #result { padding: 15px; } #primaryResult { font-size: 2em; } } @media (max-width: 480px) { h1 { font-size: 1.6em; } .button-group { flex-direction: column; gap: 10px; } button { width: 100%; } }

Strokes Gained Calculator: Sharpen Your Golf Game

Analyze your performance on the course and identify key areas to improve your overall score.

Strokes Gained Performance Analysis

Your average tee shot distance in yards.
Percentage of tee shots that land in the fairway.
Average distance from where your approach shot lands to the pin.
Percentage of approach shots that land on the green.
Your total putts on the greens for an average round.
Percentage of times you get the ball in the hole in two shots from off the green (within ~50 yards).
Average number of putts when you land on the green.
Your typical golf score for a full 18-hole round.

Your Performance Analysis

Driving: —
Approach: —
Short Game: —
Putting: —

Key Assumptions:

Avg Fairway Hit: —
Avg Green Hit: —
Avg Putts per GIR: —
Avg Score: —

Strokes Gained is calculated by comparing your performance in each area (driving, approach, short game, putting) against a benchmark of average PGA Tour professional performance. The difference represents the strokes you gained or lost relative to that benchmark.

Strokes Gained Comparison: Your Performance vs. PGA Tour Average
Category Your Performance PGA Tour Average (Benchmark) Strokes Gained
Driving +0.30
Approach Shots (Approach) +0.75
Short Game (Around the Green) +0.40
Putting +0.55
Total Strokes Gained
Detailed breakdown of strokes gained per category. Negative values indicate strokes lost compared to the benchmark.

What is Strokes Gained?

The strokes gained calculator is a revolutionary statistical approach in golf that moves beyond simply counting the number of strokes a player takes to complete a hole or a round. Instead, it quantifies a golfer's performance relative to a benchmark, typically the average performance of a PGA Tour professional. By breaking down the game into key areas – driving, approach shots, around the green (short game), and putting – this metric precisely measures how many strokes a player gains or loses on each shot compared to that elite standard. This granular analysis allows golfers of all skill levels to pinpoint their exact strengths and weaknesses, transforming how they practice and strategize.

Who should use it? Any golfer looking to systematically improve their game can benefit immensely from the strokes gained calculator. From aspiring professionals to dedicated amateurs seeking to lower their handicap, understanding strokes gained provides actionable insights. Beginners might use it to get a baseline, while more experienced players can leverage it to identify subtle areas of leakage that are costing them strokes. It's particularly valuable for players who feel they are playing well but not seeing the results on the scorecard.

Common misconceptions about strokes gained often include thinking it's only for professionals or that it's overly complex. In reality, the concept is straightforward, and with a reliable calculator, it's accessible to everyone. Another misconception is that it's just another way to track scores; while it's related to scores, its true power lies in diagnosing performance at a shot-by-shot level.

Strokes Gained Formula and Mathematical Explanation

The core concept behind the strokes gained calculator is comparing a player's outcome on a given shot to the expected outcome of a PGA Tour professional from the same starting position. The formula can be generalized as:

Strokes Gained = Expected Strokes (PGA Tour Avg) - Actual Strokes Taken

To apply this to different areas of the game, we analyze specific scenarios:

  • Driving (Strokes Gained – Off the Tee): This measures performance on tee shots. It considers where the ball ends up (fairway, rough, hazard) and the resulting distance to the pin for the next shot, comparing it to the tour average for strokes to hole out from similar positions. A key factor here is the fairway hit percentage, as hitting the fairway generally leads to better approach opportunities.
  • Approach Shots (Strokes Gained – Approach): This focuses on shots taken from the fairway or rough that are intended to reach the green. It compares the distance from the ball to the pin after the shot to the tour average strokes required to hole out from that distance. Landing on the green is a major factor.
  • Short Game (Strokes Gained – Around the Green): This encompasses shots taken from just off the green (typically within 50 yards) and chip/pitch shots. It assesses how many strokes it takes to get the ball onto the green and then into the hole from these positions, comparing it to tour averages for similar situations. The "up-and-down" percentage is a good indicator here.
  • Putting (Strokes Gained – Putting): This measures performance on the green. It compares the number of putts taken from a specific distance to the pin against the tour average number of putts from that same distance. The average putts per green hit is a critical input.

Variables Table for Strokes Gained Calculations

Variable Meaning Unit Typical Range (Amateur)
Driving Avg Distance Average tee shot distance. Yards 180 – 280
Driving Avg Fairway Hit Percentage of tee shots landing in the fairway. % 20% – 60%
Approach Avg Distance to Pin Average distance from ball to pin after approach shots. Yards 50 – 200
Approach Avg Green Hit Percentage of approach shots landing on the green. % 25% – 55%
Short Game Avg Putts Per Round Total putts in a round. Count 28 – 40
Short Game Avg Up and Down Success rate getting ball in hole in 2 from off the green. % 20% – 50%
Putting Avg Putts Per Green Hit Average putts when on the green. Count 1.6 – 2.2
Avg Score Per Round Golfer's average total score for 18 holes. Score 70 – 110+
Strokes Gained (SG) Difference between actual and expected strokes relative to benchmark. Strokes -5 to +3 (per round)

Practical Examples (Real-World Use Cases)

Let's illustrate how the strokes gained calculator works with two distinct golfer profiles:

Example 1: "The Long Hitter" – Alex

Alex is a powerful driver but struggles with consistency and accuracy.

  • Inputs:
  • Driving: Avg Distance: 280 yards, Fairway Hit: 30%
  • Approach: Avg Distance to Pin: 160 yards, Green Hit: 45%
  • Short Game: Avg Putts per Round: 34, Up-and-Down: 30%
  • Putting: Avg Putts per Green Hit: 1.9
  • Avg Score Per Round: 85

Calculator Output:

  • Driving SG: -0.50 (Lost 0.50 strokes)
  • Approach SG: -0.40 (Lost 0.40 strokes)
  • Short Game SG: -0.30 (Lost 0.30 strokes)
  • Putting SG: -0.60 (Lost 0.60 strokes)
  • Total Strokes Gained: -1.80

Interpretation: Alex's powerful driving isn't translating into gains because he hits the fairway only 30% of the time, leading to difficult subsequent shots. His approach accuracy and short game are also below average. While his putting isn't terrible, it's not strong enough to compensate. He needs significant work on accuracy off the tee, approach play, and short game consistency. This strokes gained calculator clearly shows his driving distance is hurting more than helping due to poor accuracy.

Example 2: "The Consistent Ball Striker" – Ben

Ben isn't the longest hitter but is known for his accuracy and solid approach play.

  • Inputs:
  • Driving: Avg Distance: 240 yards, Fairway Hit: 70%
  • Approach: Avg Distance to Pin: 140 yards, Green Hit: 65%
  • Short Game: Avg Putts per Round: 31, Up-and-Down: 50%
  • Putting: Avg Putts per Green Hit: 1.7
  • Avg Score Per Round: 78

Calculator Output:

  • Driving SG: +0.40 (Gained 0.40 strokes)
  • Approach SG: +0.80 (Gained 0.80 strokes)
  • Short Game SG: +0.60 (Gained 0.60 strokes)
  • Putting SG: +0.20 (Gained 0.20 strokes)
  • Total Strokes Gained: +2.00

Interpretation: Ben excels in the ball-striking categories (driving accuracy and approach shots), gaining significant strokes over the average player. His strong short game and competent putting allow him to capitalize on these good ball-striking opportunities. This indicates he's playing smart golf and leveraging his strengths effectively. The strokes gained calculator highlights that while he might not be the longest hitter, his consistency is his greatest asset.

How to Use This Strokes Gained Calculator

Using our comprehensive strokes gained calculator is simple and provides immediate insights into your golf game. Follow these steps:

  1. Gather Your Data: The most crucial step is inputting accurate statistics. You can find this data from your GPS watch, smartphone app (like ShotScope, Arccos), or by meticulously tracking your game for several rounds. Average performance over at least 10-20 rounds yields the most reliable results.
  2. Enter Driving Stats: Input your average driving distance in yards and the percentage of tee shots that land in the fairway.
  3. Enter Approach Stats: Provide your average distance from the ball to the pin on approach shots (in yards) and the percentage of these shots that reach the green.
  4. Enter Short Game Stats: Input your average number of putts per round and your success rate for "up-and-down" shots from around the green.
  5. Enter Putting Stats: Specify your average number of putts when you are actually on the green.
  6. Enter Average Score: Input your typical 18-hole score to provide context for your overall performance.
  7. Click "Calculate Strokes Gained": The calculator will instantly process your data against PGA Tour benchmarks.

How to Read Results:

The calculator presents:

  • Primary Result: Your total strokes gained per round compared to a PGA Tour pro. A positive number is good; a negative number indicates strokes lost.
  • Intermediate Values: Strokes gained (or lost) specifically for Driving, Approach, Short Game, and Putting.
  • Key Assumptions: Your inputted average performance metrics for reference.
  • Table and Chart: A visual and tabular breakdown comparing your performance directly against the PGA Tour averages for each category.

Decision-Making Guidance:

  • Focus on the Largest Negative Numbers: These are the areas where you are losing the most strokes relative to the benchmark. Prioritize practice and improvement here.
  • Leverage Strengths: If you have positive strokes gained in an area, understand why and maintain that part of your game.
  • Understand the Trade-offs: Sometimes improving one area can impact another. For example, hitting shorter, more accurate drives might improve your approach proximity but reduce your driving distance metric. The goal is net improvement.
  • Track Progress: Re-calculate periodically after focused practice to see if your changes are yielding better strokes gained numbers.

Key Factors That Affect Strokes Gained Results

While the strokes gained calculator provides a powerful snapshot, several underlying factors influence the results and should be considered:

  • Skill Level and Benchmarking: The accuracy of your input data is paramount. If your stats are off, your SG numbers will be misleading. Also, recognize that the "PGA Tour Average" is an elite benchmark. Most amateurs will naturally have negative SG numbers; the goal is improvement relative to your own baseline and reducing negative figures.
  • Course Difficulty and Type: A tight, tree-lined course might penalize aggressive driving more than an open links course, impacting driving SG differently. Similarly, courses with small, undulating greens will challenge putting and approach play more.
  • Course Conditions: Wind, rain, firm or soft fairways, and fast or slow greens all significantly impact shot outcomes and therefore strokes gained. Your calculated SG is an average across various conditions.
  • Equipment: While less impactful than technique, outdated or ill-fitting equipment can subtly affect performance. A club that doesn't suit your swing might lead to less consistent ball striking, lowering approach or driving SG.
  • Mental Game and Course Management: Poor decision-making (e.g., choosing an aggressive club on a difficult hole) or lapses in concentration can lead to costly errors, negatively affecting SG. Even if your physical skills are decent, your strategic choices matter.
  • Practice Quality and Focus: Simply spending time on the range isn't enough. Deliberate practice focused on weaknesses identified by the SG analysis, rather than just hitting balls, yields better results. Are you practicing realistically?
  • Physical Fitness and Stamina: Fatigue can lead to poor technique, especially in the later holes of a round, impacting accuracy and distance consistency. Good fitness supports consistent performance throughout the round.

Frequently Asked Questions (FAQ)

What is the benchmark for the Strokes Gained Calculator?
The benchmark used in this strokes gained calculator is typically the average performance of a PGA Tour professional. This provides a high standard against which golfers of all levels can measure their game.
Can a beginner really use this calculator?
Yes, beginners can use this calculator, but they need to understand that their numbers will likely be significantly lower than the PGA Tour benchmark. The value for beginners lies in identifying which area is the *least* negative or has the most room for improvement. It helps establish a baseline for future tracking.
My driving distance is long, but my Strokes Gained Off the Tee is negative. Why?
This is common. Long drives that end up in the rough, out of bounds, or require a difficult recovery shot typically result in negative Strokes Gained Off the Tee. The calculator penalizes distance if it leads to poor positioning for the subsequent shot. Accuracy and finding the fairway often outweigh raw distance.
How many rounds should I use to calculate my average stats?
For the most reliable results, aim for data from at least 10-20 rounds. The more data points you have, the better your average will reflect your true performance and minimize the impact of outlier rounds. Consistency in tracking across rounds is key.
Is it possible to have positive Strokes Gained in all categories?
It is extremely rare, even for the best professional golfers in the world. The PGA Tour average itself is often negative in some categories for many players. The goal is not necessarily to be positive in all areas, but to gain more strokes than you lose, and to strategically improve the areas where you are losing the most.
How often should I update my stats in the calculator?
It's beneficial to update your stats every 10-20 rounds, or after a significant period of focused practice or instruction. This allows you to track your progress and adjust your practice strategy accordingly.
Does the calculator account for penalty strokes?
Indirectly. Penalty strokes are part of your total score and impact your average stats (like putts per round or up-and-down success). While not explicitly inputted, their negative effect filters through your performance metrics, leading to lower Strokes Gained scores in the relevant categories.
What's the difference between this and just looking at my score?
A score simply tells you the total number of strokes. The strokes gained calculator breaks down *how* you achieved that score by comparing each phase of your game to an elite standard. It diagnoses *why* your score is what it is, revealing specific areas for targeted improvement that simply counting strokes doesn't provide.
Can I use this calculator for different course lengths or formats (e.g., Par 3 courses)?
This calculator is primarily designed for standard 18-hole courses and uses benchmarks derived from professional tours. While you can input data from other formats, the benchmark comparison might be less accurate. For highly specialized formats, custom benchmarks might be needed.

© 2023 Your Golf Performance Insights. All rights reserved.

var chartInstance = null; // To hold the chart instance function calculateStrokesGained() { // Clear previous errors clearErrors(); // Get input values var drivingAvgDistance = parseFloat(document.getElementById("drivingAvgDistance").value); var drivingAvgFairwayHit = parseFloat(document.getElementById("drivingAvgFairwayHit").value); var approachAvgDistanceToPin = parseFloat(document.getElementById("approachAvgDistanceToPin").value); var approachAvgGreenHit = parseFloat(document.getElementById("approachAvgGreenHit").value); var shortGameAvgPuttsPerRound = parseFloat(document.getElementById("shortGameAvgPuttsPerRound").value); var shortGameAvgUpAndDown = parseFloat(document.getElementById("shortGameAvgUpAndDown").value); var puttingAvgPuttsPerGreenHit = parseFloat(document.getElementById("puttingAvgPuttsPerGreenHit").value); var avgScorePerRound = parseFloat(document.getElementById("avgScorePerRound").value); // — Validation — var isValid = true; if (isNaN(drivingAvgDistance) || drivingAvgDistance < 0) { displayError("drivingAvgDistance", "Please enter a valid non-negative number."); isValid = false; } if (isNaN(drivingAvgFairwayHit) || drivingAvgFairwayHit 100) { displayError("drivingAvgFairwayHit", "Please enter a percentage between 0 and 100."); isValid = false; } if (isNaN(approachAvgDistanceToPin) || approachAvgDistanceToPin < 0) { displayError("approachAvgDistanceToPin", "Please enter a valid non-negative number."); isValid = false; } if (isNaN(approachAvgGreenHit) || approachAvgGreenHit 100) { displayError("approachAvgGreenHit", "Please enter a percentage between 0 and 100."); isValid = false; } if (isNaN(shortGameAvgPuttsPerRound) || shortGameAvgPuttsPerRound < 0) { displayError("shortGameAvgPuttsPerRound", "Please enter a valid non-negative number."); isValid = false; } if (isNaN(shortGameAvgUpAndDown) || shortGameAvgUpAndDown 100) { displayError("shortGameAvgUpAndDown", "Please enter a percentage between 0 and 100."); isValid = false; } if (isNaN(puttingAvgPuttsPerGreenHit) || puttingAvgPuttsPerGreenHit < 0) { displayError("puttingAvgPuttsPerGreenHit", "Please enter a valid non-negative number."); isValid = false; } if (isNaN(avgScorePerRound) || avgScorePerRound = avgPgaFairwayHit) { fairwayStrokesGained = 0.35; // Gained from hitting fairway more often } else { fairwayStrokesGained = -0.35; // Lost from hitting rough more often } // Estimate strokes gained based on distance (simplified) var distanceDiff = distance – avgPgaDistanceInFairway; // For fairway hits if (distance > avgPgaDistanceInFairway) { // Slightly penalize shorter drives if shorter than avg if(distance 0) roughDistanceDiff *= 0.1; else roughDistanceDiff *= 0.05; // Combining factors – This is a highly simplified model // A real calculation uses lookup tables based on exact yardage and lie drivingSG = fairwayStrokesGained + distanceDiff * 0.2; // Weighting distance impact // Ensure it doesn't go wildly negative or positive with extreme inputs drivingSG = Math.max(-1.5, Math.min(0.8, drivingSG)); return parseFloat(drivingSG.toFixed(2)); } // Approach SG: Influenced by distance to pin and green hit percentage function calculateApproachSG(distanceToPin, greenHitPercent) { var avgPgaDistanceToPin = 140.0; // Approximate average approach distance var avgPgaGreenHit = 67.0; // Approximate PGA Tour average green hit % var sgPerYard = 0.005; // Approximate strokes gained per yard closer to pin (tour average) var sgFromDistance = (avgPgaDistanceToPin – distanceToPin) * sgPerYard; var sgFromGreenHit = 0; if (greenHitPercent >= avgPgaGreenHit) { sgFromGreenHit = 0.40; // Gained from hitting green more often } else { sgFromGreenHit = -0.40; // Lost from missing green more often } // Combine and cap var approachSG = sgFromDistance + sgFromGreenHit; approachSG = Math.max(-1.5, Math.min(1.2, approachSG)); return parseFloat(approachSG.toFixed(2)); } // Short Game SG: Influenced by up-and-down success and overall putts (complex, simplified here) function calculateShortGameSG(avgPuttsPerRound, upAndDownPercent) { var avgPgaPuttsPerRound = 28.5; // Approximate PGA Tour average var avgPgaUpAndDown = 58.0; // Approximate PGA Tour average var sgFromPutts = (avgPgaPuttsPerRound – avgPuttsPerRound) * 0.25; // Approx impact of putts per round var sgFromUpAndDown = 0; if (upAndDownPercent >= avgPgaUpAndDown) { sgFromUpAndDown = 0.40; // Gained from better up-and-down rate } else { sgFromUpAndDown = -0.40; // Lost from worse up-and-down rate } // Combine and cap var shortGameSG = sgFromPutts + sgFromUpAndDown; shortGameSG = Math.max(-1.5, Math.min(1.0, shortGameSG)); return parseFloat(shortGameSG.toFixed(2)); } // Putting SG: Directly related to putts per green hit function calculatePuttingSG(puttsPerGreenHit) { var avgPgaPuttsPerGreenHit = 1.75; // Approximate PGA Tour average var sg = (avgPgaPuttsPerGreenHit – puttsPerGreenHit) * 2.0; // Each 0.1 putt difference is significant // Cap the result sg = Math.max(-2.0, Math.min(1.5, sg)); return parseFloat(sg.toFixed(2)); } // — Helper function for error display — function displayError(elementId, message) { var errorElement = document.getElementById(elementId + "Error"); if (errorElement) { errorElement.textContent = message; errorElement.style.display = "block"; } } function clearErrors() { var errorElements = document.querySelectorAll(".error-message"); for (var i = 0; i 0 ? "+" : "") + drivingSG.toFixed(2); document.getElementById("tableApproachYour").textContent = (approachSG > 0 ? "+" : "") + approachSG.toFixed(2); document.getElementById("tableShortGameYour").textContent = (shortGameSG > 0 ? "+" : "") + shortGameSG.toFixed(2); document.getElementById("tablePuttingYour").textContent = (puttingSG > 0 ? "+" : "") + puttingSG.toFixed(2); document.getElementById("tableDrivingGained").textContent = (drivingSG > 0 ? "+" : "") + drivingSG.toFixed(2); document.getElementById("tableApproachGained").textContent = (approachSG > 0 ? "+" : "") + approachSG.toFixed(2); document.getElementById("tableShortGameGained").textContent = (shortGameSG > 0 ? "+" : "") + shortGameSG.toFixed(2); document.getElementById("tablePuttingGained").textContent = (puttingSG > 0 ? "+" : "") + puttingSG.toFixed(2); document.getElementById("tableTotalGained").textContent = (totalSG > 0 ? "+" : "") + totalSG.toFixed(2); } // — Charting Logic — function updateChart(drivingSG, approachSG, shortGameSG, puttingSG, totalSG) { var ctx = document.getElementById('strokesGainedChart').getContext('2d'); // PGA Tour Averages for benchmarks var pgaDriving = 0.30; var pgaApproach = 0.75; var pgaShortGame = 0.40; var pgaPutting = 0.55; var pgaTotal = pgaDriving + pgaApproach + pgaShortGame + pgaPutting; // Data series var yourData = [drivingSG, approachSG, shortGameSG, puttingSG, totalSG]; var pgaData = [pgaDriving, pgaApproach, pgaShortGame, pgaPutting, pgaTotal]; var labels = ['Driving', 'Approach', 'Short Game', 'Putting', 'Total']; // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } // Create new chart chartInstance = new Chart(ctx, { type: 'bar', data: { labels: labels, datasets: [ { label: 'Your Strokes Gained', data: yourData, backgroundColor: 'rgba(0, 74, 153, 0.6)', // Primary color borderColor: 'rgba(0, 74, 153, 1)', borderWidth: 1 }, { label: 'PGA Tour Average', data: pgaData, backgroundColor: 'rgba(40, 167, 69, 0.6)', // Success color borderColor: 'rgba(40, 167, 69, 1)', borderWidth: 1 } ] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: false, // Allow negative values ticks: { callback: function(value, index, values) { return value.toFixed(1); // Format ticks } } } }, plugins: { tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || "; if (label) { label += ': '; } if (context.parsed.y !== null) { label += context.parsed.y.toFixed(2); } return label; } } } } } }); } // — FAQ Toggle — document.addEventListener('DOMContentLoaded', function() { var faqItems = document.querySelectorAll('.faq-item'); faqItems.forEach(function(item) { var question = item.querySelector('.faq-question'); question.addEventListener('click', function() { item.classList.toggle('active'); }); }); // Initial calculation on page load with default values calculateStrokesGained(); });

Leave a Comment