Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.


Assignment 3Goals Details For this assignment, we will use the Chicago Food Inspection Data. The data has been preprocessed and organized into a JSON file where each record has an Inspection Date pr

we will use the Chicago Food Inspection Data. The data has been preprocessed and organized into a JSON file where each record has an Inspection Date property storing the month and four other properties that count the number of attempted inspections according to their result. The data is available here:


We will be using D3 to create a vertically stacked bar chart. The visualizations should show each month along the x-axis and a bar showing the total number of attempted inspections each day. That bar should be split into subunits for each inspection result, where each range receives its own color. Provide a legend describing which colors map to which result.

1. Tableau (25 points)

Download Tableau Desktop and register here to receive a free academic license. You may work before your license arrives using a 14-day trial. Load the JSON file and create a stacked bar chart.

Example Solution for TableauHints

  • There is documentation on creating a stacked bar chart available.
  • Think about which colors to use. We will discuss this design choice more later in the course.

2. Vega-Lite (30 points)

Use the online editor to build a JSON representation that describes the stacked bar chart. It may useful to look at the tutorial and examples. Turn in the full JSON specification you create. Consider translating the result types into key-value pairs via the fold transform. Turn in the JSON specification (you can export it from the online editor as JSON).

Example Solution for Vega-LiteHints

  • You can load the data directly into the Vega-Lite editor using the url specified above
  • Use the fold transform to translate key-value pairs into separate entries
  • It may be useful to tag the inspection date with a timeUnit.

3. D3 (30/45 points)

In this part of the assignment, use D3 to create the stacked bar chart. should create the stacked version with a legend. You may start from the provided template in a3.html and a3.js; it also contains code to load the json file and compute the totals. If you use the provided template, make sure that your code is within the defined functions (or called from them). 

If you used any additional JavaScript libraries, please append a note indicating their usage to the text above (e.g. “I used the jQuery library to write callback functions.”) Include links to the libraries used. You do not need to adhere to any particular style for this text, but I would suggest using headings to separate the sections of the assignment.

Example Solution for D3Hints

  • d3.scaleBand is useful for bar charts
  • D3 has routines (e.g. d3.axisLeft) to build an axis given a scale
  • A group element with a transform can help shift the entire visualization so that labels or axes have space
  • To obtain the maximum monthly total, you can use d3.max with a proper accessor
  • d3.stack may be useful here. Check how the keys function works with the stack.
  • If you use d3.stack, you will need nested selections (note that these groups may be different than you expect)
Show more
Ask a Question