Tyre Stretch Calculator

Tyre Stretch Calculator: Calculate Tyre Fitment & Visual Impact :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –card-background: #fff; –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; display: flex; flex-direction: column; align-items: center; } .container { width: 100%; max-width: 980px; background-color: var(–card-background); padding: 30px; border-radius: 10px; box-shadow: var(–shadow); margin-bottom: 30px; } h1, h2, h3 { color: var(–primary-color); text-align: center; } h1 { font-size: 2.2em; margin-bottom: 15px; } h2 { font-size: 1.8em; margin-top: 30px; margin-bottom: 20px; } h3 { font-size: 1.4em; margin-top: 25px; margin-bottom: 15px; } .calculator-wrapper { background-color: var(–card-background); padding: 30px; border-radius: 8px; box-shadow: var(–shadow); margin-bottom: 30px; display: flex; flex-direction: column; align-items: center; } .loan-calc-container { width: 100%; max-width: 600px; display: flex; flex-direction: column; gap: 20px; } .input-group { display: flex; flex-direction: column; margin-bottom: 15px; } .input-group label { font-weight: bold; margin-bottom: 8px; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px 15px; border: 1px solid var(–border-color); border-radius: 5px; font-size: 1em; transition: border-color 0.3s ease; width: calc(100% – 30px); /* Adjust for padding */ } .input-group input:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.2); } .input-group small { font-size: 0.85em; color: #6c757d; margin-top: 5px; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; min-height: 1.2em; /* Reserve space for error message */ } .results-container { margin-top: 30px; padding: 25px; border: 1px solid var(–border-color); border-radius: 8px; background-color: #eef5ff; text-align: center; width: 100%; box-sizing: border-box; } .results-container h3 { margin-top: 0; color: var(–primary-color); } .main-result { font-size: 2.5em; font-weight: bold; color: var(–success-color); margin: 15px 0; padding: 10px; background-color: #d4edda; border-radius: 5px; display: inline-block; } .intermediate-results { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: 20px; padding-top: 15px; border-top: 1px dashed var(–border-color); } .intermediate-results div { text-align: center; } .intermediate-results span { display: block; font-size: 1.2em; font-weight: bold; color: var(–primary-color); } .intermediate-results p { margin: 5px 0 0 0; font-size: 0.9em; color: #555; } .formula-explanation { margin-top: 25px; font-style: italic; color: #555; border-top: 1px dashed var(–border-color); padding-top: 15px; font-size: 0.95em; } .button-group { margin-top: 30px; display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; } 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; } .btn-primary { background-color: var(–primary-color); color: white; } .btn-primary:hover { background-color: #003366; transform: translateY(-2px); } .btn-secondary { background-color: #6c757d; color: white; } .btn-secondary:hover { background-color: #5a6268; transform: translateY(-2px); } .btn-success { background-color: var(–success-color); color: white; } .btn-success:hover { background-color: #218838; transform: translateY(-2px); } table { width: 100%; border-collapse: collapse; margin-top: 30px; box-shadow: var(–shadow); border-radius: 8px; overflow: hidden; /* Ensures rounded corners on cells */ } caption { font-size: 1.2em; font-weight: bold; color: var(–primary-color); margin-bottom: 15px; text-align: left; } th, td { padding: 12px 15px; text-align: left; border: 1px solid #dee2e6; } th { background-color: var(–primary-color); color: white; font-weight: bold; } tr:nth-child(even) { background-color: #f2f6fc; } tr:hover { background-color: #e9ecef; } .chart-container { margin-top: 30px; padding: 25px; border: 1px solid var(–border-color); border-radius: 8px; background-color: var(–card-background); box-shadow: var(–shadow); text-align: center; } .chart-container h3 { margin-top: 0; } canvas { max-width: 100%; height: auto; } .article-section { width: 100%; max-width: 980px; background-color: var(–card-background); padding: 30px; border-radius: 10px; box-shadow: var(–shadow); margin-top: 30px; margin-bottom: 30px; text-align: left; } .article-section h2, .article-section h3 { text-align: left; margin-top: 0; margin-bottom: 15px; } .article-section h2 { font-size: 2.0em; margin-bottom: 25px; } .article-section h3 { font-size: 1.6em; margin-bottom: 15px; } .article-section p { margin-bottom: 15px; } .article-section ul, .article-section ol { margin-left: 25px; margin-bottom: 15px; } .article-section li { margin-bottom: 8px; } .article-section .faq-question { font-weight: bold; color: var(–primary-color); margin-top: 20px; margin-bottom: 8px; display: block; } .article-section .faq-answer { margin-left: 0; margin-bottom: 0; } .internal-links-section ul { list-style: none; padding: 0; } .internal-links-section li { margin-bottom: 15px; border-bottom: 1px dashed var(–border-color); padding-bottom: 10px; } .internal-links-section li:last-child { border-bottom: none; padding-bottom: 0; } .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; } .variable-table td, .variable-table th { border: 1px solid #ddd; } .variable-table { width: 100%; margin-top: 15px; } .variable-table th { background-color: #e9ecef; color: var(–text-color); } @media (min-width: 768px) { .container, .calculator-wrapper, .article-section { padding: 40px; } h1 { font-size: 2.8em; } } @media (max-width: 480px) { button { width: 100%; } .button-group { flex-direction: column; } .intermediate-results { flex-direction: column; gap: 15px; } .intermediate-results div { padding-bottom: 10px; border-bottom: 1px dashed var(–border-color); } .intermediate-results div:last-child { border-bottom: none; padding-bottom: 0; } }

