Polished Concrete Floor Cost Calculator

Polished Concrete Floor Cost Calculator & Guide :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –secondary-text-color: #555; –border-color: #ddd; –shadow-color: rgba(0, 0, 0, 0.1); –white-color: #fff; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: var(–text-color); background-color: var(–background-color); margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; min-height: 100vh; } header { background-color: var(–primary-color); color: var(–white-color); padding: 20px 0; text-align: center; width: 100%; } header h1 { margin: 0; font-size: 2.5em; } main { width: 100%; max-width: 1000px; margin: 20px auto; padding: 0 15px; box-sizing: border-box; } .calculator-container { background-color: var(–white-color); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-bottom: 40px; display: flex; flex-direction: column; align-items: center; } .calculator-container h2 { text-align: center; color: var(–primary-color); margin-top: 0; margin-bottom: 25px; } .input-group { margin-bottom: 20px; width: 100%; max-width: 400px; text-align: left; } .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: 100%; padding: 12px; border: 1px solid var(–border-color); border-radius: 5px; box-sizing: border-box; font-size: 1em; transition: border-color 0.3s ease; } .input-group input:focus, .input-group select:focus { border-color: var(–primary-color); outline: none; } .input-group .helper-text { font-size: 0.85em; color: var(–secondary-text-color); margin-top: 5px; display: block; } .error-message { color: red; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; justify-content: center; gap: 15px; margin-top: 30px; flex-wrap: wrap; } button { padding: 12px 25px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; color: var(–white-color); background-color: var(–primary-color); } button:hover { background-color: #003a70; transform: translateY(-2px); } button.reset-button { background-color: #6c757d; } button.reset-button:hover { background-color: #5a6268; } button.copy-button { background-color: var(–success-color); } button.copy-button:hover { background-color: #218838; } .results-container { background-color: var(–white-color); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-top: 40px; width: 100%; text-align: center; border: 1px solid var(–border-color); } .results-container h3 { color: var(–primary-color); margin-top: 0; margin-bottom: 20px; } .main-result { font-size: 2.2em; font-weight: bold; color: var(–white-color); background-color: var(–success-color); padding: 15px 25px; border-radius: 6px; display: inline-block; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(40, 167, 69, 0.4); } .intermediate-results, .formula-explanation { margin-top: 20px; text-align: left; font-size: 0.95em; color: var(–secondary-text-color); } .intermediate-results p, .formula-explanation p { margin-bottom: 10px; } .intermediate-results strong, .formula-explanation strong { color: var(–text-color); } .formula-explanation code { background-color: #e9ecef; padding: 2px 5px; border-radius: 3px; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; } .chart-container, .table-container { background-color: var(–white-color); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-top: 40px; width: 100%; overflow-x: auto; /* Enable horizontal scroll for tables */ } .chart-container h3, .table-container h3 { text-align: center; color: var(–primary-color); margin-top: 0; margin-bottom: 20px; } canvas { max-width: 100%; height: auto; display: block; margin: 0 auto; } table { width: 100%; border-collapse: collapse; margin-top: 20px; min-width: 600px; /* For horizontal scroll */ } th, td { padding: 12px 15px; text-align: left; border: 1px solid var(–border-color); } thead { background-color: var(–primary-color); color: var(–white-color); } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e0e0e0; } .article-content { background-color: var(–white-color); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-top: 40px; width: 100%; line-height: 1.8; font-size: 1.1em; color: var(–text-color); } .article-content h2, .article-content h3 { color: var(–primary-color); margin-top: 30px; margin-bottom: 15px; } .article-content h2 { font-size: 1.8em; border-bottom: 2px solid var(–primary-color); padding-bottom: 8px; } .article-content h3 { font-size: 1.4em; margin-top: 25px; } .article-content p { margin-bottom: 20px; } .article-content ul { margin-left: 25px; margin-bottom: 20px; } .article-content li { margin-bottom: 10px; } .article-content strong { color: var(–text-color); } .article-content code { background-color: #e9ecef; padding: 2px 5px; border-radius: 3px; font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; } .article-content a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .article-content .variable-table { width: 100%; margin-top: 20px; margin-bottom: 20px; border-collapse: collapse; } .article-content .variable-table th, .article-content .variable-table td { border: 1px solid var(–border-color); padding: 10px; text-align: left; } .article-content .variable-table th { background-color: var(–primary-color); color: var(–white-color); } .article-content .variable-table tr:nth-child(even) { background-color: #f2f2f2; } .faq-list .faq-item { margin-bottom: 20px; border-bottom: 1px dashed var(–border-color); padding-bottom: 15px; } .faq-list .faq-item:last-child { border-bottom: none; padding-bottom: 0; } .faq-list .faq-question { font-weight: bold; color: var(–primary-color); display: block; margin-bottom: 8px; cursor: pointer; } .faq-list .faq-answer { font-size: 0.95em; color: var(–secondary-text-color); display: none; /* Hidden by default */ margin-top: 8px; } .faq-list .faq-question.active + .faq-answer { display: block; } .related-tools { background-color: var(–white-color); padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px var(–shadow-color); margin-top: 40px; width: 100%; } .related-tools h3 { text-align: center; color: var(–primary-color); margin-top: 0; margin-bottom: 20px; } .related-tools ul { list-style: none; padding: 0; margin: 0; } .related-tools li { margin-bottom: 15px; border-bottom: 1px solid var(–border-color); padding-bottom: 10px; } .related-tools li:last-child { border-bottom: none; padding-bottom: 0; } .related-tools a { font-weight: bold; color: var(–primary-color); text-decoration: none; } .related-tools a:hover { text-decoration: underline; } .related-tools p { font-size: 0.9em; color: var(–secondary-text-color); margin-top: 5px; } /* Responsive adjustments */ @media (max-width: 768px) { header h1 { font-size: 1.8em; } .calculator-container, .results-container, .chart-container, .table-container, .article-content, .related-tools { padding: 20px; } button { padding: 10px 20px; font-size: 0.95em; width: 100%; max-width: 200px; /* For button group */ } .button-group { flex-direction: column; align-items: center; } .main-result { font-size: 1.8em; } table { min-width: unset; /* Remove min-width for better scrolling */ } }

