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

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.

主站蜘蛛池模板: 巴楚县| 沐川县| 遂平县| 新源县| 乌兰县| 长白| 乃东县| 祁阳县| 卢湾区| 石台县| 文水县| 波密县| 宕昌县| 宣恩县| 丹凤县| 铁岭县| 泸西县| 扎兰屯市| 尚志市| 大理市| 广水市| 酒泉市| 陵水| 古丈县| 墨竹工卡县| 龙海市| 莱阳市| 吉首市| 溆浦县| 保靖县| 桑植县| 临湘市| 双峰县| 昌乐县| 长兴县| 永胜县| 开江县| 凤冈县| 沽源县| 汉沽区| 镇宁|