{"spec_id":"bifurcation-basic","library":"highcharts","language":"javascript","code":"// anyplot.ai\n// bifurcation-basic: Bifurcation Diagram for Dynamical Systems\n// Library: highcharts 12.6.0 | JavaScript 22.22.3\n// Quality: 90/100 | Created: 2026-06-17\n\n//# anyplot-orientation: landscape\n\nconst t = window.ANYPLOT_TOKENS;\n\n// --- Data: logistic map x(n+1) = r * x(n) * (1 - x(n)) -------------------\nconst R_MIN = 2.5;\nconst R_MAX = 4.0;\nconst N_R = 1000;\nconst TRANSIENT = 200;\nconst STABLE = 100;\n\nconst data = [];\nfor (let i = 0; i <= N_R; i++) {\n    const r = R_MIN + (R_MAX - R_MIN) * (i / N_R);\n    let x = 0.5;\n    for (let j = 0; j < TRANSIENT; j++) x = r * x * (1 - x);\n    for (let j = 0; j < STABLE; j++) {\n        x = r * x * (1 - x);\n        data.push([r, x]);\n    }\n}\n\n// Brand green (#009E73) at partial opacity for density-based visualization\nconst seriesColor = \"rgba(0, 158, 115, 0.30)\";\n\n// --- Chart -----------------------------------------------------------------\nHighcharts.chart(\"container\", {\n    chart: {\n        type: \"scatter\",\n        backgroundColor: \"transparent\",\n        animation: false,\n        style: { fontFamily: \"inherit\" }\n    },\n    credits: { enabled: false },\n    title: {\n        text: \"bifurcation-basic · javascript · highcharts · anyplot.ai\",\n        style: { color: t.ink, fontSize: \"22px\", fontWeight: \"600\" }\n    },\n    xAxis: {\n        title: {\n            text: \"Growth Rate (r)\",\n            style: { color: t.inkSoft, fontSize: \"16px\" }\n        },\n        min: R_MIN,\n        max: R_MAX,\n        lineColor: t.inkSoft,\n        tickColor: t.inkSoft,\n        gridLineWidth: 0,\n        labels: { style: { color: t.inkSoft, fontSize: \"14px\" } },\n        plotLines: [\n            {\n                value: 3.0,\n                color: t.inkSoft,\n                dashStyle: \"Dash\",\n                width: 1,\n                label: {\n                    text: \"Period-1→2<br/>r≈3.0\",\n                    style: { color: t.inkSoft, fontSize: \"12px\" },\n                    rotation: 0,\n                    align: \"left\",\n                    x: 4,\n                    y: 16\n                }\n            },\n            {\n                value: 3.449,\n                color: t.inkSoft,\n                dashStyle: \"Dash\",\n                width: 1,\n                label: {\n                    text: \"Period-2→4<br/>r≈3.449\",\n                    style: { color: t.inkSoft, fontSize: \"12px\" },\n                    rotation: 0,\n                    align: \"left\",\n                    x: 4,\n                    y: 16\n                }\n            },\n            {\n                value: 3.544,\n                color: t.inkSoft,\n                dashStyle: \"Dash\",\n                width: 1,\n                label: {\n                    text: \"Period-4→8<br/>r≈3.544\",\n                    style: { color: t.inkSoft, fontSize: \"12px\" },\n                    rotation: 0,\n                    align: \"left\",\n                    x: 4,\n                    y: 60\n                }\n            }\n        ]\n    },\n    yAxis: {\n        title: {\n            text: \"Population (x)\",\n            style: { color: t.inkSoft, fontSize: \"16px\" }\n        },\n        min: 0,\n        max: 1,\n        lineColor: t.inkSoft,\n        tickColor: t.inkSoft,\n        gridLineColor: t.grid,\n        labels: { style: { color: t.inkSoft, fontSize: \"14px\" } }\n    },\n    legend: { enabled: false },\n    tooltip: { enabled: false },\n    plotOptions: {\n        series: {\n            animation: false,\n            enableMouseTracking: false,\n            turboThreshold: 0\n        },\n        scatter: {\n            marker: {\n                radius: 0.7,\n                symbol: \"circle\",\n                lineWidth: 0\n            }\n        }\n    },\n    series: [{\n        name: \"x(r)\",\n        data: data,\n        color: seriesColor\n    }]\n});\n"}