-
-
Save lqb2/9139366 to your computer and use it in GitHub Desktop.
Working on Tosci Coffee Viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF8"> | |
</head> | |
<body> | |
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script> | |
<script src="tosci.js" charset="utf-8"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//var dataset = []; | |
var dataset = d3.csv("5feb2014.csv", function(d) { | |
var dateTimeJoiner = d3.time.format("%x %X") // combines date and time into a Date object | |
var dateTime = dateTimeJoiner.parse(d["Date"] + " " + d["Time"]) // grabs the date and time | |
var gross_sales_conversion = +d["Gross Sales"].substr(1) //strips the $ sign | |
var total_sales = gross_sales_conversion * 1.07 //add tax | |
return { | |
date: dateTime, | |
category: d.Category, | |
item: d.Item, | |
quantity: +d.Quantity, | |
pricepoint: d["Price Point Name"], | |
gross_sales: gross_sales_conversion, | |
total_sale: +d3.format(".2f")(total_sales), // rounds to 2 decimal places | |
device_name: d["Device Name"] | |
}; | |
}, function(error, rows) { | |
console.log(rows); | |
/*for (var item in rows) { | |
console.log(item); | |
};*/ | |
// document.write(rows.length); | |
}); | |
/*for (var item in dataset) { | |
alert(dataset[item]); | |
} | |
*/ |
bengolder
commented
Feb 21, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment