superset可视化-Force-directed graph(力导引图)

数据

https://gitee.com/fastsource/examples-data

下载energy.json.gz转化成csv[1]

然后通过datagrip导入mysql

superset run

superset连接mysql[2]

superset可视化具体操作步骤

查询语句

SELECT target AS target,
       source AS source,
                 count(*) AS count
FROM
  (SELECT source AS source,
                    target AS target,
                    SUM(value) AS sum__value
   FROM energy
   GROUP BY source,
            target
   ORDER BY sum__value DESC
   LIMIT 5000) AS expr_qry
GROUP BY target,
         source
ORDER BY count DESC
LIMIT 1000;

运行sql以后选择下方的Explore:

superset可视化-Force-directed graph(力导引图)_第1张图片

 

左侧配置如下:

superset可视化-Force-directed graph(力导引图)_第2张图片

superset可视化-Force-directed graph(力导引图)_第3张图片

点击Run Query

superset可视化-Force-directed graph(力导引图)_第4张图片

 

得到:

superset可视化-Force-directed graph(力导引图)_第5张图片

 

Reference:

[1]superset中的json数据转csv

[2]superset各种数据库连接地址(持续更新中)

你可能感兴趣的:(Superset)