In this recipe we will animate the transition when switching between two data sets. We will show how to animate without using any libraries. To do so we will use the bar chart as a base. We are going to start by fading in the chart. After that, we will grow the bars until they reach their desired size. In order to animate the switch between the two data sets, we will first shrink the current bars until we can't see them so that we can expand the new bars after.
Copy over the files from Chapter 3, Creating Bar Charts, the Building vertical bar charts recipe, as we will start from those.
The following are the steps needed to animate a bar chart: