Create visualizations with Gemini assistance

Gemini is an AI-powered collaborator in Google Cloud. You can use Gemini to customize formatting options on Looker visualizations that use the HighCharts API. The Visualization Assistant generates JSON formatting options from text-based prompts to accelerate the customization of Looker visualizations.

Before you begin

To create visualizations with Gemini assistance, note the following requirements:

Using the Visualization Assistant

The Visualization Assistant is available for visualizations that use the HighCharts API, which includes most Cartesian charts, such as the column chart, bar chart, and line chart, among others. To customize a visualization with the Visualization Assistant, follow these steps:

  1. View a supported visualization in an Explore, or edit a visualization in a Look or dashboard.
  2. Open the Edit menu in the visualization.
  3. Click Visualization Assistant to open the prompt menu.

Within the Visualization Assistant prompt menu you are able to:

  • Type out a plain text prompt of changes for the visualization in the Ask anything field.
  • Apply generated Suggestions to the visualization.
  • Open the Edit Chart Config to manually write and edit JSON formatting options.
  • Clear Chart Overrides to clear all custom changes applied to the visualization. You will be prompted to Confirm removing all changes before proceeding. If you cleared the changes by accident it is possible to retrieve them by navigating back in your browser history.

Once the prompt has run a preview window will open with the options to:

  • Open the Edit Chart Config to manually write and edit the generated JSON formatting options. Click Visualization Assistant to return to the prompt menu
  • Start Over from the Visualization Assistant menu. All unapplied changes will be lost.
  • Apply the previewed changes to the visualization. If changes are made in the Chart Config menu this option will change to Revalidate and Apply
  • Vote to indicate whether the prompt response was helpful or the response was not what was expected .

An Invalid JSON detected error message will appear if you try to preview code containing invalid JSON. You can clean up invalid JSON using the Autofix code option at the bottom of the Chart Config pane.

Creating successful prompts

Writing successful prompts can take practice. Try some of the following suggestions to write prompts that successfully accomplish your goal.

Break prompts into multiple parts

Prompts are more successful when they focus on one change at a time. For example, if you want to change both the font family and the type of visualization, it's better to make these separate prompts. Once you approve of the generated changes apply them and then begin writing the next prompt.

Prompt: Change the last series into a line

The Visualization Assistant menu shows a preview of a prompt that changes one of the three series in a visualization from a column to a line.

Prompt: Change the font to Arial and make it bold

The Visualization Assistant menu shows a preview of a prompt that changes the font of the graph to the Arial font family, and makes text bold.

Try writing a prompt multiple ways

If, while writing a prompt, you're not seeing the results that you expect, try rewording the prompt. When you apply conditional formatting, try making your prompt as unambiguous as possible. Setting specific value ranges and providing hex codes can create a more successful output. See the following examples:

Good prompt: Make the first series #F4B400 if it is over 350000

Poor prompt: Highlight the top values in yellow

The Visualization Assistant menu shows a preview of a prompt that changes the color of the first series of values over 350,000.

Use prompts as a starting point

Particularly complex customizations may require making edits directly to the JSON. Try using the Visualization Assistant prompts to create templates and patterns for complex customizations, and then use the Edit Chart Config to manually write and edit JSON formatting options. Visit the Customizing visualizations using the Chart Config Editor documentation for more on using HighCharts JSON.

Sample prompts

Try the following sample prompts to get ideas on how the Visualization Assistant can help you get started customizing your visualizations:

  • "Make this chart a column chart"
  • "Add data labels to the chart"
  • "Set the chart margin as 100px"
  • "Set the line color as Red"
  • "Set the chart background color as pink"
  • "Set the line series marker shape as triangle"