寻求Grafana气泡图面板教程及查询配置问题解决帮助
Hey Jayden, let's walk through this step by step to get your Grafana Bubble Chart working properly. I'll cover troubleshooting your empty chart, explaining those confusing $tag_* variables, and share a working example tailored to your SQL setup.
First, let's figure out why your chart isn't showing any content—here are the most common culprits to check:
- Verify your query returns data: Head to the panel's Query Inspector (click the "eye" icon next to your query) and run the SQL statement. If no rows come back, the issue is with your data source or filter:
- Double-check that
$__timeFilter(date)is working correctly. For SQL sources, this translates to something likedate BETWEEN '2024-01-01' AND '2024-01-02'—make sure yourdatefield is a valid DATETIME/DATE type that matches this filter. - Confirm there are rows in the
tradetable for the time range you've selected in Grafana's top-right time picker (it's easy to accidentally pick a range with no data!).
- Double-check that
- Check panel field mapping: Even if data is returned, Grafana might not be assigning fields correctly to the bubble chart:
- Go to the Visualization tab > Fields section.
- Ensure
time_secis mapped to the Time field. - Assign your
value(amt) to Size (this controls bubble size—if you skip this, bubbles might be invisible). - Map your
metric(server+org combo) to Series—this tells Grafana to create separate bubbles for each unique server/org pair.
$tag_dc,$tag_host in the Docs Those variables are specific to tag-based time series data sources like InfluxDB, Prometheus, or Loki. They're used to filter data using pre-defined tags in your metrics (e.g., filtering by data center dc or server host via dashboard variables).
Since you're using a SQL source (like MySQL/PostgreSQL), you don't need these variables at all. Your approach of concatenating server and org into a single metric field is actually the right way to group bubbles for SQL data—great call there!
Let's refine your query and configuration to ensure it works reliably:
1. Updated SQL Query (MySQL)
SELECT UNIX_TIMESTAMP(date) as time_sec, amt as value, server as tag_server, -- Split into separate fields for future filtering (optional) org as tag_org, CONCAT(server, ' - ', org) as metric -- Friendlier name for bubble groups FROM trade WHERE $__timeFilter(date) ORDER BY date ASC
Splitting server and org into separate fields lets you create dashboard variables later to filter bubbles by server or org, but the metric field is still needed to group bubbles.
2. Step-by-Step Panel Configuration
- After running the query and confirming data is returned, go to the Visualization tab:
- Under Data Format, ensure it's set to Time series (SQL queries usually default to this).
- Under Fields:
- Map
time_secto Time - Map
valueto Size (adjust min/max size later if bubbles are too small/large) - Map
metricto Series - Optional: If you want the Y-axis to reflect
amtvalues, mapvalueto Y as well (X-axis will be time, Y-axis is amt, bubble size is amt).
- Map
- Under Axes:
- Set X-axis to Time
- Set Y-axis to Value (label it "Amount" for clarity)
- Under Bubbles:
- Toggle on Show Labels to display the
metricname on each bubble—this helps confirm groups are working. - Adjust Min Size and Max Size (start with 5 and 30 if bubbles are invisible).
- Toggle on Show Labels to display the
Quick Debugging Check
If bubbles still don't show:
- Make sure
amtvalues are non-zero (0-value bubbles won't appear). - Try narrowing your time range to a period where you know there are trade records.
内容的提问来源于stack exchange,提问作者Jayden Chan

