load more than one month

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

19
app.js
View File

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