{"id":3337,"date":"2026-05-16T00:03:00","date_gmt":"2026-05-16T00:03:00","guid":{"rendered":"https:\/\/kosningaspa.is\/?p=3337"},"modified":"2026-05-17T08:06:21","modified_gmt":"2026-05-17T08:06:21","slug":"16-mai-2","status":"publish","type":"post","link":"https:\/\/kosningaspa.is\/?p=3337","title":{"rendered":"16. ma\u00ed"},"content":{"rendered":"\n<div id=\"borg2026-chart-wrap\" style=\"font-family: 'Helvetica Neue', Arial, sans-serif; max-width: 680px; margin: 0 auto; padding: 16px 0;\">\n  <div style=\"position: relative; width: 100%; height: 385px;\">\n    <canvas id=\"borg2026-canvas\"><\/canvas>\n  <\/div>\n  <p style=\"font-size: 14px; font-weight: 600; color: #444; text-align: center; margin: 6px 0 0 0;\">Fylgi (%)<\/p>\n<\/div>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/Chart.js\/4.4.1\/chart.umd.js\"><\/script>\n<script>\n(function() {\n  var parties = [\n    { key: 'D', label: 'Sj\u00e1lfsst\u00e6\u00f0isflokkurinn', value: 31.4, color: '#0248f2' },\n    { key: 'S', label: 'Samfylkingin',           value: 20.3, color: '#e42802' },\n    { key: 'A', label: 'Vinstri\u00f0',               value: 11.1, color: '#b8e8a0' },\n    { key: 'C', label: 'Vi\u00f0reisn',               value: 11.1, color: '#ef8437' },\n    { key: 'M', label: 'Mi\u00f0flokkurinn',          value:  10.3, color: '#008a9a' },\n    { key: 'B', label: 'Frams\u00f3kn',               value:  5.5, color: '#4a8a1c' },\n    { key: 'J', label: 'S\u00f3s\u00edalistaflokkurinn',   value:  4.6, color: '#9c0f18' },\n    { key: 'F', label: 'Flokkur f\u00f3lksins',       value:  2.5, color: '#f7cc5b' },\n    { key: 'P', label: 'P\u00edratar',                value:  2.4, color: '#4c2186' },\n    { key: 'R', label: 'Okkar borg',             value:  0.5, color: '#7ab8cc' },\n    { key: 'G', label: 'G\u00f3\u00f0an daginn',           value:  0.3, color: '#e1ff2f' }\n  ];\n  parties.sort(function(a, b) { return b.value - a.value; });\n  new Chart(document.getElementById('borg2026-canvas'), {\n    type: 'bar',\n    data: {\n      labels: parties.map(function(p) { return p.label; }),\n      datasets: [{\n        data: parties.map(function(p) { return p.value; }),\n        backgroundColor: parties.map(function(p) { return p.color; }),\n        borderWidth: 0,\n        borderRadius: 3,\n        barThickness: 22\n      }]\n    },\n    options: {\n      indexAxis: 'y',\n      responsive: true,\n      maintainAspectRatio: false,\n      plugins: {\n        legend: { display: false },\n        tooltip: {\n          callbacks: {\n            label: function(ctx) { return ' ' + ctx.parsed.x.toFixed(1) + '%'; }\n          }\n        }\n      },\n      scales: {\n        x: {\n          min: 0,\n          max: 35,\n          ticks: {\n            callback: function(v) { return v + '%'; },\n            color: '#666',\n            font: { size: 13, weight: '500' }\n          },\n          grid: { color: 'rgba(0,0,0,0.07)' },\n          border: { display: false }\n        },\n        y: {\n          ticks: {\n            color: '#444',\n            font: { size: 12 },\n            padding: 4\n          },\n          grid: { display: false },\n          border: { display: false }\n        }\n      },\n      layout: { padding: { right: 60 } }\n    },\n    plugins: [{\n      id: 'barLabels',\n      afterDatasetsDraw: function(chart) {\n        var ctx = chart.ctx;\n        var meta = chart.getDatasetMeta(0);\n        ctx.save();\n        ctx.textBaseline = 'middle';\n        meta.data.forEach(function(bar, i) {\n          var val = chart.data.datasets[0].data[i];\n          var key = parties[i].key;\n          var barLeft = chart.scales.x.getPixelForValue(0);\n          var barRight = chart.scales.x.getPixelForValue(val);\n          var barWidth = barRight - barLeft;\n          var y = bar.y;\n          if (key) {\n            ctx.font = 'bold 11px Helvetica Neue, Arial, sans-serif';\n            ctx.textAlign = 'left';\n            if (barWidth > 28) {\n              ctx.fillStyle = 'rgba(255,255,255,0.92)';\n              ctx.fillText(key, barLeft + 6, y);\n            } else {\n              ctx.fillStyle = '#444';\n              ctx.fillText(key, barRight + 6, y);\n            }\n          }\n          ctx.font = '500 12px Helvetica Neue, Arial, sans-serif';\n          ctx.fillStyle = '#444';\n          ctx.textAlign = 'left';\n          var offset = (key && barWidth <= 28) ? 20 : 7;\n          ctx.fillText(val.toFixed(1) + '%', barRight + offset, y);\n        });\n        ctx.restore();\n      }\n    }]\n  });\n})();\n<\/script>\n\n\n\n<h4 class=\"wp-block-heading\">Kannanir \u00ed n\u00fdjustu kosningasp\u00e1:<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gallup 11.-15. ma\u00ed (v\u00e6gi: 42%)<\/li>\n\n\n\n<li>Mask\u00edna 12.-15. ma\u00ed (v\u00e6gi: 58%)<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Fylgis\u00fer\u00f3un<\/h4>\n\n\n\n<div id=\"borg2026-trend-wrap\" style=\"font-family: 'Helvetica Neue', Arial, sans-serif; max-width: 720px; margin: 0 auto; padding: 16px 0;\">\n  <div id=\"borg2026-trend-legend\" style=\"display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-bottom: 14px;\"><\/div>\n  <div style=\"position: relative; width: 100%; height: 420px;\">\n    <canvas id=\"borg2026-trend-canvas\"><\/canvas>\n  <\/div>\n  <p style=\"font-size: 14px; font-weight: 600; color: #444; text-align: center; margin: 6px 0 0 0;\">Fylgi (%)<\/p>\n<\/div>\n\n<style>\n.borg-legend-item {\n  display: flex;\n  align-items: center;\n  gap: 5px;\n  font-size: 12px;\n  color: #444;\n  cursor: pointer;\n  user-select: none;\n  padding: 3px 6px;\n  border-radius: 4px;\n  transition: opacity 0.15s;\n}\n.borg-legend-item:hover { background: rgba(0,0,0,0.05); }\n.borg-legend-item.inactive { opacity: 0.35; }\n.borg-legend-swatch {\n  width: 20px;\n  height: 3px;\n  border-radius: 2px;\n  display: inline-block;\n  flex-shrink: 0;\n  transition: opacity 0.15s;\n}\n<\/style>\n\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/Chart.js\/4.4.1\/chart.umd.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/luxon\/3.4.4\/luxon.min.js\"><\/script>\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chartjs-adapter-luxon@1.3.1\/dist\/chartjs-adapter-luxon.umd.min.js\"><\/script>\n<script>\n(function() {\n\n  var raw = [\n    { t: '2025-10-14', B:3.9,  C:12.1, D:29.6, F:4.0, J:4.7, M:6.2,  R:null, P:6.9, S:27.8, A:4.1,  Adrir:0.7 },\n    { t: '2025-10-29', B:4.0,  C:12.4, D:27.9, F:4.5, J:5.2, M:7.2,  R:null, P:6.9, S:27.3, A:3.9,  Adrir:0.7 },\n    { t: '2025-11-28', B:4.5,  C:11.7, D:28.5, F:4.0, J:5.4, M:8.5,  R:null, P:7.1, S:24.9, A:4.5,  Adrir:0.9 },\n    { t: '2025-12-09', B:3.7,  C:10.4, D:29.6, F:3.9, J:5.8, M:9.5,  R:null, P:6.1, S:25.7, A:4.7,  Adrir:0.6 },\n    { t: '2025-12-29', B:4.0,  C:11.0, D:27.7, F:4.1, J:5.7, M:9.7,  R:null, P:6.2, S:26.1, A:4.9,  Adrir:0.6 },\n    { t: '2026-01-29', B:4.0,  C:12.8, D:25.8, F:3.9, J:4.7, M:10.1, R:null, P:4.2, S:26.6, A:7.0,  Adrir:0.9 },\n    { t: '2026-02-02', B:3.3,  C:11.4, D:29.2, F:3.0, J:4.4, M:9.7,  R:null, P:4.6, S:28.0, A:6.0,  Adrir:0.4 },\n    { t: '2026-03-03', B:4.3,  C:11.8, D:26.2, F:3.4, J:3.5, M:10.7, R:1.2,  P:4.4, S:26.1, A:8.1,  Adrir:0.3 },\n    { t: '2026-03-28', B:5.0,  C:12.3, D:22.9, F:3.7, J:3.0, M:10.9, R:1.8,  P:5.0, S:23.4, A:10.8, Adrir:1.3 },\n    { t: '2026-04-17', B:4.4,  C:11.1, D:24.9, F:3.8, J:2.6, M:10.6, R:1.8,  P:4.3, S:22.6, A:13.0, Adrir:0.9 },\n    { t: '2026-04-24', B:3.9,  C:11.0, D:26.3, F:3.2, J:4.1, M:10.3, R:2.2,  P:4.5, S:21.9, A:11.7, Adrir:0.9 },\n    { t: '2026-05-03', B:3.6,  C:10.4, D:27.4, F:2.7, J:4.5, M:10.2, R:2.0,  P:4.1, S:22.0, A:12.2, Adrir:0.9 },\n    { t: '2026-05-06', B:4.9,  C:11.6, D:28.5, F:2.5, J:5.1, M:7.7, R:1.6,  P:4.4, S:19.3, A:13.2, Adrir:0.1 },\n    { t: '2026-05-13', B:5.2,  C:11.4, D:28.4, F:3.2, J:4.2, M:8.7, R:1.3,  P:4.2, S:19.9, A:12.5, Adrir:0.0 },\n    { t: '2026-05-15', B:5.2,  C:10.6, D:30.0, F:3.1, J:4.1, M:10.2, R:0.6,  P:3.1, S:20.9, A:11.5, Adrir:0.0 },\n    { t: '2026-05-16', B:5.5,  C:11.1, D:31.4, F:2.5, J:4.6, M:10.3, R:0.5,  P:2.4, S:20.3, A:11.1, Adrir:0.0 },\n\n  ];\n\n  var parties = [\n    { key: 'S', field: 'S', name: 'Samfylkingin',           color: '#e42802' },\n    { key: 'D', field: 'D', name: 'Sj\u00e1lfsst\u00e6\u00f0isflokkurinn', color: '#0248f2' },\n    { key: 'C', field: 'C', name: 'Vi\u00f0reisn',               color: '#ffa500' },\n    { key: 'M', field: 'M', name: 'Mi\u00f0flokkurinn',          color: '#008a9a' },\n    { key: 'A', field: 'A', name: 'Vinstri\u00f0',        color: '#78c858' },\n    { key: 'B', field: 'B', name: 'Frams\u00f3kn',               color: '#4a8a1c' },\n    { key: 'P', field: 'P', name: 'P\u00edratar',                color: '#3f0942' },\n    { key: 'F', field: 'F', name: 'Flokkur f\u00f3lksins',       color: '#ec509a' },\n    { key: 'J', field: 'J', name: 'S\u00f3s\u00edalistaflokkurinn',   color: '#9c0f18' },\n    { key: 'R', field: 'R', name: 'Okkar borg',             color: '#7ab8cc' },\n    { key: '',  field: 'Adrir', name: 'A\u00f0rir',              color: '#999999' },\n  ];\n\n  var chart = new Chart(document.getElementById('borg2026-trend-canvas'), {\n    type: 'line',\n    data: {\n      datasets: parties.map(function(p) {\n        return {\n          label: (p.key ? p.key + ' \u2013 ' : '') + p.name,\n          data: raw.filter(function(r) { return r[p.field] !== null; })\n                   .map(function(r) { return { x: r.t, y: r[p.field] }; }),\n          borderColor: p.color,\n          backgroundColor: 'transparent',\n          borderWidth: 2,\n          pointRadius: 3,\n          pointHoverRadius: 5,\n          pointBackgroundColor: p.color,\n          tension: 0,\n          spanGaps: false,\n        };\n      })\n    },\n    options: {\n      responsive: true,\n      maintainAspectRatio: false,\n      interaction: { mode: 'index', intersect: false },\n      plugins: {\n        legend: { display: false },\n        tooltip: {\n          callbacks: {\n            label: function(ctx) {\n              if (ctx.parsed.y === null) return null;\n              return '  ' + ctx.dataset.label + ': ' + ctx.parsed.y.toFixed(1) + '%';\n            }\n          },\n          itemSort: function(a, b) { return b.parsed.y - a.parsed.y; },\n          filter: function(item) { return !chart.getDatasetMeta(item.datasetIndex).hidden; }\n        }\n      },\n      scales: {\n        x: {\n          type: 'time',\n          time: {\n            unit: 'month',\n            tooltipFormat: 'd. MMM yyyy',\n            displayFormats: { month: 'MMM' }\n          },\n          min: '2025-10-01',\n          max: '2026-05-18',\n          ticks: {\n            color: '#666',\n            font: { size: 11 },\n            maxRotation: 0,\n            callback: function(value) {\n              var dt = luxon.DateTime.fromMillis(value);\n              var mon = dt.toFormat('MMM');\n              if (dt.month === 10 && dt.year === 2025) return [mon, \"'25\"];\n              if (dt.month === 1) return [mon, \"'26\"];\n              return mon;\n            }\n          },\n          grid: { display: false },\n          border: { display: false }\n        },\n        y: {\n          min: 0,\n          max: 35,\n          ticks: {\n            callback: function(v) { return v + '%'; },\n            color: '#666',\n            font: { size: 12, weight: '500' },\n            stepSize: 5\n          },\n          grid: { color: 'rgba(0,0,0,0.07)' },\n          border: { display: false }\n        }\n      },\n      layout: { padding: { right: 8 } }\n    }\n  });\n\n  \/* Build clickable legend *\/\n  var legend = document.getElementById('borg2026-trend-legend');\n  parties.forEach(function(p, i) {\n    var item = document.createElement('span');\n    item.className = 'borg-legend-item';\n    item.title = p.name;\n    var displayLabel = p.key ? p.key : p.name;\n    item.innerHTML =\n      '<span class=\"borg-legend-swatch\" style=\"background:' + p.color + ';\"><\/span>' +\n      displayLabel;\n\n    item.addEventListener('click', function() {\n      var meta = chart.getDatasetMeta(i);\n      meta.hidden = !meta.hidden;\n      item.classList.toggle('inactive', meta.hidden);\n      updateYAxis();\n      chart.update();\n    });\n\n    legend.appendChild(item);\n  });\n\n  function updateYAxis() {\n    var maxVal = 0;\n    chart.data.datasets.forEach(function(ds, i) {\n      if (chart.getDatasetMeta(i).hidden) return;\n      ds.data.forEach(function(pt) {\n        if (pt && pt.y > maxVal) maxVal = pt.y;\n      });\n    });\n    \/* Round up to nearest 5, add a 5% buffer *\/\n    var ceiling = Math.ceil((maxVal + 3) \/ 5) * 5;\n    ceiling = Math.max(ceiling, 10); \/* never go below 10 *\/\n    chart.options.scales.y.max = ceiling;\n  }\n\n})();\n<\/script>\n\n\n\n<p>Athugi\u00f0 a\u00f0 h\u00e6gt er a\u00f0 velja hva\u00f0a flokkar eru s\u00fdndir \u00e1 fylgis\u00fer\u00f3unar grafinu me\u00f0 \u00fev\u00ed a\u00f0 \u00fdta \u00e1 b\u00f3kstafina fyrir ofan grafi\u00f0.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><\/h4>\n\n\n\n<p><\/p>\n\n\n","protected":false},"excerpt":{"rendered":"<p>Fylgi (%) Kannanir \u00ed n\u00fdjustu kosningasp\u00e1: Fylgis\u00fer\u00f3un Fylgi (%) Athugi\u00f0 a\u00f0 h\u00e6gt er a\u00f0 velja hva\u00f0a flokkar eru s\u00fdndir \u00e1 fylgis\u00fer\u00f3unar grafinu me\u00f0 \u00fev\u00ed a\u00f0 \u00fdta \u00e1 b\u00f3kstafina fyrir ofan grafi\u00f0.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-3337","post","type-post","status-publish","format-standard","hentry","category-borgarstjornarkosningar"],"_links":{"self":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts\/3337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3337"}],"version-history":[{"count":5,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts\/3337\/revisions"}],"predecessor-version":[{"id":3355,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=\/wp\/v2\/posts\/3337\/revisions\/3355"}],"wp:attachment":[{"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kosningaspa.is\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}