Check out Code Sample
Analysis chart (Chart
) is mainly used to arrange data statistics analysis query logic, supports the use of JavaScript scripts to process the results of each query node, can directly view the analysis chart in the data management background, and can also be used as a process (process
), The reference method is charts.<analytical chart name>
. Analysis chart (Chart
) supports data analysis engines based on ElasticSearch
and MySQL
for various business scenarios.
Data kanban and data big screen pages can also be written in the same way.
Data kanban, analysis charts, data screen related processes.
process | Description | Documentation |
---|---|---|
xiang.chart.Data | Returns chart query results. | - |
xiang.chart.Setting | Read data table configuration information for front-end interface rendering | - |
API | Description | Documentation |
---|---|---|
xiang.chart.XXX.Data | Request chart data | Documentation |
xiang.chart.XXX.Setting | Read and formulate data table configuration information for front-end interface rendering | Documentation |
The analysis chart description file is a JSON text file named with lowercase English letters + .chart.json
extension, <name>.chart.json
;
The result processing script file is a JavaScript script file named <name>.<script>.js
with the extension of Analysis chart name
+ .
+ script name
+ .js
.
The extension of the data kanban is .kan.json
, and the extension of the big data screen is .scr.json
Folder (relative to analytic graph root) | File name | Analytic graph name | Script name | Process (referenced in API/Flow) | API route address |
---|---|---|---|---|---|
/ | name.chart.json | name | charts.name | /api/xiang/chart/name/query interface | |
/ | name.count.js | name | count | - | - |
/group | name.chart.json | group.name | charts.group.name | /api/xiang/chart/group.name/query interface | |
/group | name.count.js | gorup.name | count | - | - |
/group1/group2 | name.chart.json | group1.group2.name | charts.group1.group2.name | /api/xiang/chart/group1.group2.name/query interface | |
/group1/group2 | name.count.js | group1.group2.name | count | - | - |
The analysis chart layout document consists of basic information, query nodes, output data, and analysis page rendering parameters.
{"lang": "gou","label": "Latest Information","version": "1.0.0","description": "Latest Information","nodes": [],"output": {},"apis": {},"filters": {},"page": {}}
Fields | Type | Description | Required Fields |
---|---|---|---|
lang | String | Data query condition description language. The license value gou applies to a database-based data analysis engine. tai applies to the analysis engine implemented based on ElasticSearch (mounted separately). Default is gou | yes |
label | String | Analysis chart rendering name, used for development platform rendering | yes |
version | String | Version number, used for dependency check and development platform rendering | yes |
description | String | Analysis chart introduction, used for development platform presentation | No |
nodes | Array<Object Node> | query node | yes |
output | Object | String | Definition of output result, same as business logic orchestration (flow ) output | yes |
apis | [key:String]:Object API | Analysis chart query API, you can set the same key settings to close the interface, set the authentication method and default value options. | No |
filters | [key:String]:Object Filter | Query filter settings. Same as data table (talbe ) fliters . | No |
page | Object Page | Analysis chart query page settings. | yes |
Write a data kanban description file pet.kan.json and place it in the application's kanban directory.
Description file content:
Application Directory Structure:
├── apis # Used to store interface description files│ └── pet.http.json├── models # Used to store data model description files│ └── pet.mod.json├── tables # Used to store data table description files│ └── pet.tab.json├── kanban # Used to store data kanban description files│ └── pet.kan.json├── db└── ui└── app.json
Access Kanban interface:
Page route: /xiang/kanban/<Kanban Name>
Enter https://127.0.0.1:5099/xiang/kanban/pet
in the address bar
It is recommended to add the /xiang/kanban/pet
route as a menu item.
{"nodes": [{"name": "Industry Distribution","query": {"model": "service","select": ["city", ":COUNT(id) as cnt", "@industries.$ as industry"],"wheres": [{ "column": "created_at", "value": "{{$query.from}}", "op": "ge" },{ "column": "created_at", "value": "{{$query.to}}", "op": "le" }],"order": ["cnt.desc"],"limit": 100,"group": ["@industries.$", "city"]}},{"name": "Billing method","query": {"model": "service","select": ["city", ":COUNT(id) as cnt", "@price_options.$ as option"],"wheres": [{ "column": "created_at", "value": "{{$query.from}}", "op": "ge" },{ "column": "created_at", "value": "{{$query.to}}", "op": "le" }],"order": ["cnt.desc"],"limit": 100,"group": ["@price_options.$", "city"]}},{"name": "Merge result","process": "xiang.chart.MergeData","args": [["city", "industry", "billing"],{"Industry": {"key": "city","values": "{{$res.Industry distribution[*].industry}}"},"Billing": {"key": "city","values": "{{$res.Billing method[*].option}}"}}]}]}
An analysis chart query orchestration (Chart
) can have multiple query nodes, each query node also writes and sets the query
query parameters corresponding to the data engine, or calls a process (process
), which can specify the result Processing scripts and return values can be used to reference contextual information in query nodes. The context data reference and result processing script are specifically consistent with the business logic orchestration (Flow
).
Object Node
data structure
Fields | Type | Description | Required Fields |
---|---|---|---|
name | String | query node name | yes |
query | Query DSL | Query Language | No |
process | String | Invoke the process process , query or process . If also present ignore the process setting. | No |
args | Array<Any> | process argument list. Can refer to input/output or context data, same as flow . | No |
script | String | Result processing script, supports ES5, same as flow . | No |
outs | Array<String> | Query node result output. Use {{$out}} to refer to the process to return the result, same as flow . If not set, the return value is equal to the result returned by the process. | No |
next | Object Next | Jump to the specified query node when the query result meets the set conditions (Not yet implemented) | No |
apis
The data and configuration query interface is enabled by default in the analysis chart. You can disable the interface, set the authentication method and default value options by setting the same key
settings.
{"apis": {"data": {"disable": true,"guard": "bearer-jwt","default": {}},"setting": {"guard": "-","default": {}}}}
Fields | Type | Description | Required Fields |
---|---|---|---|
disable | Bool | Disables the interface. true closes the interface | no |
guard | String | Interface authentication middleware, multiple are separated by , , set to - , no authentication middleware is set, and no default authentication mode is set. | No |
default | Object | Parameter table default value, {"from":"2021-08-28"} | no |
management interface (key ) | request method | route (relative) | description |
---|---|---|---|
data | GET | /data | return query result |
setting | GET | /setting | Read analysis chart configuration information for front-end interface rendering |
Check out Code Sample
Analysis chart (Chart
) is mainly used to arrange data statistics analysis query logic, supports the use of JavaScript scripts to process the results of each query node, can directly view the analysis chart in the data management background, and can also be used as a process (process
), The reference method is charts.<analytical chart name>
. Analysis chart (Chart
) supports data analysis engines based on ElasticSearch
and MySQL
for various business scenarios.
Data kanban and data big screen pages can also be written in the same way.
Data kanban, analysis charts, data screen related processes.
process | Description | Documentation |
---|---|---|
xiang.chart.Data | Returns chart query results. | - |
xiang.chart.Setting | Read data table configuration information for front-end interface rendering | - |
API | Description | Documentation |
---|---|---|
xiang.chart.XXX.Data | Request chart data | Documentation |
xiang.chart.XXX.Setting | Read and formulate data table configuration information for front-end interface rendering | Documentation |
The analysis chart description file is a JSON text file named with lowercase English letters + .chart.json
extension, <name>.chart.json
;
The result processing script file is a JavaScript script file named <name>.<script>.js
with the extension of Analysis chart name
+ .
+ script name
+ .js
.
The extension of the data kanban is .kan.json
, and the extension of the big data screen is .scr.json
Folder (relative to analytic graph root) | File name | Analytic graph name | Script name | Process (referenced in API/Flow) | API route address |
---|---|---|---|---|---|
/ | name.chart.json | name | charts.name | /api/xiang/chart/name/query interface | |
/ | name.count.js | name | count | - | - |
/group | name.chart.json | group.name | charts.group.name | /api/xiang/chart/group.name/query interface | |
/group | name.count.js | gorup.name | count | - | - |
/group1/group2 | name.chart.json | group1.group2.name | charts.group1.group2.name | /api/xiang/chart/group1.group2.name/query interface | |
/group1/group2 | name.count.js | group1.group2.name | count | - | - |
The analysis chart layout document consists of basic information, query nodes, output data, and analysis page rendering parameters.
{"lang": "gou","label": "Latest Information","version": "1.0.0","description": "Latest Information","nodes": [],"output": {},"apis": {},"filters": {},"page": {}}
Fields | Type | Description | Required Fields |
---|---|---|---|
lang | String | Data query condition description language. The license value gou applies to a database-based data analysis engine. tai applies to the analysis engine implemented based on ElasticSearch (mounted separately). Default is gou | yes |
label | String | Analysis chart rendering name, used for development platform rendering | yes |
version | String | Version number, used for dependency check and development platform rendering | yes |
description | String | Analysis chart introduction, used for development platform presentation | No |
nodes | Array<Object Node> | query node | yes |
output | Object | String | Definition of output result, same as business logic orchestration (flow ) output | yes |
apis | [key:String]:Object API | Analysis chart query API, you can set the same key settings to close the interface, set the authentication method and default value options. | No |
filters | [key:String]:Object Filter | Query filter settings. Same as data table (talbe ) fliters . | No |
page | Object Page | Analysis chart query page settings. | yes |
Write a data kanban description file pet.kan.json and place it in the application's kanban directory.
Description file content:
Application Directory Structure:
├── apis # Used to store interface description files│ └── pet.http.json├── models # Used to store data model description files│ └── pet.mod.json├── tables # Used to store data table description files│ └── pet.tab.json├── kanban # Used to store data kanban description files│ └── pet.kan.json├── db└── ui└── app.json
Access Kanban interface:
Page route: /xiang/kanban/<Kanban Name>
Enter https://127.0.0.1:5099/xiang/kanban/pet
in the address bar
It is recommended to add the /xiang/kanban/pet
route as a menu item.
{"nodes": [{"name": "Industry Distribution","query": {"model": "service","select": ["city", ":COUNT(id) as cnt", "@industries.$ as industry"],"wheres": [{ "column": "created_at", "value": "{{$query.from}}", "op": "ge" },{ "column": "created_at", "value": "{{$query.to}}", "op": "le" }],"order": ["cnt.desc"],"limit": 100,"group": ["@industries.$", "city"]}},{"name": "Billing method","query": {"model": "service","select": ["city", ":COUNT(id) as cnt", "@price_options.$ as option"],"wheres": [{ "column": "created_at", "value": "{{$query.from}}", "op": "ge" },{ "column": "created_at", "value": "{{$query.to}}", "op": "le" }],"order": ["cnt.desc"],"limit": 100,"group": ["@price_options.$", "city"]}},{"name": "Merge result","process": "xiang.chart.MergeData","args": [["city", "industry", "billing"],{"Industry": {"key": "city","values": "{{$res.Industry distribution[*].industry}}"},"Billing": {"key": "city","values": "{{$res.Billing method[*].option}}"}}]}]}
An analysis chart query orchestration (Chart
) can have multiple query nodes, each query node also writes and sets the query
query parameters corresponding to the data engine, or calls a process (process
), which can specify the result Processing scripts and return values can be used to reference contextual information in query nodes. The context data reference and result processing script are specifically consistent with the business logic orchestration (Flow
).
Object Node
data structure
Fields | Type | Description | Required Fields |
---|---|---|---|
name | String | query node name | yes |
query | Query DSL | Query Language | No |
process | String | Invoke the process process , query or process . If also present ignore the process setting. | No |
args | Array<Any> | process argument list. Can refer to input/output or context data, same as flow . | No |
script | String | Result processing script, supports ES5, same as flow . | No |
outs | Array<String> | Query node result output. Use {{$out}} to refer to the process to return the result, same as flow . If not set, the return value is equal to the result returned by the process. | No |
next | Object Next | Jump to the specified query node when the query result meets the set conditions (Not yet implemented) | No |
apis
The data and configuration query interface is enabled by default in the analysis chart. You can disable the interface, set the authentication method and default value options by setting the same key
settings.
{"apis": {"data": {"disable": true,"guard": "bearer-jwt","default": {}},"setting": {"guard": "-","default": {}}}}
Fields | Type | Description | Required Fields |
---|---|---|---|
disable | Bool | Disables the interface. true closes the interface | no |
guard | String | Interface authentication middleware, multiple are separated by , , set to - , no authentication middleware is set, and no default authentication mode is set. | No |
default | Object | Parameter table default value, {"from":"2021-08-28"} | no |
management interface (key ) | request method | route (relative) | description |
---|---|---|---|
data | GET | /data | return query result |
setting | GET | /setting | Read analysis chart configuration information for front-end interface rendering |