You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

寻求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.

Troubleshooting the Empty Bubble Chart

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 like date BETWEEN '2024-01-01' AND '2024-01-02'—make sure your date field is a valid DATETIME/DATE type that matches this filter.
    • Confirm there are rows in the trade table 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!).
  • Check panel field mapping: Even if data is returned, Grafana might not be assigning fields correctly to the bubble chart:
    1. Go to the Visualization tab > Fields section.
    2. Ensure time_sec is mapped to the Time field.
    3. Assign your value (amt) to Size (this controls bubble size—if you skip this, bubbles might be invisible).
    4. Map your metric (server+org combo) to Series—this tells Grafana to create separate bubbles for each unique server/org pair.
Understanding $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!

Working SQL Example & Panel Setup

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

  1. 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_sec to Time
      • Map value to Size (adjust min/max size later if bubbles are too small/large)
      • Map metric to Series
      • Optional: If you want the Y-axis to reflect amt values, map value to Y as well (X-axis will be time, Y-axis is amt, bubble size is amt).
  2. Under Axes:
    • Set X-axis to Time
    • Set Y-axis to Value (label it "Amount" for clarity)
  3. Under Bubbles:
    • Toggle on Show Labels to display the metric name on each bubble—this helps confirm groups are working.
    • Adjust Min Size and Max Size (start with 5 and 30 if bubbles are invisible).

Quick Debugging Check

If bubbles still don't show:

  • Make sure amt values 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.07 10:07:48