Tire Wheel Calculator

Tire and Wheel Size Calculator: Ensure Perfect Fit :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-radius: 5px; –shadow: 0 2px 4px 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: 0; display: flex; flex-direction: column; min-height: 100vh; } .container { max-width: 1200px; margin: 20px auto; padding: 20px; background-color: #fff; border-radius: var(–border-radius); box-shadow: var(–shadow); display: grid; grid-template-columns: 1fr; gap: 30px; } @media (min-width: 992px) { .container { grid-template-columns: 1fr 1fr; } } header { background-color: var(–primary-color); color: #fff; padding: 20px 0; text-align: center; margin-bottom: 20px; box-shadow: var(–shadow); } header h1 { margin: 0; font-size: 2.2em; } .calculator-section, .article-section { padding: 25px; background-color: #fff; border-radius: var(–border-radius); box-shadow: var(–shadow); } .loan-calc-container { display: grid; gap: 15px; } .input-group { display: flex; flex-direction: column; gap: 8px; } .input-group label { font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px 15px; border: 1px solid #ccc; border-radius: var(–border-radius); 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 { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 2px rgba(0, 74, 153, 0.2); } .input-group select { appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,'); background-repeat: no-repeat; background-position: right 15px top 50%; background-size: 14px 8px; } .input-group small { color: #6c757d; font-size: 0.85em; } .error-message { color: #dc3545; font-size: 0.8em; margin-top: 5px; display: none; /* Hidden by default */ } .error-message.visible { display: block; } .button-group { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; } button { padding: 12px 20px; border: none; border-radius: var(–border-radius); cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; color: #fff; background-color: var(–primary-color); } button:hover { background-color: #003366; transform: translateY(-1px); } button.secondary { background-color: #6c757d; } button.secondary:hover { background-color: #5a6268; } button.success { background-color: var(–success-color); } button.success:hover { background-color: #218838; } .results-container { margin-top: 25px; padding: 20px; border: 1px solid #eee; border-radius: var(–border-radius); background-color: var(–background-color); } #result { font-size: 1.8em; font-weight: bold; color: var(–primary-color); text-align: center; margin-bottom: 15px; padding: 15px; background-color: #e7f3ff; border-radius: var(–border-radius); border: 1px solid #cce5ff; } .intermediate-results div { margin-bottom: 10px; display: flex; justify-content: space-between; font-size: 0.95em; padding: 8px 0; border-bottom: 1px dashed #ddd; } .intermediate-results div:last-child { border-bottom: none; } .intermediate-results span:first-child { font-weight: bold; color: #555; } .intermediate-results span:last-child { color: var(–primary-color); font-weight: bold; } .formula-explanation { margin-top: 20px; font-size: 0.9em; color: #6c757d; padding: 10px; background-color: #f0f5fa; border-left: 3px solid var(–primary-color); } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: var(–shadow); } th, td { padding: 12px 15px; text-align: left; border: 1px solid #ddd; } thead { background-color: var(–primary-color); color: #fff; } tbody tr:nth-child(even) { background-color: #f2f2f2; } caption { font-size: 1.1em; font-weight: bold; margin-bottom: 10px; color: var(–primary-color); text-align: left; } canvas { max-width: 100%; margin-top: 20px; background-color: #fff; border-radius: var(–border-radius); box-shadow: var(–shadow); } .article-section h2, .article-section h3 { color: var(–primary-color); margin-top: 30px; margin-bottom: 15px; } .article-section h2 { font-size: 1.8em; border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; } .article-section h3 { font-size: 1.4em; margin-top: 25px; } .article-section p { margin-bottom: 15px; } .article-section ul { margin-left: 20px; margin-bottom: 15px; } .article-section li { margin-bottom: 8px; } .article-section .variable-table { margin-top: 20px; margin-bottom: 20px; border-collapse: collapse; width: 100%; box-shadow: var(–shadow); } .article-section .variable-table th, .article-section .variable-table td { padding: 10px; border: 1px solid #ccc; text-align: left; } .article-section .variable-table th { background-color: var(–primary-color); color: white; } .article-section .variable-table tr:nth-child(even) { background-color: #f9f9f9; } .article-section .faq-item { margin-bottom: 15px; border-left: 3px solid var(–primary-color); padding-left: 10px; } .article-section .faq-item strong { display: block; color: var(–primary-color); margin-bottom: 5px; font-size: 1.1em; } .internal-links { margin-top: 30px; padding: 15px; background-color: #e7f3ff; border-radius: var(–border-radius); border: 1px solid #cce5ff; } .internal-links h3 { margin-top: 0; color: var(–primary-color); font-size: 1.3em; } .internal-links ul { list-style: none; padding: 0; margin: 0; } .internal-links li { margin-bottom: 10px; } .internal-links a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links a:hover { text-decoration: underline; } .internal-links p { font-size: 0.9em; color: #555; margin-top: 5px; } footer { text-align: center; padding: 20px; margin-top: auto; background-color: var(–primary-color); color: #fff; font-size: 0.9em; box-shadow: 0 -2px 4px rgba(0,0,0,0.1); } footer a { color: #fff; text-decoration: underline; }

Tire and Wheel Size Calculator

Calculate Tire & Wheel Fitment

Input your current tire and wheel specifications to compare them with potential new sizes and see the physical differences.

The overall diameter of your current tire.
The diameter of your current wheel rim.
The overall diameter of the proposed new tire.
The diameter of the proposed new wheel rim.
Your vehicle's approximate curb weight.
Standard Lowered Lifted Indicates clearance availability.
Diameter Difference
Radius Difference
Clearance Impact
Speedometer Error
Calculation Logic:

Diameter Difference = New Tire Diameter – Current Tire Diameter
Radius Difference = (New Tire Diameter / 2) – (Current Tire Diameter / 2)
Speedometer Error (%) = ((New Tire Diameter / Current Tire Diameter) – 1) * 100

Clearance Impact is assessed based on the magnitude of the Diameter Difference and the Suspension Type.

Tire Diameter Comparison
Tire & Wheel Specification Comparison
Metric Current New
Tire Diameter (in)
Wheel Diameter (in)
Radius (in)

Understanding Tire and Wheel Size

What is a Tire and Wheel Size Calculator?

A tire and wheel size calculator is a vital digital tool designed to help vehicle owners and enthusiasts determine the compatibility and impact of changing their vehicle's tire and wheel specifications. It allows users to input their current tire and wheel dimensions and compare them against proposed new sizes. The primary goal is to ensure that new tires and wheels will fit correctly without causing interference (rubbing) with the vehicle's body, suspension, or brakes, while also assessing how the change might affect critical functions like the speedometer and odometer readings. This tire and wheel size calculator takes the guesswork out of selecting aftermarket wheels and tires, preventing costly mistakes and ensuring optimal vehicle performance and safety.

This tool is indispensable for anyone considering:

  • Upgrading to larger or smaller wheels.
  • Changing tire profiles for aesthetic or performance reasons.
  • Fitting off-road tires for SUVs and trucks.
  • Optimizing a vehicle for track use or specific driving conditions.
  • Ensuring proper fitment after suspension modifications (lifting or lowering).

A common misconception is that simply matching wheel diameter is enough. However, the overall diameter of the tire-and-wheel combination is what truly matters for fitment and speedometer accuracy. Our tire and wheel size calculator addresses this by focusing on the total tire diameter and its implications.

Tire and Wheel Size Formula and Mathematical Explanation

The core calculations performed by a tire and wheel size calculator revolve around geometric principles and their application to vehicle dynamics. The most critical aspect is understanding the overall diameter of the tire, which includes the rim diameter and the tire's sidewall height.

Key Dimensions and Formulas:

  1. Tire Sidewall Height: This is not directly inputted but is derived from tire size codes (e.g., 225/45R17). The '45' represents the aspect ratio (sidewall height as a percentage of tire width). However, for simplicity in this calculator, we use the overall tire diameter.
  2. Overall Tire Diameter: This is the most crucial measurement. It's the distance from the bottom of the tire tread to the top. The calculator uses direct input for this.
  3. Tire Radius: Calculated as Overall Tire Diameter / 2.
  4. Difference Calculations: The calculator compares the new tire diameter and radius to the current ones.
  5. Speedometer Error: This is a percentage difference calculated based on the ratio of the new tire diameter to the old one.

Detailed Formulas Used:

  • Diameter Difference = New Tire Diameter – Current Tire Diameter
  • Radius Difference = (New Tire Diameter / 2) – (Current Tire Diameter / 2)
  • Speedometer Error (%) = ((New Tire Diameter / Current Tire Diameter) – 1) * 100

The tire and wheel size calculator uses these fundamental formulas to provide insights into potential fitment issues and functional changes.

Tire & Wheel Calculator Variables Table

Variable Name Meaning Unit Typical Range
Current Tire Diameter Overall diameter of the existing tire. Inches 15 – 35+
Current Wheel Diameter Diameter of the existing wheel rim. Inches 13 – 26+
New Tire Diameter Overall diameter of the proposed new tire. Inches 15 – 35+
New Wheel Diameter Diameter of the proposed new wheel rim. Inches 13 – 26+
Vehicle Weight The curb weight of the vehicle. Crucial for assessing stress on components. Pounds (lbs) 2000 – 8000+
Suspension Type Modification status of the vehicle's suspension affecting clearance. Category Standard, Lowered, Lifted
Diameter Difference Absolute change in tire diameter. Inches Negative to Positive
Radius Difference Change in distance from wheel center to tire tread top. Inches Negative to Positive
Speedometer Error Percentage deviation of displayed speed from actual speed. % -10% to +10% (typically)

Practical Examples (Real-World Use Cases)

Let's illustrate how the tire and wheel size calculator works with practical scenarios:

Example 1: Upgrading Wheels for a Sport Sedan

Scenario: A car owner has a sedan with stock 225/45R17 tires on 17-inch wheels. They want to upgrade to a sportier look with 235/40R18 tires on 18-inch wheels. The vehicle weight is approximately 3600 lbs, and the suspension is standard.

Input Values:

  • Current Tire Diameter: 25.9 inches (approximated from 225/45R17)
  • Current Wheel Diameter: 17 inches
  • New Tire Diameter: 26.4 inches (approximated from 235/40R18)
  • New Wheel Diameter: 18 inches
  • Vehicle Weight: 3600 lbs
  • Suspension Type: Standard

Calculator Output:

  • Diameter Difference: +0.5 inches
  • Radius Difference: +0.25 inches
  • Clearance Impact: Minor increase in ride height, likely fits without rubbing on standard suspension. Check fender liner.
  • Speedometer Error: +1.93% (The speedometer will read lower than actual speed)

Financial Interpretation: This is a relatively safe upgrade. The overall diameter increase is minimal. The speedometer error means that when the speedometer shows 60 mph, the car is actually traveling at approximately 61.15 mph (60 * 1.0193). This slight inaccuracy needs to be accounted for, especially regarding speed limits. The cost of new tires and wheels is a significant upfront investment, but the calculator confirms the physical feasibility.

Example 2: Off-Road Upgrade for a Jeep Wrangler

Scenario: An owner of a Jeep Wrangler with stock 255/70R18 tires on 18-inch wheels wants to fit larger, more aggressive off-road tires. They are considering 33-inch tires on 17-inch wheels. The vehicle weighs around 4500 lbs, and the suspension is slightly lifted (+2 inches).

Input Values:

  • Current Tire Diameter: Approximately 32.1 inches (from 255/70R18)
  • Current Wheel Diameter: 18 inches
  • New Tire Diameter: 33 inches
  • New Wheel Diameter: 17 inches
  • Vehicle Weight: 4500 lbs
  • Suspension Type: Lifted

Calculator Output:

  • Diameter Difference: +0.9 inches
  • Radius Difference: +0.45 inches
  • Clearance Impact: Noticeable increase in ride height, should fit well with the existing lift. Minimal risk of rubbing, but advise checking at full suspension articulation.
  • Speedometer Error: +2.80% (Speedometer will read lower than actual speed)

Financial Interpretation: This upgrade involves a significant increase in tire diameter, which is desirable for off-roading. The calculator shows it's feasible, especially with the lift. The speedometer error increases, requiring more careful speed monitoring. The investment in 33-inch tires and potentially new 17-inch wheels (if not reusing) is substantial. This tire and wheel size calculator confirms the physical viability, allowing the owner to proceed with confidence after considering the financial outlay and the need for potential recalibration of the speedometer if precision is paramount.

How to Use This Tire and Wheel Size Calculator

Using our tire and wheel size calculator is straightforward. Follow these steps to get accurate results and make informed decisions about your vehicle's wheel and tire setup:

  1. Identify Current Specifications: Find the diameter of your current tires (often found on the tire sidewall or in your owner's manual) and the diameter of your current wheel rims.
  2. Determine New Specifications: Decide on the diameter of the new tires you intend to purchase and the diameter of the new wheel rims you plan to use.
  3. Input Data: Enter the identified current tire diameter, current wheel diameter, new tire diameter, and new wheel diameter into the respective fields in the calculator.
  4. Enter Vehicle Weight: Input your vehicle's approximate curb weight. This helps contextualize the size change relative to the vehicle's mass.
  5. Select Suspension Type: Choose the appropriate suspension type (Standard, Lowered, or Lifted) as this directly influences available clearance.
  6. Click 'Calculate Fitment': Press the button to see the results.

Interpreting the Results:

  • Diameter Difference: A positive number means the new tire is larger overall; a negative number means it's smaller. Significant positive differences increase the risk of rubbing.
  • Radius Difference: Indicates how much higher or lower the vehicle's body will sit relative to the ground.
  • Clearance Impact: This is a qualitative assessment. A small difference on a standard suspension is usually fine. Large differences, especially on lowered vehicles, are problematic. Lifted vehicles generally accommodate larger tires more easily. Always perform visual checks and consider potential rubbing at full lock or suspension compression.
  • Speedometer Error: A positive percentage means your speedometer will read slower than your actual speed (e.g., +5% error means when you're going 60 mph, your speedometer shows ~57 mph). A negative percentage means it reads faster. This is crucial for legal compliance and accurate distance tracking.

Decision-Making Guidance: Use the results to determine if a tire/wheel combination is physically compatible. If the diameter difference is large and the suspension is standard or lowered, rubbing is likely. If the speedometer error is significant (beyond +/- 3-5%), consider if it's acceptable or if you'll need to have your speedometer recalibrated. This tire and wheel size calculator is a preliminary assessment tool; always double-check manufacturer recommendations and consider a professional opinion for critical applications.

Key Factors That Affect Tire and Wheel Fitment Results

While our tire and wheel size calculator provides essential data, several other factors influence the actual fitment and performance of new tires and wheels:

  1. Tire Width and Offset: The calculator primarily uses diameter. However, tire width and the wheel's offset (how the wheel mounts to the hub) significantly impact whether the tire will rub the fender, suspension components (like control arms or struts), or brakes. A wider tire or incorrect offset can cause rubbing even if the diameter is suitable.
  2. Actual Tire Dimensions: Tire manufacturers' stated diameters are often nominal. The actual measured diameter can vary slightly based on tire construction, load, and inflation pressure. Always check real-world measurements if precision is critical.
  3. Suspension Condition and Geometry: Worn suspension components can allow for more movement, increasing the chance of rubbing. Furthermore, the specific angles of your suspension arms (camber, caster) can affect clearance.
  4. Brake Clearance: Larger brake systems, especially performance upgrades, require sufficient clearance from the inner spokes of the wheel. Our calculator doesn't directly account for this, so visual inspection or checking wheel specifications against brake caliper dimensions is necessary.
  5. Fender Liners and Trim: Even if the tire clears the metal bodywork, it might rub against plastic fender liners or other trim pieces, especially during turns or suspension travel. Modifications might be needed.
  6. Tire Tread Pattern: Aggressive off-road tires with chunky treads can sometimes measure wider than their nominal width, potentially impacting clearance differently than a street tire of the same stated size.
  7. Load Rating: Ensure the new tires and wheels have an appropriate load rating for your vehicle's weight. Overloading can lead to tire failure and unsafe driving conditions.
  8. Intended Use: For performance driving or off-roading, slight speedometer errors might be less critical than maximizing grip or ground clearance. For daily commuting, accuracy and minimizing rubbing are usually higher priorities.

Frequently Asked Questions (FAQ)

Q1: What is the most important number when using a tire and wheel size calculator?

A: The overall Tire Diameter is the most critical measurement. It determines ground clearance, affects speedometer readings, and is the primary factor in whether the tire will physically fit without rubbing.

Q2: Can I change my wheel diameter without changing my tire diameter?

A: Yes, but it requires adjusting the tire's aspect ratio (sidewall height). For instance, going from a 17-inch wheel with a 225/45R17 tire to an 18-inch wheel often involves a tire like a 235/40R18. The tire and wheel size calculator helps compare the overall diameter impact of such changes.

Q3: How much speedometer error is acceptable?

A: Most regulatory bodies consider errors up to 5-7% acceptable. However, exceeding this range can lead to significant inaccuracies. Many drivers aim for less than a 3% error for better accuracy. Our tire and wheel size calculator highlights any deviation.

Q4: My new tires rub when I turn. What should I do?

A: This usually means the tires are too wide, have too much offset, or the overall diameter is too large for your current setup. You may need to reduce tire size, adjust wheel offset, consider fender liner modifications, or seek professional advice on suspension adjustments. A tire and wheel size calculator is a starting point, not a final solution for all fitment nuances.

Q5: Does a lifted or lowered suspension affect tire fitment?

A: Absolutely. A lifted suspension provides more clearance, allowing for larger diameter tires. A lowered suspension reduces clearance, making it easier for tires to rub, and typically requires smaller or lower-profile tires. The calculator's suspension type input helps gauge this.

Q6: How does vehicle weight factor into tire and wheel selection?

A: Heavier vehicles put more stress on tires and wheels. Ensure your chosen components have adequate load ratings. While the calculator uses weight mainly for context, it's a critical safety consideration for purchasing.

Q7: Can I use the calculator to check if my spare tire fits?

A: Yes, you can input your spare tire's dimensions (if known) as the 'New Tire Diameter' and your regular tire dimensions as 'Current' to see the difference and potential speedometer/odometer issues.

Q8: What is the difference between tire diameter and wheel diameter?

A: Wheel diameter refers only to the metal rim. Tire diameter is the total height of the rubber tire when mounted on the wheel. The tire and wheel size calculator focuses on the combined effect, primarily the overall tire diameter.

function getElement(id) { return document.getElementById(id); } function setErrorMessage(inputId, message) { var errorElement = document.getElementById(inputId + 'Error'); if (message) { errorElement.innerText = message; errorElement.classList.add('visible'); } else { errorElement.innerText = "; errorElement.classList.remove('visible'); } } function isValidNumber(value, min, max) { if (isNaN(parseFloat(value)) || !isFinite(value)) { return { valid: false, message: "Please enter a valid number." }; } if (value <= 0) { return { valid: false, message: "Value must be positive." }; } if (min !== undefined && value max) { return { valid: false, message: "Value must be no more than " + max + "." }; } return { valid: true }; } var diameterChartInstance = null; function drawChart(currentDiameter, newDiameter) { var canvas = getElement('diameterChart'); var ctx = canvas.getContext('2d'); if (diameterChartInstance) { diameterChartInstance.destroy(); } var labels = ['Current Tire Diameter', 'New Tire Diameter']; var data = [currentDiameter, newDiameter]; var colors = ['#004a99', '#28a745']; diameterChartInstance = new Chart(ctx, { type: 'bar', data: { labels: labels, datasets: [{ label: 'Tire Diameter (inches)', data: data, backgroundColor: colors, borderColor: colors, borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, title: { display: true, text: 'Diameter (inches)' } } }, plugins: { legend: { display: false }, title: { display: true, text: 'Comparison of Tire Diameters' } } } }); } function calculateTireFit() { var currentTireDiameter = parseFloat(getElement('currentTireDiameter').value); var currentWheelDiameter = parseFloat(getElement('currentWheelDiameter').value); var newTireDiameter = parseFloat(getElement('newTireDiameter').value); var newWheelDiameter = parseFloat(getElement('newWheelDiameter').value); var vehicleWeight = parseFloat(getElement('vehicleWeight').value); var suspensionType = getElement('suspensionType').value; var errors = false; var validationCurrentTire = isValidNumber(currentTireDiameter, 15, 35); if (!validationCurrentTire.valid) setErrorMessage('currentTireDiameter', validationCurrentTire.message); else errors = true; var validationCurrentWheel = isValidNumber(currentWheelDiameter, 13, 26); if (!validationCurrentWheel.valid) setErrorMessage('currentWheelDiameter', validationCurrentWheel.message); else errors = true; var validationNewTire = isValidNumber(newTireDiameter, 15, 35); if (!validationNewTire.valid) setErrorMessage('newTireDiameter', validationNewTire.message); else errors = true; var validationNewWheel = isValidNumber(newWheelDiameter, 13, 26); if (!validationNewWheel.valid) setErrorMessage('newWheelDiameter', validationNewWheel.message); else errors = true; var validationVehicleWeight = isValidNumber(vehicleWeight, 2000, 8000); if (!validationVehicleWeight.valid) setErrorMessage('vehicleWeight', validationVehicleWeight.message); else errors = true; if (!errors) { setErrorMessage('currentTireDiameter'); setErrorMessage('currentWheelDiameter'); setErrorMessage('newTireDiameter'); setErrorMessage('newWheelDiameter'); setErrorMessage('vehicleWeight'); } else { return; // Stop calculation if there are errors } var diameterDifference = newTireDiameter – currentTireDiameter; var radiusDifference = (newTireDiameter / 2) – (currentTireDiameter / 2); var speedometerError = ((newTireDiameter / currentTireDiameter) – 1) * 100; var clearanceImpactText = ""; var clearanceMagnitude = Math.abs(diameterDifference); if (clearanceMagnitude < 0.5) { clearanceImpactText = "Minimal change, likely no rubbing."; } else if (clearanceMagnitude 5000 && clearanceMagnitude > 0.7) { clearanceImpactText += " Consider increased stress on heavier vehicles."; } getElement('result').innerText = "Diameter Difference: " + diameterDifference.toFixed(2) + " inches"; getElement('diameterDifference').querySelector('span:last-child').innerText = diameterDifference.toFixed(2) + " in"; getElement('radiusDifference').querySelector('span:last-child').innerText = radiusDifference.toFixed(2) + " in"; getElement('clearanceImpact').querySelector('span:last-child').innerText = clearanceImpactText; getElement('speedometerError').querySelector('span:last-child').innerText = speedometerError.toFixed(2) + "%"; getElement('currentTireDiamTable').innerText = currentTireDiameter.toFixed(1); getElement('currentWheelDiamTable').innerText = currentWheelDiameter.toFixed(1); getElement('newTireDiamTable').innerText = newTireDiameter.toFixed(1); getElement('newWheelDiamTable').innerText = newWheelDiameter.toFixed(1); getElement('currentRadiusTable').innerText = (currentTireDiameter / 2).toFixed(1); getElement('newRadiusTable').innerText = (newTireDiameter / 2).toFixed(1); drawChart(currentTireDiameter, newTireDiameter); getElement('resultsContainer').style.display = 'block'; } function resetCalculator() { getElement('currentTireDiameter').value = "; getElement('currentWheelDiameter').value = "; getElement('newTireDiameter').value = "; getElement('newWheelDiameter').value = "; getElement('vehicleWeight').value = "; getElement('suspensionType').value = 'standard'; getElement('result').innerText = "; getElement('diameterDifference').querySelector('span:last-child').innerText = "; getElement('radiusDifference').querySelector('span:last-child').innerText = "; getElement('clearanceImpact').querySelector('span:last-child').innerText = "; getElement('speedometerError').querySelector('span:last-child').innerText = "; getElement('currentTireDiamTable').innerText = "; getElement('currentWheelDiamTable').innerText = "; getElement('newTireDiamTable').innerText = "; getElement('newWheelDiamTable').innerText = "; getElement('currentRadiusTable').innerText = "; getElement('newRadiusTable').innerText = "; var canvas = getElement('diameterChart'); var ctx = canvas.getContext('2d'); if (diameterChartInstance) { diameterChartInstance.destroy(); diameterChartInstance = null; } // Clear canvas if no chart instance ctx.clearRect(0, 0, canvas.width, canvas.height); getElement('resultsContainer').style.display = 'none'; // Clear error messages setErrorMessage('currentTireDiameter'); setErrorMessage('currentWheelDiameter'); setErrorMessage('newTireDiameter'); setErrorMessage('newWheelDiameter'); setErrorMessage('vehicleWeight'); } function copyResults() { var resultDiv = getElement('resultsContainer'); if (resultDiv.style.display === 'none') { alert('Please calculate results first.'); return; } var mainResult = getElement('result').innerText; var intermediateResults = resultDiv.querySelectorAll('.intermediate-results div'); var summary = "Tire & Wheel Fitment Results:\n\n"; summary += mainResult + "\n\n"; intermediateResults.forEach(function(item) { var label = item.querySelector('span:first-child').innerText; var value = item.querySelector('span:last-child').innerText; summary += label + ": " + value + "\n"; }); var tempTextarea = document.createElement("textarea"); tempTextarea.value = summary; document.body.appendChild(tempTextarea); tempTextarea.select(); try { document.execCommand("copy"); alert("Results copied to clipboard!"); } catch (err) { console.error("Could not copy text: ", err); alert("Failed to copy results. Please copy manually."); } document.body.removeChild(tempTextarea); } // Initialize chart on load if needed, or wait for calculation // Ensure chart canvas is present and clear on load window.onload = function() { var canvas = getElement('diameterChart'); var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, canvas.width, canvas.height); };

Leave a Comment