Spaces:
Running
Running
remova as funções desnecessarias
Browse files769 unmodified lines770771772773774775776777778779780781782783784785786787788789790791792793794795796797678 unmodified lines1476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581769 unmodified lines// Initialize multiselect componentsinitMultiselect('xAxisSelect');initMultiselect('yAxisSelect');// PowerBI-like featuresdocument.getElementById('analyzeData').addEventListener('click', showDataInsights);// Generate chart button now shows "Update Chart"document.getElementById('generateChart').innerHTML = '<i class="fas fa-sync-alt mr-2"></i> Update Chart';// Reset chart buttondocument.getElementById('resetChart').addEventListener('click', function() {if (currentChart) {currentChart.destroy();currentChart = null;}document.querySelectorAll('.multiselect-selected').forEach(el => el.innerHTML = '');});// Export data buttondocument.getElementById('exportData').addEventListener('click', exportData);document.getElementById('exportDataBtn').addEventListener('click', exportData);// Export chart buttondocument.getElementById('exportChartBtn').addEventListener('click', exportChart);// File upload handler (now returns Promise)function handleFileUpload(e) {return new Promise((resolve, reject) => {const file = e.target.files[0];678 unmodified lines}}, 100);}// Export datafunction exportData() {if (rawData.length === 0) {alert('No data to export');return;}const exportScope = document.querySelector('input[name="exportScope"]:checked').value;const exportFormat = document.getElementById('exportFormat').value;let dataToExport;if (exportScope === 'all') {dataToExport = [columns, ...rawData];} else {dataToExport = [columns, ...filteredData];}let blob, filename;if (exportFormat === 'csv') {const csvContent = dataToExport.map(row =>row.map(cell =>typeof cell === 'string' ? `"${cell.replace(/"/g, '""')}"` : cell).join(',')).join('\n');blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });filename = 'data_export.csv';}else if (exportFormat === 'xlsx') {const ws = XLSX.utils.aoa_to_sheet(dataToExport);const wb = XLSX.utils.book_new();XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');const excelBuffer = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });blob = new Blob([excelBuffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });filename = 'data_export.xlsx';}else if (exportFormat === 'json') {const jsonData = [];const headers = dataToExport[0];for (let i = 1; i < dataToExport.length; i++) {const obj = {};for (let j = 0; j < headers.length; j++) {obj[headers[j]] = dataToExport[i][j];}jsonData.push(obj);}blob = new Blob([JSON.stringify(jsonData, null, 2)], { type: 'application/json' });filename = 'data_export.json';}const url = URL.createObjectURL(blob);const a = document.createElement('a');a.href = url;a.download = filename;document.body.appendChild(a);a.click();document.body.removeChild(a);URL.revokeObjectURL(url);}// Export chartfunction exportChart() {if (!currentChart) {alert('No chart to export');return;}const format = document.querySelector('input[name="chartFormat"]:checked').value;const quality = parseFloat(document.getElementById('chartQuality').value);const canvas = document.getElementById('dataChart');let imageUrl;if (format === 'svg') {// SVG export (not supported directly by Chart.js, this is a simplified approach)const serializer = new XMLSerializer();const svgBlob = new Blob([serializer.serializeToString(canvas)], { type: 'image/svg+xml' });imageUrl = URL.createObjectURL(svgBlob);} else {// PNG or JPEG exportimageUrl = canvas.toDataURL(`image/${format}`, quality);}const a = document.createElement('a');a.href = imageUrl;a.download = `chart_export.${format}`;document.body.appendChild(a);a.click();document.body.removeChild(a);if (format !== 'svg') {URL.revokeObjectURL(imageUrl);}}});</script><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jair2323/resmonit-1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=jair2323/data-analyser" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html>769 unmodified lines770771772773774775776777678 unmodified lines1456145714581459146014611462769 unmodified lines// Initialize multiselect componentsinitMultiselect('xAxisSelect');initMultiselect('yAxisSelect');// Reset chart button// File upload handler (now returns Promise)function handleFileUpload(e) {return new Promise((resolve, reject) => {const file = e.target.files[0];678 unmodified lines}}, 100);}});</script></body></html>
index.html+3-122