Mtb Spring Weight Calculator

MTB Spring Weight Calculator: Find Your Perfect Shock Setting :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-radius: 8px; –shadow: 0 4px 8px 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: 20px; } .container { max-width: 960px; margin: 20px auto; background-color: #ffffff; padding: 30px; border-radius: var(–border-radius); box-shadow: var(–shadow); } header { background-color: var(–primary-color); color: #ffffff; padding: 20px; border-radius: var(–border-radius) var(–border-radius) 0 0; text-align: center; margin: -30px -30px 20px -30px; } header h1 { margin: 0; font-size: 2em; } .calculator-section { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px solid #eee; } .calculator-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; } h2, h3 { color: var(–primary-color); margin-bottom: 15px; } .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); } .input-group input, .input-group select { padding: 10px 15px; border: 1px solid #ccc; border-radius: var(–border-radius); font-size: 1em; transition: border-color 0.3s ease; } .input-group input:focus, .input-group select:focus { border-color: var(–primary-color); outline: none; } .helper-text { font-size: 0.85em; color: #666; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; gap: 15px; margin-top: 25px; flex-wrap: wrap; /* Allow wrapping on small screens */ } button { padding: 12px 20px; border: none; border-radius: var(–border-radius); font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; } button.primary { background-color: var(–primary-color); color: #ffffff; } button.primary:hover { background-color: #003a7a; transform: translateY(-2px); } button.secondary { background-color: #6c757d; color: #ffffff; } button.secondary:hover { background-color: #5a6268; transform: translateY(-2px); } #results-container { background-color: var(–primary-color); color: #ffffff; padding: 25px; border-radius: var(–border-radius); margin-top: 30px; box-shadow: inset 0 0 15px rgba(0,0,0,0.2); } #results-container h3 { color: #ffffff; margin-top: 0; text-align: center; font-size: 1.5em; } #results-container p { margin-bottom: 10px; font-size: 1.1em; } #results-container .main-result { font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px; color: var(–success-color); } #results-container .intermediate-value { font-weight: bold; } .formula-explanation { margin-top: 15px; font-size: 0.95em; color: rgba(255, 255, 255, 0.8); text-align: center; } #chart-container { margin-top: 30px; padding: 20px; background-color: #ffffff; border-radius: var(–border-radius); box-shadow: var(–shadow); } #chart-container canvas { display: block; width: 100%; height: auto; } .chart-caption { text-align: center; font-size: 0.9em; color: #666; margin-top: 10px; } table { width: 100%; border-collapse: collapse; margin-top: 20px; } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #ddd; } th { background-color: var(–primary-color); color: #ffffff; font-weight: bold; } td { background-color: #f2f2f2; } tr:nth-child(even) td { background-color: #ffffff; } .article-content { margin-top: 40px; background-color: #ffffff; padding: 30px; border-radius: var(–border-radius); box-shadow: var(–shadow); } .article-content h2 { margin-top: 30px; border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; } .article-content h3 { margin-top: 20px; color: #0056b3; } .article-content p { margin-bottom: 15px; } .article-content ul, .article-content ol { margin-left: 20px; margin-bottom: 15px; } .article-content li { margin-bottom: 8px; } .faq-list dt { font-weight: bold; color: var(–primary-color); margin-top: 15px; } .faq-list dd { margin-left: 20px; margin-bottom: 10px; } a { color: var(–primary-color); text-decoration: none; } a:hover { text-decoration: underline; } .internal-links-section ul { list-style: none; padding: 0; } .internal-links-section li { margin-bottom: 10px; } @media (min-width: 768px) { .container { padding: 40px; } header h1 { font-size: 2.5em; } .loan-calc-container { gap: 25px; } button { padding: 15px 25px; } }

MTB Spring Weight Calculator

Find your optimal rear shock spring for peak performance on any trail.

Calculate Your Ideal MTB Spring Weight

Your total weight on the bike in kilograms (kg).
Recommended sag is typically 15-30% for most MTB disciplines.
The total travel of your rear shock in millimeters (mm).
lb/in (Pounds per inch) N/mm (Newtons per millimeter)
Select your preferred unit for the spring rate.

Your Recommended Spring Settings

Calculated Sag Depth:

Spring Rate in N/mm:

Spring Rate in lb/in:

Formula: Spring Rate (N/mm) = (Rider Weight in kg * 9.81 m/s²) / (Shock Travel in mm * Desired Sag Percentage)

Spring Rate Comparison Table

Spring Type Rate (lb/in) Rate (N/mm) Typical Rider Weight Range (kg)
Visualizing Spring Rates for Different Rider Weights

Spring Weight vs. Sag Depth Chart

Impact of Spring Weight on Sag Depth for a 65mm Shock

What is MTB Spring Weight?

The term MTB spring weight refers to the specific stiffness of the coil spring used in a mountain bike's rear suspension shock. Unlike air springs, which use compressed air for damping and support, coil springs use a physical, wound metal spring. The mtb spring weight dictates how much force is required to compress the spring by a certain amount. A heavier spring (higher mtb spring weight) will resist compression more strongly, while a lighter spring will compress more easily under load. This is a fundamental aspect of setting up your rear suspension for optimal performance, comfort, and control on the trail. Understanding and correctly selecting your mtb spring weight is crucial for achieving the desired 'sag' – the amount the suspension compresses under your static weight.

Who Should Use an MTB Spring Weight Calculator?

Anyone riding a mountain bike equipped with a coil-sprung rear shock should consider using an mtb spring weight calculator. This includes:

  • Downhill (DH) riders who often prefer the consistent feel and durability of coil shocks.
  • Enduro riders who prioritize plushness and control on aggressive descents.
  • Freeride and slopestyle riders looking for predictable suspension behavior.
  • Trail riders who prefer the feel of a coil shock over an air shock.
  • Beginners trying to dial in their first coil-sprung bike.
  • Experienced riders making a shock change or fine-tuning their setup.

Essentially, if your bike uses a coil shock, this calculator is a valuable tool to get you into the ballpark of the correct mtb spring weight. It helps translate your body weight and desired suspension performance into a tangible spring rate.

Common Misconceptions about MTB Spring Weight

  • "Heavier rider = much heavier spring": While rider weight is the primary factor, the desired sag percentage and shock travel also play significant roles. A lighter rider with a very progressive suspension design might end up with a spring rate surprisingly close to a heavier rider on a less progressive setup.
  • "You can just use any spring and adjust it": Coil springs are designed for specific force ranges. While some preload adjustment is possible, it has minimal effect on the spring rate itself and can negatively impact suspension performance and safety if overdone. Using a spring far outside the recommended range for your weight is ineffective and potentially dangerous.
  • "Air springs and coil springs are interchangeable": They are not. While they achieve a similar goal (suspension damping and support), their characteristics, tuning methods, and recommended spring rates (or air pressures) are entirely different. This calculator is specifically for coil shocks.
  • "More sag is always better": Too much sag can lead to bottom-outs, poor climbing efficiency, and a harsh ride as the suspension works through its travel too quickly. Too little sag can result in a stiff, unforgiving ride and reduced traction. The goal is the *correct* sag for your riding style and terrain.

MTB Spring Weight Formula and Mathematical Explanation

The core calculation for determining the required mtb spring weight relies on understanding the relationship between force, mass, acceleration, spring stiffness, and suspension travel. We aim to find a spring rate that, when subjected to the rider's weight, compresses the suspension to the desired sag depth.

The Formula:

The primary formula used in our mtb spring weight calculator is derived from basic physics principles:

Spring Rate (N/mm) = (Rider Weight (kg) * g) / (Shock Travel (mm) * Sag Percentage)

Where:

  • g is the acceleration due to gravity, approximately 9.81 m/s². This converts mass (kg) into force (Newtons).

Variable Explanations:

  • Rider Weight (kg): This is the total mass of the rider, including their riding gear (helmet, pads, backpack, etc.). Accuracy here is key.
  • Shock Travel (mm): This is the total amount of travel the rear shock is designed to provide (e.g., 50mm, 55mm, 65mm, 230mm eye-to-eye with stroke X). The calculator uses the *stroke* length.
  • Desired Sag Percentage: This is the target amount of suspension compression under static rider weight, expressed as a percentage of the total shock travel. Common values range from 15% (for XC/light trail) to 30% (for DH/enduro).
  • Acceleration due to Gravity (g): A constant value (approx. 9.81 m/s²) used to convert mass into weight (force).

Step-by-Step Derivation:

  1. Calculate Rider Force: First, convert the rider's mass (kg) into force (Newtons) using the acceleration due to gravity: Force (N) = Rider Weight (kg) * g.
  2. Calculate Desired Sag Depth: Determine the actual amount the shock should compress in millimeters: Sag Depth (mm) = Shock Travel (mm) * (Sag Percentage / 100).
  3. Apply Hooke's Law: Hooke's Law states that Force = Spring Constant * Displacement (F = kx). In our context, the Force is the Rider Force (N), and the Displacement (x) is the Sag Depth (mm). The Spring Constant (k) is the Spring Rate we want to find.
  4. Rearrange Hooke's Law: To find the Spring Rate (k), we rearrange the formula: k = F / x.
  5. Substitute and Simplify: Substitute the calculated Rider Force and Sag Depth into the rearranged formula: Spring Rate (N/mm) = (Rider Weight (kg) * g) / (Shock Travel (mm) * Sag Percentage / 100) This simplifies to the formula presented above.

Variables Table:

Variable Meaning Unit Typical Range
Rider Weight Total mass of rider plus gear kg 40 – 150+
Shock Travel Total stroke length of the rear shock mm 35 – 230+ (common MTB: 50-65mm for Trunnion/Metric, 190-230mm for DH/Enduro)
Desired Sag Percentage Target suspension compression under static weight % 15% – 30%
Spring Rate (N/mm) Force required to compress spring by 1mm N/mm ~100 – 1500+
Spring Rate (lb/in) Force required to compress spring by 1 inch lb/in ~50 – 850+

Practical Examples (Real-World Use Cases)

Example 1: Enduro Rider Setup

Scenario: Alex is an enduro rider weighing 80 kg with all his gear. He rides a bike with a 65mm stroke rear shock and prefers a slightly firmer suspension feel, aiming for 20% sag.

Inputs:

  • Rider Weight: 80 kg
  • Desired Sag Percentage: 20%
  • Rear Shock Travel: 65 mm

Calculation:

  • Rider Force = 80 kg * 9.81 m/s² ≈ 784.8 N
  • Desired Sag Depth = 65 mm * (20 / 100) = 13 mm
  • Spring Rate (N/mm) = 784.8 N / 13 mm ≈ 60.37 N/mm
  • Spring Rate (lb/in) = 60.37 N/mm * (175.13 lb/in / 1 N/mm) ≈ 1057 lb/in

Result Interpretation: The calculator recommends a spring rate of approximately 60.4 N/mm or 1057 lb/in. Alex should look for a coil spring close to this value. This setup will provide a responsive feel with good support during enduro stages, minimizing excessive compression while maintaining traction on descents.

Example 2: Downhill Rider Tuning

Scenario: Ben is a downhill rider, heavier at 95 kg including his full-face helmet and pads. His downhill bike features a robust 230mm (9-inch) stroke rear shock. He likes a plush, ground-hugging feel and targets 25% sag.

Inputs:

  • Rider Weight: 95 kg
  • Desired Sag Percentage: 25%
  • Rear Shock Travel: 230 mm

Calculation:

  • Rider Force = 95 kg * 9.81 m/s² ≈ 931.95 N
  • Desired Sag Depth = 230 mm * (25 / 100) = 57.5 mm
  • Spring Rate (N/mm) = 931.95 N / 57.5 mm ≈ 162.1 N/mm
  • Spring Rate (lb/in) = 162.1 N/mm * (175.13 lb/in / 1 N/mm) ≈ 2838 lb/in

Result Interpretation: The calculation suggests Ben needs a much stiffer spring, around 162.1 N/mm or 2838 lb/in. This higher mtb spring weight is necessary to prevent the long-travel shock from bottoming out excessively under his weight and the demands of downhill riding, ensuring better control and protection against harsh impacts.

How to Use This MTB Spring Weight Calculator

Our mtb spring weight calculator is designed for simplicity and accuracy. Follow these steps to find your ideal spring:

Step-by-Step Guide:

  1. Measure Your Rider Weight: Weigh yourself accurately wearing all your usual riding gear – helmet, pads, backpack, water, etc. This provides the most realistic input for the calculator.
  2. Determine Your Shock Travel: Find the manufacturer's specifications for your rear shock's total stroke length. This is usually listed in millimeters (mm). If unsure, consult your bike's manual or the shock manufacturer's website.
  3. Choose Your Desired Sag: Select the sag percentage that aligns with your riding style and discipline.
    • 15-20%: Typically for Cross-Country (XC) or lighter trail riding, prioritizing pedaling efficiency.
    • 20-25%: A good middle ground for aggressive trail riding and lighter enduro use.
    • 25-30%: Common for Enduro and Downhill (DH), prioritizing grip and bump absorption on rough terrain.
  4. Select Spring Unit Preference: Choose whether you want the final recommendation in Newtons per millimeter (N/mm) or Pounds per inch (lb/in), as these are the common units for coil springs.
  5. Enter Values into the Calculator: Input your measured rider weight, desired sag percentage, and shock travel into the respective fields.
  6. Click 'Calculate Spring Weight': The calculator will instantly display your recommended primary spring rate, along with intermediate values like the calculated sag depth and the spring rate in both units.

How to Read the Results:

  • Recommended Spring Weight (Primary Result): This is the core output, indicating the stiffness of the spring you should aim for. It's displayed prominently.
  • Calculated Sag Depth: Shows how much the shock should compress (in mm) based on your inputs. This helps visualize the suspension's behavior.
  • Spring Rate in N/mm & lb/in: Provides the recommended spring rate in both common units, making it easier to find compatible springs regardless of manufacturer labeling.

Decision-Making Guidance:

The calculator provides a starting point. Springs are often sold in increments (e.g., 25 lb/in or 50 lb/in steps). If your calculated value falls between two available spring weights, consider:

  • Riding Style: If you ride aggressively and hit large obstacles, lean towards the stiffer spring. For smoother riding or prioritizing climbing, lean towards the lighter spring.
  • Terrain: Rough, technical terrain might benefit from a slightly softer setup (lighter spring within range), while smoother, jump-focused tracks might prefer a stiffer spring.
  • Personal Preference: Fine-tuning is essential. After installing a spring close to the recommendation, test ride your bike and make small adjustments (if possible via preload, though ideally use the next closest spring) or re-calculate with a slightly adjusted sag percentage.

Always prioritize safety. If unsure, consult a qualified bike mechanic or suspension tuning specialist. Remember that this calculator focuses on the primary mtb spring weight; shock damping also plays a critical role in overall suspension performance.

Key Factors That Affect MTB Spring Weight Results

While the calculator provides a strong baseline, several factors can influence your final choice and overall suspension performance. Understanding these nuances is key to truly dialing in your bike:

  1. Rider Weight Accuracy: The most significant input. Inaccurate weight measurement (especially underestimating) is the most common reason for incorrect spring selection. Always weigh yourself with *all* riding gear.
  2. Shock Stroke vs. Total Length: Ensure you are using the shock's *stroke* (the amount it compresses) and not its overall length (eye-to-eye). Using the wrong measurement will lead to vastly incorrect spring rate calculations.
  3. Desired Sag Percentage Nuances: While 25% is a common starting point, your specific riding style matters. Aggressive downhill riders might prefer slightly less sag (e.g., 20-22%) for better ramp-up and support, while riders focused on traction in technical terrain might opt for slightly more (e.g., 27-30%).
  4. Suspension Leverage Ratio: Different bike frames have different leverage ratios, which affect how the shock compresses relative to wheel travel. A bike with a highly progressive leverage ratio might feel stiffer overall, potentially allowing for a slightly lighter spring than a linear or regressive design for the same rider and sag. Our calculator uses a simplified approach assuming standard shock stroke, but leverage ratio is a significant factor for advanced tuning.
  5. Spring Rate Increments and Availability: Coil springs are manufactured in set increments (e.g., every 25 lb/in or 50 lb/in). You'll rarely find a spring that exactly matches the calculator's output. You'll need to choose the closest available spring, often rounding up or down based on the factors below.
  6. Spring Material and Design: Titanium springs are lighter than steel springs of the same rate. Some springs might have different winding designs affecting their end-stroke characteristics. While the calculator focuses on the rated stiffness, these subtle differences can matter to discerning riders.
  7. Riding Discipline and Terrain: Cross-country riders prioritize pedaling efficiency (less sag, potentially lighter spring), while downhill riders focus on absorbing impacts and maintaining control (more sag, heavier spring). Enduro sits in between, balancing climbing and descending needs.
  8. Damping Settings: The rebound and compression damping settings on your shock work in conjunction with the spring rate. A poorly set damping circuit can make even the correctly rated spring feel harsh or uncontrolled. Always tune damping *after* selecting the appropriate spring.
  9. Personal Preference and Feel: Ultimately, suspension feel is subjective. Some riders prefer a firmer, more supportive ride, while others like a plusher, more active feel. Use the calculator as a guide, but trust your own feedback on the trail.

Frequently Asked Questions (FAQ)

Q1: How do I know if I have a coil shock or an air shock?
A: Coil shocks have a visible, metal spring wound around the shock body. Air shocks use a smooth cylinder with air valve caps, often resembling a soda can.
Q2: Can I use this calculator for my bike's fork?
A: No, this calculator is specifically for rear coil shocks. Forks (both air and coil) have different tuning characteristics and leverage ratios.
Q3: What does "spring rate" actually mean?
A: The spring rate (e.g., 500 lb/in or 88 N/mm) indicates how much force is required to compress the spring by one unit of distance (one inch or one millimeter, respectively). A higher number means a stiffer spring.
Q4: My calculated spring rate is exactly between two available options. Which one should I choose?
A: If you ride aggressively or hit big impacts, lean towards the stiffer spring. If you prioritize pedaling efficiency, climbing, or a plusher feel on smaller bumps, lean towards the lighter spring. You may need to experiment.
Q5: Does preload adjustment change the spring rate?
A: No, preload adjustment only changes the initial compression of the spring *before* you sit on the bike. It affects your starting sag slightly but does not change the spring's inherent stiffness (rate). Over-tightening preload can harm suspension performance.
Q6: How often should I check/change my MTB spring weight?
A: You generally only need to change your spring weight if your rider weight changes significantly (e.g., +/- 5-10 kg) or if you change riding disciplines and desire a different suspension feel. The spring itself rarely needs replacement unless it's damaged or excessively worn.
Q7: What if my shock has adjustable bottom-out resistance or compression damping?
A: These adjustments complement the spring rate. You should set your spring rate first to achieve the correct sag and support, then tune damping for control and impact absorption. High compression damping can sometimes mask an overly light spring, but it's not a substitute.
Q8: My shock is 200mm eye-to-eye, but what is its stroke?
A: Eye-to-eye length is the shock's overall length. The stroke is the amount the shaft moves within the shock body. For example, a 200x57mm shock has a 200mm eye-to-eye length and a 57mm stroke. Always use the stroke measurement for this calculator.

Related Tools and Internal Resources

var g = 9.81; // Acceleration due to gravity in m/s^2 var conversionFactorLbInToNmm = 175.13; // Approximate conversion factor function validateInput(id, min, max, message) { var input = document.getElementById(id); var errorElement = document.getElementById(id + 'Error'); var value = parseFloat(input.value); if (isNaN(value) || input.value.trim() === "") { errorElement.textContent = "This field is required."; errorElement.style.display = 'block'; input.style.borderColor = '#dc3545'; return false; } else if (value max) { errorElement.textContent = message || `Value cannot exceed ${max}.`; errorElement.style.display = 'block'; input.style.borderColor = '#dc3545'; return false; } else { errorElement.textContent = ""; errorElement.style.display = 'none'; input.style.borderColor = '#ccc'; return true; } } function clearErrors() { var inputs = document.querySelectorAll('#mtbSpringWeightCalculator input[type="number"], #mtbSpringWeightCalculator select'); for (var i = 0; i < inputs.length; i++) { var errorElement = document.getElementById(inputs[i].id + 'Error'); if (errorElement) { errorElement.textContent = ""; errorElement.style.display = 'none'; } inputs[i].style.borderColor = '#ccc'; } } function calculateSpringWeight() { clearErrors(); var riderWeight = parseFloat(document.getElementById('riderWeight').value); var sagPercentage = parseFloat(document.getElementById('sagPercentage').value); var shockTravel = parseFloat(document.getElementById('shockTravel').value); var units = document.getElementById('springRateUnits').value; var isValid = true; if (!validateInput('riderWeight', 1, 300, 'Please enter a valid weight in kg.')) isValid = false; if (!validateInput('sagPercentage', 1, 100, 'Sag must be between 1% and 100%.')) isValid = false; if (!validateInput('shockTravel', 10, 300, 'Please enter a valid shock travel in mm.')) isValid = false; if (!isValid) { document.getElementById('results-container').style.display = 'none'; return; } var riderForce = riderWeight * g; // Force in Newtons var sagDepthMm = shockTravel * (sagPercentage / 100); // Sag depth in mm var springRateNmm = riderForce / sagDepthMm; // Spring rate in N/mm // Ensure we don't divide by zero or have invalid sag depth if (isNaN(springRateNmm) || !isFinite(springRateNmm) || springRateNmm 0 && shockTravel > 0 && sagPercentage > 0) { var baseWeight = riderWeight; var baseTravel = shockTravel; var baseSag = sagPercentage; var weightsToTest = [ baseWeight * 0.8, baseWeight * 0.9, baseWeight, baseWeight * 1.1, baseWeight * 1.2 ]; var springsToShow = 5; // Show a few springs around the target // Generate some representative spring rates based on rider weight and common increments var exampleRates = []; // Generate N/mm rates (example: +/- 50 N/mm steps around current) var startNmm = Math.max(25, Math.floor(currentNmm / 50) * 50 – 100); // Start a bit lower var endNmm = Math.ceil(currentNmm / 50) * 50 + 100; // End a bit higher for (var rate = startNmm; rate 0) { var rateLbin = rate * conversionFactorLbInToNmm; var approxWeight = (rate * baseTravel * (baseSag / 100)) / g; exampleRates.push({ nmm: rate, lbin: rateLbin, weight: approxWeight }); } } // Ensure current recommended is included if not already var foundCurrent = exampleRates.some(function(r) { return Math.abs(r.nmm – currentNmm) 0) { var currentRateLbin = currentNmm * conversionFactorLbInToNmm; var approxWeight = (currentNmm * baseTravel * (baseSag / 100)) / g; exampleRates.push({ nmm: currentNmm, lbin: currentRateLbin, weight: approxWeight }); exampleRates.sort(function(a, b) { return a.nmm – b.nmm; }); // Sort by N/mm } // Limit the number of rows shown and ensure diversity var uniqueRates = []; var seenNmm = new Set(); for (var i = 0; i < exampleRates.length && uniqueRates.length 0 && !isNaN(baseRiderWeight) && baseRiderWeight > 0 && !isNaN(baseSagPercentage) && baseSagPercentage > 0) { // Data Series 1: Sag Depth vs. Spring Rate (holding rider weight and shock travel constant) var minNmm = Math.max(10, currentNmm / 2); var maxNmm = currentNmm * 2; var stepNmm = (maxNmm – minNmm) / (numPoints -1); for (var i = 0; i < numPoints; i++) { var nmmRate = minNmm + i * stepNmm; var riderForce = baseRiderWeight * g; var sagMm = riderForce / nmmRate; labels.push(nmmRate.toFixed(1) + " N/mm"); dataSeries1.push(sagMm); } // Data Series 2: Rider Weight vs. Spring Rate (holding sag % and shock travel constant) // This requires calculating the required spring rate for various rider weights to achieve the target sag // Let's simplify: show how much sag changes IF rider weight changes for a fixed current spring rate. // Or, show how rider weight changes for the target sag across different springs. // For simplicity, let's show how sag depth changes with rider weight, assuming the TARGET spring rate. var minWeight = Math.max(30, baseRiderWeight * 0.7); var maxWeight = baseRiderWeight * 1.3; var stepWeight = (maxWeight – minWeight) / (numPoints – 1); var currentSpringRateNmm = currentNmm; // Use the currently calculated rate for (var i = 0; i < numPoints; i++) { var weight = minWeight + i * stepWeight; var riderForce = weight * g; var sagMm = riderForce / currentSpringRateNmm; dataSeries2.push(sagMm); // We'll use the same X-axis labels for simplicity but note the context change. } sagDepthChartInstance = new Chart(ctx, { type: 'line', data: { labels: labels, // Represents varying spring rates (N/mm) on X-axis datasets: [ { label: 'Sag Depth (mm) for current rider weight', data: dataSeries1, borderColor: 'rgb(0, 74, 153)', // Primary color backgroundColor: 'rgba(0, 74, 153, 0.2)', tension: 0.1, fill: false, yAxisID: 'y' // Primary Y-axis }, { label: 'Sag Depth (mm) if rider weight changes (fixed spring)', data: dataSeries2, // Data represents sag depth change with rider weight variation borderColor: 'rgb(40, 167, 69)', // Success color backgroundColor: 'rgba(40, 167, 69, 0.2)', tension: 0.1, fill: false, yAxisID: 'y' // Same primary Y-axis } ] }, options: { responsive: true, maintainAspectRatio: true, scales: { x: { title: { display: true, text: 'Spring Rate (N/mm) / Context: Rider Weight (kg)' } }, y: { title: { display: true, text: 'Sag Depth (mm)' }, beginAtZero: true } }, 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) + ' mm'; } // Add context for the second series if needed if (context.datasetIndex === 1 && context.dataIndex < labels.length) { label += ` (Rider Weight: ${minWeight + context.dataIndex * stepWeight.toFixed(1)} kg)`; } return label; } } } } } }); } else { // Optionally display a message or clear the canvas if inputs are invalid ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.font = "16px Arial"; ctx.fillStyle = "grey"; ctx.textAlign = "center"; ctx.fillText("Enter valid inputs above to generate the chart.", ctx.canvas.width / 2, ctx.canvas.height / 2); } } // Initial setup for table and chart on load if defaults are present document.addEventListener('DOMContentLoaded', function() { // Check if default values are set and trigger calculation if (document.getElementById('riderWeight').value && document.getElementById('shockTravel').value) { calculateSpringWeight(); } else { // Populate table and chart with default/placeholder data if inputs are empty populateSpringRateTable(0, 0); // Pass 0 to indicate no calculation yet updateSagDepthChart(0, 0); } });

Leave a Comment