{"spec_id":"radar-basic","library":"chartjs","language":"javascript","code":"// anyplot.ai\n// radar-basic: Basic Radar Chart\n// Library: chartjs 4.4.7 | JavaScript 22.23.1\n// Quality: 93/100 | Created: 2026-07-24\n\n//# anyplot-orientation: square\nconst t = window.ANYPLOT_TOKENS;\n\n// --- Data (in-memory, deterministic) ----------------------------------------\n// Sports player statistics: two forwards compared across six attributes.\nconst attributes = [\n  \"Speed\",\n  \"Strength\",\n  \"Accuracy\",\n  \"Stamina\",\n  \"Agility\",\n  \"Vision\",\n];\nconst playerA = [88, 62, 79, 70, 91, 68];\nconst playerB = [65, 84, 88, 75, 60, 82];\n\n// --- Mount -------------------------------------------------------------------\nconst canvas = document.createElement(\"canvas\");\ndocument.getElementById(\"container\").appendChild(canvas);\n\n// --- Chart ---------------------------------------------------------------\nnew Chart(canvas, {\n  type: \"radar\",\n  data: {\n    labels: attributes,\n    datasets: [\n      {\n        label: \"Kova (Forward)\",\n        data: playerA,\n        borderColor: t.palette[0],\n        backgroundColor: `${t.palette[0]}40`,\n        borderWidth: 3,\n        pointBackgroundColor: t.palette[0],\n        pointBorderColor: t.pageBg,\n        pointBorderWidth: 2,\n        pointRadius: 6,\n        pointStyle: \"circle\",\n      },\n      {\n        label: \"Renn (Forward)\",\n        data: playerB,\n        borderColor: t.palette[1],\n        backgroundColor: `${t.palette[1]}40`,\n        borderWidth: 3,\n        pointBackgroundColor: t.palette[1],\n        pointBorderColor: t.pageBg,\n        pointBorderWidth: 2,\n        pointRadius: 6,\n        pointStyle: \"triangle\",\n      },\n    ],\n  },\n  options: {\n    responsive: true,\n    maintainAspectRatio: false,\n    animation: false,\n    plugins: {\n      title: {\n        display: true,\n        text: \"radar-basic · javascript · chartjs · anyplot.ai\",\n        color: t.ink,\n        font: { size: 22 },\n        padding: { bottom: 4 },\n      },\n      subtitle: {\n        display: true,\n        text: \"Kova's biggest edge is Agility (+31); Renn's is Strength (+22)\",\n        color: t.inkSoft,\n        font: { size: 16, style: \"italic\" },\n        padding: { bottom: 20 },\n      },\n      legend: {\n        position: \"bottom\",\n        labels: {\n          color: t.ink,\n          font: { size: 16 },\n          padding: 20,\n          usePointStyle: true,\n        },\n      },\n    },\n    scales: {\n      r: {\n        min: 0,\n        max: 100,\n        ticks: {\n          stepSize: 20,\n          color: t.inkSoft,\n          font: { size: 12 },\n          backdropColor: \"transparent\",\n        },\n        grid: { color: t.grid },\n        angleLines: { color: t.grid },\n        pointLabels: {\n          color: t.ink,\n          font: (ctx) => ({\n            size: 15,\n            weight: attributes[ctx.index] === \"Agility\" ? \"bold\" : \"normal\",\n          }),\n        },\n      },\n    },\n  },\n});\n"}