My personal blog homepage is: http://www.ourd3js.com/. CSDN Blog Home for: http://blog.csdn.net/lzhlzz/. Reprint please indicate the source. Thank you.
Here's how to start with D3.js to deal with the first simple question, first look at the following code:
Suppose you have studiedHTML, you should know that two lines of text will be printed on the screen. For example, with:
Suppose you want to useJavaScriptTo change these two lines of text, what to do? We will add the code into:The result becomes:
can see. Use JavaScript. We have added 4 lines of code, assuming that we useD3.jsit? Just add a line of code to it. Be careful not to forget to refer to the D3.js source file.
The results will change to:
similar to JavaScript like jquery, it simplifies the process of using JavaScript.
Next change the font color and size, such as the following:
var p = d3.select ("Body"). SelectAll ("P"). Text ("www.ourd3js.com");p. Style ("Color", "red");p. Style ("Font-size", "72px ");
You can see that the above code assigns a value to the variable p first. Then use P.This will make the code cleaner.
"D3.js Starter Series---1" First program HelloWorld