Exercise

Modifying glyph size with a widget

Another area of interest for the hedge fund is pharmaceuticals as there is a lot of innovation taking place, which creates opportunities for new start-ups and scale-ups.

You have been asked to produce a scatter plot displaying the value and volume of stocks for five pharmaceutical companies within the dataset - AbbVie, Eli Lilly, Merck, Johnson & Johnson, and Nuformix. You aren't sure how the data will look, so decide to use the Spinner widget, allowing stakeholders to customize glyph size if needed.

Instructions

100 XP
  • Import layout and Spinner.
  • Create a spinner titled "Glyph size", with sizes ranging from 1 to 30 pixels, changing by 1 pixel with each click, a default value of 4, and a width of 60.
  • Complete spinner.js_link(), first passing "value", followed by the scatter's glyph attribute, and lastly specifying "size" as the attribute you wish to modify using the spinner.
  • Display the layout, with title on a single row, and a second row showing the spinner and fig in that order.