Polished Concrete Floor Cost Calculator

Estimate Your Polished Concrete Floor Cost

Enter the total square footage or square meters of your floor.
200 – Basic Matte Finish 400 – Satin Finish 800 – Semi-Gloss Finish 1500 – High-Gloss Finish 3000 – Ultra-High Gloss (Requires more labor) Higher grit levels result in a smoother, glossier finish and increase cost.
Good (Few repairs needed) Fair (Minor cracks/imperfections) Poor (Significant damage, requires extensive repair) Deteriorated concrete may require more work and higher costs.
None Stain/Dye Application Densifier/Sealer Application Epoxy Coatings/Inlays Decorative Saw Cuts/Scoring Select any extra services needed beyond standard polishing.

Your Polished Concrete Floor Estimate

$0

Base Material Cost: $0

Labor Cost: $0

Additional Services Cost: $0

Total Estimated Cost: $0

Formula Used:

Total Estimated Cost = (Area * Base Rate per SqFt * Concrete Quality Factor) + Additional Services Cost

Where Base Rate is determined by the desired Grit Level.

Cost Breakdown by Component

Chart showing the proportion of Base Material, Labor, and Additional Services in the total cost.

Polishing Grit Level Cost Factors

Grit Level Finish Type Typical Base Rate ($/sqft) Labor Intensity Factor
200 Basic Matte $1.50 – $2.50 1.0
400 Satin $2.50 – $4.00 1.2
800 Semi-Gloss $3.50 – $5.50 1.4
1500 High-Gloss $4.50 – $7.00 1.6
3000 Ultra-High Gloss $6.00 – $9.00 2.0

Note: Rates are indicative and can vary based on location, contractor, and specific concrete conditions. The calculator uses an average from the range for 800 grit (approx. $4.50/sqft) as a base.

Understanding Polished Concrete Floor Costs

What is a Polished Concrete Floor?

A polished concrete floor is a durable and aesthetically pleasing flooring solution created by mechanically grinding, honing, and polishing an existing concrete slab. This process uses progressively finer abrasive tools to achieve a desired level of sheen, from matte to a mirror-like gloss. It transforms ordinary concrete into a high-performance surface ideal for residential, commercial, and industrial spaces. This method enhances the concrete's natural beauty, making it stronger, easier to clean, and resistant to stains and abrasion.

