w{"id":1212,"date":"2025-05-08T06:13:52","date_gmt":"2025-05-08T04:13:52","guid":{"rendered":"https:\/\/www.brobacke.se\/?page_id=1212"},"modified":"2025-05-08T06:16:25","modified_gmt":"2025-05-08T04:16:25","slug":"historisk-avkastning","status":"publish","type":"page","link":"https:\/\/brobacke.saltisdata.se\/?page_id=1212","title":{"rendered":"Historisk avkastning"},"content":{"rendered":"    <div>\n        <button onclick=\"setRange('7')\">7 dagar<\/button>\n        <button onclick=\"setRange('30')\">30 dagar<\/button>\n        <button onclick=\"setRange('90')\">90 dagar<\/button>\n        <button onclick=\"setRange('all')\">Visa alla<\/button>\n    <\/div>\n\n    <canvas id=\"fondChart\" width=\"600\" height=\"300\"><\/canvas>\n\n    <style>\n        button { margin-right: 10px; }\n        canvas { margin-top: 20px; }\n    <\/style>\n\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chartjs-plugin-annotation@1.4.0\/dist\/chartjs-plugin-annotation.min.js\"><\/script>\n\n    <script>\n        const csvUrlBase = \"https:\/\/docs.google.com\/spreadsheets\/d\/e\/2PACX-1vRU1TNbF8oX0uTruzuWCEUC4VMUuNOtPQTFQyxt3JAX6XeCmDngKTnULO5TFKMAnu5FC44tRSo4fLOK\/pub?output=csv\";\n        const csvUrl = `${csvUrlBase}&t=${new Date().getTime()}`; \/\/ Disable cache\n        const markerDate = \"11\/1\/2022\";\n\n        let originalLabels = [];\n        let originalData = [];\n        let chart;\n\n        fetch(csvUrl)\n            .then(res => res.text())\n            .then(text => {\n                const rows = text.split('\\n').slice(1);\n                rows.forEach((row) => {\n                    const [date, value] = row.split(',');\n                    if (date && value && !isNaN(parseFloat(value))) {\n                        originalLabels.push(date.trim());\n                        originalData.push(parseFloat(value.trim()));\n                    }\n                });\n                initChart(originalLabels, originalData);\n            });\n\n        function getAnnotation(labels) {\n            if (!labels.includes(markerDate)) return {};\n            return {\n                annotations: {\n                    markLine: {\n                        type: 'line',\n                        scaleID: 'x',\n                        value: markerDate,\n                        borderColor: 'red',\n                        borderWidth: 2,\n                        label: {\n                            content: 'Ny f\u00f6rvaltare: Nils Brobacke',\n                            enabled: true,\n                            position: 'start',\n                            backgroundColor: 'red',\n                            color: 'white',\n                            font: {\n                                size: 12\n                            }\n                        }\n                    }\n                }\n            };\n        }\n\n        function initChart(labels, data) {\n            const ctx = document.getElementById(\"fondChart\").getContext(\"2d\");\n            chart = new Chart(ctx, {\n                type: 'line',\n                data: {\n                    labels: labels,\n                    datasets: [{\n                        label: \"Fondens v\u00e4rde\",\n                        data: data,\n                        borderColor: \"blue\",\n                        backgroundColor: \"rgba(0,0,255,0.1)\",\n                        fill: true,\n                        tension: 0.1,\n                        pointRadius: 2\n                    }]\n                },\n                options: {\n                    responsive: true,\n                    plugins: {\n                        annotation: getAnnotation(labels),\n                        tooltip: {\n                            callbacks: {\n                                label: function(context) {\n                                    return \"V\u00e4rde: \" + context.parsed.y.toFixed(2);\n                                }\n                            }\n                        }\n                    },\n                    scales: {\n                        x: { title: { display: true, text: 'Datum' } },\n                        y: { title: { display: true, text: 'V\u00e4rde' } }\n                    }\n                },\n                plugins: [Chart.registry.getPlugin('annotation')]\n            });\n        }\n\n        function updateChart(labels, data) {\n            chart.data.labels = labels;\n            chart.data.datasets[0].data = data;\n            chart.options.plugins.annotation = getAnnotation(labels);\n            chart.update();\n        }\n\n        function setRange(days) {\n            if (days === 'all') {\n                updateChart(originalLabels, originalData);\n            } else {\n                const count = parseInt(days);\n                const total = originalLabels.length;\n                const start = Math.max(total - count, 0);\n                const rangeLabels = originalLabels.slice(start);\n                const rangeData = originalData.slice(start);\n                updateChart(rangeLabels, rangeData);\n            }\n        }\n    <\/script>\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1212","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Historisk avkastning - brobacke.se<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/brobacke.saltisdata.se\/?page_id=1212\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Historisk avkastning - brobacke.se\" \/>\n<meta property=\"og:url\" content=\"https:\/\/brobacke.saltisdata.se\/?page_id=1212\" \/>\n<meta property=\"og:site_name\" content=\"brobacke.se\" \/>\n<meta property=\"article:modified_time\" content=\"2025-05-08T04:16:25+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Ber\u00e4knad l\u00e4stid\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minut\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/brobacke.saltisdata.se\/?page_id=1212\",\"url\":\"https:\/\/brobacke.saltisdata.se\/?page_id=1212\",\"name\":\"Historisk avkastning - brobacke.se\",\"isPartOf\":{\"@id\":\"http:\/\/brobacke.saltisdata.se\/#website\"},\"datePublished\":\"2025-05-08T04:13:52+00:00\",\"dateModified\":\"2025-05-08T04:16:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/brobacke.saltisdata.se\/?page_id=1212#breadcrumb\"},\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/brobacke.saltisdata.se\/?page_id=1212\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/brobacke.saltisdata.se\/?page_id=1212#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/brobacke.saltisdata.se\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Historisk avkastning\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/brobacke.saltisdata.se\/#website\",\"url\":\"http:\/\/brobacke.saltisdata.se\/\",\"name\":\"brobacke.se\",\"description\":\"If it moves, we trade it\",\"publisher\":{\"@id\":\"http:\/\/brobacke.saltisdata.se\/#organization\"},\"alternateName\":\"Brobacke Global Allokering\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/brobacke.saltisdata.se\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"sv-SE\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/brobacke.saltisdata.se\/#organization\",\"name\":\"Brobacke Global Allokering\",\"url\":\"http:\/\/brobacke.saltisdata.se\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"http:\/\/brobacke.saltisdata.se\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.brobacke.se\/wp-content\/uploads\/2022\/11\/BGA_logo_horisontal_green.png\",\"contentUrl\":\"https:\/\/www.brobacke.se\/wp-content\/uploads\/2022\/11\/BGA_logo_horisontal_green.png\",\"width\":1087,\"height\":285,\"caption\":\"Brobacke Global Allokering\"},\"image\":{\"@id\":\"http:\/\/brobacke.saltisdata.se\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Historisk avkastning - brobacke.se","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/brobacke.saltisdata.se\/?page_id=1212","og_locale":"sv_SE","og_type":"article","og_title":"Historisk avkastning - brobacke.se","og_url":"https:\/\/brobacke.saltisdata.se\/?page_id=1212","og_site_name":"brobacke.se","article_modified_time":"2025-05-08T04:16:25+00:00","twitter_card":"summary_large_image","twitter_misc":{"Ber\u00e4knad l\u00e4stid":"1 minut"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/brobacke.saltisdata.se\/?page_id=1212","url":"https:\/\/brobacke.saltisdata.se\/?page_id=1212","name":"Historisk avkastning - brobacke.se","isPartOf":{"@id":"http:\/\/brobacke.saltisdata.se\/#website"},"datePublished":"2025-05-08T04:13:52+00:00","dateModified":"2025-05-08T04:16:25+00:00","breadcrumb":{"@id":"https:\/\/brobacke.saltisdata.se\/?page_id=1212#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/brobacke.saltisdata.se\/?page_id=1212"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/brobacke.saltisdata.se\/?page_id=1212#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/brobacke.saltisdata.se\/"},{"@type":"ListItem","position":2,"name":"Historisk avkastning"}]},{"@type":"WebSite","@id":"http:\/\/brobacke.saltisdata.se\/#website","url":"http:\/\/brobacke.saltisdata.se\/","name":"brobacke.se","description":"If it moves, we trade it","publisher":{"@id":"http:\/\/brobacke.saltisdata.se\/#organization"},"alternateName":"Brobacke Global Allokering","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/brobacke.saltisdata.se\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"sv-SE"},{"@type":"Organization","@id":"http:\/\/brobacke.saltisdata.se\/#organization","name":"Brobacke Global Allokering","url":"http:\/\/brobacke.saltisdata.se\/","logo":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"http:\/\/brobacke.saltisdata.se\/#\/schema\/logo\/image\/","url":"https:\/\/www.brobacke.se\/wp-content\/uploads\/2022\/11\/BGA_logo_horisontal_green.png","contentUrl":"https:\/\/www.brobacke.se\/wp-content\/uploads\/2022\/11\/BGA_logo_horisontal_green.png","width":1087,"height":285,"caption":"Brobacke Global Allokering"},"image":{"@id":"http:\/\/brobacke.saltisdata.se\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=\/wp\/v2\/pages\/1212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1212"}],"version-history":[{"count":2,"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=\/wp\/v2\/pages\/1212\/revisions"}],"predecessor-version":[{"id":1214,"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=\/wp\/v2\/pages\/1212\/revisions\/1214"}],"wp:attachment":[{"href":"https:\/\/brobacke.saltisdata.se\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}