Histograms with data bins
In the three other recipes in this chapter, we used Swift Charts to create beautiful charts. We used and learned the different building blocks and view modifiers available. Please refer to the previous recipes if you’re not familiar with Swift Charts.
In this recipe, we will focus on one specific data visualization chart called histogram. Histograms are used in statistics, and it is the most used chart to plot the frequency distribution of an event. A histogram is a very useful chart to understand a large dataset. The histogram looks like a bar chart, but here, the main difference is that each bar represents the frequency of a range of values, instead of the frequency of a single value. In the y-axis, we have the frequency of the event, and in the x-axis, the range of the event. For example, imagine we want to understand the frequency distribution of the age of a population of 1,000,000 people, measured in years. We have an initial dataset of...