View Variables¶
View variables are the core mechanism for implementing chart linkage filtering in Guance scenarios. They allow users to change the value of one or more view variables, enabling multiple charts to simultaneously respond to the same filtering conditions and update visualization results in real-time.
Scenario Comparison¶
| ❌ Without View Variables | ✅ With View Variables |
|---|---|
Viewing monitoring for Host A:host=A;host=A;host=A |
Viewing monitoring for Host A: Select "Host A" from the top dropdown, all charts refresh automatically |
| 10 charts require 10 operations | 10 charts require only 1 operation |
| Team members modify individually, configurations can easily become messy | Unified entry, centralized configuration management |
Core Logic¶
As a global filter control at the top of the dashboard, its working principle is:
- Specify a variable name (e.g.,
host) and an optional value source (e.g., a list of all hosts); - Insert the variable into chart queries using the
#{host}syntax; - After the user selects a value at the top, all charts referencing that variable refresh automatically.
Create¶
- Variable Name: The name of the variable set to which the current view variable belongs. When adding charts to the dashboard, it needs to be referenced in the chart query, format:
#{variable name}; - Display Name: The name displayed for the current view variable set in the dashboard, e.g., variable name is
host, display name isHost Name; - Query: Define the data source for optional values;
- Sort: Perform default, ascending, or descending sorting on the view variables returned by the query;
- Determine the Display Options;
- Default Value: The initial value of the current view variable in the dashboard. Based on your configuration in "Display Options", a dropdown lists variables, allowing you to select the initial value displayed by default in the dashboard. If the default value is empty, the dashboard displays the latest field data. Click Select All to select all values in the current list;
- Save.
Note
When workspace data is interrupted, fields can be preset in view variables; after data recovery, the system will automatically match them.
Display Options¶
| Option | Function Description | Use Cases |
|---|---|---|
| Hidden | When enabled, this variable is not visible within the dashboard in non-edit mode | Used to enforce fixed conditions, e.g., only allowing viewing of the production environment |
| Multi-value | Supports selecting multiple values simultaneously | Enable when needing to compare multiple hosts |
Include * |
Enabled by default (❗️ When * is selected, the filtering condition for this variable is ignored, and charts display full data) |
Enable when default viewing of full data is required |
Manage Variables¶
In the view variable list, the following operations can be performed:
- Clone: Copy the current variable configuration to quickly create similar variables;
- Edit: Modify the variable's query logic, display options, etc.;
- Delete: Remove this variable (charts that have referenced this variable will become invalid);
- Hidden Indicator: Variables marked as hidden will display a hidden button.