Skip to content

Commit de11dd8

Browse files
committed
feat: column, bar and line axis title
1 parent c31f8ee commit de11dd8

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

backend/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ template:
5959
{{"type":"line", "title": "标题", "axis": {{"x": {{"name":"x轴的中文名称","value": "SQL 查询 x 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}, "y": {{"name":"y轴的中文名称","value": "SQL 查询 y 轴的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}, "series": {{"name":"分类的中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}}}}
6060
其中“x”和“y”必须从SQL查询列中提取。
6161
- 如果需要饼图,则生成的 JSON 格式应为:
62-
{{"type":"pie", "title": "标题", "axis": {{"y": {{"值轴的中文名称","value":"SQL 查询数值的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}, "series": {{"name":"分类的中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}}
62+
{{"type":"pie", "title": "标题", "axis": {{"y": {{"name":"值轴的中文名称","value":"SQL 查询数值的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}, "series": {{"name":"分类的中文名称","value":"SQL 查询分类的列(有别名用别名,去掉外层的反引号、双引号、方括号)"}}}}}}
6363
其中“y”和“series”必须从SQL查询列中提取。
6464
- 如果答案未知或者与生成JSON无关,则生成的 JSON 格式应为:
6565
{{"type":"error", "reason": "抱歉,我无法回答您的问题。"}}

frontend/src/views/chat/component/charts/Bar.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export class Bar extends BaseG2Chart {
2323
.data(data)
2424
.encode('x', x[0].value)
2525
.encode('y', y[0].value)
26+
.axis({
27+
x: { title: x[0].name },
28+
y: { title: y[0].name },
29+
})
2630
.scale('x', {
2731
nice: true,
2832
})

frontend/src/views/chat/component/charts/Column.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export class Column extends BaseG2Chart {
2222
.data(data)
2323
.encode('x', x[0].value)
2424
.encode('y', y[0].value)
25+
.axis({
26+
x: { title: x[0].name },
27+
y: { title: y[0].name },
28+
})
2529
.scale('x', {
2630
nice: true,
2731
})

frontend/src/views/chat/component/charts/Line.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export class Line extends BaseG2Chart {
2121
?.data(data)
2222
.encode('x', x[0].value)
2323
.encode('y', y[0].value)
24+
.axis({
25+
x: { title: x[0].name },
26+
y: { title: y[0].name },
27+
})
2428
.scale('x', {
2529
nice: true,
2630
})

0 commit comments

Comments
 (0)