Charts in Stackdriver Monitoring have configurable legends. The legend looks like a table positioned beneath the graph. It has one column of colored dots, a variable number of data columns, and a Value column. The following screenshot shows a chart with a legend:
The column of colored dots keys the lines in the graph to the rows in the legend. The Value column displays the values for the metric being charted, and other columns show the values of chosen metric or resource labels. The dashed bar on the chart indicates the time for which values are displayed.
This page describes how to work with these legends. You can:
- Choose the metric and resource labels to display as columns in the legend.
- Sort the rows in the legend based on the values in a column.
- Show both current and past values when using the Compare to past chart-view option. (See Compare to past for details on this option.)
For information on using the legend template to change the descriptive strings that appear in the legend, go to Legend template.
To change the columns that appear in the legend, click the Columns button, view_column. This button is located at the far right of the legend, next to the Value column. Clicking the button brings up a configuration panel. This panel lists the metric and resource labels available to display as columns. Required columns have disabled checkboxes. The following screenshot shows the Columns button and the configuration panel for a particular legend:
When the chart is initially created, the system heuristically chooses a set of labels to show by default. You can check or uncheck labelled columns. The entries for required columns, most typically Value, are disabled and cannot be unchecked. When you change the configuration, you must have at least one metric or resource label selected.
If you selected more fields than the chart's width can accommodate, or the if the legend has too many rows to display, it provides appropriate scrollbars, as seen in the following screenshot:
Sorting the rows
You can sort the rows of the legend by any of the columns, except Value. Rows can be sorted into ascending or descending order. To sort a row, click on the header. The most recently sorted column displays an arrow indicating the sort order. The following screenshot shows a legend that has been sorted by zone in descending order:
Legends in Compare to past mode
When you use Compare to Past mode on a chart, the legend is modified to include an additional “values” column. The current Value column becomes Today, and the past values column is named appropriately—for example, Last Week. The following screenshot shows a legend for a table comparing current data to that of the last hour: