Calculate Feet from Weight of Wire

Wire Length Calculator: Calculate Feet from Wire Weight body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f8f9fa; color: #333; line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 960px; margin: 20px auto; padding: 20px; background-color: #ffffff; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; align-items: center; } header { background-color: #004a99; color: white; padding: 20px 0; text-align: center; width: 100%; border-top-left-radius: 8px; border-top-right-radius: 8px; margin-bottom: 20px; } header h1 { margin: 0; font-size: 2.2em; font-weight: 700; } .subtitle { font-size: 1.1em; opacity: 0.9; margin-top: 5px; } .calculator-section { width: 100%; margin-bottom: 30px; padding: 25px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05); } h2, h3 { color: #004a99; margin-bottom: 15px; text-align: center; font-weight: 600; } .input-group { margin-bottom: 20px; width: 100%; display: flex; flex-direction: column; align-items: flex-start; } .input-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #555; } .input-group input[type="number"], .input-group select { width: calc(100% – 20px); padding: 12px 10px; border: 1px solid #ced4da; border-radius: 5px; font-size: 1em; box-sizing: border-box; transition: border-color 0.3s ease; } .input-group input[type="number"]: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: #6c757d; margin-top: 5px; display: block; } .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ width: 100%; } .button-group { display: flex; justify-content: center; gap: 15px; margin-top: 25px; width: 100%; } button { padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: 500; transition: background-color 0.3s ease, transform 0.2s ease; } button:hover { transform: translateY(-2px); } .btn-calculate { background-color: #004a99; color: white; } .btn-calculate:hover { background-color: #003a7c; } .btn-reset { background-color: #6c757d; color: white; } .btn-reset:hover { background-color: #5a6268; } .btn-copy { background-color: #28a745; color: white; } .btn-copy:hover { background-color: #218838; } .results-section { width: 100%; margin-top: 30px; padding: 25px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #e9ecef; text-align: center; } .primary-result { font-size: 2.5em; font-weight: 700; color: #004a99; margin: 15px 0; padding: 15px; background-color: #cfe2ff; border-radius: 8px; display: inline-block; min-width: 50%; } .intermediate-results div, .formula-explanation { margin-bottom: 15px; font-size: 1.1em; } .intermediate-results span { font-weight: 600; color: #004a99; } .formula-explanation strong { color: #004a99; } .chart-container { width: 100%; margin-top: 30px; padding: 25px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05); } .chart-caption { text-align: center; font-style: italic; color: #6c757d; margin-bottom: 15px; font-size: 0.95em; } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); } th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #dee2e6; } thead { background-color: #004a99; color: white; } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e2e2e2; } .article-section { width: 100%; margin-top: 40px; padding: 25px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05); } .article-section h2, .article-section h3 { text-align: left; margin-bottom: 20px; } .article-section p { margin-bottom: 15px; } .article-section ul, .article-section ol { margin-left: 20px; margin-bottom: 15px; } .article-section li { margin-bottom: 8px; } .article-section table { margin-top: 10px; } .article-section .faq-item { margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px dashed #ccc; } .article-section .faq-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; } .article-section .faq-question { font-weight: 600; color: #004a99; margin-bottom: 8px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; } .article-section .faq-answer { display: none; margin-top: 8px; padding-left: 10px; } .article-section .faq-question::after { content: '+'; font-size: 1.2em; color: #004a99; } .article-section .faq-question.active::after { content: '-'; } .internal-links-section { margin-top: 40px; padding: 25px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.05); } .internal-links-section h2 { text-align: left; margin-bottom: 20px; } .internal-links-section ul { list-style: none; padding: 0; margin: 0; } .internal-links-section li { margin-bottom: 10px; } .internal-links-section a { color: #004a99; text-decoration: none; font-weight: 500; } .internal-links-section a:hover { text-decoration: underline; } .internal-links-section p { font-size: 0.9em; color: #555; margin-top: 5px; } canvas { display: block; margin: 20px auto 0 auto; max-width: 100%; height: auto !important; /* Override potential inline styles from libraries */ } @media (max-width: 768px) { .container { margin: 10px; padding: 15px; } header h1 { font-size: 1.8em; } button { padding: 10px 20px; font-size: 0.95em; } .primary-result { font-size: 2em; } }

Wire Length Calculator

Calculate Feet from Wire Weight Accurately

Calculate Wire Length by Weight

Enter the details of your wire to find out its estimated length in feet.

Enter the total weight of the wire spool/coil (in pounds).
Enter the weight of one foot of this specific wire type (in pounds per foot).

Results

Weight Per Foot: N/A lbs/ft
Total Weight: N/A lbs
Estimated Length: N/A ft
Length: N/A ft
Formula:
Estimated Length (ft) = Total Wire Weight (lbs) / Weight Per Foot (lbs/ft)

Wire Length vs. Weight Projection

This chart visualizes the relationship between wire weight and its estimated length based on the entered 'Weight Per Foot'.
Weight (lbs) Estimated Length (ft)
50 N/A
100 N/A
200 N/A

What is Wire Length Calculation by Weight?

Calculating the feet of wire from its weight is a practical method used by electricians, engineers, and DIY enthusiasts to estimate the usable length of wire available on a spool or coil when the exact length marking is unclear or missing. This process leverages the known physical properties of the wire, specifically its weight per unit of length. By measuring the total weight of the wire and knowing how much a single foot of that wire weighs, one can accurately derive the total linear footage. This wire length calculation by weight is crucial for project planning, material management, and ensuring sufficient wire is on hand for electrical installations.

This tool is invaluable for anyone working with bulk wire, such as electrical contractors managing large job sites, manufacturers verifying inventory, or even homeowners who might have leftover wire from previous projects. It eliminates the need for tedious unspooling and measuring. A common misconception is that all wires of the same gauge have the same weight. However, variations in conductor material (e.g., copper vs. aluminum), insulation type and thickness, and manufacturing tolerances mean that the weight per foot can differ even for wires with the same AWG (American Wire Gauge) size. Therefore, using the specific wire length calculation by weight for *your* particular wire is paramount.

Wire Length Calculation by Weight Formula and Mathematical Explanation

The fundamental principle behind calculating wire length from weight is a direct proportionality. If you know the weight of a single unit of length (in this case, one foot), you can determine the total length by dividing the total weight by the weight per foot.

The formula is derived as follows:

We start with the definition of linear density (or weight per unit length):
Linear Density = Total Weight / Total Length

Rearranging this formula to solve for Total Length, we get:
Total Length = Total Weight / Linear Density

In the context of wire:

Estimated Length (in feet) = Total Wire Weight (in pounds) / Weight Per Foot (in pounds per foot)

Variables and Units

Variable Meaning Unit Typical Range
Total Wire Weight The measured weight of the entire length of wire in question. Pounds (lbs) 0.1 lbs – 5000+ lbs
Weight Per Foot The specific weight of one linear foot of the wire, including conductor and insulation. This is a critical specification for the wire type. Pounds per Foot (lbs/ft) 0.0001 lbs/ft (thin magnet wire) – 5+ lbs/ft (large gauge industrial cable)
Estimated Length The calculated total length of the wire. Feet (ft) Varies greatly based on inputs.

Accurate wire length calculation by weight relies heavily on the precision of these two input values. The 'Weight Per Foot' is usually available from the wire manufacturer's specifications sheet (often called a "cable reel data sheet" or "datasheet"). If unavailable, it can be approximated by weighing a known length (e.g., 10 or 100 feet) and dividing the weight by that length.

Practical Examples (Real-World Use Cases)

Example 1: Estimating Length of Copper Building Wire

An electrician is working on a large residential project and needs to know how much 12-gauge copper THHN wire is left on a large spool. The spool is unlabeled, but the electrician weighs it and finds the wire weighs 150 lbs. Consulting the manufacturer's datasheet, they find that 12-gauge copper THHN wire weighs approximately 0.025 lbs per foot.

