This page demonstrates how to add and customize a LookML dashboard element of type: looker_column
with LookML dashboard parameters in a dashboard.lkml
file.
For information about building a column chart through the Looker UI, see the Column chart options documentation page.
Example usage
Parameter definitions
Parameter Name | Description | |
---|---|---|
Basic Parameters | ||
name (for elements) |
Creates an element | |
title (for elements) |
Changes the way an element name appears to users | |
type (for elements) |
Determines the type of visualization to be used in the element | |
height (for elements) |
Defines the height of an element in units of tile_size for layout: tile and layout: static dashboards |
|
width (for elements) |
Defines the width of an element in units of tile_size for layout: tile and layout: static dashboards |
|
top |
Defines the top-to-bottom position of an element in units of tile_size for layout: static dashboards |
|
left |
Defines the left-to-right position of an element in units of tile_size for layout: static dashboards |
|
row |
Defines the top-to-bottom position of an element in units of rows for layout: newspaper dashboards |
|
col |
Defines the left-to-right position of an element in units of columns for layout: newspaper dashboards |
|
refresh (for elements) |
Sets the interval at which the element will automatically refresh | |
note |
Starts a section of LookML to define a note for an element. This parameter has subparameters text , state , and display . |
|
Query Parameters | ||
model |
Defines the model to be used for the element’s query | |
explore (for elements) |
Defines the Explore to be used for the element’s query | |
dimensions |
Defines the dimensions to be used for the element’s query | |
measures |
Defines the measures to be used for the element’s query | |
sorts |
Defines the sorts to be used for the element’s query | |
pivots |
Defines the dimensions that should be pivoted to be used for the element’s query | |
limit |
Defines the row limit to be used for the element’s query | |
filters (for elements) |
Defines the filters that cannot be changed for the element’s query | |
listen |
Defines the filters that can be changed for the element’s query, if filters (for dashboard) have been created |
|
query_timezone |
Defines the time zone that should be used when the query is run | |
merged_queries |
Defines a merged results query | |
Plot Parameters | ||
stacking |
Stacks series on top of each other to create a stacked chart | |
show_dropoff |
Adds arrows that show the percent change between data points | |
ordering |
Sets the order of series values in a stacked or stacked percentage chart | |
column_spacing_ratio |
Sets the spacing between columns within a group | |
column_group_spacing_ratio |
Sets the spacing between column groups to a value between 0 and 1 | |
hide_legend |
Hides the chart legend | |
legend_position |
Specifies whether legend appears to the left, center, or right of the chart | |
hidden_fields |
Specifies any fields to use in the query but hide from the chart | |
limit_displayed_rows |
Shows or hides rows in a visualization based on their position in the results | |
limit_displayed_rows_values |
Specifies which rows to show or hide in a visualization. This parameter has the subparameters show_hide , first_last , and num_rows . |
|
Series Parameters | ||
colors |
Sets the colors of chart series based on the order in which the series appear | |
series_colors |
Sets the colors of chart series based on the name of the series | |
series_labels |
Changes the way a series name appears to users | |
series_types |
Mixes visualization types by defining the type for each series | |
show_view_names |
Hides view names from chart labels | |
Value Parameters | ||
show_value_labels |
Shows labels next to data points | |
show_null_labels |
Determines if null labels should be shown on a chart when labels are shown | |
label_color |
Specifies a comma-separated list of color values | |
font_size |
Sets the font size of value labels | |
label_rotation |
With stacking set to the default ('' ), sets the rotation of value labels to a value between -360 and 360 |
|
label_value_format |
Specifies Excel-style formatting for value labels | |
show_totals_labels |
With stacking set to normal , specifies whether totals are displayed for each stacked group of data points on a chart |
|
hidden_series |
Hides a chart series when the element loads | |
show_silhouette |
With stacking set to normal , displays a lightly shaded representation of a disabled series |
|
totals_color |
With stacking set to normal , specifies the color of totals labels |
|
X-Axis Parameters | ||
x_axis_scale |
Specifies how the x-axis scale is calculated | |
x_axis_reversed |
Specifies the direction of the x-axis | |
show_x_axis_label |
Hides the x-axis label | |
x_axis_label |
Defines a custom x-axis label | |
show_x_axis_ticks |
Shows ticks on the x-axis | |
x_axis_gridlines |
Extends grid lines from the x-axis | |
x_axis_label_rotation |
Rotates x-axis labels a number of degrees | |
x_axis_datetime_label |
Specifies a format string for the x-axis labels, if they are dates | |
Y-Axis Parameters | ||
y_axis_gridlines |
Extends gridlines from the y-axis | |
y_axis_reversed |
Sets the direction of the x-axis | |
reference_lines |
Adds reference lines to a chart |
Basic parameters
When defining a LookML dashboard element, you must specify values for at least the name
and type
basic parameters. Other basic parameters like title
, height
, and width
affect the appearance and position of an element on a dashboard.
name
This section refers to the
name
parameter that is part of a dashboard element.
name
can also be used as part of a dashboard filter, described on the Dashboard parameters documentation page.
Each name
declaration creates a new dashboard element and assigns it a name. Element names must be unique. Names are sometimes referenced in the elements
parameter when you're using layout: grid
dashboards.
title
This section refers to the
title
parameter that is part of a dashboard element.
title
can also be used as part of a dashboard, described on the Dashboard parameters documentation page.
title
can also be used as part of a dashboard filter, described on the Dashboard parameters documentation page.
The title
parameter lets you change how an element's name will appear to users. If unspecified, the title defaults to the element name
.
Consider this example:
If you used this format, instead of the element appearing as Sales Overview, it would appear as 1) Sales Overview.
type
This section refers to the
type
parameter that is part of a dashboard element.
type
can also be used as part of a dashboard filter, described on the Dashboard parameters documentation page.
type
can also be used as part of a join, described on thetype
(for joins) parameter documentation page.
type
can also be used as part of a dimension, described on the Dimension, filter, and parameter types documentation page.
type
can also be used as part of a measure, described on the Measure types documentation page.
The type
parameter determines the type of visualization to be used in the element.
See the type
(for LookML dashboards) documentation page for an overview of the different types of LookML dashboard elements.
height
This section refers to the
height
parameter that is part of a dashboard element.
height
can also be used as part of a dashboard row, described on the Dashboard parameters documentation page.
For dashboards with tile
or static
layouts
The height
parameter defines the height of an element, in units of tile_size
(which is defined in pixels), for layout: tile
and layout: static
dashboards.
For example, the following code specifies tile_size: 100
and height: 4
, making the orders_by_date
element 400 pixels in height.
For dashboards with newspaper
layout
The height
parameter defines the height of an element, in units of row, for layout: newspaper
dashboards.
A dashboard with newspaper layout defaults to an element height of 6 rows, or about 300 pixels. The minimum height is 1 row for dashboards with a preferred viewer
parameter set to dashboards-next
. The minimum height is 2 rows for dashboards with a preferred viewer
parameter set to dashboards
.
For example, the following code sets an element to be 12 rows tall, or twice as tall as other elements that are set to the default:
width
This section refers to the
width
parameter that is part of a dashboard element.
width
can also be used as part of a dashboard, described on the Dashboard parameters documentation page.
The width
parameter defines the width of an element, in units of tile_size
, for layout: tile
and layout: static
dashboards.
For example, the following code specifies tile_size: 100
and width: 4
, making the orders_by_date
element 400 pixels in width.
The width
parameter defines the width of an element, in units of columns, for layout: newspaper
dashboards.
A dashboard with newspaper layout defaults to a width of 24 columns.
For example, the following code sets the element to half the width of the dashboard:
top
The top
parameter defines the top-to-bottom position of an element, in units of tile_size
, for layout: static
dashboards.
For example, the following code specifies tile_size: 100
and top: 4
, positioning the top edge of the orders_by_date
element 400 pixels from the top of the dashboard.
left
The left
parameter defines the left-to-right position of an element, in units of tile_size
, for layout: static
dashboards.
For example, the following code specifies tile_size: 100
and left: 4
, positioning the left edge of the orders_by_date
element 400 pixels from the left side of the dashboard.
row
For layout: newspaper
dashboards, the row
parameter defines the row that the top edge of an element is placed on.
A dashboard begins with row 0 at the top of the dashboard. A dashboard with newspaper layout defaults to an element height of 6 rows, meaning the dashboard elements at the top of a dashboard (row: 0
) would default to taking up rows 0-5.
Each row is 50 pixels tall, which means the default element height of 6 rows is 300 pixels.
For example, the following code sets an element to be set on the second row of elements in the dashboard, assuming elements are set at the default height:
col
For layout: newspaper
dashboards, the col
parameter defines the column that the left edge of the element is placed on.
Dashboards are divided into 24 columns. A dashboard begins with column 0 at the left of the dashboard. A dashboard with newspaper layout defaults to an element width of 8 columns, meaning the dashboard elements at the left of a dashboard (col: 0
) would default to taking up columns 0-7.
For example, the following code sets an element to be set in the third column of elements in the dashboard:
refresh
This section refers to the
refresh
parameter that is part of a dashboard element.
refresh
can also be used as part of a dashboard, described on the Dashboard parameters documentation page.
The refresh
parameter allows an element to reload automatically on some periodic basis, thereby retrieving fresh data. This is often helpful in settings where a dashboard is constantly displayed, such as on an office TV. Note that the dashboard must be open in a browser window for this parameter to have an effect. This setting does not run in the background to "pre-warm" the dashboard cache.
The refresh rate can be any number (without decimals) of seconds, minutes, hours, or days. For example:
Use caution when setting short refresh intervals. If the query behind the element is resource-intensive, certain elements may strain your database more than desired.
note
You can add descriptive notes to elements like this:
note
has the subparameters text
, state
, and display
.
text
The text
subparameter specifies the text displayed in the note. The text can be localized.
state
The state
subparameter determines whether the note will be collapsed
or expanded
if it is too big to fit on a single row within the element's width. If you choose collapsed
and the note is too long, the note will end in a clickable ellipsis (...
) that can be used to read the full note.
display
The display
subparameter determines where the note is displayed on an element. above
places the note at the top of an element, below
places it at the bottom of an element, and hover
requires the user to hover their mouse over the element to see the note.
Query parameters
When defining a LookML dashboard element, you must specify values for at least the model
and explore
query parameters, and at least one field must be specified using either the dimensions
parameter or the measures
parameter. You can also use the other query parameters described below to control the way data is displayed in a dashboard element.
model
The model
parameter defines the model to use for the element query. If unspecified, it will default to the model where the dashboard resides.
The model
parameter accepts LookML constants. You can define a constant in the manifest file for your project, then use the syntax "@{constant_name}"
to set the constant as the value for model
. Using a constant lets you define the name of a model in one place, which is particularly useful if you're updating the name of a model that is used by multiple dashboard elements.
For more information and an example of using constants with LookML dashboards, see the constant
parameter documentation page.
explore
This section refers to the
explore
parameter that is part of a dashboard element.
explore
can also be used as part of a model, described on theexplore
parameter documentation page.
explore
can also be used as part of a dashboard filter, described on the Dashboard parameters documentation page.
The explore
parameter defines the Explore to use for the element query.
The explore
parameter accepts LookML constants. You can define a constant in the manifest file for your project, then use the syntax "@{constant_name}"
to set the constant as the value for explore
. Using a constant lets you define the name of an Explore in one place, which is particularly useful if you're updating the name of an Explore that is used by multiple dashboard elements.
For more information and an example of using constants with LookML dashboards, see the constant
parameter documentation page.
dimensions
The dimensions
parameter defines the dimension or dimensions to use for the element query. Use the syntax view_name.dimension_name
to specify the dimension. Don't include dimensions
if the query doesn't have any.
measures
The measures
parameter defines the measure or measures to use for the element query. Use the syntax view_name.measure_name
to specify the measure. Don't include measures
if the query doesn't have any.
sorts
The sorts
parameter defines the sorts to be used for the element query. The primary sort is listed first, then the secondary sort, and so on. Use the syntax view_name.field_name
to specify the dimension or measure. Don't include sorts
if you want to use Looker's default sort order. Descending sorts are suffixed with desc
; ascending sorts don't need a suffix.
pivots
The pivots
parameter defines the dimensions that should be pivoted for the element query. Use the syntax view_name.dimension_name
to specify the dimension. Don't include pivots
if the query doesn't have any.
limit
The limit
parameter defines the row limit that should be used for the element query. The limit applies to the number of rows before any pivots are applied.
filters
This section refers to the
filters
parameter that is part of a dashboard element.
filters
can also be used as part of a dashboard, described on the Dashboard parameters documentation page.
filters
can also be used as part of a measure, described on thefilters
parameter documentation page.
The filters
parameter defines the non-changeable filters that should be used for the element's query. If you would like filters that a user can change in the dashboard, you should set up the filters using filters
for dashboards, then apply them to the elements using listen
.
The syntax for filters
is:
Each filter can accept a Looker filter expression or a value constant. You can also use the _localization
or _user_attributes
Liquid variables in the filter expression for flexible filter values.
listen
Dashboards can have filters that allow users to change the data behind dashboard elements. These are set up by using the filters
for dashboards parameter. For a filter to impact an element, the element must be set up to "listen" for that filter, using the listen
parameter.
The syntax for listen
is:
For example, you might create a filter called Date that requires a user to enter a date into the filter field in the UI. You could then apply the value that the user enters to the orders_by_date
element like this:
This concept is described in more detail on the Building LookML dashboards documentation page.
query_timezone
The query_timezone
parameter specifies the time zone in which the query will be run. The time zone options are shown on the Values for timezone
documentation page. If you want the query to run using the viewer's time zone, you can assign the value as user_timezone
.
merged_queries
The merged_queries
parameter defines how to merge results from several queries. You define the component queries under the merged_queries
parameter and use the join_fields
subparameter to define the merge rules.
The syntax for merged_queries
is:
The first query defined under merged_results
is the primary query, and the other queries will be merged with that one.
For example, by joining on the stock symbol, company name, and Twitter username, you can merge two queries to return results for company name, company Twitter username, IPO year, stock symbol, number of employees, and job count:
The data results would be formatted like this:
Then you can apply element parameters to style the visualization as you desire.
Plot parameters
Most of the parameters described in this section correspond to the options in the Plot section of the visualization editor for column charts.
stacking
The stacking
parameter specifies how series are clustered visually on a chart.
normal
: Stacks bars, lines, and points one on top of each other, as in a normal stacked column chart.percent
: Stack bars, lines, and points to total 100% fill of the chart and set the y-axis values to be percentages.''
: Bars, lines, and points are not stacked and are instead grouped.
show_dropoff
The show_dropoff
parameter toggles the appearance of percent change arrows across the chart. For each series, these arrows display the percent of the previous value from left to right.
ordering
The ordering
parameter lets you order each slice of a stacked or stacked percentage chart by the size of each slice.
none
(or no value is specified): Series values will be ordered according to their positions in the data table.asc
: The smallest series values will be positioned at the bottom, with values increasing in size toward the top of the column stack.desc
: The largest values will be positioned at the bottom, with values decreasing in size toward the top.
column_spacing_ratio
The column_spacing_ratio
parameter sets the spacing between columns within a group. This is available for charts that have stacking
set to the default grouped setting, specified using ''
in LookML. This parameter accepts values between 0
and 1
. 0
is associated with minimum spacing between columns within a group, and 1
is associated with maximum spacing between columns within a group.
column_group_spacing_ratio
The column_group_spacing_ratio
parameter sets the spacing between column groups. This parameter accepts values between 0
and 1
. 0
is associated with minimum spacing between column groups, and 1
is associated with maximum spacing between column groups.
hide_legend
This declaration will hide the legend from the visualization.
legend_position
If hide_legend
is set to false
(and there is more than one series), you can use the legend_position
parameter to specify whether the series legend will appear to the left, center, or right of the chart.
hidden_fields
The hidden_fields
parameter indicates which fields, if any, are used in the query but hidden in the chart. Any hidden fields will appear in the data table section of an Explore.
limit_displayed_rows
The limit_displayed_rows
parameter lets you show or hide rows in a visualization, based on their position in the results. For example, if your visualization displays a 7-day rolling average, you may want to hide the first 6 rows. Setting this to true
lets you specify the values and positions in the visualization to which this applies using the limit_displays_rows_values
parameter and its subparameters.
limit_displayed_rows_values
Use the limit_displayed_rows_values
parameter, and its subparameters show_hide
, first_last
, and num_rows
, with limit_displayed_rows
to specify which rows to show or hide in a visualization. See limit_displayed_rows
above for sample usage.
show_hide
The show_hide
subparameter sets whether to hide certain rows from the visualization. Set show_hide
to show
to display only a limited number of rows in the visualization, and set show_hide
to hide
to exclude certain rows from the visualization.
first_last
The first_last
subparameter sets whether the rows to be hidden or shown will be the first or last rows in the result set. Setting first_last
to first
shows or hides the first rows, while set first_last
to last
shows or hides the last rows.
num_rows
The num_rows
subparameter sets the number of rows to be hidden or shown. For example, num_rows: '10'
will show or hide either the first or last 10 rows of the result set from the visualization.
Series parameters
The parameters described in this section correspond to the options in the Series section of the visualization editor for column charts.
colors
The colors
parameter specifies a list of colors for the series. The first color in the list corresponds to the first data series. If there are more series than listed colors, the colors will start over at the beginning.
For all chart attributes that specify a color, the color value can take a hex string, such as #2ca6cd
, or a CSS named color string, such as mediumblue
.
series_colors
Set the colors of the series based on the series name, using name: value
pairs.
For a pivoted chart, the series names are the pivot names.
For a chart with multiple measures, the series names are the measure field names.
If the series name is not listed in series_colors
, the chart will default to the list of colors provided in colors
. If colors
is not set, the chart will fall back to the default color scheme.
series_labels
Set the labels of one or more series based on the series name, using name: label
pairs.
For a pivoted chart, the series names are the pivot names.
For a chart with multiple measures, the series names are the measure field names.
series_types
The series_type
parameter lets you use different Cartesian chart types in the same visualization. Use this parameter to assign a chart type to each series that you want to change. The type options are line
, column
, bar
, area
, and scatter
.
All series default to the initial chart type that you choose; you can then modify individual series.
show_view_names
The show_view_names
parameter determines whether view names are displayed in chart labels, such as axis names and column names.
Value parameters
The parameters described in this section correspond to the options in the Values section of the visualization editor for column charts.
show_value_labels
Display the value of a bar, line, or point next to the data point.
show_null_labels
Determine whether labels should be shown for null columns or bars, when show_value_labels
is set to true
.
label_color
The label_color
parameter accepts a comma-separated list of one or more color values. The color values can be formatted as RGB hex strings, such as #2ca6cd
, or as CSS color names, such as mediumblue
.
font_size
Set the font size of value labels using any valid CSS size, such as 10px
or 12px
.
label_rotation
Set the rotation of the value labels. This parameter accepts values between -360
and 360
, denoting the number of degrees to rotate the labels. This parameter is only available when stacking
is set to the default (''
).
label_value_format
The label_value_format
parameter specifies the formatting to apply to a value, independent of any formatting applied to the underlying dimension or measure. The field accepts Excel-style formatting. If label_value_format
is not specified, the value will be displayed in the format of the underlying dimension or measure.
You can read about how to specify these formats on the Adding custom formatting to numeric fields documentation page. However, color formatting is not supported in Looker.
The formatting used in the
label_value_format
LookML dashboard parameter is the same as formatting used with thevalue_format
LookML parameter, except that thevalue_format
LookML parameter requires the formatting string to be enclosed in double quotes.
show_totals_labels
Set whether totals are displayed for each stacked group of data points on a chart. This parameter is only available when stacking
is set to normal
.
hidden_series
The hidden_series
parameter specifies which series will be disabled in the chart, meaning that the series will appear in the chart legend, but grayed out. Users can enable disabled series by clicking them in the chart legend. Consequently, hidden_series
may not worked as desired with hide_legend: true
.
For a pivoted chart, the series names are the pivot names:
For a chart with multiple measures, the series names are the measure field names:
Used together with the show_silhouette
parameter, you can specify whether disabled series are shown as a lightly shaded representation in the chart itself.
show_silhouette
When the show_silhouette
parameter is set to true
and stacking
is set to normal
, a disabled series will be displayed as a lightly shaded silhouette.
totals_color
This parameter defines the color of the totals labels in a chart. The totals_color
parameter is only available when stacking
is set to normal
.
X-axis parameters
The parameters described in this section correspond to the options in the X section of the visualization editor for column charts.
x_axis_scale
This parameter determines how the x-axis scale is calculated.
auto
: The scale will be inferred from the underlying data. This is the default setting.ordinal
: The data will be plotted as evenly spaced, discrete entries.time
: The data will be plotted as time and the axis will be labeled appropriately. This will not work if the underlying data can't be converted to dates.
x_axis_reversed
This parameter sets the direction of the x-axis. When x_axis_reversed
is set to false
, values increase from left to right. When it is set to true
, values decrease from left to right.
show_x_axis_label
This parameter determines whether labels are shown on the x-axis.
x_axis_label
This parameter specifies a label for the x-axis. You can use this parameter when show_x_axis_label
is set to true
.
show_x_axis_ticks
This parameter determines whether value labels are shown on the x-axis.
x_axis_gridlines
This parameter determines whether gridlines are extended from the x-axis.
x_axis_label_rotation
The x_axis_label_rotation
parameter defines the rotation of the x-axis labels in degrees. This parameter accepts values between -360
and 360
, denoting the number of degrees to rotate the labels.
x_axis_datetime_label
This parameter specifies a format string for the x-axis labels, if they are dates. If x_axis_scale
is not set to time
, this does nothing.
See the Time formatting for charts documentation page for information on formatting times.
Y-axis parameters
Under construction: We are working on updating this section of the page. Meanwhile, you can check out the Column chart options documentation page to view equivalent visualization menu options for the y-axis.
The parameters described in this section correspond to the options in the Y section of the visualization editor for column charts.
y_axis_gridlines
This parameter determines whether gridlines are extended from the y-axis.
y_axis_reversed
This parameter sets the direction of the y-axis. When y_axis_reversed
is set to false
, values increase going up the axis. When it is set to true
, values decrease going down the axis.
reference_lines
This parameter specifies an array of values for specifying reference lines and regions.
See the Dashboard reference line parameters documentation page for information on setting up reference lines.