Di Pipe Weight Calculation

DI Pipe Weight Calculator – Calculate Pipe Steel Weight Easily body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; background-color: #f8f9fa; color: #333; margin: 0; padding: 0; } .container { max-width: 960px; margin: 20px auto; padding: 25px; background-color: #fff; box-shadow: 0 4px 15px rgba(0, 0, 100, 0.1); border-radius: 8px; display: flex; flex-direction: column; align-items: center; } .calc-header { text-align: center; margin-bottom: 30px; padding-bottom: 15px; border-bottom: 2px solid #eee; width: 100%; } .calc-header h1 { color: #004a99; margin-bottom: 10px; } .calc-header p { font-size: 1.1em; color: #555; } .loan-calc-container { width: 100%; display: flex; flex-direction: column; align-items: center; } .input-group { width: 100%; margin-bottom: 20px; text-align: left; } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: #004a99; } .input-group input, .input-group select { width: calc(100% – 20px); padding: 12px 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 1em; box-sizing: border-box; } .input-group input:focus, .input-group select:focus { border-color: #004a99; outline: none; box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85em; color: #666; margin-top: 5px; display: block; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; display: none; min-height: 1em; } .error-message.visible { display: block; } .btn-group { width: 100%; margin-top: 20px; display: flex; justify-content: center; gap: 15px; } button { padding: 12px 25px; background-color: #004a99; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; transition: background-color 0.3s ease, transform 0.2s ease; } button:hover { background-color: #003366; transform: translateY(-2px); } button:active { transform: translateY(0); } .btn-secondary { background-color: #6c757d; } .btn-secondary:hover { background-color: #5a6268; } .results-container { width: 100%; margin-top: 30px; padding: 25px; background-color: #e9ecef; border-radius: 8px; text-align: center; } .results-container h3 { color: #004a99; margin-bottom: 20px; } .primary-result { font-size: 2.2em; font-weight: bold; color: #28a745; margin-bottom: 20px; padding: 15px; background-color: #ffffff; border: 2px solid #28a745; border-radius: 5px; display: inline-block; min-width: 150px; } .intermediate-results { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 15px; margin-bottom: 25px; } .intermediate-results div { background-color: #ffffff; padding: 15px; border-radius: 5px; border: 1px solid #ddd; text-align: center; flex: 1; min-width: 180px; } .intermediate-results span { display: block; font-size: 1.2em; font-weight: bold; color: #004a99; } .formula-explanation { font-size: 0.9em; color: #555; margin-top: 15px; border-top: 1px dashed #ccc; padding-top: 15px; } .chart-container { width: 100%; margin-top: 30px; padding: 20px; background-color: #fff; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 100, 0.05); } .chart-container h3 { text-align: center; color: #004a99; margin-bottom: 20px; } #pipeChart { width: 100%; max-width: 700px; margin: 0 auto; display: block; } .table-container { width: 100%; margin-top: 30px; overflow-x: auto; } .table-container h3 { text-align: center; color: #004a99; margin-bottom: 20px; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 12px 15px; text-align: left; border: 1px solid #ddd; } th { background-color: #004a99; color: white; font-weight: bold; } tr:nth-child(even) { background-color: #f2f2f2; } article { margin-top: 40px; padding: 30px; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 100, 0.05); } article h2, article h3 { color: #004a99; margin-bottom: 15px; padding-top: 15px; } article h2 { border-top: 2px solid #eee; padding-top: 25px; } article p, article ul, article ol { margin-bottom: 20px; color: #333; } article ul, article ol { padding-left: 25px; } article li { margin-bottom: 10px; } article strong { color: #004a99; } article a { color: #007bff; text-decoration: none; } article a:hover { text-decoration: underline; } .faq-list { border-left: 3px solid #004a99; padding-left: 15px; } .faq-list h3 { margin-bottom: 10px; } .faq-list p { margin-bottom: 15px; } .related-links { list-style: none; padding: 0; } .related-links li { margin-bottom: 15px; border-bottom: 1px dashed #eee; padding-bottom: 10px; } .related-links li:last-child { border-bottom: none; } .related-links span { display: block; font-size: 0.9em; color: #555; margin-top: 5px; } .highlight { font-weight: bold; color: #004a99; } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } .btn-group { flex-direction: column; align-items: center; } button { width: 80%; margin-bottom: 10px; } .intermediate-results { flex-direction: column; align-items: center; } .intermediate-results div { width: 90%; } }

DI Pipe Weight Calculator

Calculate the steel weight of Ductile Iron (DI) pipes accurately and quickly.

Pipe Specifications

Enter the Nominal Diameter in millimeters (mm).
Enter the length in meters (m).
Enter the wall thickness in millimeters (mm).
Density of DI material in kg/m³ (typical is 7200).

Calculation Results

— kg
Internal Diameter— mm
Pipe Volume— m³
Steel Volume— m³

Formula Used: Weight = (Volume of Steel) * (Material Density) Volume of Steel = (Volume of Outer Cylinder) – (Volume of Inner Cylinder) Volume of Cylinder = π * (Radius)² * Length Where Radius = Diameter / 2

Typical DI Pipe Wall Thicknesses (PN Rating)

Nominal Diameter (DN) mm Standard Wall Thickness (mm) Typical Density (kg/m³)
80 5.1 7200
100 5.3 7200
150 5.9 7200
200 6.5 7200
250 7.2 7200
300 7.7 7200
350 8.3 7200
400 8.8 7200

Note: Wall thickness can vary based on pressure rating (PN) and manufacturer specifications.

Weight vs. Diameter at Fixed Length and Thickness

What is DI Pipe Weight Calculation?

The DI pipe weight calculation refers to the process of determining the mass or weight of a specific length of Ductile Iron (DI) pipe. Ductile Iron is a strong and versatile material commonly used in various infrastructure projects, especially for water and sewage transportation systems, due to its durability, corrosion resistance, and flexibility. Accurately calculating the weight of DI pipes is crucial for several reasons, including logistics planning, transportation cost estimation, structural support design, and material procurement. This calculation involves understanding the pipe's dimensions, material properties, and applying fundamental physics principles.

Who Should Use DI Pipe Weight Calculation?

Professionals and stakeholders involved in infrastructure projects, manufacturing, and supply chain management will find DI pipe weight calculation indispensable. This includes:

  • Project Managers: For budgeting, logistics, and resource allocation.
  • Engineers: For designing support structures, assessing load capacities, and ensuring material specifications are met.
  • Procurement Specialists: For accurate material ordering and cost negotiation.
  • Logistics and Transportation Companies: For planning shipment sizes, vehicle requirements, and freight costs.
  • Manufacturers: For quality control, production planning, and inventory management.
  • Contractors: For site preparation, material handling, and installation planning.

Common Misconceptions

A common misconception is that all DI pipes of the same diameter and length weigh the same. However, the actual weight is significantly influenced by the wall thickness, which varies based on the pipe's pressure rating (e.g., PN10, PN16) and specific application. Another misconception is underestimating the importance of material density, which can slightly vary between different DI grades or manufacturing processes. Our DI pipe weight calculation tool accounts for these critical factors to provide precise results.

DI Pipe Weight Calculation Formula and Mathematical Explanation

The core principle behind the DI pipe weight calculation is to determine the volume of the metal (Ductile Iron) that makes up the pipe and then multiply it by the material's density. The formula can be broken down into the following steps:

Step-by-Step Derivation

  1. Calculate Radii: Determine the outer radius (R) from the nominal pipe diameter (ND) and the inner radius (r) from the calculated internal diameter.
    • Outer Radius (R) = Nominal Pipe Diameter (ND) / 2
    • Internal Diameter = Nominal Pipe Diameter (ND) – 2 * Wall Thickness
    • Inner Radius (r) = Internal Diameter / 2
  2. Calculate Volumes: Calculate the volume of the outer cylinder and the inner cylinder using the formula for the volume of a cylinder: V = π * radius² * length.
    • Volume of Outer Cylinder (V_outer) = π * R² * Length
    • Volume of Inner Cylinder (V_inner) = π * r² * Length
  3. Calculate Volume of Steel: The volume of the actual Ductile Iron material is the difference between the outer cylinder volume and the inner cylinder volume.
    • Volume of Steel (V_steel) = V_outer – V_inner = π * Length * (R² – r²)
  4. Calculate Weight: Multiply the volume of steel by the density of Ductile Iron to get the total weight.
    • Weight = V_steel * Material Density

Variable Explanations

  • Nominal Pipe Diameter (ND): The standard size designation for the pipe, typically given in millimeters (mm). It's a reference size, not an exact outer or inner dimension.
  • Pipe Length (L): The total length of the pipe section being calculated, usually in meters (m).
  • Wall Thickness (t): The thickness of the iron material forming the pipe wall, in millimeters (mm). This is a critical factor affecting weight.
  • Material Density (ρ): The mass per unit volume of Ductile Iron. A typical value is 7200 kg/m³.
  • π (Pi): The mathematical constant, approximately 3.14159.

Variables Table

Variable Meaning Unit Typical Range / Value
ND Nominal Pipe Diameter mm 80 – 1200+
L Pipe Length m 1 – 12 (standard lengths)
t Wall Thickness mm 3 – 20+ (depending on ND and PN rating)
ρ Material Density kg/m³ ~7000 – 7200
R Outer Radius m ND / 2000
r Inner Radius m (ND – 2t) / 2000
V_steel Volume of Steel Calculated
Weight Total Weight of Pipe kg Calculated

Practical Examples (Real-World Use Cases)

Example 1: Standard Water Main

A municipality is planning a new water distribution line and needs to procure 500 meters of DI pipe. They are using pipes with a Nominal Diameter (ND) of 150 mm and a standard wall thickness for PN16 rating, which is approximately 5.9 mm. The standard pipe length is 6 meters.

  • Inputs:
    • Nominal Pipe Diameter (ND): 150 mm
    • Pipe Length (L): 6 m
    • Wall Thickness (t): 5.9 mm
    • Material Density (ρ): 7200 kg/m³
  • Calculation:
    • Outer Radius (R) = 150 mm / 2 = 75 mm = 0.075 m
    • Internal Diameter = 150 mm – 2 * 5.9 mm = 150 – 11.8 = 138.2 mm
    • Inner Radius (r) = 138.2 mm / 2 = 69.1 mm = 0.0691 m
    • Volume of Steel (V_steel) = π * 6 * (0.075² – 0.0691²) m³
    • V_steel = π * 6 * (0.005625 – 0.00477481) m³
    • V_steel = π * 6 * 0.00085019 m³ ≈ 0.01602 m³
    • Weight = 0.01602 m³ * 7200 kg/m³ ≈ 115.3 kg
  • Result: A single 6-meter length of 150 mm DI pipe with a 5.9 mm wall thickness weighs approximately 115.3 kg.
  • Financial Interpretation: For 500 meters (which is 500 / 6 ≈ 83.3 pipes, so 84 pipes), the total weight would be 84 * 115.3 kg ≈ 9685 kg. This weight is critical for determining transportation load limits and handling equipment requirements.

Example 2: Large Diameter Sewer Line

A contractor is installing a large-diameter DI pipeline for a sewer project. They need to calculate the weight for a 12-meter long pipe with ND 400 mm and a wall thickness of 8.8 mm (suitable for high-pressure applications).

  • Inputs:
    • Nominal Pipe Diameter (ND): 400 mm
    • Pipe Length (L): 12 m
    • Wall Thickness (t): 8.8 mm
    • Material Density (ρ): 7200 kg/m³
  • Calculation:
    • Outer Radius (R) = 400 mm / 2 = 200 mm = 0.200 m
    • Internal Diameter = 400 mm – 2 * 8.8 mm = 400 – 17.6 = 382.4 mm
    • Inner Radius (r) = 382.4 mm / 2 = 191.2 mm = 0.1912 m
    • Volume of Steel (V_steel) = π * 12 * (0.200² – 0.1912²) m³
    • V_steel = π * 12 * (0.040000 – 0.03655744) m³
    • V_steel = π * 12 * 0.00344256 m³ ≈ 0.1297 m³
    • Weight = 0.1297 m³ * 7200 kg/m³ ≈ 933.8 kg
  • Result: A single 12-meter length of 400 mm DI pipe with an 8.8 mm wall thickness weighs approximately 933.8 kg.
  • Financial Interpretation: These heavy pipes require specialized lifting equipment (like cranes or heavy-duty forklifts) and careful planning for installation. The high weight also contributes significantly to transportation costs per unit length.

How to Use This DI Pipe Weight Calculator

Our DI Pipe Weight Calculator is designed for simplicity and accuracy. Follow these steps to get your weight calculations:

Step-by-Step Instructions

  1. Input Pipe Diameter (ND): Enter the Nominal Diameter of the DI pipe in millimeters (mm) into the first field.
  2. Input Pipe Length: Enter the length of the pipe section in meters (m). Standard lengths are often 6 meters, but you can input any value.
  3. Input Wall Thickness: Enter the specific wall thickness of the pipe in millimeters (mm). This is crucial for accurate weight. Refer to pipe specifications or standards if unsure.
  4. Input Material Density: The calculator defaults to a typical density of 7200 kg/m³. You can adjust this if your DI material has a different specified density.
  5. Click 'Calculate Weight': Once all values are entered, click the "Calculate Weight" button.

How to Read Results

  • Primary Result (Weight): The largest, highlighted number shows the total calculated weight of the pipe section in kilograms (kg).
  • Intermediate Values:
    • Internal Diameter: Shows the calculated inner diameter based on ND and wall thickness.
    • Pipe Volume: The total volume enclosed by the outer diameter of the pipe.
    • Steel Volume: The calculated volume of the Ductile Iron material itself.
  • Key Assumptions: The calculation assumes a perfectly cylindrical pipe and uses the provided density. The formula displayed clarifies the mathematical approach.

Decision-Making Guidance

Use the calculated weight for:

  • Budgeting: Estimate raw material costs and transportation expenses.
  • Logistics: Determine the number of trucks or shipping containers needed and their payload capacity.
  • Site Planning: Ensure adequate lifting and handling equipment is available on-site.
  • Structural Design: Verify that foundations and support systems can handle the load.

Utilize the "Copy Results" button to easily transfer the data for reports or further analysis.

Key Factors That Affect DI Pipe Weight Results

While the formula is straightforward, several factors can influence the final DI pipe weight calculation. Understanding these is key to achieving the most accurate results:

  1. Wall Thickness Variation: This is the most significant factor after diameter. Different pressure ratings (PN ratings) require thicker walls. Always use the precise wall thickness specified for the pipe class (e.g., PN10, PN16, PN25). Thicker walls mean more material, hence higher weight.
  2. Nominal Diameter (ND) vs. Actual Outer Diameter (OD): ND is a standard size designation. The actual Outer Diameter (OD) might slightly vary between manufacturers or standards. While our calculator uses ND to derive the outer radius, be aware that for highly precise calculations, using the exact OD specified in the product datasheet is preferable.
  3. Material Density Variations: While 7200 kg/m³ is a common average density for Ductile Iron, slight variations can occur due to the specific alloy composition, manufacturing process, and temperature. Consistent quality control ensures density remains within a tight tolerance.
  4. Pipe Length Precision: Ensure the inputted pipe length is accurate. Standard lengths are common, but custom lengths or slight manufacturing variances can affect the total weight for long runs.
  5. Fittings and Specials: This calculator calculates the weight of straight pipe sections only. DI bends, tees, sockets, and flanges have different shapes and require separate weight calculations or referencing manufacturer data, significantly impacting the total project weight.
  6. Manufacturing Tolerances: Like any manufactured product, DI pipes have tolerances for diameter and wall thickness. While standard calculations use nominal values, actual weights might differ slightly due to these inherent manufacturing variations.
  7. Coatings and Linings: Some DI pipes have internal linings (e.g., cement mortar) or external coatings (e.g., zinc and bitumen). These add a small amount of weight, which is typically not included in basic DI pipe weight calculations but can be relevant for very large projects or specific requirements.
  8. Temperature Effects: While negligible for most practical applications, materials expand or contract with temperature. This can minutely affect dimensions and thus volume, but the density change is usually more significant if working across extreme temperature ranges.

Frequently Asked Questions (FAQ)

Q1: What is the difference between Ductile Iron (DI) and Cast Iron (CI)?

A: Ductile Iron (DI) has graphite in a nodular (spheroidal) form, giving it higher tensile strength, ductility, and impact resistance compared to Grey Cast Iron (CI), where graphite exists as flakes. This makes DI pipes more resilient and suitable for applications requiring flexibility and resistance to breakage.

Q2: Can I use this calculator for Steel Pipes?

A: No, this calculator is specifically designed for Ductile Iron pipes. Steel pipes have different material densities and often different dimensional standards. You would need a dedicated steel pipe weight calculator.

Q3: What does 'PN Rating' mean for DI pipes?

A: PN stands for 'Nominal Pressure' or 'Pressure Nominal'. It indicates the maximum pressure (in bars) the pipe can withstand at room temperature. Higher PN ratings (e.g., PN16, PN25) require thicker walls than lower ratings (e.g., PN10), thus increasing the pipe's weight.

Q4: How do I find the Wall Thickness if it's not specified?

A: Wall thickness is directly related to the pipe's intended application and pressure rating (PN class). Consult the pipe manufacturer's specifications, relevant industry standards (like ISO 2531, EN 545, or AWWA C151/C111), or your project engineer to determine the correct wall thickness for your specific requirements.

Q5: Does the calculation account for pipe joints (sockets)?

A: No, this calculator is for straight pipe sections only. Joints like sockets, flanges, and mechanical couplings add weight and complexity that need separate calculations or data from the manufacturer.

Q6: Why is accurate DI pipe weight calculation important?

A: Accurate weight calculation is vital for transportation logistics (ensuring vehicles are not overloaded and freight costs are correct), structural engineering (designing foundations and supports), material procurement (accurate ordering and cost management), and safe on-site handling (using appropriate lifting equipment).

Q7: What is the typical density of Ductile Iron?

A: The typical density of Ductile Iron is around 7200 kg/m³. This value is commonly used in calculations, but it's always best to verify with the specific material datasheet if available.

Q8: Can I calculate the weight of a single component like a DI bend?

A: This calculator is for straight pipes. Bends, tees, and other fittings have complex geometries. Their weight is usually provided by the manufacturer or requires specialized CAD software for accurate volume calculation. The formula used here is not directly applicable to fittings.

Related Tools and Internal Resources

function getElement(id) { return document.getElementById(id); } function validateInput(value, id, errorId, min, max, name) { var errorElement = getElement(errorId); errorElement.textContent = "; errorElement.classList.remove('visible'); if (value === ") { errorElement.textContent = name + ' cannot be empty.'; errorElement.classList.add('visible'); return false; } var numValue = parseFloat(value); if (isNaN(numValue)) { errorElement.textContent = name + ' must be a valid number.'; errorElement.classList.add('visible'); return false; } if (min !== undefined && numValue max) { errorElement.textContent = name + ' cannot be greater than ' + max + '.'; errorElement.classList.add('visible'); return false; } return true; } function calculateWeight() { var pipeDiameter = getElement("pipeDiameter").value; var pipeLength = getElement("pipeLength").value; var wallThickness = getElement("wallThickness").value; var materialDensity = getElement("materialDensity").value; var validDiameter = validateInput(pipeDiameter, "pipeDiameter", "pipeDiameterError", 1, 5000, "Nominal Pipe Diameter"); var validLength = validateInput(pipeLength, "pipeLength", "pipeLengthError", 0.1, 1000, "Pipe Length"); var validThickness = validateInput(wallThickness, "wallThickness", "wallThicknessError", 0.1, 500, "Wall Thickness"); var validDensity = validateInput(materialDensity, "materialDensity", "materialDensityError", 1000, 10000, "Material Density"); if (!validDiameter || !validLength || !validThickness || !validDensity) { return; } var nd = parseFloat(pipeDiameter); var len = parseFloat(pipeLength); var t = parseFloat(wallThickness); var density = parseFloat(materialDensity); var outerRadius = nd / 2000; // Convert mm to meters var innerDiameter = nd – (2 * t); var innerRadius = innerDiameter / 2000; // Convert mm to meters if (innerRadius <= 0) { var errorElement = getElement("wallThicknessError"); errorElement.textContent = 'Wall thickness is too large for the given diameter.'; errorElement.classList.add('visible'); return; } var steelVolume = Math.PI * len * (Math.pow(outerRadius, 2) – Math.pow(innerRadius, 2)); var totalWeight = steelVolume * density; var pipeVolume = Math.PI * Math.pow(outerRadius, 2) * len; getElement("internalDiameterValue").textContent = innerDiameter.toFixed(2) + " mm"; getElement("pipeVolumeValue").textContent = pipeVolume.toFixed(4) + " m³"; getElement("steelVolumeValue").textContent = steelVolume.toFixed(4) + " m³"; getElement("result").textContent = totalWeight.toFixed(2) + " kg"; updateChart(nd, len, t, density); } function resetCalculator() { getElement("pipeDiameter").value = "150"; getElement("pipeLength").value = "6"; getElement("wallThickness").value = "5.9"; getElement("materialDensity").value = "7200"; getElement("pipeDiameterError").textContent = ''; getElement("pipeDiameterError").classList.remove('visible'); getElement("pipeLengthError").textContent = ''; getElement("pipeLengthError").classList.remove('visible'); getElement("wallThicknessError").textContent = ''; getElement("wallThicknessError").classList.remove('visible'); getElement("materialDensityError").textContent = ''; getElement("materialDensityError").classList.remove('visible'); getElement("internalDiameterValue").textContent = "– mm"; getElement("pipeVolumeValue").textContent = "– m³"; getElement("steelVolumeValue").textContent = "– m³"; getElement("result").textContent = "– kg"; clearChart(); } function copyResults() { var mainResult = getElement("result").textContent; var internalDiameter = getElement("internalDiameterValue").textContent; var pipeVolume = getElement("pipeVolumeValue").textContent; var steelVolume = getElement("steelVolumeValue").textContent; var pipeDiameterInput = getElement("pipeDiameter").value; var pipeLengthInput = getElement("pipeLength").value; var wallThicknessInput = getElement("wallThickness").value; var materialDensityInput = getElement("materialDensity").value; var assumptions = "Key Assumptions:\n" + "- Nominal Pipe Diameter (ND): " + pipeDiameterInput + " mm\n" + "- Pipe Length: " + pipeLengthInput + " m\n" + "- Wall Thickness: " + wallThicknessInput + " mm\n" + "- Material Density: " + materialDensityInput + " kg/m³"; var textToCopy = "— DI Pipe Weight Calculation Results —\n\n" + "Total Weight: " + mainResult + "\n\n" + "Intermediate Values:\n" + "- Internal Diameter: " + internalDiameter + "\n" + "- Pipe Volume: " + pipeVolume + "\n" + "- Steel Volume: " + steelVolume + "\n\n" + assumptions; navigator.clipboard.writeText(textToCopy).then(function() { alert('Results copied to clipboard!'); }, function(err) { console.error('Could not copy text: ', err); alert('Failed to copy results. Please copy manually.'); }); } var pipeChart; var chartContext; function updateChart(currentDiameter, length, thickness, density) { var canvas = getElement('pipeChart'); if (!chartContext) { chartContext = canvas.getContext('2d'); } var diameters = []; var weights = []; var standardThicknesses = [5.1, 5.3, 5.9, 6.5, 7.2, 7.7, 8.3, 8.8]; // Example PN ratings // Calculate weights for a range of diameters, keeping other params same var minDiameter = Math.max(80, currentDiameter / 2); var maxDiameter = currentDiameter * 1.5; var step = (maxDiameter – minDiameter) / 10; for (var d = minDiameter; d <= maxDiameter; d += step) { if (d 0) { var vol_steel = Math.PI * length * (Math.pow(r_outer, 2) – Math.pow(r_inner, 2)); weights.push(vol_steel * density); } else { weights.push(0); // Handle cases where thickness is too large } } // Data for standard thicknesses at the current diameter var standardWeights = []; for (var i = 0; i 0) { var vol_steel = Math.PI * length * (Math.pow(r_outer, 2) – Math.pow(r_inner, 2)); standardWeights.push(vol_steel * density); } else { standardWeights.push(0); } } if (pipeChart) { pipeChart.destroy(); } pipeChart = new Chart(chartContext, { type: 'line', data: { labels: diameters.map(function(d) { return d.toFixed(0) + " mm"; }), datasets: [{ label: 'Weight vs. Diameter (Fixed Thickness)', data: weights, borderColor: 'rgb(0, 74, 153)', backgroundColor: 'rgba(0, 74, 153, 0.1)', fill: true, tension: 0.1 }] }, options: { responsive: true, maintainAspectRatio: true, scales: { y: { beginAtZero: true, title: { display: true, text: 'Weight (kg)' } }, x: { title: { display: true, text: 'Nominal Pipe Diameter (mm)' } } }, plugins: { tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || "; if (label) { label += ': '; } if (context.parsed.y !== null) { label += context.parsed.y.toFixed(2) + ' kg'; } return label; } } } } } }); } function clearChart() { if (pipeChart) { pipeChart.destroy(); pipeChart = null; } if (chartContext) { chartContext.clearRect(0, 0, getElement('pipeChart').width, getElement('pipeChart').height); } } // Initial calculation and chart rendering on load window.onload = function() { calculateWeight(); };

Leave a Comment