Timeline charts help you visualize the relationship between groups of events and compare the timespans over which these events took place. A timeline visualization also works with numbers.
To use a timeline visualization, click the ellipsis (…) in the Visualization bar and choose Timeline. Click the gear in the upper right corner of the visualization tab to format your visualization.
This example shows the timespan between a customer’s first order date and the customer’s most recent order date. Each timespan is colored to indicate the number of orders that the customer has placed.
Timeline visualizations are based on fields in the Data section, and the fields must be in a particular order. Ignoring those fields that are hidden from the visualization, the timeline needs the following fields (in order from left to right):
- Label field: A string field, such as a name. This is a mandatory field.
- Detail field: A second, optional string field, which lets you combine each row of the timeline visualization into categories. See Displaying Individual or Multiple Bars per Row for more detail.
- Start field: A start date or number. This is a mandatory field.
- End field: An end date or number. This is a mandatory field.
- Magnitude field: An optional number field, which determines the bar color on a continuum between the two colors specified in the visualization options. See Using Colors for more information and other options using colors and labels.
Using timeline visualizations without dates
Timeline charts can be helpful for information other than dates. This example shows several airlines, each with a bar where:
- The bar starts at the airline’s on-time flight count
- The bar ends at the airline’s total flight count
- The bar’s color indicates the airline’s on-time percentage as a magnitude value
The magnitude coloring helps illustrate that although an airline may have a large difference between its on-time flight count and its total flight count, it may have a good on-time percentage. For example, Southwest has a wide bar but also has the best percentage of on-time flights, as shown by the purple bar showing its on-time percentage. You can hover over a bar to see the data that the bar represents, including:
- The beginning value of the bar
- The ending value of the bar
- The value represented by the color of the bar (if any)
Displaying individual or multiple bars per row
If you turn on Group Bars by Label, all records that share the same label value appear as individual bars on the same row in the visualization. For example, the data below has a label field indicating the age tier. Each age tier has only one row in the visualization, with one or more records displayed as bars on that age tier’s row:
You can also display each record bar on its own row by turning off the Group Bars by Label option. In this case, the visualization will have multiple rows with the same label value:
For timeline visualizations, the color of a bar can mean different things, depending on your data:
- Magnitude value: Each bar’s color is within a continuum and illustrates the magnitude value for the bar. To set this up, include a magnitude field in your query and specify a continuous palette (one that shades from one color to another, such as the sequential and diverging palettes in Looker’s color collections) in the visualization options.
- Detail value: Each bar’s color indicates its value in the detail field. To set this up, include a detail field in your data and choose a categorical palette (one that has multiple individual colors) in the visualization options. (If you don’t have a magnitude field, you can select a continuous palette and the colors will refer to the values in the detail field. If you do have a magnitude field and select a continuous palette, the colors will always apply to the magnitude field.)
- In all other cases, the bar colors use a repeating pattern of the colors you select in the visualization options.
Below are two different visualizations of the same customer data. The data includes a detail field (Traffic Source) and a magnitude field (Lifetime Orders.
This example uses continuous palette. Since you have a magnitude field, the color continuum indicates the magnitude. The legend shows how many lifetime orders the colors on each end of the color continuum represent:
This example uses a categorical palette; the colors indicate the values in the detail field. The legend shows which traffic source is represented by each color:
If you remove both the detail and magnitude fields, the colors cycle through the palette chosen in the visualization options:
You can define the color palette for a chart.
Selecting a color collection and palette
A collection lets you create themed visualizations and dashboards that look good together. All of Looker's built-in color collections appear on the Color collections documentation page. Your Looker admin may also create a custom color collection for your organization.
You can choose a color collection from the Collection drop-down menu. The Palette section will update with a palette from your chosen color collection. To change to a different palette in the color collection, click the color palette, which opens the palette picker. From there, you can view and select from all palettes in the collection.
Choosing the type of palettes
If you use a sequential or diverging palette, each bar is colored on a scale along the palette. If you change to a categorical palette (a palette composed of multiple individual colors), colors are assigned to each bar in order. The first bar is assigned the first color, and so on. If there are more bars than colors listed, the colors repeat from the beginning of the palette.
Creating a custom color palette
To create a custom color palette, first select the Custom tab on the palette picker. You can edit your palette in several ways:
- Click on one of the colors present to edit it.
- Click the + or - buttons below the color palette to add a color to the end of the palette or remove a selected color. When you add a color to the end of a sequential or diverging palette, Looker automatically creates a scale between that color and the previous one.
- Click EDIT ALL at the bottom right of the menu to use a comma-separated list of color values.
You can also click the color wheel to the right of the color value box to bring up a color picker, which you can use to select a color. The corresponding hex value for that color appears in the color value box:
If you click EDIT ALL, the color value box populates with all hex codes of the color palette you've chosen or customized. Copying and pasting this list is the best way to copy custom color palettes from one chart to another.
You can reverse the colors used on a palette. For a sequential or diverging palette, each bar is colored on a scale along the palette in reverse order, starting with the color at the right end of the palette and moving to the left. For a categorical palette, this would apply the colors in the palette to each bar in reverse order, starting with the last color in the palette.
Group Bars by Label
You can determine whether a visualization should display each record bar in its own row, or if the record bars for each label value should all be in the same row. See Displaying Multiple Bars per Row.
You can set the font size for labels, from Tiny to Huge.
You can specify the number or date format of a value using Excel-style formatting. If no formatting is specified, the value displays in the format of the underlying dimension or measure.
MS Excel’s complete guidedescribes how to specify these formats. However, color formatting is not currently supported in Looker.
The Adding custom formatting to numeric fields documentation page provides more information on how to use custom formatting.
You can specify the formatting of date values. Common formatting options are:
||Month as a number with no leading zero. May is shown as "5".|
||Month as a number with a leading zero when appropriate. May is shown as "05".|
||Month as an abbreviation (Jan to Dec).|
||Month as a full name (January to December).|
||Month as a single letter (J to D).|
||Day as a number without a leading zero.|
||Day as a number with a leading zero when appropriate.|
||Day as an abbreviation (Sun to Sat).|
||Day as a full name (Sunday to Saturday).|
||Year as a two-digit number.|
||Year as a four-digit number.|
||Hour as a number without a leading zero.|
||Hour as a number with a leading zero when appropriate. If the format contains AM or PM, the hour is based on the 12-hour clock. Otherwise, the hour is based on the 24-hour clock.|
||Minute as a number without a leading zero.
||Minute as a number with a leading zero when appropriate.
||Second as a number without a leading zero.|
||Second as a number with a leading zero when appropriate. If you want to display fractions of a second, use a number format that resembles h:mm:ss.00.|
||Hour using a 12-hour clock. Excel displays "AM" or "A" for times from midnight until noon and "PM" or "P" for times from noon until midnight.|
You can display or hide a legend at the bottom of the visualization.
Viewing timeline charts in the new dashboard experience
When you view timeline charts in Looker’s new dashboard experience, they may appear slightly different than when you view them as Looks, as Explores, or in legacy dashboard tiles. This example shows what a timeline chart looks like when viewed on a dashboard tile:
When you hover over a bar to see the data that bar represents, the data appears as a pop-up tooltip rather than embedded within the bar.
If your Looker admin has enabled the New Explore Visualizations Labs feature, timeline visualizations appear in the dashboard style when you view them in Explores, click Explore from Here, or open the edit window of a dashboard tile.