Having a very hard time loading in my data correctly. Here is the header row with the first content row:
BookingID,Type,Status,Unit Booked,Unit Owner,Destination,Booking Date,Checkin,Checkout,Renter - FirstName,Renter - LastName,Renter - EmailAddress,Renter - WorkPhone,Renter - HomePhone,#Adults,#Children,Total Stay,Total Paid,Total Due
15642889,House,Confirmed,GV T3 #2106,,,3/20/2016 7:00:00 PM,3/23/2016 3:00:00 PM,3/28/2016 11:00:00 AM,FirstName,LastName,first&last@gmail.com,+1 (000) 000-0000,+1 (000) 000-0000,2,0,895,895,0
And the relevant lines of loading in and parsing my csv as I want:
var parseDate = d3.time.format("%m/%d/%Y %H:%M:%S %p").parse;
var data = d3.csv("Sales Export Friendly 3-19-17.csv", function(data) {
return {
unit: data["Unit Booked"],
date: parseDate(data["Booking Date"]).getMonth() + 1,
checkin: parseDate(data["Checkin"]).getMonth() + 1,
LOS: parseDate(data["Checkout"]).valueOf() - parseDate(data["Checkin"]).valueOf()/(24*60*60*1000),
total: +data["Total Stay"],
avgNight: (+data["Total Stay"]) / ((new Date(data["Checkout"]).valueOf() - new Date(data["Checkin"]).valueOf())/(24*60*60*1000))
};
});
The idea is that I will then do something like this:
d3.parcoords()("#TopLeft").alpha(0.4)
.data(data)
.dimensions(data.columns)
If I try to console.log(data.columns); after my callback function, I get undefined. Here is what console.log(data); prints, which is quite odd looking:
Object { header: Cn/u.header(), mimeType: Cn/u.mimeType(), responseType: Cn/u.responseType(), response: Cn/u.response(), get: Cn/</u[n](), post: Cn/</u[n](), send: Cn/u.send(), abort: Cn/u.abort(), on: M/<(), row: e/o.row() }
And the error codes I am currently getting:
TypeError: data.slice is not a function
When calling data(data) on d3.parcoords and
TypeError: e is undefined
On this line:
checkin: parseDate(data["Checkin"]).getMonth() + 1,
I am terribly confused as to what is going wrong here. I am using d3 v3.