Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning D3.js Mapping
  • Table Of Contents Toc
Learning D3.js Mapping

Learning D3.js Mapping

By : Newton, Oscar Villarreal
4.3 (7)
close
close
Learning D3.js Mapping

Learning D3.js Mapping

4.3 (7)
By: Newton, Oscar Villarreal

Overview of this book

If you are interested in creating maps for the web GIS data, this book is for you. Familiarity with D3.js will be helpful but is not necessary.
Table of Contents (9 chapters)
close
close
6
6. Finding and Working with Geographic Data
8
Index

Line


The SVG line is one of the simplest in the library. It draws a straight line from one point to another. The syntax is very straightforward and can be experimented with at http://localhost:8080/chapter-2/line.html, assuming the http-server is running:

<line x1="10" y1="10" x2="100" y2="100" stroke-width="1" stroke="red"/>

This will give you the following output:

A description of the element's attributes is as follows:

  • x1 and y1: The starting x and y coordinates

  • x2 and y2: The ending x and y coordinates

  • stroke: This gives the line a red color

  • stroke-width: This denotes in pixels the width of the line to be drawn

The line tag also has the ability to change the style of the end of the line. For example, adding the following would change the image so it has round endings:

stroke-linecap: round;

As stated earlier, all SVG tags can also be styled with CSS elements. An alternative way of producing the same graphic would be to first create a CSS style, as shown in the following code:

      line ...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning D3.js Mapping
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon