cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Advanced Hover Label Extensions Exercise

(Originally distributed as part of the JMP Discovery Americas 2019 BetaLab)

 

Introduction

Beginning with JMP 15, Hover Label Extensions allow users to customize and augment the information displayed in hover labels. Users can add data-driven, markup-based rich text paragraphs to describe the underlying data to the visualization consumers; add, remove, reformat and style the hover label individual entries; and embed visualizations that not only provide an additional insight on the underlying data, but can also be launched in their own windows to further advance the data exploration.

 

In this exercise we will try Hover Label Extensions and see how they can enhance your exploratory workflow.

 

Tip: Each task is implemented as a table script, with a corresponding “(Final)” version that illustrates the desired result of the exercise. If you close a window by mistake, you can use these scripts to re-create them.

 

Task 1 (Rich text customization using Textlets)

  • Open the table CrimeData_Tucson2019.jmp located in the Hover Label Extensions Folder on the desktop
  • Run the table script Step 1. It will launch a map of the USA with states colored by crime rate.
  • Hover the mouse pointer over the map and observe how the hover labels include both a description of the associated state as well as a representative image.

 

AHLE_1.png

 

Figure 1 Hover label w/ description and thumbnail.

 

  • The description can be a bit long and hard to read. Let’s use the new Textlet extension to improve that. Right-click on the graph background to open the Hover Label Editor, located under the Hover Label RMB menu entry.
 

AHLE_2.png

Figure 2 Hover Label Editor menu entry

 

  •  On the left side panel, select Textlet. Inspect the panels to see how the content is defined (JSL Variables) and then how it is formatted (HTML Markup) for display.

Tip: If you pin a hover label to the map, you can see the results of your changes as soon as you click on the Apply button in the Hover Label Editor.

 

  • Reduce the length of the content by using JSL to truncate it to a Tweet size, for example:
local:text = Substr( ::wr << getDescription( local:_state ), 1, 140 ) || "..."
  • Change the markup to make the text easier to read. For example, select a different font, increase the font size and use a lighter background color:
<background color='white'><font family='Arial' size='12'>{local:text}</font></background>
  • Play around with the content generation and the markup to try out different configurations for the description block. Try making the text bold, use different text colors, or add your own text.

Task 2 (Content augmentation using Gridlets)

  • Go back to the data table (CrimeData_Tucson2019.jmp) and run the table script Step 2.It will launch a time series visualization showing the average number of four crime categories (Murder, Robbery, Burglary and Larceny) over time.

AHLE_3.png

Figure 3 Crime Time Series

 

  • The hover label includes the average number of occurrences for the underlying crime type on a given year. Let’s use the Gridlet extension to include values for all other years and improve the display.
  • Once again open the Hover Label Editor; this time select the Gridlet option in the left side panel.
  • Use the Delete panel to remove the first and the third entries. In the Matching Criteria box, select Index in the Type selector and specify the desired entry index as the Target input value.

Tip: Click on Add to record each selection, before clicking on Apply or OK to save it.

 

  • Use the Style panel to increase the font size of the Year value.
  • Use the Append panel to add an entry for each crime type. Use Target to specify the entry name and the following JSL expression for Value, changing the first argument to match the crime type:
::mr << getMetric( "Murder", Namespace( "Local" ) )
  • Once you’re done, the hover label should be looking like this:

AHLE_4.png

Figure 4 Hover Label with Gridlet changes

 

Task 3 (Embedded graphs and drill-down using Graphlets)

  • Switch back to the map visualization and hover over a state. Note how the hover label shows a static image. Let’s use the Graphlet extension to display an informative data visualization.
  • You can insert a dynamically configured visualization (preset) by using one of the options under the graph Hover Label RMB menu. For example, try the Heatmap option. You should see a hover label like this one:

AHLE_5.png

Figure 5 Hover Label w/ Heat Map graphlet

 

  • Compare the heatmaps of North Dakota and Florida. What can you say about the population growth of these states?

Tip:You can open an embedded graph on its own window by clicking on it.

 

  • You can also use your own visualizations as graphlet templates. Switch to the time series window and under the Little Red Triangle (LRT) menu, select Save Script > To Clipboard

 

AHLE_6.png

 

Figure 6 Save to clipboard to paste as graphlet

 

  • Now switch back to the map, and under the graph Hover Label RMB menu select Paste Graphlet.
  • Verify that the map hover label now displays the crime time series for the associated state. Can you compare the crime time series for North Dakota and Florida?
 

Recommended Articles