Input Price Data for Soft Commodities (USD $)

Option 1 (Multi-Commodity): CSV with columns: Commodity,Date,Price (e.g., Wheat,2023-01-01,250.75).
Option 2 (Single-Commodity): For the commodity selected above, CSV can be: Date,Price.


Or Enter Data Manually for Wheat:


Current Data Preview (All Commodities):

No data loaded yet.
Commodity Date Price ($) Actions

Soft Commodities Price Trends & Analysis

Select commodities and click "Update Chart".

Summary Statistics (for selected commodities):

Select commodities and click "Update Chart & Summaries" to view statistics.

Data Points: ${sortedData.length}

Highest Price: $${high.price.toFixed(2)} (on ${high.date})

Lowest Price: $${low.price.toFixed(2)} (on ${low.date})

Average Price: $${avg.toFixed(2)}

Net Change: ${netChange >= 0 ? '+' : ''}$${netChange.toFixed(2)}

Percentage Change: ${pctChange.toFixed(2)}%

`; summaryContainer.appendChild(summaryDiv); } }); if (summariesGenerated > 0) { summaryMessageEl.classList.add('scpt-hidden'); } else { summaryMessageEl.textContent = "No data available for the selected commodities to generate summaries."; summaryMessageEl.classList.remove('scpt-hidden'); } }, downloadResultsAsPDF: function() { // Ensure analysis tab content (chart, summaries) is up-to-date for what's selected // The print CSS will try to capture the current state of the #scptAnalysisTab content const analysisTab = document.getElementById('scptAnalysisTab'); const dataInputTab = document.getElementById('scptDataInputTab'); let originalDataInputDisplay = ''; if(dataInputTab) { originalDataInputDisplay = dataInputTab.style.display; dataInputTab.style.display = 'none'; } if(analysisTab) analysisTab.style.display = 'block'; // Optional: If you want PDF to include a data table for selected commodities: // You might need to dynamically build a printable table here or ensure print CSS for scptDataTablePreview is robust // For now, the print CSS includes the main data table on the input tab, which might not be ideal if hidden. // A better approach for PDF would be to generate a specific "printable report section" dynamically. // For this version, we rely on printing the #scptAnalysisTab + #scptDataTableContainer if it's styled to be visible. // For simplicity, let's assume the current scptDataTablePreview (all data) will be part of the printout as styled in @media print. setTimeout(() => { window.print(); // Restore display if(dataInputTab) dataInputTab.style.display = originalDataInputDisplay; if(analysisTab && this.currentTab !== 'scptAnalysisTab') analysisTab.style.display = 'none'; else if (analysisTab && this.currentTab === 'scptAnalysisTab') analysisTab.style.display = 'block'; }, 750); // Increased delay for potentially more complex chart/summaries } }; SCPT_App.init();
Scroll to Top