Koalitionenrechner - wahlrecht.de

11/13/2024, 11:00:16 PM

< Отзив за Koalitionenrechner - wahlrecht.de

Отзив: Отлично - скриптът работи

§
Публикуван на: 25.07.2024
SidemАвтор
§
Публикуван на: 26.07.2024
Редактиран на: 26.07.2024

thank you, really cool script, i made a couple tweaks so the information is presented clearer imo, try it out:

let datasets = partyNames.map(party => ({
      label: party,
      data: dataByParty[party].reverse(),
      fill: true,
      backgroundColor: partyColors[party],
      tension: 0.1,
      pointStyle: 'line',
    }));
    let ctx = document.createElement('canvas');
    table.parentNode.insertBefore(ctx, table);
    new Chart(ctx, {
      type: 'line',
      data: {
        labels: dates.reverse(),
        datasets: datasets
      },
      options: {
        responsive: true,
        plugins: {
          legend: {
            position: 'top',
          },
          title: {
            display: true,
            text: 'Wahlrecht.de Umfragen - Zeitreihe'
          }
        },
        interaction: {
          mode: 'nearest',
          axis: 'x',
          intersect: false
        },
        scales: {
          x: {
            display: true,
            title: {
              display: true,
              text: 'Datum'
            }
          },
          y: {
            min: 0,
            max: 100,
            stacked: true,
            title: {
              display: true,
              text: 'Prozent'
            }
          }
        }
      }
    });
§
Публикуван на: 30.07.2024

Updated the script and switched to the stacked/filled style.

Публикувайте отговор

Влезте, за да публикувате отговор.