Built with blockbuilder.org
forked from molliemarie's block: CrimeInChicago_BarPlot_Starter
forked from mscheriger's block: CrimeInChicago_BarPlot_Starter
| license: mit |
Built with blockbuilder.org
forked from molliemarie's block: CrimeInChicago_BarPlot_Starter
forked from mscheriger's block: CrimeInChicago_BarPlot_Starter
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <script src="https://d3js.org/d3.v5.min.js"></script> | |
| <style type="text/css"> | |
| /*Add styling here */ | |
| </style> | |
| <body> | |
| </body> | |
| <script> | |
| //Define variables that do not need data first: | |
| //Define Margins and svg here: | |
| // var margin = | |
| // var width = | |
| // var height = | |
| // var svg = | |
| //Define xscale, yscale, xaxis, and yaxis here: | |
| // var xScale = | |
| // var yScale = | |
| // var xAxis = | |
| // var yAxis = | |
| // Reading in data here, then calling "ready" function: | |
| d3.csv("https://raw.githubusercontent.com/molliemarie/MSIA-D3Course-2019/master/Projects%26Exercises/FirstCompleteBar/data/ChiCrime.csv", function(d) { | |
| return { | |
| count: +d.count, | |
| year: +d.year, | |
| violation: d['Primary Type'] | |
| } | |
| }).then(ready); | |
| // Ready Function | |
| function ready(data) { | |
| // filtering for 2018 data | |
| data2018 = data.filter(function(d) { return d.year == 2018}) | |
| console.log(data2018) | |
| // Define xScale and yScale domains here: | |
| // xScale.domain([0, d3.max([fill in appropriate code here])]); | |
| // yScale.domain(); | |
| // define xAxisGroup and yAxisGroup here: | |
| // var xAxisGroup = | |
| // var yAxisGroup = | |
| // Create bars here: | |
| // var bars = | |
| } | |
| </script> |