{"spec_id":"qrcode-basic","library":"highcharts","language":"javascript","code":"// anyplot.ai\n// qrcode-basic: Basic QR Code Generator\n// Library: highcharts 12.6.0 | JavaScript 22.23.0\n// Quality: 89/100 | Created: 2026-06-24\n//# anyplot-orientation: square\n\nconst t = window.ANYPLOT_TOKENS;\n\n// Pre-computed QR matrix for \"https://anyplot.ai\"\n// Version 2 (25×25 modules), Error Correction Level M\nconst QR_MATRIX = [\n  [1,1,1,1,1,1,1,0,1,0,0,1,1,0,1,0,0,0,1,1,1,1,1,1,1],\n  [1,0,0,0,0,0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,0,0,0,0,1],\n  [1,0,1,1,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,0,1,1,1,0,1],\n  [1,0,1,1,1,0,1,0,0,1,0,0,1,0,1,0,1,0,1,0,1,1,1,0,1],\n  [1,0,1,1,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1],\n  [1,0,0,0,0,0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,0,0,0,0,1],\n  [1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1],\n  [0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0],\n  [1,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,0,0,1,0,1,1,1],\n  [0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1,1,0],\n  [1,0,0,0,0,1,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,1,0,0,1],\n  [0,1,1,1,1,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1],\n  [1,0,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,1,0,0,0,0,1],\n  [1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,1,0,0,1,0],\n  [1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,1],\n  [1,0,0,1,0,1,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,1,1,0,1],\n  [1,0,1,1,1,0,1,0,1,0,1,1,1,0,0,0,1,1,1,1,1,0,1,1,0],\n  [0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,0,0,0,1,0,1,1,0],\n  [1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1],\n  [1,0,0,0,0,0,1,0,1,0,1,1,0,1,0,1,1,0,0,0,1,0,0,0,0],\n  [1,0,1,1,1,0,1,0,1,0,1,1,0,1,0,1,1,1,1,1,1,0,0,0,1],\n  [1,0,1,1,1,0,1,0,1,1,1,0,1,1,0,0,1,1,1,0,0,0,0,1,1],\n  [1,0,1,1,1,0,1,0,0,0,0,1,0,1,0,0,1,0,0,0,1,1,1,1,1],\n  [1,0,0,0,0,0,1,0,0,1,0,1,1,1,0,0,0,1,1,1,1,0,1,1,1],\n  [1,1,1,1,1,1,1,0,1,1,0,1,1,1,0,0,1,1,1,0,0,1,0,0,1],\n];\n\n// Title — scale font size for length\nconst TITLE = \"qrcode-basic · javascript · highcharts · anyplot.ai\";\nconst titleLen = TITLE.length;\nconst titleFontSize = titleLen > 67\n  ? Math.max(Math.round(22 * 67 / titleLen), 14) + \"px\"\n  : \"22px\";\n\n// Encoded URL label\nconst ENCODED_URL = \"https://anyplot.ai\";\n\n// Module colors: dark ink on cream (light) / near-white on near-black (dark)\nconst MODULE_COLOR = t.ink;       // dark (#1A1A17) on light / light (#F0EFE8) on dark\nconst QR_BG       = t.pageBg;    // cream (#FAF8F1) on light / near-black (#1A1A17) on dark\n\n// Chart — square, transparent background, no axes\nconst chart = Highcharts.chart(\"container\", {\n  chart: {\n    backgroundColor: \"transparent\",\n    animation: false,\n    style: { fontFamily: \"inherit\" },\n    margin: [90, 60, 30, 60],\n  },\n  credits: { enabled: false },\n  colors: t.palette,\n  title: {\n    text: TITLE,\n    style: { color: t.ink, fontSize: titleFontSize, fontWeight: \"600\" },\n    margin: 20,\n  },\n  subtitle: {\n    text: \"Encodes: \" + ENCODED_URL + \"  |  Version 2  ·  ECC Level M\",\n    style: { color: t.inkSoft, fontSize: \"14px\" },\n  },\n  xAxis: { visible: false },\n  yAxis: { visible: false },\n  legend: { enabled: false },\n  plotOptions: { series: { animation: false } },\n  series: [],\n});\n\n// Draw QR code using Highcharts SVG renderer\nconst qrSize    = QR_MATRIX.length;  // 25 modules\nconst quietZone = 4;                 // standard quiet zone\nconst totalMods = qrSize + 2 * quietZone; // 33\n\nconst plotW = chart.plotWidth;\nconst plotH = chart.plotHeight;\n\n// Center a square QR area within the plot area\nconst qrAreaSize = Math.min(plotW, plotH);\nconst offsetX = chart.plotLeft + (plotW - qrAreaSize) / 2;\nconst offsetY = chart.plotTop  + (plotH - qrAreaSize) / 2;\n\nconst cellSize = qrAreaSize / totalMods;\n\n// White quiet zone background\nchart.renderer.rect(offsetX, offsetY, qrAreaSize, qrAreaSize)\n  .attr({ fill: QR_BG, zIndex: 3, 'shape-rendering': 'crispEdges' })\n  .add();\n\n// Black QR modules\nfor (let row = 0; row < qrSize; row++) {\n  for (let col = 0; col < qrSize; col++) {\n    if (QR_MATRIX[row][col]) {\n      chart.renderer.rect(\n        offsetX + (col + quietZone) * cellSize,\n        offsetY + (row + quietZone) * cellSize,\n        cellSize,\n        cellSize\n      ).attr({ fill: MODULE_COLOR, zIndex: 4, 'shape-rendering': 'crispEdges' }).add();\n    }\n  }\n}\n"}