Bitcoin Dominance Impact on Altcoins Analyzer

Bitcoin Dominance Impact on Altcoins Analyzer

N/A

Impact Analysis

General Market Outlook (Simulated):

N/A

Altcoin Category Impact Analysis:

© BTC.D Analyzer. For demonstration purposes only.

AI Insight: ${data.insight}

`; altcoinCategoryAnalysisEl.appendChild(card); }); }; const handleAnalyzeButtonClick = () => { const trend = btcDominanceTrendEl.value; analyzeButtonText.classList.add('hidden'); analyzeButtonLoader.classList.remove('hidden'); analyzeImpactButton.disabled = true; resultsDisplaySection.style.display = 'block'; loadingIndicatorResults.style.display = 'block'; analysisOutputContainer.style.display = 'none'; pdfDownloadButtonContainer.style.display = 'none'; setTimeout(() => { const analysisResult = getSimulatedAnalysis(currentBtcDominance, trend); renderAnalysis(analysisResult); analyzeButtonText.classList.remove('hidden'); analyzeButtonLoader.classList.add('hidden'); analyzeImpactButton.disabled = false; loadingIndicatorResults.style.display = 'none'; analysisOutputContainer.style.display = 'block'; pdfDownloadButtonContainer.style.display = 'block'; showMessage(`Impact analysis complete for ${trend} BTC.D trend.`, "success"); }, 1300); }; // --- PDF Download --- const downloadPDF = () => { if (!currentAnalysisData) { showMessage("No analysis data to download.", "error"); return; } if (typeof window.jspdf === 'undefined' || typeof window.jspdf.jsPDF === 'undefined') { showMessage('PDF generation library (jsPDF) is not loaded.', 'error'); return; } const { jsPDF: JSPDF } = window.jspdf; const doc = new JSPDF(); const data = currentAnalysisData; const today = new Date().toLocaleDateString('en-US'); doc.setFontSize(16); doc.text("Bitcoin Dominance Impact Analysis", 14, 22); doc.setFontSize(10); doc.text(`Report Generated: ${today}`, 14, 30); doc.text(`Simulated BTC.D: ${formatPercentage(data.btcD)} | Selected Trend: ${data.trend.charAt(0).toUpperCase() + data.trend.slice(1)}`, 14, 36); let yPos = 46; doc.setFontSize(12); doc.setFont(undefined, 'bold'); doc.text("General Market Outlook (Simulated):", 14, yPos); yPos += 6; doc.setFont(undefined, 'normal'); doc.setFontSize(10); const outlookLines = doc.splitTextToSize(data.generalOutlook, 180); doc.text(outlookLines, 14, yPos); yPos += (outlookLines.length * 5) + 5; doc.setFontSize(12); doc.setFont(undefined, 'bold'); doc.text("Altcoin Category Impact Analysis:", 14, yPos); yPos += 2; const tableHeaders = [["Altcoin Category", "Expected Impact", "AI Insight (Simulated)"]]; const tableBody = Object.entries(data.categoryImpacts).map(([category, catData]) => [ category, catData.impact, doc.splitTextToSize(catData.insight, 90) // Wrap insight text ]); if (typeof doc.autoTable === 'function') { doc.autoTable({ head: tableHeaders, body: tableBody, startY: yPos + 2, theme: 'grid', headStyles: { fillColor: [249, 115, 22] }, // orange-500 styles: { fontSize: 9, cellPadding: 2, valign: 'middle' }, columnStyles: { 0: { cellWidth: 50 }, // Category 1: { cellWidth: 35 }, // Impact 2: { cellWidth: 'auto' } // Insight }, didParseCell: function (data) { if (data.column.dataKey === 2 && typeof data.cell.raw === 'object') { data.cell.styles.lineHeight = 1.3; } // Color impact text if (data.column.dataKey === 1) { if (data.cell.raw === "Positive" || data.cell.raw === "Very Positive / Volatile") doc.setTextColor(22, 163, 74); // green else if (data.cell.raw === "Negative" || data.cell.raw === "Very Negative") doc.setTextColor(220, 38, 38); // red else if (data.cell.raw === "Volatile / Speculative") doc.setTextColor(245, 158, 11); // amber else doc.setTextColor(107, 114, 128); // gray } }, didDrawPage: function(data) { // Reset text color after each page draw doc.setTextColor(0,0,0); } }); } else { doc.text("jsPDF-autoTable plugin not loaded. Detailed table cannot be generated.", 14, yPos + 5); } doc.setTextColor(0,0,0); // Ensure color is reset finally doc.save(`BTC_Dominance_Impact_Analysis_${today.replace(/\//g, '-')}.pdf`); showMessage("PDF report downloaded.", "success"); }; // --- Event Listeners --- if (analyzeImpactButton) analyzeImpactButton.addEventListener('click', handleAnalyzeButtonClick); if (downloadPdfButton) downloadPdfButton.addEventListener('click', downloadPDF); // --- Initialization --- const initializeApp = () => { if (currentYearSpan) currentYearSpan.textContent = new Date().getFullYear(); simulateBtcDominanceUpdate(); // Initial BTC.D display dominanceUpdateInterval = setInterval(simulateBtcDominanceUpdate, 7000); // Update BTC.D every 7s handleAnalyzeButtonClick(); // Perform initial analysis showMessage("Analyzer ready. Select a BTC.D trend and analyze.", "success", 2000); }; initializeApp(); });
Scroll to Top