Pie charts are useful for illustrating the proportions that several components contribute to a whole.
Building a Pie Chart
Ignoring any fields that are hidden from the visualization, pie chart visualizations require the following in the Data section:
- One dimension
- One measure
More dimensions or measures will prevent a pie chart from rendering. Additionally, pie charts can visualize a maximum of 50 rows of data; use filters or the Row Limit option to limit your data if your results contain more than 50 rows.
This page describes the options for editing pie charts in the visualization menu. This menu can be accessed by clicking the gear in the upper right corner of the visualization tab.
Some of the options listed below may be grayed out or hidden in situations where they would conflict with other settings you have chosen.
Plot Menu Options
Value Labels for pie charts enables you to change how individual sections of the pie chart are labeled for end users. There are three individual label types:
None: Labels and legend are not displayed.
Legend: The default option. Displays the legend at the bottom of the visualization.
Labels: Displays lines marking the individual sections of the the pie chart. You are able to customize the information that is displayed next to these lines by selecting one of the options from the Value Type drop-down menu that appears when selecting Labels.
Label Type enables you to customize the format of the labels marking the sections of your pie chart. There are five ways you can customize your labels.
Label: Displays the series name.
Value: Displays the numeric value associated with the pie slice.
Label - Value: Displays the series name in bold first, then the numeric value.
Percent: Displays the percentage of the pie slice as a portion of the total pie.
Label - Percent: Displays the series name in bold first, then the percentage.
Label Type is only available when Value Labels is set to Labels.
Inner Radius enables you to format a pie chart as a donut chart, by setting the radius for the "donut hole." This field accepts integers between 0 and 100, representing the percentage of the pie chart's total width (i.e., diameter) that will make up the hole. If no value is set the chart will appear as a normal pie chart.
Start Angle and End Angle
Start Angle and End Angle enable you to control whether the pie chart appears as a full circle or as a portion of a circle. These fields use the 360-degree angles of a circle, and numbers between -360 and 360 can be entered into them. The End Angle must be a more positive number than the Start Angle; if it's not, the visualization will default to a full circle. Similarly, if no values are entered in Start Angle and End Angle, the chart defaults to a full circle.
Once the Start Angle and End Angle are set, your full data results will be shown within that portion of the circle, adjusted to fit that space.
For example, if you enter a Start Angle of
0 and an End Angle of
90, your data appears within the upper right quarter of a circle:
If you enter a Start Angle of
-270 and an End Angle of
-90, your data appears as the bottom half of a circle:
Series Menu Options
The series menu controls how your chart shows each data series.
You can define the color palette for a chart in the Colors section.
Choose a color collection from the Collection drop-down menu. A collection allows you to create themed visualizations and dashboards that look good together. You can see all the palettes in each of Looker's built-in color collections on the Color Collections documentation page. Your Looker admin may also create a custom color collection for your organization.
Once you select the color collection, the Palette section will update with a palette from that collection.
Once you've selected a color collection, you can choose a different palette from the collection, or customize your palette, by clicking the color palette itself. This opens the palette picker and displays all the palettes from the collection.
Colors are assigned to each series in order. For a categorical palette, the first color in the palette is assigned to the first series, and so on. For a sequential or diverging palette, the color at the left end of the palette is assigned to the first series and the colors for each remaining series move to the right on the palette. If your query returns more data series than colors listed, the colors repeat from the beginning of the palette, first as a lighter version of each color, then as a darker version of each color.
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.
- Click EDIT ALL at the bottom right of the menu to use a comma-separated list of color values.
To change a selected color, or edit all colors at once, you can input hex strings, such as
#2ca6cd, or CSS color names, such as
mediumblue, into the color value box at the bottom of the picker.
You can also click the color wheel to the right of the color value box to bring up a color picker, which can be used to select a color. The corresponding hex value for that color appears in the color value box:
If you click EDIT ALL, you'll see that the color value box is populated with the 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.
Select Reverse colors to reverse the palette. For a categorical palette, this would apply the last color in the palette to the first series, the second-to-last color in the palette to the second series, and so on. For a sequential or diverging palette, this would apply the color at the right end of the palette to the first series and move left on the palette for the remaining series.
Each series in the chart can be customized in several different ways:
- Click the arrow next to a series to expand its options.
- Click on the color swatch to select a custom color for the series. This overrides the color palette defined by the Colors option.
- Enter a custom series label if desired. This impacts the chart legend and tooltips.