document.addEventListener('DOMContentLoaded', function () { const canvas = document.getElementById( 'valuationMultiplesChart' ); if (!canvas || typeof Chart === 'undefined') { return; } const labels = ["EV\/EBITDA","P\/E","P\/B","P\/S","P\/FCF"]; const targetValues = [122.5952057123427465512577327899634838104248046875,381.11864406779665159774594940245151519775390625,17.657657328609520419604450580663979053497314453125,15.2946629124616411132819848717190325260162353515625,233.17475884244373673936934210360050201416015625]; const peerValues = [9.689521748818666679881062009371817111968994140625,11.165291133480419460966004407964646816253662109375,1.9855534183408749537846915700356476008892059326171875,1.3782469355852680070739779694122262299060821533203125,6.70448398789370259009956498630344867706298828125]; if (labels.length === 0) { return; } const ctx = canvas.getContext('2d'); new Chart(ctx, { type: 'bar', data: { labels: labels, datasets: [ { label: 'TSLA', data: targetValues, backgroundColor: '#ef6f6c', borderWidth: 0, borderRadius: 4, borderSkipped: false }, { label: 'Peer median', data: peerValues, backgroundColor: 'rgba(255, 255, 255, 0.25)', borderWidth: 0, borderRadius: 4, borderSkipped: false } ] }, options: { responsive: true, maintainAspectRatio: false, plugins: { title: { display: false }, legend: { display: true, position: 'bottom', labels: { color: 'rgba(255, 255, 255, 0.75)', usePointStyle: true, pointStyle: 'circle', padding: 20 } }, tooltip: { enabled: true, callbacks: { label: function (context) { const value = context.parsed.y; if (value === null) { return context.dataset.label + ': N/A'; } return ( context.dataset.label + ': ' + value.toFixed(2) + 'x' ); } } } }, scales: { x: { grid: { display: false }, border: { display: false }, ticks: { color: 'rgba(255, 255, 255, 0.65)' } }, y: { beginAtZero: true, grid: { color: 'rgba(255, 255, 255, 0.08)' }, border: { display: false }, ticks: { color: 'rgba(255, 255, 255, 0.65)', callback: function (value) { return value + 'x'; } } } }, layout: { padding: 10 } }, plugins: [{ id: 'interFont', beforeInit: function () { Chart.defaults.font.family = "'Inter', sans-serif"; } }] }); });