Created
February 9, 2013 14:33
-
-
Save moricard/4745465 to your computer and use it in GitHub Desktop.
different vishna load function
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 news; | |
function load () { | |
d3.json("#path/feed.json", function(data){ | |
//Everything here will be executed once the data has arrived. | |
news = data; | |
news.map( function(newsItem) { | |
//do the treatment for each newsItem here. | |
//For example, transforming the Timestamp string to an actual javascript Date object: | |
newsItem.timestamp = new Date(newsItem.Timestamp); | |
return newsItem; | |
}); | |
//initialize the scales you want to use. | |
//Call everything that needs to be done at initialization of the data... | |
}); | |
} | |
// ... | |
function launch() { | |
force.nodes( news ); | |
} | |
function addText () { | |
//... | |
var text = d3.selectAll("text"); | |
text | |
.data(news) | |
.append("svg:text") | |
.attr("x", 8) | |
.attr("y", ".31em") | |
.text(function(d) { return d.keyword; }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment