load more than one month

This commit is contained in:
Anton Volnuhin 2025-03-20 17:52:19 +03:00
parent 8817727896
commit 24be9787bd

17
app.js
View File

@ -622,10 +622,13 @@ async function loadAvailableMonths() {
// Load TinyColor first // Load TinyColor first
await loadTinyColor(); await loadTinyColor();
// For now, we only have one month // Include all available months
const months = ['2025-01']; const months = ['2025-01', '2025-02'];
const select = document.getElementById('month-select'); const select = document.getElementById('month-select');
// Clear existing options
select.innerHTML = '';
months.forEach(month => { months.forEach(month => {
const option = document.createElement('option'); const option = document.createElement('option');
option.value = month; option.value = month;
@ -633,10 +636,14 @@ async function loadAvailableMonths() {
select.appendChild(option); select.appendChild(option);
}); });
// Load the first month by default // Load the most recent month by default
const data = await parseCSV(`altcats-${months[0]}.csv`); const latestMonth = months[months.length - 1];
const data = await parseCSV(`altcats-${latestMonth}.csv`);
renderChart(data); renderChart(data);
// Set the select value to match
select.value = latestMonth;
// Add event listener for month selection // Add event listener for month selection
select.addEventListener('change', async (e) => { select.addEventListener('change', async (e) => {
const month = e.target.value; const month = e.target.value;
@ -785,7 +792,7 @@ function setupHoverEvents(sunburstData) {
`; `;
// Number of items to show in the details box // Number of items to show in the details box
const MAX_DETAIL_ITEMS = 5; const MAX_DETAIL_ITEMS = 10;
let itemsToShow = []; let itemsToShow = [];
// Check if the node has children (subcategories or microcategories) // Check if the node has children (subcategories or microcategories)