currentMonthCategories.sort((a, b) => {
                const dataA = categoryMap.get(a);
                const dataB = categoryMap.get(b);
                if (dataA && dataB) return dataB.total - dataA.total;
                if (dataA) return -1;
                if (dataB) return 1;
                return a.localeCompare(b);
            }).forEach(category => {
                const item = document.createElement('div');
                item.className = `legend-item${disabledCategories.has(category) ? ' dis