Create a new project (or you can use your existing one if you only need a single custom viz) and create a new project manifest:
Then add the following:
project_name: "custom_viz"
visualization: {
id: "my_new_vis"
label: "My new vis"
file: "customvis.js"
}
Now let’s start having fun: using your favorite LLM model, ask it to create the custom viz you want:
I want to create a Looker custom bar charts vis using google charts, can you give me code?
make sure you add the custom api reference in your prompt (either url or text itself depending on what your LLM supports)
The response tells me I need some html:
a custom viz always uses a specific library to render graphs, in this case it is just calling the external library for google charts, we can add the link as a dependency in the manifest:
dependencies: [
"https://www.gstatic.com/charts/loader.js"
]
Then create a new text file on your computer, paste the JS code gemini gives you, and save it as customvis.js”
Then drag and drop the js file you just created in your Looker project:
And push your project to production
Then you should be able to select your new vis:
If nothing shows up, open the chrome developer tools and the javascript console:
You should see an error:
Copy the error to gemini and make sure you ask it to give you the full js file code, so you can quickly copy paste it in Looker:
Then you can paste it directly into your js file on Looker, save and push to prod (ignore the red error which seems to show up)
And here we are:
Now lets ask to remove the title:
Paste the code, push to production and now the title is removed!
Now let's make the viz window adjust to the looker frame:
It’s telling me to use a css file, but we cannot upload it on Looker, so I just ask gemini to embed the css into the js file:
And it works perfect:
And so on…
A few prompts tips:
Use different LLM models if you are stuck
Way cool. I'll also plug the Chart Config Editor here - the HighCharts LLM is really good at providing JSON from plain english requests, and those can be plugged right into Looker to enhance your visualizations!