### **关系图支持3种数据形式:** #### **1. SQL数据** 使用SQL形式,可直接连接数据库,将SQl种的数据筛选并显示在图表上。 点击报表编辑器右侧的操作栏,点击“数据”,选择"数据类型"为“SQL数据集”,按步骤操作即可,下边讲解一下各个参数的意思: ``` 备注: 关系图需要绑定两个数据集; ``` * 绑定数据集:是左侧绑定过的数据集,可选择任意一个SQL类型的数据集,主要显示节点数据; * 分类属性:是X轴绑定数据库的字段; * 值属性:是Y轴绑定数据库的字段; * 系列类型:数据类型字段; * 绑定节点关系数据集:绑定的另一个数据集,主要是显示对应关系; * 来源属性:关系数据集中来源字段; * 目标属性:关系数据集中目标字段,来源和目标字段字段是为了显示关系线; ![](https://img.kancloud.cn/c3/7f/c37fb801d7a13f3541b1b30654363678_1435x806.png) ![](https://img.kancloud.cn/72/9f/729fc64c268a78965a5658529f8784cf_800x28.png) ### **数据库配置字段如下:** ![](https://img.kancloud.cn/f7/ac/f7ac7574403b254da99155155c0f8b37_874x449.png) ![](https://img.kancloud.cn/72/9f/729fc64c268a78965a5658529f8784cf_800x28.png) #### **2. 静态API数据** 报表绑定的数据可以是静态API的形式。 点击报表编辑器右侧的操作栏,点击“数据”,选择"数据类型"为“Api数据集”,“Api类型”选择“静态数据”,点击“数据值”,输入静态类型即可,如: ``` { "data":[ {"name":"测试0","value":28,"type":"北航"}, {"name":"测试1","value":9,"type":"南航"}, {"name":"测试2","value":23,"type":"东航"}, {"name":"测试3","value":8,"type":"西航"}, {"name":"测试4","value":8,"type":"中航"}, {"name":"测试5","value":8,"type":"南航"} ], "links":[ {"source":"测试1","target":"测试0"}, {"source":"测试2","target":"测试0"}, {"source":"测试3","target":"测试1"}, {"source":"测试4","target":"测试1"}, {"source":"测试4","target":"测试2"}, {"source":"测试2","target":"测试3"}, {"source":"测试3","target":"测试2"}, {"source":"测试3","target":"测试1"}, {"source":"测试2","target":"测试1"}, {"source":"测试2","target":"测试4"}, {"source":"测试5","target":"测试0"}, {"source":"测试4","target":"测试0"}, {"source":"测试4","target":"测试1"}, {"source":"测试4","target":"测试2"}, {"source":"测试1","target":"测试0"}, {"source":"测试1","target":"测试4"}, {"source":"测试1","target":"测试3"}, {"source":"测试3","target":"测试0"}, {"source":"测试5","target":"测试1"}, {"source":"测试5","target":"测试4"} ]} ``` ![](https://img.kancloud.cn/7f/e6/7fe6095600aa0e337f9046c30ddcf0d4_1226x540.png) ![](https://img.kancloud.cn/d7/8b/d78bc2ddfbcd473208b62421972ba2bf_807x34.png) #### **3. 动态API数据** 绑定的数据也可以是动态API的形式。 点击报表编辑器右侧的操作栏,点击“数据”,选择"数据类型"为“Api数据集”,“Api类型”选择“动态数据”,选择“绑定数据集”,点击“运行”,就可以将数据渲染过来,代码如: ``` { "data":[ {"name":"测试0","value":28,"type":"北航"}, {"name":"测试1","value":9,"type":"南航"}, {"name":"测试2","value":23,"type":"东航"}, {"name":"测试3","value":8,"type":"西航"}, {"name":"测试4","value":8,"type":"中航"}, {"name":"测试5","value":8,"type":"南航"} ], "links":[ {"source":"测试1","target":"测试0"}, {"source":"测试2","target":"测试0"}, {"source":"测试3","target":"测试1"}, {"source":"测试4","target":"测试1"}, {"source":"测试4","target":"测试2"}, {"source":"测试2","target":"测试3"}, {"source":"测试3","target":"测试2"}, {"source":"测试3","target":"测试1"}, {"source":"测试2","target":"测试1"}, {"source":"测试2","target":"测试4"}, {"source":"测试5","target":"测试0"}, {"source":"测试4","target":"测试0"}, {"source":"测试4","target":"测试1"}, {"source":"测试4","target":"测试2"}, {"source":"测试1","target":"测试0"}, {"source":"测试1","target":"测试4"}, {"source":"测试1","target":"测试3"}, {"source":"测试3","target":"测试0"}, {"source":"测试5","target":"测试1"}, {"source":"测试5","target":"测试4"} ]} ```