Motorcycle Rear Shock Spring Weight Calculator

Motorcycle Rear Shock Spring Weight Calculator & Guide :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –card-background: #fff; –error-color: #dc3545; } 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; display: flex; flex-direction: column; align-items: center; } .container { width: 95%; max-width: 1000px; margin: 20px auto; padding: 25px; background-color: var(–card-background); border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; align-items: center; } h1, h2, h3 { color: var(–primary-color); text-align: center; } h1 { font-size: 2.5em; margin-bottom: 15px; } h2 { font-size: 1.8em; margin-top: 30px; margin-bottom: 15px; } h3 { font-size: 1.4em; margin-top: 20px; margin-bottom: 10px; } .calculator-section { width: 100%; margin-bottom: 30px; padding: 20px; border: 1px solid var(–border-color); border-radius: 6px; background-color: #fdfdfd; } .loan-calc-container { display: flex; flex-direction: column; gap: 20px; } .input-group { display: flex; flex-direction: column; gap: 8px; } .input-group label { font-weight: bold; color: var(–primary-color); margin-bottom: 2px; display: block; } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px; border: 1px solid var(–border-color); border-radius: 4px; font-size: 1em; width: 100%; box-sizing: border-box; transition: border-color 0.3s ease; } .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.85em; color: #666; margin-top: 2px; } .error-message { color: var(–error-color); font-size: 0.8em; margin-top: 5px; min-height: 1.2em; /* Prevent layout shift */ } .button-group { display: flex; justify-content: center; gap: 15px; margin-top: 25px; } 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; text-transform: uppercase; } button.primary { background-color: var(–primary-color); color: white; } button.primary:hover { background-color: #003366; transform: translateY(-1px); } button.secondary { background-color: #6c757d; color: white; } button.secondary:hover { background-color: #5a6268; transform: translateY(-1px); } .results-container { background-color: var(–primary-color); color: white; padding: 25px; border-radius: 6px; margin-top: 30px; width: 100%; box-shadow: 0 2px 10px rgba(0, 74, 153, 0.3); text-align: center; } .results-container h3 { color: white; margin-bottom: 15px; font-size: 1.6em; } #main-result { font-size: 2.5em; font-weight: bold; margin-bottom: 15px; display: block; padding: 10px; border-radius: 4px; } .intermediate-results div, .formula-explanation { margin-top: 15px; font-size: 1.1em; } .intermediate-results span, .formula-explanation span { font-weight: bold; color: var(–success-color); } .formula-explanation { margin-top: 25px; font-style: italic; border-top: 1px dashed rgba(255,255,255,0.3); padding-top: 15px; } table { width: 100%; border-collapse: collapse; margin-top: 25px; margin-bottom: 25px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } th, td { border: 1px solid var(–border-color); padding: 12px 15px; text-align: left; } thead { background-color: var(–primary-color); color: white; } th { font-weight: bold; } tbody tr:nth-child(even) { background-color: #f2f2f2; } caption { caption-side: top; font-weight: bold; font-size: 1.1em; color: var(–primary-color); margin-bottom: 10px; text-align: left; } .chart-container { width: 100%; margin-top: 30px; padding: 20px; background-color: var(–card-background); border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); } .chart-container h3 { margin-bottom: 20px; } canvas { display: block; margin: 0 auto; max-width: 100%; } .article-content { width: 100%; margin-top: 40px; padding: 30px; background-color: var(–card-background); border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); } .article-content p, .article-content ul, .article-content ol { margin-bottom: 15px; } .article-content ul, .article-content ol { padding-left: 20px; } .article-content li { margin-bottom: 8px; } .article-content a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .faq-section h3 { cursor: pointer; position: relative; padding-left: 25px; margin-bottom: 5px; } .faq-section h3::before { content: "+"; position: absolute; left: 0; font-size: 1.2em; color: var(–primary-color); transition: transform 0.3s ease; } .faq-section h3.active::before { content: "-"; transform: rotate(0deg); } .faq-section .answer { display: none; padding-left: 15px; border-left: 2px solid var(–primary-color); margin-left: 10px; margin-top: 5px; font-size: 0.95em; color: #555; } .related-tools ul { list-style: none; padding: 0; } .related-tools li { margin-bottom: 15px; border-bottom: 1px dashed var(–border-color); padding-bottom: 10px; } .related-tools li:last-child { border-bottom: none; } .related-tools a { font-weight: bold; } @media (min-width: 768px) { .container { padding: 30px; } h1 { font-size: 3em; } h2 { font-size: 2em; } h3 { font-size: 1.5em; } }

Motorcycle Rear Shock Spring Weight Calculator

Find the ideal spring rate for your motorcycle's rear suspension.

Enter your total weight including all riding gear (in kg).
Enter the total weight of your motorcycle (in kg).
Desired rider sag percentage (e.g., 0.25 for 25%, 0.33 for 33%).
Total travel of your rear shock absorber (in mm).

Recommended Spring Rate

Static Sag: mm
Total Weight Force: N
Required Spring Force: N
The recommended spring rate is calculated based on rider weight, motorcycle weight, desired sag, and shock travel. The core idea is to find a spring that compresses a specific amount (sag) under the rider's weight to achieve optimal suspension performance.

Spring Rate vs. Sag Depth

Spring Rate Recommendations
Spring Rate (N/mm) Rider Sag (mm) Sag Depth (%)

What is Motorcycle Rear Shock Spring Weight?

Motorcycle rear shock spring weight, often referred to as spring rate, is a critical specification that dictates how much force is required to compress a spring by a certain distance. For a motorcycle's rear suspension, it's the primary component that supports the bike's and rider's weight, absorbing impacts and maintaining tire contact with the ground. The correct spring rate ensures the suspension operates within its intended range, providing a balance between comfort, control, and stability. Getting this right is fundamental for effective handling and safety.

Who should use this calculator: Any motorcycle owner looking to set up or adjust their rear suspension. This includes riders who have recently purchased a new bike and want to set it up for their specific weight, riders who have gained or lost weight, those modifying their motorcycle with luggage or passenger capacity, or anyone experiencing poor handling, bottoming out, or excessive harshness from their rear suspension. It's also invaluable for mechanics and suspension tuners.

Common misconceptions: A frequent misunderstanding is that a stiffer spring always means better performance. In reality, an overly stiff spring can lead to a harsh ride, reduced traction, and poor bump absorption. Conversely, a spring that is too soft can cause the suspension to bottom out easily, reduce stability, and negatively impact handling. Another misconception is that spring rate is solely determined by the bike's model; rider weight and riding style are equally, if not more, important factors. The motorcycle rear shock spring weight is a personalized setting.

Motorcycle Rear Shock Spring Weight Formula and Mathematical Explanation

Calculating the correct motorcycle rear shock spring weight involves understanding how weight translates into force and how that force should compress the suspension to achieve optimal sag. Sag is the amount the suspension compresses under static load (rider and bike weight) when the bike is stationary.

The formula we use is derived from basic physics principles. First, we need to determine the total force exerted by the rider and the motorcycle. Then, we use the desired sag ratio to find out how much the spring should compress under this load. The spring rate (k) is defined as Force (F) divided by displacement (x): k = F/x.

