"D3.js Starter Series---1" First program HelloWorld

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.