Session Ready
Exercise

Adding a slider for time

In the previous lesson, you created an animation displaying the number of launches by each state over the years. A slider bar is an alternative to that animation that gives you full control over what portion of the story to investigate. For example, you can view it from beginning to end or focus only on the 1960s. In this exercise, your task is to add a slider bar below the line chart of state-based launches.

plotly, crosstalk, dplyr, and the state_launches data set have been loaded for you.

Instructions
100 XP
  • Calculate the number of launches by state_code and launch_year, and convert this to a SharedData object. Store the result in shared_launches.
  • Using shared_launches, create a line chart displaying the the number of launches (n) by each state over time. Store this chart as launch_ts. Use color to represent the state_code.
  • Position a slider below the chart to filter the years displayed. Label this slider "Year".