All examples By author By category About

ndarville

Confidence Interval

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


This chart displays the share of votes over time between two Danish parliamentary coalitions using placeholder data. The chart here has been used for two coalitions, but can also be used for two candidates.

You will notice something enveloping the line charts, which is the confidence interval, which indicates the spectrum of the confidence in our displayed results---to use a completely unscientific definition.

Compare this to Sam Wang's chart for the U.S. 2012 election and Drew Linzer's charts for individual states.

Usage

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

var dataset = "data.csv",
    parseDate = d3.time.format("%Y/%m").parse,
    electionDate = "",  // "2014/11",
    interpolation = "linear";

var coalitionLeft = ["A", "B", "F", "Ø"],
    coalitionLeftColor = "#D7191C", // blue
    coalitionRight = ["V", "O", "K", "I", "C"],
    coalitionRightColor = "#2B83BA", // red
    displaySingleCoalition = false;
    // false, "left", "right"

var useCoalitionLabels = true,
    yAxisTitle = "Votes (%)",
    cutoff = 50;

if (useCoalitionLabels === true) { margin.right = 50; }

The other parameters should be self-explanatory.

The data should have a column with (1) a date, one for (2) each party or candidate, and one for (3) the number of respondents.

Future Features to Consider

Issues