How to Calculate Reinforcement Bar Weight

Calculate Reinforcement Bar Weight – Expert Guide & Calculator :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ddd; –card-bg: #fff; –shadow: 0 2px 5px 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; } .container { max-width: 960px; margin: 20px auto; padding: 20px; background-color: var(–card-bg); border-radius: 8px; box-shadow: var(–shadow); } header { background-color: var(–primary-color); color: white; padding: 20px 0; text-align: center; margin-bottom: 20px; border-radius: 8px 8px 0 0; } header h1 { margin: 0; font-size: 2.2em; } h1, h2, h3 { color: var(–primary-color); } .loan-calc-container { background-color: var(–card-bg); padding: 30px; border-radius: 8px; box-shadow: var(–shadow); margin-bottom: 40px; } .input-group { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(–border-color); } .input-group:last-child { border-bottom: none; } .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% – 20px); padding: 12px 10px; border: 1px solid var(–border-color); border-radius: 4px; font-size: 1em; box-sizing: border-box; } .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 .helper-text { font-size: 0.85em; color: #666; margin-top: 5px; display: block; } .input-group .error-message { color: #dc3545; font-size: 0.9em; margin-top: 5px; display: block; min-height: 1.2em; } .button-group { display: flex; justify-content: space-between; margin-top: 30px; flex-wrap: wrap; gap: 15px; } .button-group button { padding: 12px 25px; border: none; border-radius: 5px; font-size: 1em; cursor: pointer; transition: background-color 0.3s ease; font-weight: bold; } .button-group .calculate-btn { background-color: var(–primary-color); color: white; } .button-group .calculate-btn:hover { background-color: #003366; } .button-group .reset-btn, .button-group .copy-btn { background-color: #6c757d; color: white; } .button-group .reset-btn:hover, .button-group .copy-btn:hover { background-color: #5a6268; } #result-section { margin-top: 30px; padding: 25px; background-color: var(–primary-color); color: white; border-radius: 5px; box-shadow: var(–shadow); text-align: center; } #result-section h3 { color: white; margin-top: 0; font-size: 1.5em; } #result-section .primary-result { font-size: 2.5em; font-weight: bold; margin: 10px 0; } #result-section .unit { font-size: 1em; opacity: 0.9; } .intermediate-results { display: flex; justify-content: space-around; margin-top: 20px; flex-wrap: wrap; gap: 15px; } .intermediate-results div { text-align: center; padding: 10px; background-color: rgba(255,255,255,0.1); border-radius: 4px; } .intermediate-results span { display: block; font-size: 1.2em; font-weight: bold; } .intermediate-results small { font-size: 0.9em; opacity: 0.9; } .formula-explanation { margin-top: 15px; font-size: 0.95em; opacity: 0.9; text-align: left; border-top: 1px solid rgba(255,255,255,0.3); padding-top: 10px; } .table-section, .chart-section { margin-top: 40px; padding: 30px; background-color: var(–card-bg); border-radius: 8px; box-shadow: var(–shadow); } .table-section h3, .chart-section h3 { text-align: center; margin-bottom: 20px; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 12px; text-align: left; border: 1px solid var(–border-color); } th { background-color: #e9ecef; color: var(–text-color); font-weight: bold; } tr:nth-child(even) { background-color: #f8f9fa; } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; caption-side: top; text-align: left; } canvas { display: block; margin: 20px auto; max-width: 100%; border: 1px solid var(–border-color); border-radius: 4px; } .article-content { margin-top: 40px; padding: 30px; background-color: var(–card-bg); border-radius: 8px; box-shadow: var(–shadow); } .article-content h2 { border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; margin-top: 30px; } .article-content h3 { margin-top: 25px; color: #0056b3; } .article-content p, .article-content ul, .article-content ol { margin-bottom: 15px; } .article-content ul, .article-content ol { padding-left: 25px; } .article-content li { margin-bottom: 8px; } .faq-item { margin-bottom: 15px; } .faq-item h3 { margin-bottom: 5px; color: var(–primary-color); font-size: 1.1em; } .faq-item p { margin-left: 15px; color: #555; } a { color: var(–primary-color); text-decoration: none; } a:hover { text-decoration: underline; } .internal-links-list { list-style: none; padding: 0; } .internal-links-list li { margin-bottom: 10px; } .internal-links-list a { font-weight: bold; } footer { text-align: center; margin-top: 40px; padding: 20px; font-size: 0.9em; color: #777; } .tooltip { position: relative; display: inline-block; cursor: help; } .tooltip .tooltiptext { visibility: hidden; width: 220px; background-color: #555; color: #fff; text-align: center; border-radius: 6px; padding: 5px 0; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -110px; opacity: 0; transition: opacity 0.3s; font-size: 0.8em; line-height: 1.4; } .tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }

Reinforcement Bar Weight Calculator

Accurate Calculation for Construction Projects

Calculate Reinforcement Bar Weight

Easily determine the weight of your steel reinforcement bars (rebar) for construction projects.

Nominal diameter of the rebar in millimeters.
Total length of the rebar in meters.
Standard density of steel. Usually 7850 kg/m³.

Calculated Reinforcement Bar Weight

kg
Volume (m³)
Area (m²)
Linear Density (kg/m)
Formula Used: Weight = Volume × Density. Volume is calculated from the bar's cross-sectional area and length.

Standard Rebar Diameters and Linear Densities

Nominal Diameter (mm) Cross-Sectional Area (mm²) Theoretical Linear Density (kg/m)
628.270.222
850.270.395
1078.540.617
12113.100.888
16201.061.578
20314.162.466
25490.873.853
32804.256.313
401256.649.864

Note: Linear densities are calculated using a steel density of 7850 kg/m³. Actual weights may vary slightly due to manufacturing tolerances.

Weight vs. Length for Different Bar Diameters

This chart visualizes the relationship between rebar length and its total weight for common bar diameters.

What is Reinforcement Bar Weight Calculation?

Calculating reinforcement bar weight, often referred to as rebar weight, is a fundamental process in civil engineering and construction. It involves determining the mass of steel bars used to reinforce concrete structures. This calculation is crucial for accurate material estimation, cost budgeting, structural analysis, and efficient logistics planning. Understanding how to calculate reinforcement bar weight ensures that the correct amount of steel is procured, preventing both shortages and excessive waste. This metric is vital for project managers, quantity surveyors, structural engineers, and site supervisors involved in any concrete construction project, from small residential foundations to large-scale infrastructure.

Common misconceptions include assuming all bars of the same diameter have identical weights or that weight is solely dependent on length. In reality, manufacturing tolerances and the precise density of the steel play a role. Furthermore, engineers often rely on theoretical weights per meter for quick estimations, but precise project costing requires a more detailed calculation based on actual lengths and project-specific material densities.

Reinforcement Bar Weight Formula and Mathematical Explanation

The core principle behind calculating reinforcement bar weight relies on the fundamental physics equation: Weight = Volume × Density. To apply this to a rebar, we need to calculate its volume first.

The volume of a rebar can be conceptualized as a cylinder. The formula for the volume of a cylinder is: Volume = Cross-Sectional Area × Length.

Therefore, the complete formula for reinforcement bar weight becomes:

Weight = (Cross-Sectional Area × Length) × Steel Density

Step-by-Step Derivation:

  1. Calculate the Cross-Sectional Area (A): This is the area of the circular face of the rebar. The formula for the area of a circle is A = π * (radius)². Since the input is usually diameter (d), and radius (r) = diameter / 2, the formula becomes A = π * (diameter / 2)², or more commonly written as A = (π * diameter²) / 4. It's essential to ensure units are consistent; if diameter is in millimeters, convert it to meters before calculating area, or calculate in mm² and then convert to m².
  2. Calculate the Volume (V): Multiply the cross-sectional area by the total length (L) of the bar. V = A × L. Ensure A is in square meters (m²) and L is in meters (m) for the volume to be in cubic meters (m³).
  3. Calculate the Weight (W): Multiply the volume by the density (ρ) of steel. W = V × ρ. If Volume is in m³ and Density is in kg/m³, the Weight will be in kilograms (kg).

Variable Explanations:

  • Diameter (d): The nominal diameter of the reinforcement bar.
  • Length (L): The total length of the reinforcement bar being considered.
  • Cross-Sectional Area (A): The area of the bar's circular cross-section.
  • Steel Density (ρ): The mass per unit volume of the steel material.
  • Volume (V): The total space occupied by the reinforcement bar.
  • Weight (W): The total mass of the reinforcement bar.

Variables Table:

Variable Meaning Unit Typical Range / Value
d Nominal Bar Diameter mm (or m) 6 mm to 50 mm (common)
L Bar Length m Variable, depends on project design
A Cross-Sectional Area m² (or mm²) Calculated value based on diameter
ρ (Steel Density) Density of Steel kg/m³ Typically 7850 kg/m³
V Volume Calculated value
W Total Weight kg Calculated value

Practical Examples (Real-World Use Cases)

Example 1: Calculating Weight for a Single Foundation Bar

A construction project requires a single reinforcing bar for a foundation footing. The design specifies a bar with a nominal diameter of 16 mm and a total length of 8 meters.

Inputs:

  • Bar Diameter = 16 mm
  • Bar Length = 8 m
  • Steel Density = 7850 kg/m³

Calculation Steps:

  1. Convert diameter to meters: 16 mm = 0.016 m
  2. Calculate Cross-Sectional Area (A): A = (π * (0.016 m)²) / 4 ≈ 0.00020106 m²
  3. Calculate Volume (V): V = 0.00020106 m² * 8 m ≈ 0.0016085 m³
  4. Calculate Weight (W): W = 0.0016085 m³ * 7850 kg/m³ ≈ 12.63 kg

Result Interpretation: The single 8-meter long, 16 mm diameter rebar weighs approximately 12.63 kg. This figure is crucial for ordering materials, estimating the load on handling equipment, and calculating the total steel requirement for the foundation.

Example 2: Estimating Weight for Multiple Bars in a Beam

A concrete beam requires six reinforcement bars, each with a diameter of 12 mm and a length of 10 meters. We need to find the total weight of these bars.

Inputs:

  • Number of Bars = 6
  • Bar Diameter = 12 mm
  • Bar Length = 10 m
  • Steel Density = 7850 kg/m³

Calculation Steps (for one bar, then multiply):

  1. Convert diameter to meters: 12 mm = 0.012 m
  2. Calculate Cross-Sectional Area (A): A = (π * (0.012 m)²) / 4 ≈ 0.0001131 m²
  3. Calculate Volume (V) per bar: V = 0.0001131 m² * 10 m ≈ 0.001131 m³
  4. Calculate Weight (W) per bar: W = 0.001131 m³ * 7850 kg/m³ ≈ 8.88 kg
  5. Calculate Total Weight: Total W = Weight per bar × Number of Bars = 8.88 kg * 6 ≈ 53.28 kg

Result Interpretation: The total weight for the six 12 mm diameter, 10-meter long bars is approximately 53.28 kg. This information helps in procurement, transportation planning, and ensuring sufficient capacity for lifting and placing the rebar.

How to Use This Reinforcement Bar Weight Calculator

Our calculator simplifies the process of determining rebar weight. Follow these steps:

  1. Enter Bar Diameter: Input the nominal diameter of the rebar in millimeters (e.g., 10, 12, 16).
  2. Enter Bar Length: Input the total length of the rebar in meters (e.g., 6, 10, 12).
  3. Verify Steel Density: The calculator defaults to the standard steel density of 7850 kg/m³. You can change this value if your project specifications differ, though it's uncommon.
  4. Calculate: Click the "Calculate Weight" button.
  5. Review Results: The calculator will display the total weight in kilograms (kg). It will also show intermediate values: the bar's cross-sectional area (m²), its volume (m³), and its theoretical linear density (kg/m).
  6. Reset: Use the "Reset" button to clear all fields and start over with default values.
  7. Copy Results: Click "Copy Results" to copy the primary weight, intermediate values, and key assumptions to your clipboard for use in reports or spreadsheets.

Decision-Making Guidance: The calculated weight is essential for accurate material ordering. Ensure you round up quantities slightly to account for cutting waste and potential manufacturing variations. This tool helps prevent under-ordering (leading to project delays) and over-ordering (leading to increased costs and material waste).

Key Factors That Affect Reinforcement Bar Weight

