Ashley
Ashley

Reputation: 27

Referencing the D3.js library from my webpage

I am taking a class on web-based visualization programming. I have never used HTML, CSS, Javascript, SVG or JSON. I tried asking one of the TAs for help, but the responses I got was not very helpful still. So I will post my questions here.

In order to use D3.js, I need to be able to be able to host files.

  1. What does this mean? Is it talking about the hosts file that I can access from the Run Line?

I downloaded d3.js from this site: http://d3js.org/ I tried opening it, but it wont open. I do not know what to do with this file. There was also an option to link directly to the latest release with this snippet:

 <script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>

2.Link to what and from what though?

3.How do I actually use D3.js and where do I code for it at? It is all browser-based?

Apologies, but I really do not understand any of this stuff. And I would appreciate help.

Upvotes: 1

Views: 1214

Answers (2)

Mars
Mars

Reputation: 8854

Scott Murray's book Interactive Data Visualization for the Web is a very nice introduction to D3. It also reviews some basic ideas about HTML and Javascript at the beginning of the book. I'm not sure whether the quick review would be enough for someone who didn't have some past familiarity with HTML and Javascript.

Upvotes: 1

echen
echen

Reputation: 2072

You need to place the "script" tag into a HTML file (among other things). then load that HTML file from a web browser.

It is probably not possible to unlock the potential of D3.js without some working knowledge of javascript and html.

You can find fairly good introductory tutorials at http://www.w3schools.com/

Start with HTML, then move on to Javascript (IMHO)

or else post any specific questions you have.

but as a 30 second quick start

  • HTML/CSS is the technology used to describe the positioning & look-and-feel of elements on any web page. It describes what you see on a web page (ex: text paragraphs, images)

  • Javascript add behavior to a given web page, such as deciding when to hide/show HTML elements, when to ask a web server for more data etc

to answer your question of what it means to "host a file"

The HTML page or JavaScript file that will contain your visualization code must be stored on some computer somewhere. For the web browser on another computer to access those files, you must setup a "web server" to send these files over when requested, such as when the user type in www.something.com/your_file.html

When you are just experimenting, your web-server does not need to be complicated (i.e. able to be accessed by any computer in the world). You can turn your personal computer into a simple web-server by using httpd, check it out here http://httpd.apache.org/

It is fairly easy to set it up

Upvotes: 1

Related Questions