官术网_书友最值得收藏!

Basic Charts and Shapes

In the previous chapter, we created a simple bar chart using the SVG rect element. While this works for simple charts, using the standard SVG elements for more complex charts can be difficult. Luckily, D3 provides an extensive set of helper functions that we can use to easily create more complex visualizations, without having to manipulate basic SVG elements ourselves. In this chapter, we're going to create visualizations based on data from the US Census Bureau (http://www.census.gov). To be more precise, we're going to create the following data visualizations:

  • How long have American firms been in business visualized with pies and donuts: The US census releases an overview that shows how long firms have been in business. This provides a nice data set to show how D3 allows you to create pie and donut charts.
  • Real Median Household income in the US visualized with a line chart: In the US Census data, there is information present on how the average household income has changed during the last thirty years. This is information that can be very nicely visualized using a line chart.
  • Population growth estimates using a stacked graph: The US Census Bureau provides information on how the population of the US is expected to change from 2014 to 2060. We'll use this data to show how this can be visualized using a stacked graph.

To make the visualizations more interesting, we'll also add interactivity and animations to them. Let's get started with the first visualization: the donut and pie charts.

主站蜘蛛池模板: 旺苍县| 永仁县| 宁阳县| 杭州市| 平塘县| 银川市| 翁牛特旗| 宣恩县| 邹平县| 合江县| 台山市| 洪雅县| 宣汉县| 闸北区| 宝清县| 上虞市| 陈巴尔虎旗| 阳春市| 南乐县| 望都县| 蓝山县| 铅山县| 兴和县| 黎川县| 永靖县| 额尔古纳市| 岫岩| 会理县| 龙胜| 成武县| 道孚县| 夏河县| 三明市| 太康县| 邓州市| 新宁县| 嵩明县| 高邑县| 喀喇| 卢龙县| 平安县|