Inputs:

  • Total Wire Weight: 150 lbs
  • Weight Per Foot: 0.025 lbs/ft

Calculation:
Estimated Length = 150 lbs / 0.025 lbs/ft = 6000 ft

Interpretation: The electrician can confidently estimate that there are 6,000 feet of wire remaining on the spool. This is a standard length for large spools, suggesting it might be a new or nearly full spool, which is excellent for completing the project's wiring needs. This efficient wire length calculation by weight prevents unnecessary ordering of new materials.

Example 2: Checking Aluminum Feeder Cable Quantity

A facility manager needs to verify the amount of 4/0 AWG aluminum feeder cable on hand for an upcoming upgrade. They weigh a section of the cable that was recently cut and find it weighs 45 lbs. The specifications for this particular 4/0 aluminum cable indicate a weight of approximately 0.75 lbs per foot.

Inputs:

  • Total Wire Weight: 45 lbs
  • Weight Per Foot: 0.75 lbs/ft

Calculation:
Estimated Length = 45 lbs / 0.75 lbs/ft = 60 ft

Interpretation: The manager determines they have about 60 feet of the 4/0 aluminum feeder cable. This quantity might be sufficient for the planned connection, or they may need to order more depending on the exact requirements of the upgrade. This quick calculation using wire length calculation by weight ensures accurate inventory assessment.

How to Use This Wire Length Calculator

Our online calculator simplifies the process of determining wire length from weight. Follow these steps for accurate results:

  1. Measure Total Wire Weight: Accurately weigh the entire spool, coil, or length of wire you are working with. Ensure your scale is calibrated and provides readings in pounds (lbs). Enter this value into the "Wire Weight" field.
  2. Find Weight Per Foot: Locate the manufacturer's specifications for your specific wire type and gauge. This data is often found on the manufacturer's website or the original product packaging/datasheet. Look for the "weight per foot" or "linear density" value, typically in pounds per foot (lbs/ft). Enter this precise value into the "Weight Per Foot" field. If you cannot find the exact specification, you can estimate it by weighing a known length (e.g., 100 ft) and dividing that weight by the length.
  3. Click Calculate: Once both values are entered, click the "Calculate" button.
  4. Review Results: The calculator will display the estimated total length of your wire in feet. It will also show the intermediate values used in the calculation and provide a visual representation on the chart.
  5. Copy Results (Optional): If you need to document or share these figures, use the "Copy Results" button to copy the main estimate, intermediate values, and key assumptions to your clipboard.
  6. Reset Calculator: To perform a new calculation, click the "Reset" button, which will clear all fields and restore default values.

Reading Results: The primary result, prominently displayed, is your estimated wire length in feet. The intermediate results confirm the inputs and provide context. The chart offers a visual projection, and the table summarizes key data points for different weights.

Decision-Making Guidance: Use the calculated length to determine if you have enough wire for a project, if a spool needs replacing, or to manage inventory effectively. Compare the result against your project's requirements to make informed decisions about material procurement and usage. This tool empowers you to avoid costly errors associated with incorrect wire length estimations.

Key Factors That Affect Wire Length Calculation Results

While the formula for wire length calculation by weight is straightforward, several factors can influence the accuracy of the results:

  • Accuracy of Weight Measurement: The precision of your scale is critical. Even small inaccuracies in measuring the total wire weight can lead to significant deviations in the calculated length, especially for large spools. Always use a properly calibrated scale.
  • Precision of Weight Per Foot Data: This is arguably the most crucial factor. The manufacturer's stated weight per foot is an average. Actual weight can vary due to:
    • Conductor Material: Copper is denser than aluminum, so copper wire of the same gauge will weigh more per foot. Ensure you are using the specification for the correct conductor material.
    • Insulation Type and Thickness: Different insulation materials (e.g., PVC, XLPE, rubber) have different densities and thicknesses, affecting the overall weight. The type of jacketing or shielding also adds weight.
    • Manufacturing Tolerances: Wire manufacturers have acceptable tolerance ranges for dimensions and material composition, which can lead to slight variations in weight per foot from batch to batch or even within the same spool.
  • Moisture Content: For wires stored in humid environments, the insulation or jacketing might absorb some moisture, slightly increasing the overall weight and thus artificially inflating the calculated length.
  • Presence of Other Materials: Ensure the weight measurement includes *only* the wire. Remove any cardboard cores, packaging materials, or other contaminants before weighing the spool.
  • Wire Gauge and Construction: While gauge (like AWG) is a primary indicator, variations in stranding (solid vs. stranded) and specific construction details (e.g., concentric stranding, compact stranding) can subtly affect the weight per foot. Always refer to the exact specification for your wire.
  • Temperature Effects: While negligible for most practical purposes, extreme temperature variations can cause minor expansion or contraction of the wire material, slightly altering its density and thus weight. This effect is usually insignificant for standard industrial calculations.

Understanding these factors helps in interpreting the calculated length as an "estimated" value. For critical applications, it may be prudent to perform a small-scale test by weighing a known length of wire to verify the manufacturer's specifications.

Frequently Asked Questions (FAQ)

