HTML and CSS Reference
In-Depth Information
Getting Started In jQuery
We'll use jQuery to create our graph on the fly, separate from the original data table. To do
this, we need to get the data out of the table and store it in a more usable format. Then, we
can add to our document new elements that use this data in order to construct our graph.
Let's get started by creating our main createGraph() function. I've abbreviated some of the
inner workings of this function so that you get a clearer picture of the structure. Don't forget:
you can always refer to the source code that comes with this tutorial.
Here's our basic structure:
// Wait for the DOM to load everything, just to be safe
$ ( document ). ready ( function () {
// Create our graph from the data table and specify a container to put the
graph in
createGraph ( '#data-table' , '.chart' );
// Here be graphs
function createGraph ( data , container ) {
// Declare some common variables and container elements
 
Search WWH ::




Custom Search