Drill using a sparkline or other images


(Zachary Michel) #1

###Objective
Add a nice sparkline to encourage users to link out to wherever the sparkline points. I’ve most often seen sparklines used as links to dashboards, but that doesn’t mean we are limited to such behavior! Using Looker’s html parameter to deploy custom drill you can link your users anywhere.

###How do we do it?

The sparkline is built into Looker’s file system. Self-hosted Looker customers can add custom images and use the same syntax to add images to a dimension/measure.

- dimension: sparkline_drill
  type: string
  sql: ${name}
  html: |
    {{ linked_value }}
    <a href="/dashboards/model/dashboard_name?name={{ value }}" target="_new">
    <img src="/images/qr-graph-line@2x.png" height=20 width=20></a>

###What does it look like?
Going to steal an example from the drill to dashboard article

Example screenshots below.

Overview Dashboard. Sparklines link to individual dashboards for each brand (highlighted in red), where the value from a given row is passed to a filter for the Brand Dashboard.

Brand Dashboard. Here we drilled in to Calvin Klein’s dashboard via the sparkline (using the LookML above passed via {{ value }}).

###Live LookML example
Here’s a link to the products view on learn.looker.com where you can tweak the code in your own dev directory to see how it changes. If you do not have a learn account email support@looker.com and we can get you hooked up.


Using HTML and Liquid with Looker
Drill using a favicon
LookML Best Practices
[Retired] Drill to Dashboard Using HTML and Query Parameters
Can drilling down into a service by clicking on a bar in a bar chart lead to a predefined look?