import React, { useState, useEffect } from 'react'; import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'; const WeldingPositionerCalculator = () => { const [distance, setDistance] = useState(500); const [maxLoad, setMaxLoad] = useState(0); const [chartData, setChartData] = useState([]); // Calculate max load based on the provided formula: 2800000 * distance^(-1.12) // But ensure it never exceeds 5000 kg (5 tonnes) const calculateMaxLoad = (dist) => { if (dist <= 0) return 5000; // Default to 5 tonnes (5000 kg) for zero distance const calculatedLoad = Math.round(2800000 * Math.pow(dist, -1.12)); // Cap at 5000 kg return Math.min(calculatedLoad, 5000); }; // Generate chart data points const generateChartData = () => { const data = []; // Generate data points from 250 to 2500mm for (let d = 250; d <= 2500; d += 150) { data.push({ distance: d, maxLoad: calculateMaxLoad(d) }); } return data; }; // Update calculations when inputs change useEffect(() => { setMaxLoad(calculateMaxLoad(distance)); setChartData(generateChartData()); }, [distance]); return (

5 Tonne Capacity Welding Positioner Calculator

setDistance(Number(e.target.value))} className="w-full p-2 border border-gray-300 rounded" /> setDistance(Number(e.target.value))} className="w-full mt-2" />

Maximum Safe Load (balanced only):

{maxLoad.toLocaleString()} kg
({(maxLoad / 1000).toFixed(2)} tonnes)
value >= 1000 ? `${value/1000}k` : value} /> [`${value.toLocaleString()} kg`, '']} />

Use as a guide only

This interactive graphic can only be used as a guide. For safety you must do you own calculations, or contact Spectrum directly.

); }; export default WeldingPositionerCalculator;