Who should use it: Homeowners looking for a modern, low-maintenance, and cost-effective flooring option for garages, basements, kitchens, and living areas. Businesses such as retail stores, restaurants, warehouses, garages, and showrooms benefit from its durability, visual appeal, and ease of maintenance. It's also a sustainable choice as it utilizes the existing slab, reducing material waste.

Common misconceptions:

  • It's just a cheap alternative: While it can be cost-effective, high-quality polished concrete requires significant labor and specialized equipment, making it a premium finish.
  • It's slippery: Properly sealed and finished polished concrete is no more slippery than other hard flooring surfaces, and can even be enhanced with anti-slip additives if needed.
  • It's cold: Like tile or stone, concrete floors can feel cool, but this can be mitigated with radiant heating systems, which work very effectively with concrete.
  • It's easily damaged: Polished concrete is extremely durable and resistant to wear and tear. Damage is rare and usually preventable with proper maintenance.

Polished Concrete Floor Cost Formula and Mathematical Explanation

The polished concrete floor cost is primarily determined by the area to be covered, the complexity of the desired finish, and any additional treatments. Our polished concrete floor cost calculator simplifies this by using a layered approach:

Step-by-Step Derivation

  1. Base Rate Determination: A base rate per square foot ($/sqft) is established based on the chosen grit level for polishing. Higher grit levels (more polishing) cost more due to increased labor and diamond tooling wear.
  2. Concrete Quality Adjustment: This base rate is multiplied by a Concrete Quality Factor. If the existing concrete is in poor condition (cracks, spalling), it requires more preparation and repair, increasing the overall cost. A factor of 1.0 represents good quality concrete, while higher factors indicate more extensive work is needed.
  3. Labor Integration: The adjusted base rate inherently includes the labor required for the specific grit level. Higher grit levels naturally have higher base rates that reflect this increased labor intensity.
  4. Additional Services Cost: Any extra services like staining, dyeing, densifying, sealing, or decorative scoring are added as a separate cost.
  5. Total Calculation: The final estimated cost is the sum of the adjusted base material and labor cost and the cost of any additional services.

Formula:

Total Estimated Cost = (Area * Base Rate per SqFt * Concrete Quality Factor) + Additional Services Cost

Variable Explanations

Variable Meaning Unit Typical Range / Values
Area The total surface area of the floor to be polished. Square Feet (sqft) 100 – 5000+ sqft
Base Rate per SqFt The cost per square foot for the chosen polishing grit level, including standard labor. $/sqft $1.50 – $9.00 (depending on grit)
Concrete Quality Factor A multiplier to account for the condition of the existing concrete slab. Unitless 1.0 (Good) to 1.5+ (Poor)
Additional Services Cost The combined cost of any extra treatments or decorative elements. $ $0 – $1000+
Total Estimated Cost The final projected cost of the polished concrete floor project. $ Calculated

Practical Examples (Real-World Use Cases)

Example 1: Modern Kitchen Renovation

A homeowner is renovating their kitchen and wants a sleek, durable floor. They have a polished concrete floor cost calculator and input the following:

  • Area: 300 sqft
  • Desired Grit Level: 800 (Semi-Gloss)
  • Concrete Quality: Good (Factor: 1.0)
  • Additional Services: Densifier/Sealer Application

Calculation:

  • Base Rate for 800 Grit (average): ~$4.50/sqft
  • Additional Services Cost: ~$150
  • (300 sqft * $4.50/sqft * 1.0) + $150 = $1350 + $150 = $1500

Result Interpretation: The estimated cost for their kitchen is $1500. This reflects a quality finish on a well-maintained slab with essential protective treatments. This budget fits within their renovation plan.

Example 2: Large Garage Transformation

A property owner wants to convert their old garage into a functional workshop and needs to estimate the cost.

  • Area: 600 sqft
  • Desired Grit Level: 400 (Satin)
  • Concrete Quality: Fair (Factor: 1.2, due to some minor cracks)
  • Additional Services: None

Calculation:

  • Base Rate for 400 Grit (average): ~$3.25/sqft
  • Additional Services Cost: $0
  • (600 sqft * $3.25/sqft * 1.2) + $0 = $1950 * 1.2 = $2340

Result Interpretation: The estimated cost is $2340. The higher factor due to fair concrete quality increased the price. This covers a durable, satin finish suitable for a workshop environment. They might consider other flooring options if this exceeds their budget.

How to Use This Polished Concrete Floor Cost Calculator

  1. Measure Your Area: Accurately determine the square footage (or square meters) of the floor space you intend to polish.
  2. Select Grit Level: Choose the finish you desire. 200-400 for a matte/satin look, 800+ for increasing gloss. Remember higher grits mean higher costs.
  3. Assess Concrete Quality: Honestly evaluate the condition of your existing concrete slab. Select the option that best reflects its state (Good, Fair, Poor). This is crucial for accurate estimates.
  4. Add Optional Services: Tick any additional services like staining, dyeing, or specialized sealers if required.
  5. Calculate: Click the "Calculate Cost" button.

Reading Your Results:

  • Main Result: This is your total estimated project cost.
  • Intermediate Values: These break down the cost into base material/labor and additional services, helping you understand where the money goes.
  • Formula Explanation: Provides insight into how the calculation was performed.
  • Charts & Tables: Visualize the cost breakdown and understand the pricing tiers for different grit levels.

Decision-Making Guidance:

Use the results to compare against your budget. If the estimate is too high, consider opting for a lower grit level, or assess if your concrete quality is truly "fair" or if "good" might apply to save costs. For significant cost reductions, explore basic concrete grinding rather than full polishing.

Key Factors That Affect Polished Concrete Floor Results

  1. Area Size: Larger areas often benefit from economies of scale, potentially lowering the per-square-foot cost, but the total investment will be higher. Our calculator directly incorporates this.
  2. Desired Sheen/Grit Level: As shown in the calculator and table, achieving higher gloss requires more passes with finer diamond abrasives, significantly increasing labor and tooling costs.
  3. Existing Concrete Condition: This is critical. Cracks, spalling, previous coatings, or unevenness require extensive repair and prep work (grinding, patching, filling), driving up costs substantially. A "poor" quality factor reflects this.
  4. Complexity of the Space: Tight corners, columns, multiple rooms, stairs, or intricate shapes increase labor time and difficulty compared to a large, open rectangular space.
  5. Type of Densifier/Sealer: While our calculator has a flat rate for this service, premium sealers offering enhanced stain or UV resistance can be more expensive than standard options.
  6. Location & Contractor Choice: Labor rates vary geographically. Experienced, reputable contractors may charge more but often deliver superior results and reliability. Always get multiple quotes for professional concrete polishing services.
  7. Time Constraints: Rush jobs or work required outside normal business hours may incur additional charges.
  8. Design Elements: Incorporating stains, dyes, intricate patterns, saw cuts, or aggregate exposure adds complexity and cost beyond basic polishing.

Frequently Asked Questions (FAQ)

How much does polished concrete cost per square foot?
The cost typically ranges from $3 to $12 per square foot, depending heavily on the desired grit level, concrete condition, and additional services. Our calculator provides a more specific estimate based on your inputs.
Is polished concrete more expensive than tile?
Generally, high-end polished concrete can be comparable to or slightly more expensive than basic tile installation, but it often becomes more cost-effective when considering its durability, longevity, and minimal maintenance needs compared to tile replacement or grout cleaning.
What is the difference between polished concrete and epoxy coating?
Polished concrete is a mechanical process that enhances the natural concrete slab. Epoxy coating is a layer of polymer resin applied over the concrete. Polished concrete is generally more durable and natural-looking, while epoxy offers a thicker, often glossier, and more varied color finish but can be prone to scratching or peeling under heavy use.
How long does polished concrete last?
With proper maintenance and occasional re-sealing (if applied), a polished concrete floor can last for decades, often outlasting the building itself. Its durability makes it an excellent long-term investment.
Does the calculator account for repair costs?
Yes, the "Concrete Quality" input acts as a factor to adjust the base cost, reflecting the increased labor and materials needed for repairs like crack filling or patching spalled areas. However, extremely severe damage might require specialized assessment beyond this calculator's scope.
Can I DIY polished concrete floors?
While DIY kits exist for basic concrete grinding and sealing, achieving a true, high-gloss polished finish typically requires professional-grade equipment (heavy grinders, specialized vacuum systems) and expertise. For best results and longevity, professional installation is recommended.
What maintenance is required for polished concrete?
Maintenance is minimal. Regular sweeping or dust mopping is usually sufficient. Occasional damp mopping with a pH-neutral cleaner is recommended. Depending on traffic and the type of sealer used, a re-application of sealer or a light re-polish might be needed every few years to maintain optimal sheen and protection.
Does the calculator include cost for new concrete installation?
No, this calculator assumes you have an existing concrete slab. The costs calculated are for the polishing process itself, including surface preparation and finishing. Pouring new concrete would be a separate, additional cost.

© 2023 Your Company Name. All rights reserved. This calculator provides estimates for informational purposes only.

var chartInstance = null; function getInputValue(id) { var inputElement = document.getElementById(id); if (!inputElement) return NaN; var value = parseFloat(inputElement.value); return isNaN(value) ? NaN : value; } function setError(elementId, message) { var errorElement = document.getElementById(elementId); if (errorElement) { errorElement.innerText = message; errorElement.style.display = message ? 'block' : 'none'; } } function validateInputs() { var area = getInputValue('area'); var areaError = "; if (isNaN(area) || area 10000) { // Arbitrary upper limit for sanity check areaError = 'Area seems too large. Please verify.'; } setError('areaError', areaError); return !areaError; } function calculateCost() { if (!validateInputs()) { document.getElementById('resultsContainer').style.display = 'none'; return; } var area = getInputValue('area'); var gritLevel = parseInt(document.getElementById('gritLevel').value); var concreteQualityFactor = parseFloat(document.getElementById('concreteQuality').value); var additionalServicesValue = parseFloat(document.getElementById('additionalServices').value); var baseRatePerSqFt; var laborIntensityFactor; switch(gritLevel) { case 200: baseRatePerSqFt = 2.00; // Average of 1.50-2.50 laborIntensityFactor = 1.0; break; case 400: baseRatePerSqFt = 3.25; // Average of 2.50-4.00 laborIntensityFactor = 1.2; break; case 800: baseRatePerSqFt = 4.50; // Average of 3.50-5.50 laborIntensityFactor = 1.4; break; case 1500: baseRatePerSqFt = 5.75; // Average of 4.50-7.00 laborIntensityFactor = 1.6; break; case 3000: baseRatePerSqFt = 7.50; // Average of 6.00-9.00 laborIntensityFactor = 2.0; break; default: baseRatePerSqFt = 4.50; // Default to 800 grit average laborIntensityFactor = 1.4; } var adjustedBaseRate = baseRatePerSqFt * concreteQualityFactor; var baseMaterialAndLaborCost = area * adjustedBaseRate; var additionalServicesCost = area * (additionalServicesValue / 100); // Assuming additionalServicesValue is a per sqft cost multiplier for simplicity or fixed value mapping. If it's flat rate, adjust. Using fixed values from options: switch(parseInt(document.getElementById('additionalServices').value)) { case 0: additionalServicesCost = 0; break; case 100: additionalServicesCost = 100; break; // Flat fee case 150: additionalServicesCost = 150; break; // Flat fee case 250: additionalServicesCost = 250; break; // Flat fee case 300: additionalServicesCost = 300; break; // Flat fee default: additionalServicesCost = 0; } var totalEstimatedCost = baseMaterialAndLaborCost + additionalServicesCost; document.getElementById('baseMaterialCost').innerText = '$' + baseMaterialAndLaborCost.toFixed(2); document.getElementById('laborCost').innerText = '$' + (baseMaterialAndLaborCost * laborIntensityFactor).toFixed(2); // Simplified: Labor is factored into adjustedBaseRate, but showing labor intensity separately for clarity if needed. Re-calculating for distinct labor representation. // A better way to represent labor if it's distinct from material: var estimatedLaborCost = baseRatePerSqFt * area * laborIntensityFactor * 0.7; // Assume 70% of adjusted base rate is labor var estimatedMaterialCost = adjustedBaseRate * area – estimatedLaborCost; // Rough material cost document.getElementById('baseMaterialCost').innerText = '$' + estimatedMaterialCost.toFixed(2); document.getElementById('laborCost').innerText = '$' + estimatedLaborCost.toFixed(2); document.getElementById('additionalServicesCost').innerText = '$' + additionalServicesCost.toFixed(2); document.getElementById('totalEstimatedCost').innerText = '$' + totalEstimatedCost.toFixed(2); document.getElementById('mainResult').innerText = '$' + totalEstimatedCost.toFixed(2); updateChart(baseMaterialAndLaborCost, additionalServicesCost, totalEstimatedCost); document.getElementById('resultsContainer').style.display = 'block'; } function resetCalculator() { document.getElementById('area').value = '500'; document.getElementById('gritLevel').value = '800'; document.getElementById('concreteQuality').value = '1.0'; document.getElementById('additionalServices').value = '0'; document.getElementById('areaError').innerText = "; document.getElementById('resultsContainer').style.display = 'none'; if (chartInstance) { chartInstance.destroy(); chartInstance = null; } } function copyResults() { var mainResult = document.getElementById('mainResult').innerText; var baseMaterialCost = document.getElementById('baseMaterialCost').innerText; var laborCost = document.getElementById('laborCost').innerText; var additionalServicesCost = document.getElementById('additionalServicesCost').innerText; var totalEstimatedCost = document.getElementById('totalEstimatedCost').innerText; var area = document.getElementById('area').value; var gritLevelText = document.getElementById('gritLevel').options[document.getElementById('gritLevel').selectedIndex].text; var concreteQualityText = document.getElementById('concreteQuality').options[document.getElementById('concreteQuality').selectedIndex].text; var additionalServicesText = document.getElementById('additionalServices').options[document.getElementById('additionalServices').selectedIndex].text; var resultsText = "— Polished Concrete Floor Cost Estimate — \n\n"; resultsText += "Key Assumptions:\n"; resultsText += "- Area: " + area + " sqft\n"; resultsText += "- Desired Finish: " + gritLevelText + "\n"; resultsText += "- Concrete Quality: " + concreteQualityText + "\n"; resultsText += "- Additional Services: " + additionalServicesText + "\n\n"; resultsText += "Estimated Costs:\n"; resultsText += "- Base Material & Labor: " + baseMaterialCost + "\n"; resultsText += "- Labor Component (Est.): " + laborCost + "\n"; resultsText += "- Additional Services: " + additionalServicesCost + "\n"; resultsText += "- TOTAL ESTIMATED COST: " + mainResult + "\n\n"; resultsText += "Calculated using: Total Cost = (Area * Base Rate * Quality Factor) + Additional Services Cost"; // Use navigator.clipboard if available, fallback to textarea if (navigator.clipboard && navigator.clipboard.writeText) { navigator.clipboard.writeText(resultsText).then(function() { alert('Results copied to clipboard!'); }).catch(function(err) { console.error('Failed to copy text: ', err); fallbackCopyTextToClipboard(resultsText); }); } else { fallbackCopyTextToClipboard(resultsText); } } function fallbackCopyTextToClipboard(text) { var textArea = document.createElement("textarea"); textArea.value = text; textArea.style.position = "fixed"; textArea.style.top = "0"; textArea.style.left = "0"; textArea.style.width = "2em"; textArea.style.height = "2em"; textArea.style.padding = "0"; textArea.style.border = "none"; textArea.style.outline = "none"; textArea.style.boxShadow = "none"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand('copy'); var msg = successful ? 'successful' : 'unsuccessful'; alert('Results copied to clipboard! (' + msg + ')'); } catch (err) { console.error('Fallback: Oops, unable to copy', err); alert('Failed to copy results. Please copy manually.'); } document.body.removeChild(textArea); } function updateChart(baseLaborCost, additionalCost, totalCost) { var ctx = document.getElementById('costBreakdownChart').getContext('2d'); // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } // Calculate percentages for display if needed, but raw values are fine for simple bar chart var dataValues = [baseLaborCost, additionalCost]; var labels = ['Base Material & Labor', 'Additional Services']; chartInstance = new Chart(ctx, { type: 'bar', // Changed to bar chart for clearer comparison data: { labels: labels, datasets: [{ label: 'Cost Component ($)', data: dataValues, backgroundColor: [ 'rgba(0, 74, 153, 0.7)', // Primary color for Base 'rgba(40, 167, 69, 0.7)' // Success color for Additional ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(40, 167, 69, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, title: { display: true, text: 'Cost ($)' } } }, plugins: { legend: { display: false // Hide legend as labels are on x-axis }, title: { display: true, text: 'Cost Breakdown' } } } }); } // Initialize chart on page load if results are visible (e.g., pre-filled) // Or better, call calculateCost() once on load if defaults should be shown document.addEventListener('DOMContentLoaded', function() { calculateCost(); // Calculate with default values on load // FAQ functionality 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"; } }); }); });

Leave a Comment