<canvas id="bubble" height="600" width="400"></canvas>
<script src=https://documentcloud.github.com/underscore/underscore.js></script>
<script src=https://mbostock.github.com/d3/d3.v2.js?2.8.1></script>
d3.csv("flavorbible2.csv", function(csv) {
// so the csv variable in here is the whole csv file
var data = _.filter(csv, function(d) {
return d["ingredient1"] == "chard";
console.log(data[0]["quality"]);
var data_for_graph = _.map(data, function(elm){
var w = 400, h = 400, max_r = 40,
r = taste_quality[elm["quality"]];
// keeping the circle visible along the x axis
while (((x*w) - (max_r * r) < 0) || ((x*w) + (max_r * r) > w))
//var who = ((x*w) + (max_r *r));
// keeping the circle visible along the y axis
while (((h*y) - (max_r * r) < 0) || ((h*y) + (max_r *r) > h))
return [x, y, taste_quality[elm["quality"]], 'blue', elm["ingredient2"]];
//_.chain.pluck("fat (g)").max.value[];
/* set up canvas, get tallest column height */
var canvas = document.getElementById('bubble');
var ctx = canvas.getContext('2d');
/* d is of form [x, y, r, color, label] */
ctx.font = "20pt Calibri";
ctx.fillStyle = "yellow";
ctx.fillText(d[4], w*d[0]-(max_r*d[2]), h*d[1]);
// when in doubt, just console.log whatever data in the scope
// to see the format its in and go from there
// _.filter(data, function(d) {
// 2 nutrients as axees. color bubbles based on their food groups
// scale the data, print bubbles