grafana:配置一般图表、柱状图、折线图、雷达图

配置一般表格

  • =sql语句

配置柱状图

  • 注意开头$__time(data_time), x轴作为$dimension的group by也要
SELECT
$__time(data_time),
sum(user_active) as '活跃用户',
$dimension
from $db_name.$table_name
where data_time=DATE_SUB(CURDATE(),INTERVAL 1 DAY)
and platform='$platform'
and date_type='one'
and app_ver!='' and app_ver in ("1.0.0","1.0.1","1.0.3","1.0.4")
group by $dimension
order by user_active desc
limit 20

配置折线图

  • 注意$__time(data_time),$__timeFilter(data_time), 以及group by data_time, $dimension
SELECT
$__time(data_time),
sum(user_active) as '活跃用户',
$dimension
from $db_name.$table_name
where $__timeFilter(data_time)
and platform='$platform'
and date_type='one'
and app_ver!='' and app_ver in ("1.0.0","1.0.1","1.0.3","1.0.4")
group by data_time, $dimension
order by user_active desc
limit 20
posted @ 2019-12-11 16:04  Adamanter  阅读(13134)  评论(1编辑  收藏  举报