mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 23:21:48 +08:00 
			
		
		
		
	
		
			
	
	
		
			12 lines
		
	
	
		
			345 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			12 lines
		
	
	
		
			345 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
								 | 
							
								const attrCounts = await api.runOnBackend(() => {
							 | 
						||
| 
								 | 
							
								    return api.sql.getRows(`
							 | 
						||
| 
								 | 
							
								        SELECT
							 | 
						||
| 
								 | 
							
								            name, COUNT(*) AS count
							 | 
						||
| 
								 | 
							
								        FROM attributes
							 | 
						||
| 
								 | 
							
								        WHERE isDeleted = 0
							 | 
						||
| 
								 | 
							
								        GROUP BY name
							 | 
						||
| 
								 | 
							
								        ORDER BY count DESC`);
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								renderPieChart(attrCounts.length <= 10 ? attrCounts : attrCounts.splice(0, 10));
							 | 
						||
| 
								 | 
							
								renderTable(attrCounts);
							 |