While the core formula is straightforward, several factors can influence the actual weight of reinforcement bars:

  1. Nominal Diameter Tolerances: Standards allow for slight variations in the actual diameter of rebar compared to its nominal size. These tolerances can lead to minor deviations in cross-sectional area and, consequently, weight. Our calculator uses the nominal diameter for theoretical calculations.
  2. Steel Density Variations: Although 7850 kg/m³ is the standard density for steel, slight variations can occur depending on the exact alloy composition. For most practical construction purposes, this standard value is sufficient.
  3. Bar Length: The total length of the rebar is a direct multiplier in the volume calculation. Longer bars naturally weigh more. Accurate measurement and accounting for lap lengths in continuous reinforcement are critical.
  4. Surface Deformation (Ribs): While the calculation is based on a smooth cylinder, real-world rebar has ribs and lugs for better bonding with concrete. These deformations add a small amount of material, slightly increasing the actual weight compared to the theoretical calculation. However, the standard density calculation typically accounts for this sufficiently.
  5. Cutting and Bending: Rebar is often cut to specific lengths and bent into various shapes. Each cut results in some material loss (sawdust/kerf width). Bending might slightly stretch the bar's length, affecting the total volume. These factors need to be considered in the overall quantity takeoff.
  6. Regional Standards and Specifications: Different countries or regions might have slightly different standards for rebar sizes, tolerances, and even the assumed density for calculation purposes. Always adhere to project-specific specifications.
  7. Corrosion/Rust: While not typically factored into initial weight calculations, significant rust or corrosion on stored rebar can alter its effective dimensions and weight over time. This is more of a material integrity concern than a calculation input.

Frequently Asked Questions (FAQ)

Q1: What is the standard steel density used for rebar weight calculations?

A: The standard density of steel used for reinforcement bar weight calculations is typically 7850 kilograms per cubic meter (kg/m³).

Q2: How does the rebar's surface deformation affect its weight?

A: Ribs and deformations increase the actual volume and thus the weight slightly compared to a perfectly smooth bar of the same nominal diameter. However, standard calculation methods using nominal diameter and standard density are generally accurate enough for most construction purposes.

Q3: Do I need to convert millimeters to meters in the formula?

A: Yes, for the formula Weight = (Area × Length) × Density to yield results in kilograms, all length-based units must be consistent. If density is in kg/m³, then Area must be in m² and Length must be in m. So, diameters in mm must be converted to meters.

Q4: What is the difference between nominal and actual bar diameter?

A: Nominal diameter is the theoretical or specified diameter used for calculations and identification. Actual diameter is the measured diameter, which may vary slightly within acceptable manufacturing tolerances.

Q5: Why is calculating rebar weight important?

A: It's vital for accurate material procurement, cost estimation, structural load calculations, transportation planning, and preventing material shortages or excess.

Q6: Can I use the linear density (kg/m) directly?

A: Yes, if you know the theoretical linear density for a specific bar diameter (often found in tables), you can simply multiply it by the total length in meters to get the weight in kilograms. Our calculator provides this intermediate value.

Q7: What if my project uses a different steel density?

A: While uncommon, if your project specifications call for a different density value, you can input it into the "Steel Density" field of the calculator. Ensure you are using the correct units (kg/m³).

Q8: How should I account for cutting waste?

A: Add a small percentage (e.g., 3-5%) to the total calculated weight to cover material lost during cutting and potential minor inaccuracies in bar lengths.

Related Tools and Internal Resources

© 2023 Your Construction Insights. All rights reserved.

