All examples By author By category About

ndarville

Coalition Majority

(This chart is a part of the d3-charts collection available here.)


This chart provides a historical view of the---at times---shifting majorities of the two parliamentary coalitions in the polls. Due to the dull nation of Danish politics, the majority has been very one-sided this term.

Compare this to Sam Wang's chart for the U.S. 2012 election.

The chart currently uses a LOESS regression to create a trend line---partly to alleviate the noise from a heavy dataset with a lot of polls and pollsters.

NB: Be aware that this chart does not currently take vote thresholds into account; if a party falls below it, its vote share will still be added to its coalition tally. Most, if not all, parliamentary coalition-majority charts do not account for this, but that is no excuse creating the impression of a non-existent parliamentary majority.

Usage

All parameters are in the top of the script under // Config. If we use the example script:

var dataset = "https://data.ndarville.com/danish-polls/data.csv", // "data.csv"
    parseDate = d3.time.format("%Y-%m-%d").parse,
    dateValue = "Date",
    lastElectionDate = "2011-09-15", // ""
    nextElectionDate = "2015-09-14", // ""
    coalitionLeft = ["A", "B", "F", "Ø", "Å"],
    coalitionLeftColor = "#2B83BA", // accessible red
    coalitionRight = ["V", "O", "K", "I", "C"],
    coalitionRightColor = "#D7191C", // accessible blue
    yAxisTitle = "Votes (50%)",
    loessRegression = true, // false
    loessBandwidth = .1; // .2
    // On a smaller dataset, you may want a bandwidth of .2

The other parameters should be self-explanatory.

Credits