# 数据接口 - 图表 ## 新增图表 ##### 请求路径: `/inputCharts` ##### 请求方式: `HTTP - POST` #####包类方法: `dispatch(type:'chart/remoteAdd')` ##### 请求参数 | 字段名(后端) | 字段名(前端) | 说明 | |---------------- |----------------------------- |------------------- | | chartName | header.label | 图表标题 | | dataId | baseConfig.dataSource | 基础配置 – 数据源 | | groupBy{ | | 预处理 – 分组 | | columnName | preparing.groupBy.key | 分组列列名 | | columnRamane | preparing.groupBy.label | 分组列别名 | | }] | | | | createBy | | 创建人 | | describes | description | 说明 | | style | | 样式配置 | | otherConfig | JSON.stringify(otherConfig) | 其他配置 | | chartType | base.viewType | 可视化模式 | | chartConfig | | 图表配置 | ##### 请求示例 ```json { "chartName": "文档测试1(未命名)", "dataId": 71, "groupBy": [], "createBy": "zhuth", "describes": "", "style": "", "chartConfig": "{}", "chartType": "" } ``` ##### 返回结果 ```json { "data": { "code": 200, "msg": "成功", "data": 298 } } ``` ##### 详细说明 根据base.viewType的不同 chartConfig加载内容也不同 ___ ## 修改图表 ##### 请求路径 `/updateCharts` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteModify')` ##### 请求参数 ChartID: code (图表编号) 其余同新增图表 ##### 请求示例 ```json { "chartId": 298, "chartName": "文档测试1(未命名)", "dataId": 71, "createBy": "zhuth", "describes": null, "style": "", "otherConfig": "{}", "chartsGroup": "-1", "chartType": "Histogram", "chartConfig": "{\"xAxis\":{\"column\":{},\"granularity\":{}},\"yAxis\":{\"column\":{},\"gauge\":{}},\"groupBy\":{\"key\":\"\"}}", "groupBy": [] } ``` ##### 返回结果 ```json { "data": { "code": 200, "msg": "成功", "data": null } } ``` ##### 详细说明 ___ ## 删除图表 ##### 请求路径 `/delChartsConfig` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteDelete')` ##### 请求参数 Code (图表编号) ##### 请求示例 ##### 返回结果 ##### 详细说明 ___ ## 获得图表列表 ##### 请求路径 `/getListCharts` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/fetchList')` ##### 请求参数 空 ##### 返回结果 ```json { "data": { "code": 200, "msg": "成功", "data": [{ "chartId": 262, "chartName": "bbbb", "chartType": "Pie", "describes": null, "chartsGroup": -1, "createBy": "zhuth", "createDate": "2018-08-06 11:17:33.0" }, { "chartId": 265, "chartName": "销售订单0", "chartType": "individual", "describes": null, "chartsGroup": 26, "createBy": "zhuth", "createDate": "2018-08-06 15:35:29.0" }, { "chartId": 263, "chartName": "bench_flowchart(未命名)111", "chartType": "Histogram", "describes": null, "chartsGroup": 41, "createBy": "zhuth", "createDate": "2018-08-06 11:18:19.0" }, { "chartId": 267, "chartName": "销售订单(未命名)", "chartType": "Line", "describes": null, "chartsGroup": 41, "createBy": "zhuth", "createDate": "2018-08-06 17:49:00.0" }, { "chartId": 264, "chartName": "hhjhh", "chartType": "Histogram", "describes": null, "chartsGroup": -1, "createBy": "zhuth", "createDate": "2018-08-06 11:20:16.0" }, { "chartId": 295, "chartName": "bbbb_副本", "chartType": "Pie", "describes": null, "chartsGroup": -1, "createBy": "zhuth", "createDate": "2018-08-08 13:56:26.0" }, { "chartId": 266, "chartName": "销售订单1", "chartType": "population", "describes": null, "chartsGroup": 26, "createBy": "zhuth", "createDate": "2018-08-06 16:22:30.0" }, { "chartId": 298, "chartName": "文档测试1(未命名)", "chartType": "Histogram", "describes": null, "chartsGroup": -1, "createBy": "zhuth", "createDate": "2018-08-08 16:32:33.0" }, { "chartId": 261, "chartName": "bench_flowchart(未命名)", "chartType": "Histogram", "describes": null, "chartsGroup": -1, "createBy": "zhuth", "createDate": "2018-08-06 10:03:03.0" }] } } ``` ##### 详细说明 ___ ## 获得单个图表详细数据 ##### 请求路径 `/getChartsConfig` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteDetail')` ##### 请求参数 Code (图表编号) ##### 请求示例 ```json 298 ``` ##### 返回结果 ```json { "data": { "code": 200, "msg": "成功", "data": { "chartId": 298, "chartName": "文档测试1(未命名)", "tableName": null, "chartType": "Histogram", "chartsGroup": -1, "groupBy": "[]", "chartConfig": "{\"xAxis\":{\"column\":{},\"granularity\":{}},\"yAxis\":{\"column\":{},\"gauge\":{}},\"groupBy\":{\"key\":\"\"}}", "createBy": "zhuth", "accessAuthority": "null", "updateAuthority": "null", "describes": null, "style": "\"\"", "filters": "null", "createDate": "2018-08-08 16:32:33.0", "updateDate": null, "dataId": 71, "subsections": null } } } ``` ##### 详细说明 ___ ## 请求单个图表展示数据 ##### 请求路径 `/showHistogram` `/showPie` `/showLine` `/showScatter` `/showIndividual` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/fetchBarData')` `dispatch(type:'chart/fetchLineData')` `dispatch(type:'chart/fetchPieData')` `dispatch(type:'chart/fetchScatterData')` `dispatch(type:'chart/fetchDataViewData')` ##### 请求参数 | 字段名(后端) | 字段名(前端) | 说明 | |---------------- |----------------------------------- |------------- | | id | code | 图表编号 | | groups | preparing.groupBy.key | 分组列列名 | | xAxis | | X轴 | | columnRename | barConfig.xAxis.column.value | X轴列名 | | columnType | barConfig.xAxis.column.type | X轴分析类型 | | showDataType | barConfig.xAxis.granularity.value | X轴粒度 | | yAxis | | Y轴 | | columnRename | barConfig.yAxis.column.value | Y轴列名 | | showDataType | barConfig.yAxis.gauge.value | Y轴统计方式 | ##### 请求示例 ##### 返回结果 ##### 详细说明 - 在不同的可视化模式下有不同的请求参数,这里不一一列出了 - 此处gauge的命名可能会容易混淆:指的对单列进行合计统计的方式,分有计数、累计、最大值、中位数、平均值、最小值等。可能混淆的名称有metrics, aggregate等。 - ___ ## 获得图表所有分组/子分组 - 参照数据源分组接口说明 ##### 请求路径 `/getChartsGroup` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteGroupList')` ##### 请求参数 空 ##### 请求示例 ##### 返回结果 Code 分组编号 Pcode 父级分组编号 Index 索引 Label 标签 ##### 详细说明 ___ ## 新增图表分组/子分组 ##### 请求路径 `/setChartsGroup` #####请求方式`HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteAddGroup')` ##### 请求参数 | 字段名(后端) | 字段名(前端) | 说明 | |---------------- |---------------- |------------------- | | fatherId | pgroup.code | 父级分组ID | | groupName | “新子分组”’ | 基础配置 – 数据源 | | groupIndex | | 分组索引 | | createBy | | 创建人 | ##### 请求示例 ##### 返回结果 ##### 详细说明 如果是顶级分组(没有父级分组),则父级分组ID设置为-1 ___ ## 修改图表分组信息 ##### 请求路径 `/updataChartsGroup` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteModifyGroup')` ##### 请求参数 | 字段名(后端) | 字段名(前端) | 说明 | |---------------- |---------------- |------------------- | | Id | Group.code | 分组ID | | fatherId | pgroup.code | 父级分组ID | | groupName | “新子分组”’ | 基础配置 – 数据源 | | groupIndex | | 分组索引 | | createBy | | 创建人 | ##### 请求示例 ##### 返回结果 ##### 详细说明 ___ ## 设置图表所属分组 ##### 请求路径 `/updateChartConfigGroup` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteSetChartGroup')` ##### 请求参数 | 字段名(后端) | 字段名(前端) | 说明 | |---------------- |---------------- |------------ | | Id | DatasourceCode | 数据源ID | | GroupID | “新子分组”’ | 目标分组ID | ##### 请求示例 ##### 返回结果 ##### 详细说明 ___ ## 批量修改图表分组信息 ##### 请求路径 `/updataListGroup` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteModifyGroups')` ##### 请求参数 id : code ##### 请求示例 ##### 返回结果 ##### 详细说明 ___ ## 删除图表分组/子分组 ##### 请求路径 `/delChartsGroup` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chart/remoteDeleteGroup')` ##### 请求参数 Code ID ##### 请求示例 ##### 返回结果 ##### 详细说明 ___ ## 图表编辑器 ## 获得数据源下的列数据 ##### 请求路径 `/getColumnData` ##### 请求方式 `HTTP - POST` ##### 包类方法 `dispatch(type:'chartDesigner/remoteDataColumn')` ##### 请求参数 | 字段名(后端) | 字段名(前端) | 说明 | |---------------- |---------------- |------------------- | | fatherId | pgroup.code | 父级分组ID | | groupName | “新子分组”’ | 基础配置 – 数据源 | | groupIndex | | 分组索引 | | createBy | | 创建人 | ##### 请求示例 ```json 71 ``` ##### 返回结果 ```json { "data": { "code": 200, "msg": "成功", "data": [{ "columnName": "BC_CODE", "columnRaname": "编号", "columnType": "categorical", "isGroup": "1", "isSubsection": "0" }, { "columnName": "BC_DESC", "columnRaname": "工作台说明", "columnType": "categorical", "isGroup": "1", "isSubsection": "0" }, { "columnName": "BC_DETNO", "columnRaname": "序号", "columnType": "scale", "isGroup": "0", "isSubsection": "1" }, { "columnName": "BC_ICON", "columnRaname": "图标", "columnType": "categorical", "isGroup": "1", "isSubsection": "0" }, { "columnName": "BC_ID", "columnRaname": "ID", "columnType": "scale", "isGroup": "0", "isSubsection": "1" }, { "columnName": "BC_TITLE", "columnRaname": "工作台标题", "columnType": "categorical", "isGroup": "1", "isSubsection": "0" }, { "columnName": "BC_URLCOND", "columnRaname": "链接条件", "columnType": "categorical", "isGroup": "1", "isSubsection": "0" }, { "columnName": "BC_USED", "columnRaname": "是否使用", "columnType": "scale", "isGroup": "0", "isSubsection": "1" }] } } ``` ##### 详细说明 此处将整个groups集体上传 集体替换。 此处建议使用batch表达批量修改的概念。