Quiver allows users to create fully customizable and interactive visualizations using the Vega or Vega-Lite libraries. Review Vega ↗ and Vega-Lite ↗ documentation for inspiration and examples.
Vega and Vega-Lite allow you to create, save, and share interactive visualization designs in the form of a concise JSON spec that describes the appearance and behavior of a visualization. Vega supports a variety of visualization designs, such as:
Vega-Lite is a higher-level language built on top of Vega that provides a more concise and convenient way to author common visualizations. We suggest starting with Vega-Lite, since Vega-Lite syntax is easier to read, write, and debug than Vega. If Vega-Lite's options are insufficient, consider using Vega instead.
Several examples built with Vega and Vega-Lite can be seen in the image below:
To configure a Vega plot, hover over the desired card, select Visualize and navigate to (or search for) Vega plot in the dropdown menu. Select Vega plot to open the configuration menu.
Within the editor menu, choose to configure either a Vega plot or a Vega-Lite plot. Templates for common visualizations, including bubble plots, box plots, sunburst plots and more, are provided in the Choose a template dropdown menu, as pictured below.
Once you have selected your Vega plot template, you will be prompted to fill in parameters relevant to the plot you have selected by mapping them to columns of the transform table data source.
After filling in the template parameters, select Apply to generate your Vega plot. Note that:
Vega plots accept the following data inputs:
ARRAY_VALUES
.In the data section, you can reference tabular data in the form of a transform table or array by its global ID (such as $A
) in the following format:
{
"data": { "values": $A }
...
}
For instance, if table $A
is a table with two columns, name
and id
, the data will resolve into a spec that looks like this:
{
"data": {
"values": {
{ "name": "a", "id": 1},
{ "name": "b", "id": 2},
{ "name": "c", "id": 3}
}
}
}
To reference specific columns in a transform table, use the syntax $A.column_name
. This expression gets resolved into the column's ID as a string.
{
"encoding": {
"x": {
"field": $A.column_x,
"type": "quantitative",
}
}
...
}
You can also reference value types (such as numeric metric cards) in a Vega plot. For instance, to set a threshold line at a certain value using a numeric metric card, reference that value using the metric card's global ID.
"encoding": {
"y": { "datum": $C }
}
...
You can debug issues with Vega plot configurations by looking at the resolved Vega specification. Select Preview to view the resolved Vega.
Note that resolved Vega specifications may be slow to load as they will contain all the data points from data inputs referenced within.
The Vega editor contains two useful settings for embedding a Vega plot in Workshop using Quiver dashboards:
AIP can help generate Vega plot configurations using only the description of your desired plot, or plot modification, in natural language. Users can simply describe the plot they wish to create or modify and AIP will make suggestions based on the prompt, helping to simplify Vega plot configuration in JSON, which can be prone to error.
To use AIP, select AIP Configure in the upper right of the Vega plot card. Then, provide a prompt, select Configure, and review the suggestion generated by AIP. To accept a suggestion, select Apply. If you would like AIP to make an alternative suggestion, edit your prompt and then select Reconfigure.
In the example below, the user prompts AIP with: “Show ph vs caffeine on a scatter plot and draw a red line at 13 on the x axis and at 6 on the y axis”. AIP uses the prompt to suggest the configuration of a plot which contains the two numerical properties of interest (caffeine and pH levels).
To accept AIP’s proposed update, select Apply. The Vega plot will render a visualization based on the updated Vega specification.
AIP can recognize and differentiate abstract ideas contained within your prompt and use this information to help generate or modify Vega plots. For example, AIP can use references to the characteristics of previously generated plots, allowing you to “build on top of" your existing plots.
In the image below, the user provides the prompt: “The two lines on the plot split the points into 4 quadrants. Color each quadrant a different color.” AIP recognizes that the areas defined by the vertical and horizontal lines are quadrants, even though the current plot configuration does not contain any definition or configuration of quadrants.
AIP accurately generates the desired plot, aligned to the user prompt, which builds off of the initial plot.
Quiver analysis graphs produced using AIP can include Vega plots. To instruct AIP to produce a Vega plot rather than native Quiver visualizations, such as line or scatter plots, make explicit in your prompt that AIP should return a “Vega plot.” For example, an accurate prompt could be: “Show caffeine vs ph on a scatter plot using a vega plot.”
Note: AIP feature availability is subject to change and may differ between customers.
Vega-Lite selection is a powerful and highly customizable feature for building interactive visualizations. The Vega-Lite library has built-in support for selection ↗, and Vega-Lite plots in Quiver can be configured to output selections as a transform table. Users can leverage selection data to parameterize downstream cards, construct drill-down workflows, and continue analysis. The behavior of Vega-Lite selections differ from object set plot selections and require additional steps for setup.
Vega-Lite enables users to interact with charts through two types of selection ↗:
Not all Vega-Lite plot types support selection. See the FAQ section below for more details.
To output the plot selection data as a transform table, perform the following steps:
Open the Vega plot card’s configuration panel, and scroll to Selection Options. Then, toggle on Enable output point selections as transform table and/or Enable output interval selections as transform table.
In the Vega plot’s JSON editor, add a selection parameter to the params
field. Review the Vega plot documentation for more on selection parameters.
The parameter must be named quiverDefaultClick
for point selections, or quiverDefaultBrush
for interval selections.
Set the type
property to point
for quiverDefaultClick
, or interval
for quiverDefaultBrush
.
Specify one or more encodings ↗ in the encodings
property. These are the fields that you wish to select over, such as x
, y
, or color
. Encodings determine how values are selected and what information is output.
Once a selection is made, a card footer with selection data will appear. Select Output Selection to output the selection data as a transform table. Alternatively, use the Vega plot’s next actions menu and select Convert > New Transform Table.
Unlike object set plots, where selection is a drill-down operation that outputs a filtered object set, Vega plots cannot automatically filter the input data based on the current selection. Instead, Vega plots will output the selected values of the given encodings, and these outputs can be used to manually construct a filter on the input table. For more information, review the section on constructing a drill-down workflow.
Refer to the provided Vega plot templates for additional examples of selection setups in common visualizations, such as bubble plots and heat grids. These templates can be found under the Choose a template dropdown menu in the configuration editor.
...
"params": [
{
"name": "quiverDefaultClick", // Define point selection parameter
"select": {
"type": "point",
"encodings": ["x"] // Select all points with the same "x" value
}
}
],
"encodings": [
"x": ...
"y": ...
"color": {
"condition": [
{
"param": "quiverDefaultClick",
"empty": false,
"value": "orange" // Conditionally color selected points
}
]
},
]
...
"params": [
{
"name": "quiverDefaultClick",
"select": {
"type": "point",
"encodings": ["color"] // Select all data with the same "color" encoding
}
}
]
...
"params": [
{
"name": "quiverDefaultBrush",
"select": {
"type": "interval",
"encodings": ["y"] // Restrict interval selection to the y-axis
}
}
]
Selection data from Vega-Lite plots can be used to construct drill-down workflows, where chart selections act as a filter and users can continue analysis on a subset of data based on the upstream selection. The following steps describe how to construct drill-down workflows.
Not all Vega-Lite plot types support selection. Although Vega documentation does not provide an exhaustive list of supported plot types, the following is a non-comprehensive list:
Each plot is limited to one point selection parameter and one interval selection parameter that outputs data into Quiver. This is a limitation set by Quiver; while Vega permits the definition of multiple parameters as long as they have unique names, only those named quiverDefaultClick
and quiverDefaultBrush
will be output as a Quiver transform table.
Check whether the values on that axis are being aggregated within the Vega specification. Vega does not support selection over fields aggregated by Vega. For example, if the y
encoding field includes an inline aggregation like the snippet below, users will not be able to select a subset of the y-axis.
"encodings": {
"y": {
"field": $C.field_y,
"aggregate": "avg"
},
...
}
To enable selection over the y-axis, aggregate the data in Quiver first (using pivot tables, for example) before passing it into Vega.
Invalid data selection
error when I attempt to make a selection, even though the spec compiles?Check the following:
encodings
field. Each parameter must specify one or more encodings to output selection information.color
, shape
, and so on. Removing these from the encodings array should resolve the error.Vega-Lite ↗ documentation and the Vega editor ↗ can be helpful tools to test and debug Vega specs. However, you should not enter any sensitive information in the editor tool as we cannot guarantee data security outside of the Palantir platform.