function getElement(id) { return document.getElementById(id); } function validateInput(value, id, errorId, fieldName, allowEmpty = false, minValue = null, maxValue = null) { var errorElement = getElement(errorId); errorElement.textContent = "; if (!allowEmpty && (value === null || value === ")) { errorElement.textContent = fieldName + ' is required.'; return false; } if (value === ") return true; // Allow empty if allowed var numValue = parseFloat(value); if (isNaN(numValue)) { errorElement.textContent = fieldName + ' must be a valid number.'; return false; } if (minValue !== null && numValue maxValue) { errorElement.textContent = fieldName + ' cannot be greater than ' + maxValue + '.'; return false; } return true; } function calculateReinforcementWeight() { var diameterInput = getElement("barDiameter"); var lengthInput = getElement("barLength"); var densityInput = getElement("steelDensity"); var diameter = diameterInput.value; var length = lengthInput.value; var density = densityInput.value; var isValid = true; isValid = validateInput(diameter, "barDiameter", "barDiameterError", "Bar Diameter", false, 1) && isValid; isValid = validateInput(length, "barLength", "barLengthError", "Bar Length", false, 0.01) && isValid; isValid = validateInput(density, "steelDensity", "steelDensityError", "Steel Density", false, 1000) && isValid; if (!isValid) { getElement("result-section").style.display = "none"; return; } var diameter_mm = parseFloat(diameter); var length_m = parseFloat(length); var density_kg_m3 = parseFloat(density); // Convert diameter from mm to meters var diameter_m = diameter_mm / 1000; // Calculate Cross-Sectional Area in m^2 // A = pi * r^2 = pi * (d/2)^2 = (pi * d^2) / 4 var pi = Math.PI; var area_m2 = (pi * Math.pow(diameter_m, 2)) / 4; // Calculate Volume in m^3 var volume_m3 = area_m2 * length_m; // Calculate Weight in kg var weight_kg = volume_m3 * density_kg_m3; // Calculate Linear Density in kg/m var linear_density_kg_m = weight_kg / length_m; getElement("totalWeight").textContent = weight_kg.toFixed(2); getElement("barVolume").textContent = volume_m3.toFixed(6); getElement("barCrossSectionalArea").textContent = area_m2.toFixed(6); getElement("barLinearDensity").textContent = linear_density_kg_m.toFixed(3); getElement("result-section").style.display = "block"; updateChart(diameter_mm, length_m, density_kg_m3); } function resetCalculator() { getElement("barDiameter").value = ""; getElement("barLength").value = ""; getElement("steelDensity").value = "7850"; getElement("barDiameterError").textContent = ""; getElement("barLengthError").textContent = ""; getElement("steelDensityError").textContent = ""; getElement("totalWeight").textContent = "–"; getElement("barVolume").textContent = "–"; getElement("barCrossSectionalArea").textContent = "–"; getElement("barLinearDensity").textContent = "–"; getElement("result-section").style.display = "none"; // Clear chart data (optional, or reset to defaults) if (chartInstance) { chartInstance.destroy(); chartInstance = null; } initializeChart(); } function copyResults() { var totalWeight = getElement("totalWeight").textContent; var barVolume = getElement("barVolume").textContent; var barArea = getElement("barCrossSectionalArea").textContent; var linearDensity = getElement("barLinearDensity").textContent; if (totalWeight === "–") { alert("No results to copy yet."); return; } var assumptions = "Steel Density: " + getElement("steelDensity").value + " kg/m³"; var textToCopy = "Reinforcement Bar Weight Calculation:\n\n" + "Total Weight: " + totalWeight + " kg\n" + "Volume: " + barVolume + " m³\n" + "Cross-Sectional Area: " + barArea + " m²\n" + "Linear Density: " + linearDensity + " kg/m\n\n" + "Assumptions:\n" + assumptions; navigator.clipboard.writeText(textToCopy).then(function() { alert("Results copied to clipboard!"); }).catch(function(err) { console.error('Failed to copy: ', err); alert("Failed to copy results. Please copy manually."); }); } var chartInstance = null; function initializeChart() { var ctx = getElement('weightLengthChart').getContext('2d'); var commonLengths = [2, 4, 6, 8, 10, 12, 14, 16]; // Lengths for x-axis var commonDiameters = [8, 12, 16, 20]; // Diameters to plot var datasets = []; commonDiameters.forEach(function(diameter_mm) { var data = []; commonLengths.forEach(function(len) { var diameter_m = diameter_mm / 1000; var area_m2 = (Math.PI * Math.pow(diameter_m, 2)) / 4; var volume_m3 = area_m2 * len; var weight_kg = volume_m3 * 7850; // Using default density for chart data.push(weight_kg); }); datasets.push({ label: diameter_mm + ' mm Ø', data: data, borderColor: getRandomColor(), fill: false, tension: 0.1 }); }); chartInstance = new Chart(ctx, { type: 'line', data: { labels: commonLengths.map(function(l) { return l + ' m'; }), datasets: datasets }, options: { responsive: true, maintainAspectRatio: true, plugins: { title: { display: true, text: 'Rebar Weight vs. Length for Common Diameters', font: { size: 16 } }, legend: { position: 'top', } }, scales: { x: { title: { display: true, text: 'Rebar Length (meters)' } }, y: { title: { display: true, text: 'Weight (kg)' }, beginAtZero: true } } } }); } function updateChart(currentDiameter_mm, currentLength_m, currentDensity_kg_m3) { if (!chartInstance) { initializeChart(); return; } // Add a new dataset for the currently calculated value if it's not already represented var existingLabels = chartInstance.data.datasets.map(function(ds) { return ds.label; }); var currentDiameterLabel = currentDiameter_mm + ' mm Ø'; var dataExists = existingLabels.includes(currentDiameterLabel); if (dataExists) { // Update existing dataset if diameter matches var datasetIndex = existingLabels.indexOf(currentDiameterLabel); var diameter_m = currentDiameter_mm / 1000; var area_m2 = (Math.PI * Math.pow(diameter_m, 2)) / 4; var volume_m3 = area_m2 * currentLength_m; var weight_kg = volume_m3 * currentDensity_kg_m3; // Find the index for the current length in the labels var lengthIndex = chartInstance.data.labels.findIndex(function(label) { return label.replace(' m', ") == currentLength_m; }); if (lengthIndex !== -1) { chartInstance.data.datasets[datasetIndex].data[lengthIndex] = weight_kg; } else { // If the current length is new, add it to labels and all datasets chartInstance.data.labels.push(currentLength_m + ' m'); chartInstance.data.datasets.forEach(function(ds, idx) { var dia_m = parseFloat(ds.label.replace(' mm Ø', ")) / 1000; var ar_m2 = (Math.PI * Math.pow(dia_m, 2)) / 4; var vol_m3 = ar_m2 * currentLength_m; var w_kg = vol_m3 * 7850; // Use default density for consistency if not primary calc ds.data.push(w_kg); }); // Add the current calculation point as well chartInstance.data.datasets[datasetIndex].data.push(weight_kg); } } else { // Add a new dataset for the current diameter calculation if it's a new diameter var newDatasetData = []; var commonLengths = chartInstance.data.labels.map(function(l) { return parseFloat(l.replace(' m', ")); }); var diameter_m = currentDiameter_mm / 1000; var area_m2 = (Math.PI * Math.pow(diameter_m, 2)) / 4; commonLengths.forEach(function(len) { var volume_m3 = area_m2 * len; var weight_kg = volume_m3 * currentDensity_kg_m3; newDatasetData.push(weight_kg); }); // Add the specific point for the current length/weight newDatasetData.push(parseFloat(getElement("totalWeight").textContent)); chartInstance.data.datasets.push({ label: currentDiameterLabel, data: newDatasetData, borderColor: getRandomColor(), fill: false, tension: 0.1 }); } chartInstance.update(); } function getRandomColor() { var letters = '0123456789ABCDEF'; var color = '#'; for (var i = 0; i < 6; i++) { color += letters[Math.floor(Math.random() * 16)]; } return color; } // Initialize chart on page load window.onload = function() { initializeChart(); // Add listener to update chart if input values are already present on load getElement("barDiameter").addEventListener('input', function() { if (getElement("barDiameter").value && getElement("barLength").value) { updateChartOnInput(); } }); getElement("barLength").addEventListener('input', function() { if (getElement("barDiameter").value && getElement("barLength").value) { updateChartOnInput(); } }); getElement("steelDensity").addEventListener('input', function() { if (getElement("barDiameter").value && getElement("barLength").value) { updateChartOnInput(); } }); }; function updateChartOnInput() { var diameterInput = getElement("barDiameter"); var lengthInput = getElement("barLength"); var densityInput = getElement("steelDensity"); var diameter = diameterInput.value; var length = lengthInput.value; var density = densityInput.value; if (diameter && length && density) { var diameter_mm = parseFloat(diameter); var length_m = parseFloat(length); var density_kg_m3 = parseFloat(density); updateChart(diameter_mm, length_m, density_kg_m3); } }

Leave a Comment