[1] D3.js's HelloWorld

Source: Internet
Author: User

Interested friends Welcome to http://www.ourd3js.com/Discussion

Now let's start with D3.js to deal with the first simple question, and look at the following code:

If you have studiedHTML, you should know that two lines of text will be printed on the screen, such as:

If you want to useJavaScriptTo change these two lines of text, what to do? We will add the code into:
The result becomes:
    

As you can see, using JavaScript, we've added 4 lines of code, and if you useD3.jsit? Just add one line of code. 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, as follows:

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 before using P. This will make the code cleaner.

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.