What is the most common unit for wire weight?
The most common units for wire weight are pounds (lbs) per foot (ft) or kilograms (kg) per kilometer (km). Our calculator uses pounds per foot for user convenience in the US market.
How do I find the "Weight Per Foot" for my wire?
The best source is the wire manufacturer's datasheet or specification sheet. This information is usually available on their website. You can also estimate it by weighing a precisely measured length (e.g., 100 ft) and dividing the weight by that length.
Can I use this calculator for any type of wire?
Yes, as long as you have the correct "Weight Per Foot" specification for that specific wire type (e.g., copper, aluminum, different insulation types, various gauges). The formula is universal.
What if the wire is stranded instead of solid?
The "Weight Per Foot" specification usually accounts for whether the wire is solid or stranded. Ensure you use the correct value provided by the manufacturer for the specific construction of your wire. Stranding can slightly affect density and thus weight.
Does the insulation material affect the weight per foot?
Absolutely. Different insulation materials have varying densities and thicknesses. For example, a PVC-insulated wire will likely weigh differently than a similar gauge wire with a thicker, high-temperature insulation like XLPE or rubber. Always use the specification relevant to your wire's exact construction.
What is the difference between copper and aluminum wire weight?
Copper is significantly denser than aluminum. Therefore, a copper wire will weigh more per foot than an aluminum wire of the exact same gauge and construction. This is a critical distinction when looking up "Weight Per Foot" specifications.
Can I use a calculator that converts weight to length in different units (e.g., kg to meters)?
Yes, the principle remains the same. You would need to ensure your inputs (total weight and weight per unit length) are in consistent units (e.g., kg and kg/meter) to get the output in the desired unit (meters). This calculator is specifically designed for imperial units (lbs and ft). For other unit systems, consult specialized calculators or perform manual unit conversions.
How accurate is this wire length calculation by weight?
The accuracy depends entirely on the accuracy of your two inputs: the total wire weight and, most importantly, the manufacturer's "Weight Per Foot" specification. Assuming accurate inputs, the calculation itself is precise. Real-world variations in manufacturing and environmental conditions (like moisture) are the primary sources of potential discrepancies.
function validateInput(id, errorId, minValue, maxValue) { var input = document.getElementById(id); var errorElement = document.getElementById(errorId); var value = parseFloat(input.value); errorElement.style.display = 'none'; input.style.borderColor = '#ced4da'; if (input.value === "") { errorElement.innerText = "This field cannot be empty."; errorElement.style.display = 'block'; input.style.borderColor = '#dc3545'; return false; } if (isNaN(value)) { errorElement.innerText = "Please enter a valid number."; errorElement.style.display = 'block'; input.style.borderColor = '#dc3545'; return false; } if (minValue !== undefined && value maxValue) { errorElement.innerText = "Value cannot be greater than " + maxValue + "."; errorElement.style.display = 'block'; input.style.borderColor = '#dc3545'; return false; } return true; } function calculateWireLength() { var wireWeightInput = document.getElementById("wireWeight"); var weightPerFootInput = document.getElementById("weightPerFoot"); var isValidWeight = validateInput("wireWeight", "wireWeightError", 0); var isValidWpf = validateInput("weightPerFoot", "weightPerFootError", 0.000001); // Minimum practical value > 0 if (!isValidWeight || !isValidWpf) { return; } var wireWeight = parseFloat(wireWeightInput.value); var weightPerFoot = parseFloat(weightPerFootInput.value); var estimatedLength = wireWeight / weightPerFoot; document.getElementById("estimatedLengthResult").querySelector("span").innerText = estimatedLength.toFixed(2); document.getElementById("result").querySelector("span").innerText = estimatedLength.toFixed(2); document.getElementById("totalWeightResult").querySelector("span").innerText = wireWeight.toFixed(2); document.getElementById("weightPerFootResult").querySelector("span").innerText = weightPerFoot.toFixed(6); // Display with more precision updateChartAndTable(weightPerFoot, wireWeight); } function updateChartAndTable(weightPerFoot, currentWeight) { var chart = new Chart(document.getElementById("wireLengthChart").getContext("2d"), { type: 'line', data: { labels: ["0 lbs", "50 lbs", "100 lbs", "200 lbs", "500 lbs", "1000 lbs"], datasets: [ { label: 'Estimated Length (ft)', data: [], borderColor: '#004a99', backgroundColor: 'rgba(0, 74, 153, 0.2)', fill: true, tension: 0.1 }, { label: 'Input Weight', data: [], // This dataset will mark the input weight visually borderColor: '#28a745', backgroundColor: 'rgba(40, 167, 69, 0.5)', fill: false, pointRadius: 6, pointHoverRadius: 8, showLine: false // Don't draw a line for this series } ] }, options: { responsive: true, maintainAspectRatio: false, scales: { x: { title: { display: true, text: 'Wire Weight (lbs)' } }, y: { title: { display: true, text: 'Estimated Length (ft)' }, beginAtZero: true } }, 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); } return label; } } } } } }); var weights = [0, 50, 100, 200, 500, 1000]; var lengths = weights.map(function(w) { return w / weightPerFoot; }); chart.data.datasets[0].data = lengths; // Add marker for the input weight var inputWeightIndex = weights.indexOf(Math.min( …weights.filter(function(w) { return w >= currentWeight; }) )); if (inputWeightIndex === -1) { // If currentWeight is greater than all labels chart.data.datasets[1].data = [{x: currentWeight, y: currentWeight / weightPerFoot}]; } else { chart.data.datasets[1].data = [{x: currentWeight, y: currentWeight / weightPerFoot}]; } chart.update(); // Update table var tableBody = document.getElementById("chartDataTable"); tableBody.innerHTML = ""; // Clear previous rows weights.forEach(function(w, index) { var length = lengths[index]; var row = tableBody.insertRow(); var cellWeight = row.insertCell(0); var cellLength = row.insertCell(1); cellWeight.innerText = w.toLocaleString(); cellLength.innerText = isNaN(length) || !isFinite(length) ? "N/A" : length.toFixed(2); }); } function resetCalculator() { document.getElementById("wireWeight").value = ""; document.getElementById("weightPerFoot").value = ""; document.getElementById("wireWeightError").style.display = 'none'; document.getElementById("weightPerFootError").style.display = 'none'; document.getElementById("wireWeight").style.borderColor = '#ced4da'; document.getElementById("weightPerFoot").style.borderColor = '#ced4da'; document.getElementById("estimatedLengthResult").querySelector("span").innerText = "N/A"; document.getElementById("result").querySelector("span").innerText = "N/A"; document.getElementById("totalWeightResult").querySelector("span").innerText = "N/A"; document.getElementById("weightPerFootResult").querySelector("span").innerText = "N/A"; // Reset chart and table to default state or clear them var chartElement = document.getElementById("wireLengthChart"); if (chartElement) { var canvasContext = chartElement.getContext('2d'); canvasContext.clearRect(0, 0, chartElement.width, chartElement.height); } document.getElementById("chartDataTable").innerHTML = ` 50N/A 100N/A 200N/A `; } function copyResults() { var totalWeight = document.getElementById("totalWeightResult").querySelector("span").innerText; var weightPerFoot = document.getElementById("weightPerFootResult").querySelector("span").innerText; var estimatedLength = document.getElementById("result").querySelector("span").innerText; var assumptions = "Key Assumptions:\n"; assumptions += "- Weight Per Foot: " + weightPerFoot + " lbs/ft\n"; if (estimatedLength === "N/A") { alert("Please perform a calculation before copying results."); return; } var textToCopy = "— Wire Length Calculation Results —\n\n"; textToCopy += "Estimated Length: " + estimatedLength + " ft\n"; textToCopy += "Total Weight: " + totalWeight + " lbs\n"; textToCopy += "Weight Per Foot: " + weightPerFoot + " lbs/ft\n\n"; textToCopy += assumptions; navigator.clipboard.writeText(textToCopy).then(function() { alert("Results copied to clipboard!"); }, function(err) { console.error("Failed to copy: ", err); alert("Failed to copy results. Please copy manually."); }); } // FAQ toggle functionality document.addEventListener('DOMContentLoaded', function() { var faqQuestions = document.querySelectorAll('.faq-question'); faqQuestions.forEach(function(question) { question.addEventListener('click', function() { this.classList.toggle('active'); var answer = this.nextElementSibling; if (answer.style.display === 'block') { answer.style.display = 'none'; } else { answer.style.display = 'block'; } }); }); // Initial chart setup – update with default values or placeholder if needed // Call updateChartAndTable with placeholder values or var it be updated after first calculation // Example: Update chart with initial placeholder data if inputs are not set var initialWeightPerFoot = 0.1; // Example default var initialTotalWeight = 50; // Example default updateChartAndTable(initialWeightPerFoot, initialTotalWeight); document.getElementById("estimatedLengthResult").querySelector("span").innerText = (initialTotalWeight / initialWeightPerFoot).toFixed(2); document.getElementById("result").querySelector("span").innerText = (initialTotalWeight / initialWeightPerFoot).toFixed(2); document.getElementById("totalWeightResult").querySelector("span").innerText = initialTotalWeight.toFixed(2); document.getElementById("weightPerFootResult").querySelector("span").innerText = initialWeightPerFoot.toFixed(6); }); // Function to add Chart.js (or a placeholder if not available) function addChartJs() { if (typeof Chart === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js@3.7.0/dist/chart.min.js'; script.onload = function() { console.log('Chart.js loaded successfully.'); // Re-initialize chart after library is loaded var initialWeightPerFoot = parseFloat(document.getElementById("weightPerFoot").value) || 0.1; var initialTotalWeight = parseFloat(document.getElementById("wireWeight").value) || 50; updateChartAndTable(initialWeightPerFoot, initialTotalWeight); }; script.onerror = function() { console.error('Failed to load Chart.js.'); alert('Error: Could not load charting library. The chart will not be displayed.'); }; document.head.appendChild(script); } else { // Chart.js is already loaded, initialize chart var initialWeightPerFoot = parseFloat(document.getElementById("weightPerFoot").value) || 0.1; var initialTotalWeight = parseFloat(document.getElementById("wireWeight").value) || 50; updateChartAndTable(initialWeightPerFoot, initialTotalWeight); } } // Call addChartJs when the page loads or after the DOM is ready document.addEventListener('DOMContentLoaded', addChartJs);

Leave a Comment