Tyre Stretch Calculator

Calculate the tyre stretch percentage and visualize the aesthetic impact of fitting a narrower tyre on a wider wheel rim.

The widest point of the tyre's sidewall in millimeters (mm).
The inner width of the wheel rim in inches (").
The aspect ratio of the tyre (e.g., 40 for a 205/40/R17 tyre).
The overall diameter of the tyre in inches (").

Results

— %
Tyre Stretch Percentage
— mm

Actual Tyre Width

— mm

Rim Width (mm)

— mm

Effective Rim Width

Formula Used:
Tyre Stretch % = ((Rim Width (mm) – Effective Rim Width (mm)) / Effective Rim Width (mm)) * 100
Note: Effective Rim Width is an approximation based on typical tyre bead seat designs.

Tyre Width vs. Rim Width

Tyre Stretch Compatibility Guide
Tyre Width (mm) Recommended Rim Width Range (inches) Stretch Percentage (Approx.)

What is Tyre Stretch?

Tyre stretch refers to the visual effect created when a tyre, designed for a wider wheel rim, is mounted onto a narrower rim. This causes the tyre's sidewalls to angle inwards, making the tyre appear "stretched" over the rim's edge. The degree of stretch is quantified as a percentage, indicating how much narrower the tyre is than what the rim typically accommodates.

This modification is a popular aesthetic choice in the automotive tuning and custom car scene, particularly among enthusiasts aiming for a more aggressive stance, increased wheel well clearance, or the ability to fit wider wheels under fender flares. However, it's crucial to understand that tyre stretch is not merely an aesthetic choice; it has significant implications for tyre safety, performance, and longevity.

Who should use it? Vehicle owners and enthusiasts who are modifying their car's appearance for a specific aesthetic, often aiming for a lower ride height, a flush fitment with the fenders, or a unique visual style. It's common in drift, stance, and show car communities.

Common Misconceptions:

  • It's always unsafe: While excessive stretch can be dangerous, moderate stretch within recommended ranges can be safe if done correctly.
  • It improves handling: Mild stretch might offer a firmer sidewall feel, but aggressive stretching can negatively impact grip and tyre wear.
  • Any tyre fits any rim: This is false. Tyres and rims have specific compatibility ranges. Exceeding these can lead to dangerous situations.

Tyre Stretch Formula and Mathematical Explanation

Calculating tyre stretch involves understanding the relationship between the tyre's nominal width and the wheel rim's width. The core idea is to compare the actual width the tyre *should* be on a compatible rim versus the width it is forced to adopt on a narrower rim.

The Core Calculation

The tyre stretch percentage is calculated by first determining the effective rim width that the tyre will conform to, and then comparing this to the actual width of the tyre.

Formula:

Tyre Stretch % = ((Rim Width (mm) - Effective Rim Width (mm)) / Effective Rim Width (mm)) * 100

Variable Explanations:

To implement this, we need to understand the key measurements:

  • Tyre Section Width: This is the nominal maximum width of the tyre's sidewall when measured in millimeters (mm). It's the first number in a tyre size, like '205' in 205/40R17.
  • Wheel Rim Width: This is the specified inner width of the wheel rim, typically measured in inches ("). For example, an 8.5-inch rim.
  • Effective Rim Width (ERW): This is a crucial intermediate value. It's an estimated width that the tyre bead will seat on the rim. It's generally narrower than the rim's overall width and is often approximated. For simplicity in many calculators, it's often taken as a percentage of the rim width, or a direct conversion if the rim width is given in mm. A common approximation converts rim width in inches to mm and then takes a percentage (e.g., 85-90%) or a fixed value. For this calculator, we approximate it by converting the rim width from inches to millimeters (1 inch = 25.4 mm) and then applying a typical reduction factor.
  • Rim Width (mm): The wheel rim width converted from inches to millimeters for consistent units. Rim Width (mm) = Wheel Rim Width (inches) * 25.4

Variable Table:

Variable Meaning Unit Typical Range
Tyre Section Width Nominal maximum width of the tyre sidewall. mm 155 – 325+
Wheel Rim Width Inner width of the wheel rim. inches (") 6.0 – 12.0+
Tyre Sidewall Height (Aspect Ratio) Percentage of tyre section width representing sidewall height. % 20 – 70+
Tyre Diameter Overall diameter of the tyre. inches (") 14 – 24+
Rim Width (mm) Wheel Rim Width converted to millimeters. mm 152.4 – 304.8+
Effective Rim Width (ERW) The approximate seating width on the rim where the tyre bead sits. mm 130 – 270+ (derived)
Tyre Stretch % The calculated percentage of stretch. % 0% – 15%+ (practical limit)

*Note: The inclusion of Tyre Sidewall Height and Tyre Diameter in the input is primarily to provide context and allow for potential future enhancements, such as calculating overall tyre diameter changes. They do not directly factor into the basic stretch percentage calculation itself, which relies on widths.*

Practical Examples (Real-World Use Cases)

Example 1: Moderate Stretch for Stance

An enthusiast wants to achieve a slightly stretched look on their performance car. They have 8.5-inch wide rims and are considering fitting 215mm wide tyres (with a 40 aspect ratio and 17-inch diameter). They want to know the stretch percentage.

Inputs:

  • Tyre Section Width: 215 mm
  • Wheel Rim Width: 8.5 inches
  • Tyre Sidewall Height: 40
  • Tyre Diameter: 17 inches

Calculation Breakdown:

  • Rim Width (mm) = 8.5 * 25.4 = 215.9 mm
  • Effective Rim Width (ERW) ≈ 215.9 mm * 0.85 = 183.5 mm (using a 85% approximation)
  • Tyre Stretch % = ((215.9 – 183.5) / 183.5) * 100 = (32.4 / 183.5) * 100 ≈ 17.7%

Results:

  • Actual Tyre Width: 215 mm
  • Rim Width (mm): 215.9 mm
  • Effective Rim Width: ~183.5 mm
  • Tyre Stretch Percentage: 17.7%

Interpretation: This results in a significant stretch. While visually appealing to some, 17.7% is pushing the boundaries of safe fitment for many tyre manufacturers. This setup might be challenging to mount and could compromise sidewall protection and grip.

Example 2: Mild Stretch for Flush Fitment

Another owner wants a subtle, flush look without compromising safety. They are using 7.5-inch rims and want to fit 215mm wide tyres (with a 45 aspect ratio and 16-inch diameter).

Inputs:

  • Tyre Section Width: 215 mm
  • Wheel Rim Width: 7.5 inches
  • Tyre Sidewall Height: 45
  • Tyre Diameter: 16 inches

Calculation Breakdown:

  • Rim Width (mm) = 7.5 * 25.4 = 190.5 mm
  • Effective Rim Width (ERW) ≈ 190.5 mm * 0.88 = 167.6 mm (using a 88% approximation)
  • Tyre Stretch % = ((190.5 – 167.6) / 167.6) * 100 = (22.9 / 167.6) * 100 ≈ 13.7%

Results:

  • Actual Tyre Width: 215 mm
  • Rim Width (mm): 190.5 mm
  • Effective Rim Width: ~167.6 mm
  • Tyre Stretch Percentage: 13.7%

Interpretation: A 13.7% stretch is considered moderate. This provides a noticeable flush appearance with the fenders while staying within a range that most tyre professionals would consider manageable for mounting and generally safe, although still requiring careful consideration of tyre bead protection.

How to Use This Tyre Stretch Calculator

Our Tyre Stretch Calculator is designed for simplicity and accuracy, helping you visualize the aesthetic outcome of fitting a specific tyre onto a specific wheel rim. Follow these steps to get your results:

  1. Enter Tyre Section Width: Input the nominal width of your tyre in millimeters (mm). This is the first number in your tyre's size designation (e.g., '205' in 205/50R16).
  2. Enter Wheel Rim Width: Input the inner width of your wheel rim in inches ("). This is often stamped on the back of the wheel, or found in its specifications (e.g., '7.5' for a 7.5Jx17 rim).
  3. Enter Tyre Sidewall Height (Aspect Ratio): Input the aspect ratio of your tyre (e.g., '40' for a 215/40ZR18 tyre). While not directly used in the primary stretch calculation, it provides context and is essential for other tyre-related calculations.
  4. Enter Tyre Diameter: Input the overall diameter of the tyre in inches ("). Similar to the aspect ratio, this is for contextual completeness and future calculator expansion.
  5. Click 'Calculate': Once all fields are populated, click the "Calculate" button. The calculator will instantly process your inputs.

How to Read Results:

  • Main Result (Tyre Stretch Percentage): This large, prominent number shows the calculated stretch percentage. 0% means the tyre fits perfectly on the rim. Higher percentages indicate a greater degree of stretch. Generally, >10% is considered noticeable stretch, and >15% is aggressive.
  • Actual Tyre Width: Displays the tyre's nominal width (from your input).
  • Rim Width (mm): Shows your wheel rim's width converted to millimeters for easy comparison.
  • Effective Rim Width: This is an estimated value representing where the tyre bead will seat. It's crucial for the stretch calculation.
  • Compatibility Table: This table provides general guidelines for recommended rim widths for common tyre sizes. Compare your calculated stretch to these ranges.
  • Chart: Visualizes the relationship between the tyre width and the rim width, offering another perspective on the fitment.

Decision-Making Guidance:

Use the calculated stretch percentage as a key factor in your decision-making.

  • Below 5% Stretch: Typically considered a perfect or very snug fit with no visible stretch.
  • 5% – 10% Stretch: Mild stretch, offering a slightly flatter sidewall profile and a subtle flush look. Usually safe.
  • 10% – 15% Stretch: Moderate stretch, providing a more pronounced flush fitment. Requires careful tyre mounting and consideration for sidewall protection.
  • Above 15% Stretch: Aggressive stretch. This is where safety concerns significantly increase. Sidewall protection is minimal, bead seating can be difficult, and risks of tyre failure or unseating are higher. Always consult with experienced professionals.

Important Note: Always consult the tyre manufacturer's specifications for recommended rim width ranges for your specific tyre model. This calculator provides an estimate, and professional installation is highly recommended for stretched tyre setups.

Key Factors That Affect Tyre Stretch Results

While the tyre stretch calculator provides a numerical output, several real-world factors influence the actual outcome and safety of a stretched tyre setup. Understanding these is crucial for making informed decisions.

  • Tyre Construction and Sidewall Stiffness: Different tyre manufacturers and models have varying constructions. Some tyres are designed with stiffer, more reinforced sidewalls that resist deformation better, meaning they might achieve less visible stretch than a softer-walled tyre of the same size. The aspect ratio also plays a role; lower profile tyres (smaller aspect ratio) tend to be stiffer.
  • Wheel Rim Design (Lip vs. Barrel): The exact profile and curvature of the wheel rim's lip and bead seat area can affect how the tyre seats. Some rims have a more pronounced lip that might appear to exaggerate the stretch, while others offer a smoother transition. The calculator uses a generalized ERW; actual fitment can vary.
  • Tyre Pressure: Incorrect tyre pressure significantly impacts a stretched setup. Underinflation can lead to the tyre rolling off the rim or sidewall damage, especially with stretch. Overinflation can make the ride harsh and increase stress on the tyre bead. Maintaining recommended pressures is critical.
  • Driving Style and Conditions: Aggressive driving, such as hard cornering, braking, or impacts from potholes, puts immense stress on the tyre bead and sidewall. A stretched setup is inherently less protective against impacts, increasing the risk of damage (e.g., sidewall bubbles, rim damage, or even tyre unseating) compared to a correctly sized tyre.
  • Mounting Technique and Equipment: Fitting a stretched tyre requires specialized knowledge and equipment. Improper mounting can damage the tyre bead, leading to leaks or failure. Professional tyre shops experienced with stretched fitments are essential. The 'Effective Rim Width' is an approximation; the actual seating point can be influenced by the mounting process.
  • Regulatory and Insurance Implications: In many regions, modifying vehicle tyre fitment beyond manufacturer recommendations can have legal consequences. It may affect roadworthiness inspections and potentially invalidate your vehicle insurance policy in case of an accident related to the modification.

Frequently Asked Questions (FAQ)

What is the ideal tyre stretch percentage?

There isn't one single "ideal" percentage, as it depends on aesthetics and safety tolerance. Generally, mild stretch (up to 5-7%) is visually subtle and considered safe by most. Moderate stretch (8-12%) offers a noticeable effect but requires more caution. Aggressive stretch (above 15%) is purely for show and carries significant safety risks. Always prioritize tyre manufacturer recommendations.

Can I use a tyre stretch calculator for wider tyres on wider rims?

No, this calculator specifically measures the effect of fitting a *narrower* tyre onto a *wider* rim than recommended. Fitting a wider tyre on a wider rim generally results in a "square" or "bulged" fitment, not stretch.

Does tyre stretch affect handling?

Yes, it can. A stretched sidewall is often stiffer and less compliant, which might feel more direct during cornering. However, it also reduces the tyre's contact patch size and shape under load, potentially decreasing overall grip and traction, especially in wet conditions. It also offers less protection against impacts.

What are the risks of running too much tyre stretch?

The primary risks include: damage to the tyre bead during mounting, difficulty in achieving a proper bead seal leading to slow leaks, increased susceptibility to tyre sidewall damage from impacts (curbs, potholes), reduced protection for the wheel rim, and a higher risk of the tyre unseating from the rim, especially under cornering loads or with underinflation.

How does aspect ratio (sidewall height) affect stretch?

While the aspect ratio (e.g., 40 in 205/40R17) doesn't directly factor into the stretch *percentage* calculation (which is based on width), lower aspect ratio tyres generally have stiffer sidewalls. This can influence how visibly "stretched" a tyre appears and its resistance to deformation. A low profile tyre on a narrow rim might look more stretched than a high profile tyre on the same rim.

Can I use this calculator to check if my current tyre/wheel setup is stretched?

Yes, if you know your tyre's section width (in mm) and your wheel's rim width (in inches), you can input these values to see the resulting stretch percentage and compare it against general guidelines.

What does "Effective Rim Width" mean in the calculation?

The Effective Rim Width (ERW) is an estimated measurement of the actual seating area on the rim where the tyre bead makes contact and seals. It's typically narrower than the rim's overall specified width because of the rim's lip design. The calculator uses an approximation for ERW, as the precise value can vary slightly between rim designs.

Is tyre stretch legal?

Legality varies significantly by region and country. In some places, tyre modifications must conform to strict standards to pass roadworthiness tests. In others, it may be overlooked unless it causes a safety issue. It's essential to research local regulations and be aware that extreme stretch can lead to issues with vehicle inspections and insurance.

© 2023 YourCarExpert. All rights reserved.

var tyreWidthInput = document.getElementById('tyreWidth'); var rimWidthInput = document.getElementById('rimWidth'); var tyreSidewallHeightInput = document.getElementById('tyreSidewallHeight'); var tyreDiameterInput = document.getElementById('tyreDiameter'); var tyreWidthError = document.getElementById('tyreWidthError'); var rimWidthError = document.getElementById('rimWidthError'); var tyreSidewallHeightError = document.getElementById('tyreSidewallHeightError'); var tyreDiameterError = document.getElementById('tyreDiameterError'); var mainResultDisplay = document.getElementById('mainResult'); var actualTyreWidthDisplay = document.getElementById('actualTyreWidth'); var rimWidthMmDisplay = document.getElementById('rimWidthInMm'); var effectiveRimWidthDisplay = document.getElementById('effectiveRimWidth'); var compatibilityTableBody = document.getElementById('compatibilityTableBody'); var chart; var chartInstance = null; function isValidNumber(value) { return value !== null && value !== " && !isNaN(parseFloat(value)) && isFinite(value); } function formatNumber(num, precision = 2) { if (!isValidNumber(num)) return '–'; return num.toFixed(precision); } function calculateStretch() { var tyreWidth = parseFloat(tyreWidthInput.value); var rimWidthInches = parseFloat(rimWidthInput.value); var tyreSidewallHeight = parseFloat(tyreSidewallHeightInput.value); var tyreDiameter = parseFloat(tyreDiameterInput.value); // Clear previous errors tyreWidthError.textContent = "; rimWidthError.textContent = "; tyreSidewallHeightError.textContent = "; tyreDiameterError.textContent = "; var stretchPercentage = null; var actualTyreWidthMm = '–'; var rimWidthMm = '–'; var effectiveRimWidthMm = '–'; var isValid = true; if (!isValidNumber(tyreWidth) || tyreWidth <= 0) { tyreWidthError.textContent = 'Please enter a valid tyre width (e.g., 205).'; isValid = false; } if (!isValidNumber(rimWidthInches) || rimWidthInches <= 0) { rimWidthError.textContent = 'Please enter a valid rim width (e.g., 8.5).'; isValid = false; } // Sidewall height and diameter are for context, but check if they are numbers if entered if (isValidNumber(tyreSidewallHeightInput.value) && (tyreSidewallHeight 100)) { tyreSidewallHeightError.textContent = 'Aspect ratio should typically be between 20 and 70.'; // Not strictly invalidating calculation but good to warn } if (isValidNumber(tyreDiameterInput.value) && (tyreDiameter 30)) { tyreDiameterError.textContent = 'Tyre diameter is usually between 14 and 24 inches.'; // Not strictly invalidating calculation but good to warn } if (isValid) { actualTyreWidthMm = tyreWidth; rimWidthMm = rimWidthInches * 25.4; // Approximate Effective Rim Width (ERW) // This is a simplification. Real ERW depends on rim design. // A common rule of thumb is ERW is about 85-90% of rim width in mm for performance/stance applications. // Let's use a slightly more dynamic approach: var rimWidthForErw = rimWidthMm; var minRimWidthForStretch = tyreWidth * 0.7; // Very rough baseline var maxRimWidthForStretch = tyreWidth * 1.1; // Very rough baseline var calculatedErw; if (rimWidthInches >= 7.0 && rimWidthInches <= 10.0) { calculatedErw = rimWidthMm * 0.87; // Common factor for typical widths } else if (rimWidthInches 0) { // Check if tyre width is less than effective rim width for stretch calculation if (tyreWidth = 7.0 && rimWidthInches <= 10.0) { calculatedErw = rimWidthMm * 0.87; } else if (rimWidthInches = 7.0 && midRim <= 10.0) { calculatedErw = rimWidthMm * 0.87; } else if (midRim 0 && tyre.width >= calculatedErw) { stretch = ((tyre.width – calculatedErw) / calculatedErw) * 100; } else if (calculatedErw > 0 && tyre.width < calculatedErw) { stretch = 0; // Tyre wider than ERW, no stretch } var row = document.createElement('tr'); row.innerHTML = '' + tyre.width + ' mm' + '' + rimRange + '" (' + formatNumber(minRim*25.4, 1) + '-' + formatNumber(maxRim*25.4, 1) + ' mm)' + '' + formatNumber(stretch, 1) + '%'; compatibilityTableBody.appendChild(row); } }); }); } // Initial calculation on page load window.onload = function() { calculateStretch(); // Ensure Chart.js is loaded before calling updateChart if (typeof Chart !== 'undefined') { updateChart(parseFloat(tyreWidthInput.value), parseFloat(rimWidthInput.value), 0); } else { // If Chart.js is not loaded, add a placeholder or message console.warn("Chart.js not loaded. Chart will not be displayed."); } }; // Dynamically load Chart.js if not present if (typeof Chart === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js@3.0.0/dist/chart.min.js'; // Use a specific version if needed script.onload = function() { console.log('Chart.js loaded successfully.'); // Re-run calculation and chart update after loading calculateStretch(); updateChart(parseFloat(tyreWidthInput.value), parseFloat(rimWidthInput.value), 0); }; script.onerror = function() { console.error('Failed to load Chart.js. Chart functionality will be limited.'); }; document.head.appendChild(script); }

Leave a Comment