{"id":1261,"date":"2024-12-25T09:22:22","date_gmt":"2024-12-25T09:22:22","guid":{"rendered":"https:\/\/www.polipolina.com\/?page_id=1261"},"modified":"2024-12-25T09:22:35","modified_gmt":"2024-12-25T09:22:35","slug":"1261-2","status":"publish","type":"page","link":"https:\/\/www.polipolina.com\/index.php\/1261-2\/","title":{"rendered":""},"content":{"rendered":"\n<h1>Saksan osavaltioiden parlamenttien paikat<\/h1>\n<div class=\"chart-container\" style=\"display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;\">\n<\/div>\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n<script>\n  const data = [\n    {\n      state: \"Baden-W\u00fcrttemberg\",\n      seats: 154,\n      parties: { CDU_CSU: 42, SPD: 19, Greens: 58, AfD: 17, Linke: 0, FDP: 18, BSW: 0, FW: 0, Others: 0 },\n      year: 2021,\n    },\n    {\n      state: \"Baijeri\",\n      seats: 203,\n      parties: { CDU_CSU: 85, SPD: 17, Greens: 32, AfD: 32, Linke: 0, FDP: 0, BSW: 0, FW: 37, Others: 0 },\n      year: 2023,\n    },\n    \/\/ Lis\u00e4\u00e4 muut osavaltiot\n  ];\n\n  const colors = {\n    CDU_CSU: \"#000000\",\n    SPD: \"#E3000F\",\n    Greens: \"#64A12D\",\n    AfD: \"#0088CC\",\n    Linke: \"#BE3075\",\n    FDP: \"#FFD500\",\n    BSW: \"#808080\",\n    FW: \"#F28E00\",\n    Others: \"#A9A9A9\",\n  };\n\n  const container = document.querySelector(\".chart-container\");\n\n  data.forEach(({ state, parties, year }) => {\n    const chartBox = document.createElement(\"div\");\n    chartBox.style.width = \"400px\";\n    chartBox.style.height = \"400px\";\n\n    const canvas = document.createElement(\"canvas\");\n    chartBox.appendChild(canvas);\n    container.appendChild(chartBox);\n\n    new Chart(canvas, {\n      type: \"bar\",\n      data: {\n        labels: Object.keys(parties),\n        datasets: [\n          {\n            label: `Seats (${year})`,\n            data: Object.values(parties),\n            backgroundColor: Object.keys(parties).map(party => colors[party]),\n          },\n        ],\n      },\n      options: {\n        plugins: {\n          title: {\n            display: true,\n            text: state,\n          },\n        },\n        responsive: true,\n        maintainAspectRatio: false,\n        scales: {\n          x: {\n            title: { display: true, text: \"Parties\" },\n          },\n          y: {\n            title: { display: true, text: \"Seats\" },\n            beginAtZero: true,\n          },\n        },\n      },\n    });\n  });\n<\/script>\n\n\n\n\n<h1>Saksan osavaltioiden parlamenttien paikat<\/h1>\n<div class=\"chart-container\" style=\"display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;\">\n<\/div>\n<script src=\"https:\/\/cdn.jsdelivr.net\/npm\/chart.js\"><\/script>\n<script>\n  const data = [\n    {\n      state: \"Baden-W\u00fcrttemberg\",\n      seats: 154,\n      parties: { CDU_CSU: 42, SPD: 19, Greens: 58, AfD: 17, Linke: 0, FDP: 18, BSW: 0, FW: 0, Others: 0 },\n      year: 2021,\n    },\n    {\n      state: \"Baijeri\",\n      seats: 203,\n      parties: { CDU_CSU: 85, SPD: 17, Greens: 32, AfD: 32, Linke: 0, FDP: 0, BSW: 0, FW: 37, Others: 0 },\n      year: 2023,\n    },\n    \/\/ Lis\u00e4\u00e4 muut osavaltiot\n  ];\n\n  const colors = {\n    CDU_CSU: \"#000000\",\n    SPD: \"#E3000F\",\n    Greens: \"#64A12D\",\n    AfD: \"#0088CC\",\n    Linke: \"#BE3075\",\n    FDP: \"#FFD500\",\n    BSW: \"#808080\",\n    FW: \"#F28E00\",\n    Others: \"#A9A9A9\",\n  };\n\n  const container = document.querySelector(\".chart-container\");\n\n  data.forEach(({ state, parties, year }) => {\n    const chartBox = document.createElement(\"div\");\n    chartBox.style.width = \"400px\";\n    chartBox.style.height = \"400px\";\n\n    const canvas = document.createElement(\"canvas\");\n    chartBox.appendChild(canvas);\n    container.appendChild(chartBox);\n\n    new Chart(canvas, {\n      type: \"bar\",\n      data: {\n        labels: Object.keys(parties),\n        datasets: [\n          {\n            label: `Seats (${year})`,\n            data: Object.values(parties),\n            backgroundColor: Object.keys(parties).map(party => colors[party]),\n          },\n        ],\n      },\n      options: {\n        plugins: {\n          title: {\n            display: true,\n            text: state,\n          },\n        },\n        responsive: true,\n        maintainAspectRatio: false,\n        scales: {\n          x: {\n            title: { display: true, text: \"Parties\" },\n          },\n          y: {\n            title: { display: true, text: \"Seats\" },\n            beginAtZero: true,\n          },\n        },\n      },\n    });\n  });\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"<p>Saksan osavaltioiden parlamenttien paikat Saksan osavaltioiden parlamenttien paikat<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1261","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/pages\/1261","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/comments?post=1261"}],"version-history":[{"count":2,"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/pages\/1261\/revisions"}],"predecessor-version":[{"id":1263,"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/pages\/1261\/revisions\/1263"}],"wp:attachment":[{"href":"https:\/\/www.polipolina.com\/index.php\/wp-json\/wp\/v2\/media?parent=1261"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}