Preparing the Stacked Bar Chart
Explore how to prepare data and set up a stacked bar chart in D3.js. Learn the key differences between bar charts and histograms, and how to convert data types for accurate visualization of population age groups across states.
We'll cover the following...
The next project we are going to start drawing is a stacked bar chart. Bar charts are a popular type of visualization. They are not to be confused with histograms.
Histograms vs. bar charts
There is a difference between the two. Both charts use bars to represent data. They both have an x-axis and a y-axis.
Histograms show the frequency of data. We saw an example of a histogram when we drew different types of weather data. Each bar did not represent a single value. Instead, the bars represented the frequency of values within a given range.
Bar charts are different because each bar represents one value. By representing one value, we can compare data easily. Here is a great article that details the differences between the two types of visualizations: