[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-28。"],[],[],null,["# Configure legends\n\nThis document describes how to work with chart legends. The legend looks like a\ntable positioned adjacent to the graph. By default, the legend on a dashboard\nis configured to show only the colored dots that correspond to lines in the\ngraph. The following screenshot shows a chart on a dashboard with the default\nlegend:\n\nFor charts on dashboards, you can also expand the legend to view more details,\nsuch as configurable data columns and a **Value** column. The **Value** column\ndisplays the values for the metric being charted, and other columns display the\nvalues of chosen metric or resource labels. The dashed bar on the chart\nindicates the time for which values are displayed.\n\nTo access [resource-specific dashboards](#resource-dashboards) or to apply\ntemporary filters to a dashboard, use the\n*more_vert* **Actions for this timeseries** menu in an expanded\nlegend.\n\nShow and hide legends\n---------------------\n\n### Charts on dashboards\n\nYou can show or hide the legends of all charts on a dashboard or of each\nchart individually:\n\n- To show or hide the legends of every chart in a dashboard, in the dashboard toolbar, click *settings* **Settings** and then select **Condensed** or **Table**.\n- To show or hide the legend of a particular chart, click *unfold_more* **Expand legend** , or select **Expand chart legend** in the *more_vert* **More chart options** menu.\n\n### Metrics Explorer\n\n- To show a chart's full legend, in the toggle labeled **Chart Table Both** , select **Both**.\n- To hide a chart's full legend, in the toggle labeled **Chart Table Both** , select **Chart**.\n\nLegends for charts that display multiple metric types might be difficult\nto interpret. By default, the legend columns are selected from the metric and\nresource labels for the charted metric type. When a chart has multiple\nmetric types, the result is that a specific legend column might not be\nmeaningful for a specific time series.\n\n- Example: A chart displays the number of bytes written to and the number of\n bytes read from virtual machine (VM) instances. Assume that the bytes-read\n data is filtered to the `us-central1-a` zone. The legend includes\n a `zone` column, and the values in that column might be different than\n `us-central1-a`. The reason is that the bytes-written metric type contains\n a `zone` label and that metric data wasn't filtered by zone.\n\n- Example: A chart displays the number of bytes written to VM instances and\n the CPU usage for those instances. The legend contains\n columns for the disk type and storage type. However, the values for those\n labels are empty for time legend fields. The reason is that the CPU usage\n metric type doesn't support those labels.\n\nSelect legend columns\n---------------------\n\nTo change the columns that appear in the legend, expand the legend then\nclick *view_column* **Legend columns** . Clicking the button brings up a\nconfiguration panel.\nThis panel lists the metric and resource labels available to display\nas columns. Required columns have disabled checkboxes. The following screenshot\nshows the **Columns** button and the configuration panel for a particular\nlegend:\n\nWhen the chart is initially created, the system heuristically chooses a set of\nlabels to show by default. You can select or clear labeled columns. The\nentries for required columns, most typically **Value**, are disabled and\ncan't be cleared. When you change the configuration, you must have at least\none metric or resource label selected.\n\nThe legend displays a scrollbar when it has many columns to display, and\npaginates the legend when there are many rows to display. The\nfollowing screenshot illustrates a legend with a scrollbar, and\narrows for navigating through the pages:\n\nSort legend rows\n----------------\n\nYou can sort the rows of the legend by any of the columns.\nRows can be sorted into ascending or descending order. To sort a row,\nclick the header. The most recently sorted column displays an arrow\nindicating the sort order. The following screenshot shows a legend that has\nbeen sorted by **zone** in descending order:\n\nUnderstand legends in \"Compare to Past\" mode\n--------------------------------------------\n\nWhen you use [**Compare to Past** mode](/monitoring/charts/working-with-charts#comparetopast-option) on a chart, the legend\nis modified to include a second \"values\" column.\nThe current **Value** column becomes **Today** , and the past values column\nis named appropriately---for example, **Last Week**. The following\nscreenshot shows a legend for a table comparing current data to that of the\nlast hour:\n\nConfigure the name of a legend column\n-------------------------------------\n\nThe **Legend Alias** field lets you customize a description for the\ntime series on your chart. These descriptions appear on the tooltip for\nthe chart and on the chart legend in the **Name** column.\nBy default, the descriptions in the legend are created for you from the values\nof different labels in your time series. Because the system selects the\nlabels, the results might not be helpful to you. To build a template for\ndescriptions, use this field.\n\nYou can enter plain text and templates in the **Legend Alias** field. When\nyou add a template, you add an expression that is evaluated when the legend\nis displayed.\n\nTo add a legend template to a chart, do the following:\n\n1. In the **Display** pane, expand *expand_more* **Legend Alias**.\n2. Click *add* **Display template variable suggestions** and select an entry from the menu. For example, if you select `zone`, then the template `${resource.labels.zone}` is added.\n\nFor example, the following screenshot shows a legend template that contains\nplain text and the expression `${resource.labels.zone}`:\n\nIn the chart legend, the values generated from the template appear in a column\nwith the header **Name** and in the tooltip:\n\nYou can configure the legend template to include multiple text strings and\ntemplates; however, the display space available on the tooltip is limited.\n\nAccess resource-specific dashboards\n-----------------------------------\n\n### Charts on dashboards\n\n\nWhen you are viewing a time series, you might want to view more information\nabout the resource against which that time series is written. For some\nresources, you can go to the management page for that resource\nby using options in a chart's legend.\n\nTo go to the management page for a resource, do the following:\n\n1. In the Google Cloud console, go to the **Dashboards** page:\n\n [Go to **Dashboards**](https://console.cloud.google.com/monitoring/dashboards)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n2. In the toolbar of the Google Cloud console, select your Google Cloud project. For [App Hub](/app-hub/docs/overview) configurations, select the App Hub host project or the app-enabled folder's management project.\n3. Select a dashboard and then go to the chart or table that is displaying the time series of interest.\n4. If you are viewing a table, then scroll through the table until you find the row of interest. Next, go to the column that displays the numeric value, click *more_vert* **Actions for this timeseries** , and then select **Manage**.\n5. If you are viewing a chart, then do the following:\n\n 1. On the chart, click *unfold_more* **Expand legend**.\n 2. Scroll through the legend until you find the specific time series of interest, click *more_vert* **Actions for this timeseries** , and then select **Manage**.\n\nThe following is a partial list of resources whose management page you can\naccess from the legend options:\n\n- BigQuery datasets\n- Cloud Storage buckets\n- Compute Engine disks and instances\n- Google Kubernetes Engine clusters, containers, nodes, and pods\n- External Application Load Balancers\n- Pub/Sub subscriptions and topics\n- Spanner instances\n\n\u003cbr /\u003e\n\n### Metrics Explorer\n\nNot supported."]]