';
// Property types breakdown
if (data.propertyTypes && Object.keys(data.propertyTypes).length > 0) {
statsHtml += `
Property Types
`;
for (const [type, count] of Object.entries(data.propertyTypes)) {
const percentage = Math.round((count / data.totalProperties) * 100);
statsHtml += `
${type}:
${count.toLocaleString()} (${percentage}%)
`;
}
statsHtml += '
';
}
// Price ranges
if (data.priceRanges) {
statsHtml += `
Price Ranges
Avg Sale Price:
£${data.priceRanges.avgSalePrice?.toLocaleString() || 'N/A'}
Avg Rent PCM:
£${data.priceRanges.avgRentPrice?.toLocaleString() || 'N/A'}
`;
}
// Top performing agents
if (data.topAgents && data.topAgents.length > 0) {
statsHtml += `
Top Agents
`;
data.topAgents.slice(0, 3).forEach(agent => {
statsHtml += `
${agent.name}:
${agent.property_count} props
`;
});
statsHtml += '