// Radar chart generation for IP stats
// Used by map popups and IP detail partials
// Extracted from dashboard_template.py (lines ~2092-2181)
/**
* Generate an SVG radar chart for category scores.
* This is a reusable function that can be called from:
* - Map popup panels (generateMapPanelRadarChart in map.js)
* - IP detail partials (server-side or client-side rendering)
*
* @param {Object} categoryScores - Object with keys: attacker, good_crawler, bad_crawler, regular_user, unknown
* @param {number} [size=200] - Width/height of the SVG in pixels
* @param {boolean} [showLegend=true] - Whether to show the legend below the chart
* @param {string} [legendPosition='below'] - 'below' or 'side' (side = legend to the right of the chart)
* @returns {string} HTML string containing the SVG radar chart
*/
function generateRadarChart(categoryScores, size, showLegend, legendPosition) {
size = size || 200;
if (showLegend === undefined) showLegend = true;
legendPosition = legendPosition || 'below';
if (!categoryScores || Object.keys(categoryScores).length === 0) {
return '