...

/

Exercise: Data Buttons on Line Charts

Exercise: Data Buttons on Line Charts

Practice with some lab exercises.

We'll cover the following...

Exercise 1

Create a red line chart of the spy closing prices. Add date buttons for 20 years into the past, 10 years into the past, 5 years into the past, 1 year into the past, 6 months into the past, 3 months into the past, 1 month into the past, the year so far and the month so far. Also, add an option to see all of the available data.

Solution

  • A trace is created using the go.Scatter() function on line 2 with x and y values taken from the spy DataFrame.

  • A figure is created using the go.Figure() function on line 5 ...