Step-by-step derivation:

  1. Calculate Total Weight Force (F_total): This is the combined weight of the rider (with gear) and the motorcycle, converted into force. In the metric system, Force (Newtons) = Mass (kg) * acceleration due to gravity (g ≈ 9.81 m/s²).
  2. Calculate Desired Sag Depth (x_sag): This is the target compression of the shock absorber when the rider is on the bike. It's calculated as the total shock absorber travel multiplied by the desired sag ratio.
  3. Calculate Required Spring Force (F_spring): This is the force the spring must exert to hold the combined weight at the desired sag. Under static conditions (rider on bike), the weight is supported by the spring. Therefore, the force required from the spring to achieve sag is directly related to the rider's contribution to that sag. A simplified approach focuses on the rider's weight contributing to the sag, as this is the dynamic component that greatly affects performance. However, a more comprehensive calculation considers the combined static weight. For this calculator, we'll focus on the combined static weight supported by the suspension. The force the spring needs to exert to maintain the desired sag when the rider is on board is approximated by the rider's weight force component times a factor related to static sag. A common simplification is to use the rider's weight to determine the spring rate for the *sag*, as the rider's dynamic input is critical. However, for a static recommendation, we consider the combined static weight to determine the force the suspension supports.
    Let's refine: The spring needs to compress by x_sag under the rider's weight force F_rider. Thus, the required spring rate (k) is F_rider / x_sag. The total weight force is F_total = (riderWeight + bikeWeight) * 9.81. The static sag calculation considers the rider's weight pushing down. So, the rider's weight force is F_rider = riderWeight * 9.81. The target sag displacement is x_sag = shockTravel * sagRatio. The spring rate (k) is then calculated as k = F_rider / x_sag. This gives the spring rate in N/mm.

Variables:

Variable Meaning Unit Typical Range
Rider Weight (with gear) Total mass of the rider and all safety equipment. kg 50 – 150+
Motorcycle Static Weight Total mass of the motorcycle itself. kg 100 – 300+
Rider Sag Ratio The desired percentage of the total shock travel that should compress under the rider's static weight. Decimal (e.g., 0.25-0.33) 0.20 – 0.40
Shock Absorber Travel The maximum distance the rear shock can compress. mm 50 – 200+
g (Acceleration due to gravity) Constant value used for force calculation. m/s² ~9.81
Spring Rate (k) Force required to compress the spring by 1 unit of distance. This is the primary output. N/mm Varies widely based on motorcycle type and application.

Practical Examples (Real-World Use Cases)

Example 1: Sport Touring Rider

Scenario: A rider who primarily uses their motorcycle for sport touring, often carrying light luggage. They weigh 90 kg with all their gear. Their motorcycle is a sport-tourer weighing 220 kg. The rear shock has a total travel of 120 mm. They prefer a slightly firmer feel for stability and aim for a rider sag of 30%.

Inputs:

  • Rider Weight (with gear): 90 kg
  • Motorcycle Static Weight: 220 kg
  • Rider Sag Ratio: 0.30 (30%)
  • Shock Absorber Travel: 120 mm

Calculation:

  • Rider Weight Force = 90 kg * 9.81 m/s² = 882.9 N
  • Desired Sag Depth = 120 mm * 0.30 = 36 mm
  • Recommended Spring Rate = 882.9 N / 36 mm ≈ 24.5 N/mm

Result: The calculator recommends a spring rate of approximately 24.5 N/mm. The rider might look for a spring with a rate of 24 N/mm or 25 N/mm, depending on available options. This ensures the rear suspension compresses appropriately under their load, providing good support without being excessively stiff or soft. The static sag would be around 36mm.

Example 2: Lightweight Dual-Sport Rider

Scenario: A rider on a lightweight dual-sport motorcycle used for trail riding and occasional street commuting. They weigh 70 kg with gear. The bike weighs 150 kg. The rear shock offers 100 mm of travel. They prefer a plusher ride and aim for a rider sag of 33%.

Inputs:

  • Rider Weight (with gear): 70 kg
  • Motorcycle Static Weight: 150 kg
  • Rider Sag Ratio: 0.33 (33%)
  • Shock Absorber Travel: 100 mm

Calculation:

  • Rider Weight Force = 70 kg * 9.81 m/s² = 686.7 N
  • Desired Sag Depth = 100 mm * 0.33 = 33 mm
  • Recommended Spring Rate = 686.7 N / 33 mm ≈ 20.8 N/mm

Result: The calculator suggests a spring rate of approximately 20.8 N/mm. The rider would likely choose a 20 N/mm or 21 N/mm spring. This setting provides a good balance for off-road terrain, absorbing smaller bumps effectively while still supporting the rider's weight without excessive compression.

How to Use This Motorcycle Rear Shock Spring Weight Calculator

Using our calculator is straightforward and designed to provide you with a precise recommendation for your motorcycle's rear shock spring. Follow these steps:

  1. Enter Rider Weight: Accurately measure your total weight, including your helmet, riding suit, boots, backpack, and any other gear you typically wear while riding. Enter this value in kilograms (kg).
  2. Enter Motorcycle Static Weight: Find the dry or curb weight of your motorcycle. If unsure, check your owner's manual or a reliable online specification for your bike model. Enter this value in kilograms (kg).
  3. Select Desired Rider Sag Ratio: Sag is the amount your suspension compresses under your static weight. A typical range for street and sport bikes is 25-30% (0.25-0.30), while off-road and dual-sport bikes often benefit from 30-35% (0.30-0.35). Choose a value within this range based on your riding style and preference.
  4. Enter Shock Absorber Travel: Measure the total amount of travel your rear shock absorber provides. This is usually found in your motorcycle's service manual or specifications. Enter this value in millimeters (mm).
  5. Click Calculate: Once all fields are populated, click the "Calculate" button.

How to read results:

  • Recommended Spring Rate: This is the primary output, displayed prominently. It's the target spring stiffness in Newtons per millimeter (N/mm).
  • Static Sag: This shows how much the suspension is calculated to compress in millimeters under the rider's weight alone (static).
  • Total Weight Force: The total force in Newtons exerted by the rider and motorcycle.
  • Required Spring Force: The force the spring needs to exert to achieve the calculated sag.
  • Table and Chart: The table and chart provide context, showing how different spring rates affect sag depth and percentage. This helps visualize the impact of your chosen spring rate.

Decision-making guidance: The calculated spring rate is a starting point. It's essential to test the suspension with the recommended spring. If the bike feels too harsh or bottoms out, the spring might be too stiff. If it feels too soft, wallows in corners, or doesn't provide enough support, the spring might be too soft. Small adjustments in rider sag (e.g., +/- 0.01 to 0.02) can sometimes fine-tune performance, but significant deviations usually indicate the need for a different spring rate. Always consult a professional suspension tuner if you're unsure.

Key Factors That Affect Motorcycle Rear Shock Spring Weight Results

While our calculator provides a solid baseline, several factors can influence the optimal motorcycle rear shock spring weight for your specific needs:

  1. Rider Weight and Gear: This is the most significant factor. A heavier rider requires a stiffer spring. Always include all riding gear for accuracy.
  2. Motorcycle Type and Intended Use: A heavy touring bike will require a different spring rate than a lightweight dirt bike, even with similar rider weights. The bike's weight distribution and suspension geometry also play a role.
  3. Riding Style: Aggressive riders who frequently brake hard, accelerate rapidly, or hit bumps at speed may need a slightly stiffer spring for better support and to prevent bottoming out. Casual riders can often use a softer setting for comfort.
  4. Pillion (Passenger) Riding: If you frequently carry a passenger, you MUST account for their weight. You would typically calculate the spring rate based on the combined rider and passenger weight, or use a spring that is significantly stiffer than for solo riding.
  5. Carrying Luggage: Heavy luggage, such as panniers, top boxes, or camping gear, adds significant weight. This weight needs to be factored in, especially for touring or long-distance rides. You might consider an adjustable or interchangeable spring system for different load conditions.
  6. Suspension Linkage Design: Motorcycles use different linkage systems (e.g., rising rate, progressive, linear). This affects how the spring rate feels throughout the suspension travel. Our calculator provides a linear rate approximation, but linkage designs can alter the effective spring rate during compression.
  7. Personal Preference: Some riders simply prefer a firmer or softer feel. While safety and performance are paramount, personal comfort is also a consideration once the fundamental requirements are met.
  8. Shock Absorber Condition: A worn-out shock absorber with low oil pressure or worn seals may not perform correctly, regardless of the spring rate. Ensure your suspension is in good working order.

Frequently Asked Questions (FAQ)

Q1: How often should I check my motorcycle's rear shock spring rate?

You should primarily check and adjust your spring rate when your weight changes significantly, you change riding styles, or you notice issues like bottoming out, excessive sag, or poor handling. Regular visual inspection of the suspension for leaks or damage is also recommended.

Q2: Can I use a spring rate calculator for my specific motorcycle model?

This calculator provides a general recommendation based on physics. While it's a great starting point, specific motorcycle models might have unique suspension geometries or linkage designs (e.g., rising rate) that alter the feel. Always consult your bike's manual or a suspension specialist for model-specific tuning.

Q3: What happens if my spring rate is too soft?

A spring that is too soft will result in excessive sag (too much compression under static weight), the suspension may bottom out easily over bumps, and the bike can feel unstable, especially during hard braking or cornering.

Q4: What happens if my spring rate is too stiff?

An overly stiff spring will lead to insufficient sag, a harsh ride, reduced traction as the wheel struggles to follow uneven terrain, and poor small bump absorption. The bike might feel like it's skipping over imperfections.

Q5: Does preload adjustment affect the required spring rate?

Preload adjustment primarily affects the *static sag* setting, not the spring's fundamental rate (stiffness). You use preload to fine-tune the sag to the desired percentage after installing the correct spring rate. If you have to add excessive preload to achieve proper sag, your spring is likely too soft.

Q6: What is the difference between spring rate and damping?

Spring rate determines how much the suspension compresses under load (stiffness). Damping (controlled by oil flow through valves) controls the *speed* of compression and rebound. Both are crucial for proper suspension performance, but they address different aspects.

Q7: Can I mix and match springs from different motorcycle brands?

This is generally not recommended unless you are absolutely certain of compatibility in terms of length, diameter, and mounting hardware. Using an incompatible spring can lead to dangerous suspension failure or damage to components.

Q8: How do I find the spring rate of my current shock absorber?

Spring rates are often stamped directly onto the spring itself. You can also consult your motorcycle's service manual or contact the shock absorber manufacturer. If it's an aftermarket shock, the manufacturer's documentation will list the original spring rate.

Related Tools and Internal Resources

© 2023 Your Motorcycle Resource. All rights reserved.

