From the course: DC.js for Data Science Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Setting up dummy data

Setting up dummy data

- [Instructor] We're going to work with sample data taken from the cross filter API. Here we have some payment data relating to meals taken at a restaurant, so I want you to highlight everything within the square brackets, including the square brackets themselves, and copy. Then within our template we need to create a new JavaScript section under the DC link. Let's give ourselves a bit of room, and this time we go script type equals text JavaScript, but we don't need to supply a source this time, because were going to be writing the JavaScript code indirectly, so we just open them up like that. And then we can declare a variable var data and set it equal to the array that we just copied. Let's look at this data variable a bit more closely. The square brackets tell us that we're dealing with an array in JavaScript. An array is a glorified list separated by commas, so here is one item within our array, there's the relevant comma, and here is the next item within our array. This array…

Contents