/cspro-D3-charts

Examples of creating charts from a CSPro application using D3.js

Primary LanguageHTMLMIT LicenseMIT

HTML/D3 Reports in CSPro

Example of displaying charts from a CSPro data entry application using D3. The CSPro data entry application calculates the data required for the chart and writes it out to a javascript file in JSON format. It then uses the execsystem() function to launch an HTML page containing code to generate the chart that uses a <script> tag to include the data file generated from CSPro.

All files needed for chart generation are included locally so no webserver is required to display the charts. It will run both on Windows and on Android devices without an internet connection.

Examples of the following charts are included:

  • Bar chart: histogram of household sizes household-size
  • Line chart: completed interviews by day completion-by-day
  • Pie chart: distribution of housing type housing-type
  • Population pyramid: age/sex distribution pop-pyramid
  • Progress bar chart: housing units per enumeration area versus expected counts-vs-expected

The charts were created based on the D3 examples with the exception of the population pyramid which is a modified verision of a jsbin by jshanley (no relation).

The dataset used for the examples is a slightly modified subset of the Popstan example that comes with CSPro.

Requirements