var g = 9.81; // Acceleration due to gravity in m/s^2 function formatResult(value, unit) { if (isNaN(value) || value === Infinity || value === -Infinity) { return '–'; } return value.toFixed(1) + ' ' + unit; } function displayError(elementId, message) { var errorElement = document.getElementById(elementId); if (errorElement) { errorElement.textContent = message; } } function clearErrors() { displayError('riderWeightError', "); displayError('bikeWeightError', "); displayError('sagRatioError', "); displayError('shockTravelError', "); } function validateInputs() { var riderWeight = parseFloat(document.getElementById('riderWeight').value); var bikeWeight = parseFloat(document.getElementById('bikeWeight').value); var sagRatio = parseFloat(document.getElementById('sagRatio').value); var shockTravel = parseFloat(document.getElementById('shockTravel').value); var isValid = true; if (isNaN(riderWeight) || riderWeight <= 0) { displayError('riderWeightError', 'Please enter a valid rider weight (greater than 0).'); isValid = false; } if (isNaN(bikeWeight) || bikeWeight <= 0) { displayError('bikeWeightError', 'Please enter a valid motorcycle weight (greater than 0).'); isValid = false; } if (isNaN(sagRatio) || sagRatio = 0.6) { // Realistic range check displayError('sagRatioError', 'Please enter a sag ratio between 0.05 (5%) and 0.6 (60%).'); isValid = false; } if (isNaN(shockTravel) || shockTravel <= 10) { // Realistic minimum travel displayError('shockTravelError', 'Please enter a valid shock travel (greater than 10mm).'); isValid = false; } return isValid; } function calculateSpringWeight() { clearErrors(); if (!validateInputs()) { document.getElementById('results-section').style.display = 'none'; return; } var riderWeight = parseFloat(document.getElementById('riderWeight').value); var bikeWeight = parseFloat(document.getElementById('bikeWeight').value); var sagRatio = parseFloat(document.getElementById('sagRatio').value); var shockTravel = parseFloat(document.getElementById('shockTravel').value); var riderWeightForce = riderWeight * g; // Force in Newtons var desiredSagDepth = shockTravel * sagRatio; // Displacement in mm var recommendedSpringRate = riderWeightForce / desiredSagDepth; // N/mm // Intermediate calculations for display var staticSag = desiredSagDepth; // For this model, desired sag depth IS the static sag var totalWeightForce = (riderWeight + bikeWeight) * g; // Total static force var springForce = riderWeightForce; // Force the spring must exert to hold rider's weight at sag document.getElementById('main-result').textContent = formatResult(recommendedSpringRate, 'N/mm'); document.getElementById('staticSag').textContent = formatResult(staticSag, ''); document.getElementById('totalWeightForce').textContent = formatResult(totalWeightForce, 'N'); document.getElementById('springForce').textContent = formatResult(springForce, 'N'); document.getElementById('results-section').style.display = 'block'; updateChartAndTable(recommendedSpringRate, shockTravel, sagRatio); } function updateChartAndTable(baseRate, shockTravel, baseSagRatio) { var canvas = document.getElementById('sagChart'); var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear previous chart var tableBody = document.getElementById('springRateTableBody'); tableBody.innerHTML = ''; // Clear previous table rows var rates = [ baseRate * 0.8, baseRate * 0.9, baseRate, baseRate * 1.1, baseRate * 1.2 ]; var dataPoints = []; var maxSagMm = 0; var maxRateNmm = 0; for (var i = 0; i shockTravel) { sagMm = shockTravel; sagPercent = 100; } if (sagMm maxSagMm) maxSagMm = sagMm; if (currentRate > maxRateNmm) maxRateNmm = currentRate; } document.querySelector('.chart-container').style.display = 'block'; document.querySelector('.table-container').style.display = 'block'; // Chart configuration var chartWidth = canvas.offsetWidth; var chartHeight = 300; canvas.width = chartWidth; canvas.height = chartHeight; var padding = 40; var chartAreaWidth = chartWidth – 2 * padding; var chartAreaHeight = chartHeight – 2 * padding; var xScale = chartAreaWidth / (maxRateNmm * 1.1); // Add 10% buffer var yScale = chartAreaHeight / (shockTravel * 1.1); // Use max possible travel ctx.font = '12px Segoe UI'; ctx.fillStyle = '#333'; // Draw axes and labels ctx.strokeStyle = '#ccc'; ctx.lineWidth = 1; // Y-axis (Sag Depth) ctx.beginPath(); ctx.moveTo(padding, padding); ctx.lineTo(padding, chartHeight – padding); ctx.stroke(); ctx.textAlign = 'right'; ctx.fillText('0 mm', padding – 5, chartHeight – padding); ctx.fillText(formatResult(shockTravel, 'mm'), padding – 5, padding); // X-axis (Spring Rate) ctx.beginPath(); ctx.moveTo(padding, chartHeight – padding); ctx.lineTo(chartWidth – padding, chartHeight – padding); ctx.stroke(); ctx.textAlign = 'center'; ctx.fillText('0 N/mm', padding, chartHeight – padding + 15); ctx.fillText(formatResult(maxRateNmm, 'N/mm'), chartWidth – padding, chartHeight – padding + 15); // Draw chart title and labels ctx.textAlign = 'center'; ctx.font = '16px Segoe UI'; ctx.fillStyle = 'var(–primary-color)'; ctx.fillText('Sag Depth (mm)', padding – 25, chartAreaHeight / 2 + padding); ctx.fillText('Spring Rate (N/mm)', chartWidth / 2, chartHeight – 10); // Draw data series (Spring Rate vs Sag Depth) ctx.strokeStyle = 'var(–primary-color)'; ctx.lineWidth = 2; ctx.beginPath(); for (var j = 0; j < dataPoints.length; j++) { var dp = dataPoints[j]; var x = padding + (dp.rate * xScale); var y = chartHeight – padding – (dp.sagMm * yScale); if (j === 0) { ctx.moveTo(x, y); } else { ctx.lineTo(x, y); } } ctx.stroke(); // Draw data points ctx.fillStyle = 'var(–primary-color)'; ctx.beginPath(); for (var k = 0; k < dataPoints.length; k++) { var dp = dataPoints[k]; var x = padding + (dp.rate * xScale); var y = chartHeight – padding – (dp.sagMm * yScale); ctx.moveTo(x, y); ctx.arc(x, y, 4, 0, Math.PI * 2); } ctx.fill(); // Add legend ctx.fillStyle = '#333'; ctx.textAlign = 'left'; ctx.font = '12px Segoe UI'; ctx.fillRect(padding + 10, padding + 10, 15, 8); ctx.fillStyle = 'var(–primary-color)'; ctx.fillText('Spring Rate vs. Sag', padding + 30, padding + 15); } function resetCalculator() { document.getElementById('riderWeight').value = '80'; document.getElementById('bikeWeight').value = '180'; document.getElementById('sagRatio').value = '0.30'; document.getElementById('shockTravel').value = '100'; clearErrors(); document.getElementById('results-section').style.display = 'none'; document.querySelector('.chart-container').style.display = 'none'; document.querySelector('.table-container').style.display = 'none'; } function copyResults() { var mainResult = document.getElementById('main-result').textContent; var staticSag = document.getElementById('staticSag').textContent; var totalWeightForce = document.getElementById('totalWeightForce').textContent; var springForce = document.getElementById('springForce').textContent; var assumptions = [ "Rider Weight (with gear): " + document.getElementById('riderWeight').value + " kg", "Motorcycle Static Weight: " + document.getElementById('bikeWeight').value + " kg", "Rider Sag Ratio: " + document.getElementById('sagRatio').value, "Shock Absorber Travel: " + document.getElementById('shockTravel').value + " mm" ]; var copyText = "Motorcycle Rear Shock Spring Weight Recommendation:\n\n"; copyText += "Recommended Spring Rate: " + mainResult + "\n"; copyText += "Static Sag: " + staticSag + "\n"; copyText += "Total Weight Force: " + totalWeightForce + "\n"; copyText += "Required Spring Force: " + springForce + "\n\n"; copyText += "Assumptions:\n" + assumptions.join("\n"); navigator.clipboard.writeText(copyText).then(function() { // Optionally show a confirmation message alert('Results copied to clipboard!'); }).catch(function(err) { console.error('Failed to copy results: ', err); alert('Failed to copy results. Please copy manually.'); }); } // Add event listeners for FAQ toggles document.addEventListener('DOMContentLoaded', function() { var faqHeaders = document.querySelectorAll('.faq-section h3'); faqHeaders.forEach(function(header) { header.addEventListener('click', function() { this.classList.toggle('active'); var answer = this.nextElementSibling; if (answer.style.display === 'block') { answer.style.display = 'none'; } else { answer.style.display = 'block'; } }); }); });

Leave a Comment