Epoxy Weight Calculator

Epoxy Weight Calculator: Calculate Resin & Hardener Needs :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –shadow-color: 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; justify-content: center; } .container { max-width: 960px; width: 100%; background-color: #fff; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); text-align: center; } h1, h2, h3 { color: var(–primary-color); margin-bottom: 20px; } .loan-calc-container { background-color: #f8f9fa; padding: 25px; border-radius: 6px; margin-bottom: 30px; text-align: left; border: 1px solid #e0e0e0; } .input-group { margin-bottom: 20px; opacity: 1; transition: opacity 0.3s ease-in-out; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { width: calc(100% – 22px); /* Account for padding and border */ padding: 10px 10px; border: 1px solid var(–border-color); border-radius: 4px; box-sizing: border-box; font-size: 1rem; } .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: #6c757d; margin-top: 5px; display: block; } .error-message { color: #dc3545; font-size: 0.9em; margin-top: 5px; display: block; min-height: 1.2em; /* Prevent layout shifts */ } .button-group { display: flex; justify-content: space-between; margin-top: 25px; flex-wrap: wrap; /* Allow buttons to wrap on smaller screens */ } .button-group button { padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 1rem; font-weight: bold; transition: background-color 0.3s ease; margin: 5px; /* Add margin for wrapping */ flex: 1; /* Distribute space */ min-width: 150px; /* Minimum width before wrapping */ } .calculate-btn { background-color: var(–primary-color); color: white; } .calculate-btn:hover { background-color: #003366; } .reset-btn, .copy-btn { background-color: #6c757d; color: white; } .reset-btn:hover, .copy-btn:hover { background-color: #5a6268; } #results { margin-top: 30px; padding: 20px; background-color: #e9ecef; border-radius: 6px; border: 1px solid #dee2e6; text-align: center; } #results h3 { margin-top: 0; color: var(–primary-color); } .result-item { margin-bottom: 15px; } .result-label { font-weight: bold; color: var(–primary-color); } .main-result { font-size: 2em; font-weight: bold; color: var(–success-color); margin-bottom: 20px; padding: 10px; background-color: #fff; border-radius: 4px; display: inline-block; } .formula-explanation { font-size: 0.9em; color: #555; margin-top: 15px; padding-top: 15px; border-top: 1px dashed #ccc; } .table-container, .chart-container { margin-top: 30px; padding: 20px; background-color: #f8f9fa; border-radius: 6px; border: 1px solid #e0e0e0; } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; caption-side: top; text-align: center; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 10px; border: 1px solid #ddd; text-align: left; } th { background-color: #e9ecef; color: var(–primary-color); font-weight: bold; } tr:nth-child(even) { background-color: #f2f2f2; } canvas { max-width: 100%; height: auto; } .article-content { text-align: left; margin-top: 40px; padding: 30px; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); } .article-content h2, .article-content h3 { text-align: center; margin-top: 30px; margin-bottom: 15px; } .article-content p, .article-content ul, .article-content ol { margin-bottom: 20px; text-align: left; } .article-content ul, .article-content ol { padding-left: 20px; } .article-content li { margin-bottom: 10px; } .faq-item { margin-bottom: 20px; padding: 15px; background-color: #f8f9fa; border-radius: 5px; border-left: 4px solid var(–primary-color); } .faq-item strong { color: var(–primary-color); display: block; margin-bottom: 5px; } .internal-links ul { list-style: none; padding: 0; } .internal-links li { margin-bottom: 15px; } .internal-links a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links a:hover { text-decoration: underline; } .internal-links span { font-size: 0.9em; color: #666; display: block; margin-top: 3px; } /* Responsive adjustments */ @media (max-width: 768px) { .container { padding: 20px; } .button-group { flex-direction: column; align-items: center; } .button-group button { width: 100%; max-width: 300px; margin: 5px 0; } }

Epoxy Weight Calculator

Accurately calculate the epoxy resin and hardener needed for your project based on surface area and desired thickness.

Epoxy Calculation Tool

Enter the total area to be coated (e.g., in square feet or square meters).
Enter the target thickness of the epoxy layer (e.g., in mils or mm).
Mils (thousandths of an inch) Millimeters (mm) Select the unit for your desired thickness.
Square Feet (sq ft) Square Meters (sq m) Select the unit for your surface area measurement.
Typical density is around 1.15 g/cm³ (or kg/L). Adjust if your epoxy data differs.
Enter the ratio as Resin:Hardener (e.g., 2:1, 1:1).

Calculation Results

Total Epoxy Needed (Weight):
Resin Weight:
Hardener Weight:
Volume Needed:
Formula Used:

1. Convert thickness to a consistent unit (e.g., inches).
2. Calculate volume: Volume = Surface Area (sq ft) * Thickness (ft).
3. Convert volume to cubic cm (cm³): Volume (cm³) = Volume (cubic ft) * 28316.8.
4. Calculate total weight: Total Weight (kg) = Volume (cm³) * Density (g/cm³) / 1000.
5. Distribute weight based on mixing ratio (Resin:Hardener). Total parts = Resin Parts + Hardener Parts.
Resin Weight (kg) = Total Weight * (Resin Parts / Total Parts).
Hardener Weight (kg) = Total Weight * (Hardener Parts / Total Parts).

Epoxy Weight Distribution

Component Weight (kg) Percentage
Resin
Hardener
Total 100.0%

What is the Epoxy Weight Calculator?

The Epoxy Weight Calculator is an indispensable online tool designed for anyone working with epoxy resins, from hobbyists crafting jewelry to professionals coating large surfaces like countertops or floors. It simplifies the often complex task of calculating the precise amount of epoxy resin and hardener needed for a specific project. By inputting key project parameters like surface area, desired thickness, and the epoxy's mixing ratio, the calculator instantly provides the total weight of mixed epoxy required, broken down into the exact quantities of resin and hardener components.

This tool is crucial for minimizing waste and ensuring your project has adequate material without over-purchasing. Overestimating can lead to costly material wastage, while underestimating can halt your project mid-process, potentially compromising the final finish due to improper curing or inconsistencies. The calculator helps bridge the gap between theoretical requirements and practical application, making epoxy projects more predictable and successful.

Who should use it:

  • DIY enthusiasts and hobbyists (e.g., for coasters, tumblers, small art pieces)
  • Woodworkers and furniture makers (e.g., for river tables, sealing wood)
  • Contractors and builders (e.g., for floor coatings, countertops, sealing concrete)
  • Artists and crafters
  • Anyone undertaking a project requiring a specific epoxy layer thickness.

Common misconceptions about epoxy calculations:

  • "Volume is enough": While volume is a starting point, most epoxy is sold by weight, and precise mixing ratios are often weight-based. This calculator bridges that gap.
  • "A little extra is always good": While a small buffer is wise, excessive overestimation leads to significant waste, especially with expensive art resins.
  • "All epoxies are the same": Different epoxies have varying densities and coverage rates, which affect the final weight needed.

Epoxy Weight Calculator Formula and Mathematical Explanation

The Epoxy Weight Calculator utilizes a series of calculations to accurately determine the required epoxy weight. The core idea is to first calculate the necessary volume of mixed epoxy, then convert that volume into weight using the epoxy's density, and finally, split that weight according to the product's specific mixing ratio.

Step-by-Step Derivation:

  1. Volume Calculation: The volume of epoxy needed is determined by the surface area to be covered and the desired thickness of the cured layer. This is a straightforward geometric calculation: Volume = Surface Area × Desired Thickness However, units must be consistent. If Surface Area is in square feet (sq ft) and Thickness is in mils (1 mil = 0.001 inches), we need to convert these to a common unit like cubic inches or cubic centimeters (cm³). For example, to get cubic inches: Volume (cubic inches) = Surface Area (sq ft) × 144 sq in/sq ft × Thickness (inches) Or, more practically for metric conversions later: Volume (cubic cm) = Surface Area (sq m) × 10000 sq cm/sq m × Thickness (cm) If using mils, conversion to inches first is needed: Thickness (in) = Thickness (mils) / 1000. If using sq ft and mils, a common conversion factor is: 1 sq ft at 1 mil thickness requires approximately 0.000016367 cubic feet, which converts to about 0.463 cm³ or 463 cm³ for 100 mils (1/10 inch). A more direct conversion: 1 sq ft at 10 mils ≈ 0.00027 cubic feet ≈ 7.645 cm³. A commonly used factor for flooring/coating is that 1 gallon (231 cubic inches) covers approximately 160 sq ft at 10 mils thickness. So, 1 sq ft at 10 mils ≈ 1/160 gallon ≈ 1.44 cubic inches ≈ 23.6 cm³. Let's simplify for the calculator: Convert Surface Area to sq cm and Thickness to cm. *If units are sq ft and mils:* Area (cm²) = Surface Area (sq ft) × 929.03 Thickness (cm) = Desired Thickness (mils) × 0.00254 *If units are sq m and mm:* Area (cm²) = Surface Area (sq m) × 10000 Thickness (cm) = Desired Thickness (mm) × 0.1 Then, Volume (cm³) = Area (cm²) × Thickness (cm).
  2. Weight Calculation: Once the volume is known, the total weight of the mixed epoxy can be calculated using its density. Density is typically given in grams per cubic centimeter (g/cm³). Weight = Volume × Density Since density is often in g/cm³ and we want the result in kilograms (kg) for convenience: Total Weight (kg) = Volume (cm³) × Density (g/cm³) / 1000
  3. Ratio Distribution: Epoxy is a two-part system (resin and hardener) mixed in a specific ratio. This ratio dictates how the total weight is divided between the two components. Let the ratio be R:H (e.g., 2:1). Total Parts = R + H Resin Weight (kg) = Total Weight (kg) × (R / Total Parts) Hardener Weight (kg) = Total Weight (kg) × (H / Total Parts)

Variable Explanations:

The calculator uses the following inputs and intermediate values:

Variable Meaning Unit Typical Range / Notes
Surface Area The total area that needs to be covered by the epoxy layer. sq ft or sq m Varies greatly by project (e.g., 0.5 sq ft for a coaster, 1000+ sq ft for a floor).
Desired Thickness The target cured thickness of the epoxy layer. Mils or mm Commonly 10-20 mils for coatings, thicker for castings or river tables (e.g., 1 inch = 1000 mils).
Thickness Unit Unit of measurement for the desired thickness. Enum (Mils, mm) Select based on measurement preference.
Surface Area Unit Unit of measurement for the surface area. Enum (sq ft, sq m) Select based on measurement preference.
Epoxy Density The mass per unit volume of the mixed epoxy. g/cm³ Typically 1.1 to 1.25 g/cm³ for most epoxies. 1.15 is a common average.
Mixing Ratio The ratio of resin to hardener by weight required for proper curing. Text (e.g., "2:1") Common ratios include 1:1, 2:1, 3:1, 4:1, 5:1. Crucial for correct curing.
Calculated Volume The total volume of mixed epoxy required. cm³ Intermediate calculation result.
Total Epoxy Weight The total weight of the mixed epoxy required. kg Primary output of the calculator.
Resin Weight The weight of the resin component needed. kg Derived from Total Epoxy Weight and mixing ratio.
Hardener Weight The weight of the hardener component needed. kg Derived from Total Epoxy Weight and mixing ratio.

Practical Examples (Real-World Use Cases)

Here are a couple of examples demonstrating how to use the Epoxy Weight Calculator:

Example 1: DIY Bar Top Coating

Scenario: You're coating a small home bar top with a high-gloss epoxy finish. The top measures 6 feet long by 2.5 feet wide. You want a durable layer approximately 20 mils thick. The epoxy manufacturer specifies a 2:1 resin-to-hardener ratio by weight and a density of 1.18 g/cm³.

Inputs:

  • Surface Area: 15 sq ft (6 ft * 2.5 ft)
  • Surface Area Unit: sq ft
  • Desired Thickness: 20 Mils
  • Thickness Unit: Mils
  • Epoxy Density: 1.18 g/cm³
  • Mixing Ratio: 2:1

Calculator Output (simulated):

  • Total Epoxy Needed (Weight): 4.25 kg
  • Resin Weight: 2.83 kg
  • Hardener Weight: 1.42 kg
  • Volume Needed: 3.60 L (approx. 0.095 cu ft)

Financial Interpretation: This calculation tells you that you need approximately 4.25 kg of mixed epoxy. Based on the 2:1 ratio, you'll need to purchase at least 2.83 kg of resin and 1.42 kg of hardener. This quantity helps you order the correct product size, avoiding the need for a second purchase or having excessive leftover material. If resin costs $30/kg and hardener costs $20/kg, the material cost for this layer is approximately (2.83 * $30) + (1.42 * $20) = $84.90 + $28.40 = $113.30.

Example 2: Epoxy River Table

Scenario: You are creating a river table with a tabletop surface area of 8 sq m. The "river" section is 0.5 meters wide and 4 meters long. You want to pour the river with a thickness of 1 inch (which is about 25.4 mm). The epoxy manufacturer states a 1:1 ratio by weight and a density of 1.15 g/cm³.

Inputs:

  • Surface Area: 2 sq m (0.5 m * 4 m)
  • Surface Area Unit: sq m
  • Desired Thickness: 25.4 mm
  • Thickness Unit: mm
  • Epoxy Density: 1.15 g/cm³
  • Mixing Ratio: 1:1

Calculator Output (simulated):

  • Total Epoxy Needed (Weight): 28.75 kg
  • Resin Weight: 14.38 kg
  • Hardener Weight: 14.38 kg
  • Volume Needed: 25 L (approx. 0.88 cu ft)

Financial Interpretation: This large project requires a significant amount of epoxy, around 28.75 kg total. With a 1:1 ratio, you need equal parts of resin and hardener (14.38 kg each). This volume calculation is critical for large pours to ensure you have enough material on hand. Ordering the correct sizes (e.g., multiple 5kg resin + 5kg hardener kits) is essential. If the combined cost is $50 per kg kit (resin+hardener), the total material cost is approximately 28.75 kg / 2 kg/kit * $50/kit = 14.375 * $50 ≈ $718.75.

How to Use This Epoxy Weight Calculator

Using the Epoxy Weight Calculator is straightforward. Follow these steps for accurate results:

  1. Measure Your Project Area: Accurately determine the total surface area that your epoxy coating will cover. Measure length and width for rectangular areas, or use appropriate geometric formulas for irregular shapes.
  2. Select Surface Area Units: Choose whether your measurement is in Square Feet (sq ft) or Square Meters (sq m) and select the corresponding unit in the dropdown.
  3. Determine Desired Thickness: Decide on the final cured thickness of your epoxy layer. This depends on the application (e.g., thin seal coat, thick tabletop, casting).
  4. Select Thickness Units: Choose the unit for your thickness measurement – Mils (thousandths of an inch) are common for thin coatings, while millimeters (mm) are used for thicker layers or metric measurements.
  5. Input Epoxy Density: Find the density of your specific epoxy product, usually listed in grams per cubic centimeter (g/cm³). If unsure, a typical value is 1.15 g/cm³.
  6. Enter Mixing Ratio: Input the resin-to-hardener ratio as specified by the manufacturer, typically in the format "X:Y" (e.g., "2:1"). This is usually by weight.
  7. Calculate: Click the "Calculate Epoxy Weight" button.

How to read results:

  • Total Epoxy Needed (Weight): This is the main figure – the total weight (in kg) of the mixed epoxy (resin + hardener) you'll need.
  • Resin Weight & Hardener Weight: These show the specific weights of each component you must measure out according to the mixing ratio.
  • Volume Needed: An estimate of the total liquid volume the required weight occupies, useful for understanding container size.
  • Table: Provides a clear breakdown of component weights and their percentage contribution to the total mix.
  • Chart: Visually represents the weight distribution between resin and hardener.

Decision-making guidance:

  • Ordering Materials: Use the 'Total Epoxy Needed' and individual component weights to order the correct product sizes. It's often wise to add a 5-10% buffer for spills, uneven surfaces, or a slightly thicker coat than planned.
  • Mixing: Accurately measure the Resin Weight and Hardener Weight. Incorrect ratios lead to improper curing (sticky, soft, or brittle epoxy).
  • Budgeting: Use the component weights and their respective prices to estimate the material cost for your project.

Key Factors That Affect Epoxy Weight Results

Several factors influence the accuracy of the Epoxy Weight Calculator and the actual amount of epoxy used:

  1. Surface Area Accuracy: Inaccurate measurements of the project's surface area are a primary source of error. Ensure all dimensions are carefully measured and the area calculation is correct, especially for complex shapes.
  2. Desired Thickness Consistency: Maintaining a uniform thickness across the entire surface is challenging. Uneven application, especially on floors or large tables, can significantly increase or decrease the required epoxy. The calculator assumes a uniform layer.
  3. Epoxy Viscosity: Thicker epoxies (higher viscosity) tend to cling more to tools and containers and may not spread as thinly, potentially requiring slightly more material than a thinner, lower-viscosity epoxy for the same area and nominal thickness.
  4. Surface Porosity: Porous materials like untreated wood or concrete will absorb some of the epoxy, especially in the initial coats. This means you'll need more material than calculated for the surface area alone to achieve the desired final film thickness. Consider a primer coat for highly porous substrates.
  5. Application Method & Waste: How you apply the epoxy matters. Using spatulas, rollers, or brushes will result in some material clinging to the tools. Over-mixing can also lead to waste. Always factor in a small percentage (e.g., 5-10%) for such losses.
  6. Temperature Effects: Epoxy viscosity changes significantly with temperature. Colder temperatures make epoxy thicker, increasing its cling and potentially requiring more material. Warmer temperatures make it thinner and easier to spread, potentially leading to a thinner coat if not controlled.
  7. Mixing Ratio Precision: While the calculator provides the target weights, deviations in the actual mixing ratio during application will affect the curing process, not necessarily the total weight needed, but it's a critical factor for success.
  8. Curing vs. Pot Life: The calculator determines the amount needed for the job. However, understanding the pot life (working time) is crucial. For large areas, you might need to mix epoxy in smaller batches to stay within the pot life, which complicates sequential application but doesn't change the total required weight.

Frequently Asked Questions (FAQ)

Q1: How do I calculate the area for an irregular shape?

A1: For irregular shapes, break them down into simpler geometric forms (rectangles, triangles, circles) and sum their areas. For very complex shapes, you can use techniques like grid counting or overlaying with a known grid pattern.

Q2: What if my epoxy ratio is by volume, not weight?

A2: Most high-performance epoxies use weight ratios for accuracy. If yours is by volume, you'll need the density of both the resin and the hardener (which often differ) and adjust the calculation accordingly. This calculator assumes weight ratio for simplicity and common practice.

Q3: How much extra epoxy should I order?

A3: It's generally recommended to add a buffer of 5-10% to account for spills, uneven application, surface porosity, and material sticking to tools. For critical projects, err on the side of slightly more.

Q4: Can I use this calculator for casting epoxy?

A4: Yes, but casting epoxies often have different densities and are poured to much greater thicknesses. Ensure your measurements for surface area and desired thickness are accurate, and use the correct density and ratio for your casting resin.

Q5: My epoxy is sticky after curing. What went wrong?

A5: This is usually due to an incorrect mixing ratio, insufficient mixing, or improper environmental conditions (temperature, humidity) during curing. Ensure you measure accurately by weight and mix thoroughly.

Q6: What are 'mils' in epoxy thickness?

A6: A 'mil' is a unit of measurement equal to one-thousandth of an inch (0.001″). It's commonly used in industries like coatings and flooring to specify thin layers. 20 mils is approximately 0.02 inches or about 0.5 mm.

Q7: Does the calculator account for double-coating?

A7: No, the calculator determines the amount for a single specified layer thickness. If you plan to apply multiple coats, you should run the calculation for the total desired thickness (sum of all coats) or calculate each coat individually if thicknesses vary.

Q8: How does epoxy density affect the weight needed?

A8: Higher density epoxies are heavier for the same volume. If your epoxy is denser than the default 1.15 g/cm³, you'll need less volume but potentially a similar or slightly higher weight to achieve the same thickness compared to a less dense epoxy. The calculator directly incorporates density into the weight calculation.

var canvas = document.getElementById("epoxyChart"); var ctx = canvas.getContext("2d"); var epoxyChartInstance = null; function getNumericValue(id) { var element = document.getElementById(id); if (!element || element.value === "") return NaN; var value = parseFloat(element.value); return isNaN(value) ? NaN : value; } function validateInput(id, min, max, errorId) { var value = getNumericValue(id); var errorElement = document.getElementById(errorId); if (isNaN(value)) { errorElement.textContent = "Please enter a valid number."; return false; } if (value max) { errorElement.textContent = "Value exceeds maximum allowed."; return false; } errorElement.textContent = ""; return true; } function parseRatio(ratioString) { var parts = ratioString.split(':'); if (parts.length === 2) { var resinParts = parseFloat(parts[0]); var hardenerParts = parseFloat(parts[1]); if (!isNaN(resinParts) && !isNaN(hardenerParts) && resinParts > 0 && hardenerParts > 0) { return { resin: resinParts, hardener: hardenerParts }; } } return null; } function calculateEpoxyWeight() { var isValid = true; isValid &= validateInput('surfaceArea', 0, Infinity, 'surfaceAreaError'); isValid &= validateInput('desiredThickness', 0, Infinity, 'desiredThicknessError'); isValid &= validateInput('density', 0.01, Infinity, 'densityError'); var mixingRatioInput = document.getElementById('mixingRatio'); var mixingRatioError = document.getElementById('mixingRatioError'); var ratio = parseRatio(mixingRatioInput.value); if (ratio === null) { mixingRatioError.textContent = "Invalid ratio format. Use like 2:1 or 1:1."; isValid = false; } else { mixingRatioError.textContent = ""; } if (!isValid) { document.getElementById('results').style.display = 'none'; return; } var surfaceArea = getNumericValue('surfaceArea'); var desiredThickness = getNumericValue('desiredThickness'); var density = getNumericValue('density'); var thicknessUnit = document.getElementById('thicknessUnit').value; var surfaceAreaUnit = document.getElementById('surfaceAreaUnit').value; var areaCm2 = 0; if (surfaceAreaUnit === 'sqm') { areaCm2 = surfaceArea * 10000; // 1 sqm = 10000 cm2 } else { // sqft areaCm2 = surfaceArea * 929.03; // 1 sqft = 929.03 cm2 } var thicknessCm = 0; if (thicknessUnit === 'mm') { thicknessCm = desiredThickness * 0.1; // 1 mm = 0.1 cm } else { // mils thicknessCm = desiredThickness * 0.00254; // 1 mil = 0.001 inch = 0.00254 cm } var volumeCm3 = areaCm2 * thicknessCm; var volumeLiters = volumeCm3 / 1000; // 1 Liter = 1000 cm3 var totalWeightKg = (volumeCm3 * density) / 1000; // Convert g to kg var resinWeightKg = totalWeightKg * (ratio.resin / (ratio.resin + ratio.hardener)); var hardenerWeightKg = totalWeightKg * (ratio.hardener / (ratio.resin + ratio.hardener)); // Update Results Display document.getElementById('totalWeightResult').textContent = totalWeightKg.toFixed(2) + ' kg'; document.getElementById('resinWeightResult').textContent = resinWeightKg.toFixed(2) + ' kg'; document.getElementById('hardenerWeightResult').textContent = hardenerWeightKg.toFixed(2) + ' kg'; document.getElementById('volumeNeededResult').textContent = volumeLiters.toFixed(3) + ' L'; document.getElementById('results').style.display = 'block'; // Update Table document.getElementById('tableResinWeight').textContent = resinWeightKg.toFixed(2); document.getElementById('tableHardenerWeight').textContent = hardenerWeightKg.toFixed(2); document.getElementById('tableTotalWeight').textContent = totalWeightKg.toFixed(2); document.getElementById('tableResinPercent').textContent = (resinWeightKg / totalWeightKg * 100).toFixed(1) + '%'; document.getElementById('tableHardenerPercent').textContent = (hardenerWeightKg / totalWeightKg * 100).toFixed(1) + '%'; updateChart(resinWeightKg, hardenerWeightKg, totalWeightKg); } function updateChart(resinWeight, hardenerWeight, totalWeight) { var resinPercent = (resinWeight / totalWeight) * 100; var hardenerPercent = (hardenerWeight / totalWeight) * 100; if (epoxyChartInstance) { epoxyChartInstance.destroy(); } epoxyChartInstance = new Chart(ctx, { type: 'doughnut', // Changed to doughnut for better representation of parts of a whole data: { labels: ['Resin', 'Hardener'], datasets: [{ label: 'Weight Distribution', data: [resinPercent, hardenerPercent], backgroundColor: [ 'rgba(54, 162, 235, 0.7)', // Blue for Resin 'rgba(255, 99, 132, 0.7)' // Red for Hardener ], borderColor: [ 'rgba(54, 162, 235, 1)', 'rgba(255, 99, 132, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'bottom', }, title: { display: true, text: 'Epoxy Weight Distribution (%)' } } } }); } // Helper function to add Chart.js library dynamically function addChartJs() { var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js@3.7.0/dist/chart.min.js'; script.onload = function() { // Initial calculation and chart render after library is loaded calculateEpoxyWeight(); }; document.head.appendChild(script); } // Call addChartJs when the DOM is ready document.addEventListener('DOMContentLoaded', function() { // Ensure canvas element exists before trying to get context var canvas = document.getElementById("epoxyChart"); if (canvas) { canvas.width = 300; // Set a default width canvas.height = 300; // Set a default height addChartJs(); } else { console.error("Canvas element not found!"); } }); function resetCalculator() { document.getElementById('surfaceArea').value = "; document.getElementById('desiredThickness').value = "; document.getElementById('thicknessUnit').value = 'mils'; document.getElementById('surfaceAreaUnit').value = 'sqft'; document.getElementById('density').value = '1.15'; document.getElementById('mixingRatio').value = "; document.getElementById('surfaceAreaError').textContent = "; document.getElementById('desiredThicknessError').textContent = "; document.getElementById('densityError').textContent = "; document.getElementById('mixingRatioError').textContent = "; document.getElementById('results').style.display = 'none'; } function copyResults() { var resultsText = "Epoxy Weight Calculation Results:\n\n"; resultsText += "Total Epoxy Needed (Weight): " + document.getElementById('totalWeightResult').textContent + "\n"; resultsText += "Resin Weight: " + document.getElementById('resinWeightResult').textContent + "\n"; resultsText += "Hardener Weight: " + document.getElementById('hardenerWeightResult').textContent + "\n"; resultsText += "Volume Needed: " + document.getElementById('volumeNeededResult').textContent + "\n\n"; resultsText += "Table Breakdown:\n"; resultsText += "Resin Weight: " + document.getElementById('tableResinWeight').textContent + "\n"; resultsText += "Resin Percentage: " + document.getElementById('tableResinPercent').textContent + "\n"; resultsText += "Hardener Weight: " + document.getElementById('tableHardenerWeight').textContent + "\n"; resultsText += "Hardener Percentage: " + document.getElementById('tableHardenerPercent').textContent + "\n"; resultsText += "Total Weight: " + document.getElementById('tableTotalWeight').textContent + "\n\n"; resultsText += "Key Assumptions:\n"; resultsText += "- Epoxy Density: " + document.getElementById('density').value + " g/cm³\n"; resultsText += "- Mixing Ratio: " + document.getElementById('mixingRatio').value + "\n"; resultsText += "- Surface Area Unit: " + document.getElementById('surfaceAreaUnit').selectedOptions[0].text + "\n"; resultsText += "- Thickness Unit: " + document.getElementById('thicknessUnit').selectedOptions[0].text + "\n"; // Use a temporary textarea to facilitate copying var textArea = document.createElement("textarea"); textArea.value = resultsText; textArea.style.position = "fixed"; textArea.style.left = "-9999px"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'Results copied!' : 'Copying failed!'; // Optionally show a temporary message to the user // alert(msg); // Using alert is discouraged, but for simplicity here. } catch (err) { // alert('Oops, unable to copy: ' + err); // Handle errors } document.body.removeChild(textArea); } // Re-calculate on input change for real-time updates document.getElementById('surfaceArea').addEventListener('input', calculateEpoxyWeight); document.getElementById('desiredThickness').addEventListener('input', calculateEpoxyWeight); document.getElementById('density').addEventListener('input', calculateEpoxyWeight); document.getElementById('mixingRatio').addEventListener('input', calculateEpoxyWeight); document.getElementById('thicknessUnit').addEventListener('change', calculateEpoxyWeight); document.getElementById('surfaceAreaUnit').addEventListener('change', calculateEpoxyWeight);

Leave a Comment