Skip to content
This repository has been archived by the owner on Apr 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from looker/richard/task/fix-hello-world
Browse files Browse the repository at this point in the history
Fix links on hello world and other minor errors
  • Loading branch information
RichardCzechowski authored Apr 10, 2018
2 parents d6ee1fc + 8e41cbf commit c0592f3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
9 changes: 6 additions & 3 deletions dist/hello_world.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ (function(module, exports) {

looker.plugins.visualizations.add({
// Id and Label are legacy properties that no longer have any function besides documenting
// what the visualization used to have. The properties are now set via the manifest
// form within the admin/visualizations page of Looker
id: "hello_world",
label: "Hello World",
options: {
Expand Down Expand Up @@ -117,7 +120,7 @@ looker.plugins.visualizations.add({
`;

// Create a container element to let us center the text.
const container = element.appendChild(document.createElement("div"));
var container = element.appendChild(document.createElement("div"));
container.className = "hello-world-vis";

// Create an element to contain the text.
Expand All @@ -137,8 +140,8 @@ looker.plugins.visualizations.add({
}

// Grab the first cell of the data
const firstRow = data[0];
const firstCell = firstRow[queryResponse.fields.dimensions[0].name];
var firstRow = data[0];
var firstCell = firstRow[queryResponse.fields.dimensions[0].name];

// Insert the data into the page
this._textElement.innerHTML = LookerCharts.Utils.htmlForCell(firstCell);
Expand Down
2 changes: 1 addition & 1 deletion docs/api_reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Custom Visualizations should be served as https content externally to looker. If

There is a synchronous and asynchronous version of this function – you'll only need to specify one. (It's an error to define both). The async method is more reliable for pdf rendering due to the nature of iframes.

[See details about these `update` functions →](#the-update-and-updateasync-functions)
[See details about these `update` functions →](#the-updateasync-and-update-functions)

#### Optional Properties

Expand Down
6 changes: 3 additions & 3 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

The Looker Visualization API is a pure-JavaScript API that runs in a sandboxed iframe and will be hosted within the Looker application.
The Looker Visualization API is a pure-JavaScript API that runs in a [sandboxed iframe](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox) and will be hosted within the Looker application.

The same visualization code can provide a visualization anywhere in Looker: explore, Looks, Dashboards, embed or in PDF or rendered images.

Expand All @@ -18,7 +18,7 @@ Let's walk thorough creating a simple visualization script.
We'll be creating a simple "Hello World" visualization that displays the first dimension of a given query. The final result should look like this:

![](../examples/hello_world/hello_world.png)
![](../src/examples/hello_world/hello_world.png)

### Setup

Expand Down Expand Up @@ -166,7 +166,7 @@ We can just modify the beginning of our `updateAsync` method to detect an error
That's it! If the user creates a query that only has measures, they'll now see this:
![](../examples/hello_world/hello_world_error.png)
![](../src/examples/hello_world/hello_world_error.png)
### Configuration
Expand Down
9 changes: 6 additions & 3 deletions src/examples/hello_world/hello_world.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
looker.plugins.visualizations.add({
// Id and Label are legacy properties that no longer have any function besides documenting
// what the visualization used to have. The properties are now set via the manifest
// form within the admin/visualizations page of Looker
id: "hello_world",
label: "Hello World",
options: {
Expand Down Expand Up @@ -37,7 +40,7 @@ looker.plugins.visualizations.add({
`;

// Create a container element to let us center the text.
const container = element.appendChild(document.createElement("div"));
var container = element.appendChild(document.createElement("div"));
container.className = "hello-world-vis";

// Create an element to contain the text.
Expand All @@ -57,8 +60,8 @@ looker.plugins.visualizations.add({
}

// Grab the first cell of the data
const firstRow = data[0];
const firstCell = firstRow[queryResponse.fields.dimensions[0].name];
var firstRow = data[0];
var firstCell = firstRow[queryResponse.fields.dimensions[0].name];

// Insert the data into the page
this._textElement.innerHTML = LookerCharts.Utils.htmlForCell(firstCell);
Expand Down

0 comments on commit c0592f3

Please sign in to comment.