(This chart is a part of the d3-charts collection available here.)
This chart is for displaying something as simple as the share of votes as per cent for political parties over time.
The example thumbnail.png shows the graph with the proper historical data for the Danish political parties according to the data by meningsmaalinger.dk, whereas the included data is arbitrary.
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,
yAxisTitle = "Votes (%)",
dateValue = "Date",
showDots = true,
electionDate = ""; // "2014/11"
parseDate refers to the date format---in this case YYYY/MM.electionDate refers to the date of the election, if known. This will change the maximum on the x-axis to said date to contextualize the trends.The other parameters should be self-explanatory.
The chart thumbnail.png is based on the data from the September data from at meningsmalinger.dk (translates to polls.dk, ND).
The voter data is not included in the source code out of respect for the work that went into gathering it; I merely transcribed it from the site for personal use and to gauge the usefulness of charts based on it. Instead, placeholder data has been included in this project.
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js