Usage
visualization : { id : "unique-id" label : "Visualization Label" url : "visualization_url" sri_hash : "SRI hash" dependencies : [ "dependency_url_1" , "dependency_url_2" ] file : "visualization_file_path" }
visualization
must have either a url
or a file
parameter, but not bothDefinition
The visualization
parameter adds a custom visualization to your LookML project that users can access from the Visualizationtab in the project's Explores. The custom visualization must be defined in a JavaScript file, which can be included in your LookML project files, or hosted elsewhere.
The visualization
parameter has the following subparameters:
Example: Adding a custom visualization URL to your LookML project
One option for adding a custom visualization to your LookML project is to use the URL of a custom visualization file. For example, adding this LookML to a project's manifest file adds a multiple-value CDN custom visualization to the Looker project. This visualization is defined in a JavaScript file located on Looker's Marketplace:
visualization: {
id: "spider-marketplace-dev"
label: "Spider Viz"
url: "https://marketplace-api.looker.com/viz-dist/spider.js"
sri_hash: "oqVuAfXRKap7fdgcCY5uykM6+R9GqQ8K/uxy9rx7HNQlGYl1kPzQho1wx4JwY8wC"
dependencies: ["https://code.jquery.com/jquery-2.2.4.min.js","https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.1/underscore-min.js","https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js","https://cdnjs.cloudflare.com/ajax/libs/d3-legend/1.13.0/d3-legend.min.js"]
}
Once you commit your changes and deploy them to production , Looker displays the name of the custom visualization as an option in the Visualization tab of your project's Explores.
The visualization will also be listed on the Visualizationspage in the Platformsection of Looker's Adminmenu; see the Admin settings - Visualizations documentation page for information.
Example: Adding a custom visualization file to your LookML project
Another option is to add the custom visualization JavaScript file to your LookML project using the Looker IDE:
- In the Looker IDE, drag and drop the JavaScript file that defines your custom visualization into your LookML project.
- Optionally, move the visualization file into a folder in the Looker IDE, or create a new folder for the visualization file.
- Click on the visualization file in the file browser panel to display the file contents, then click Saveto save the file.
- In the project's manifest file
, define the visualization parameters. For example, this LookML adds a radial gauge custom visualization to the Looker project. The visualization is defined in a JavaScript file located in the
visualizations
directory of the LookML project:
visualization: {
id: "radial_gauge"
label: "Radial Gauge"
file: "visualizations/radialgauge_v2.js"
}
-
Commit your changes and deploy them to production .
You must deploy the visualization updates to see the customer visualization option in an Explore (saving the updates is not sufficient, even in Development Mode).
Once you have deployed your updates, Looker displays the name of the custom visualization as an option in the Visualization tab of your project's Explores.
The visualization is also listed on the Visualizationspage in the Platformsection of Looker's Adminmenu; see the Admin settings - Visualizations documentation page for information.