Skip to content

Commit 00a4280

Browse files
committed
feat: charts css
1 parent 9e3b139 commit 00a4280

File tree

2 files changed

+48
-4
lines changed

2 files changed

+48
-4
lines changed

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,30 @@ export class Bar extends BaseG2Chart {
3232
color: series.length > 0 ? series[0].value : undefined,
3333
},
3434
style: {
35-
radiusTopLeft: 4,
36-
radiusTopRight: 4,
35+
radiusTopLeft: (d: ChartData) => {
36+
if (d[y[0].value] && d[y[0].value] > 0) {
37+
return 4
38+
}
39+
return 0
40+
},
41+
radiusTopRight: (d: ChartData) => {
42+
if (d[y[0].value] && d[y[0].value] > 0) {
43+
return 4
44+
}
45+
return 0
46+
},
47+
radiusBottomLeft: (d: ChartData) => {
48+
if (d[y[0].value] && d[y[0].value] < 0) {
49+
return 4
50+
}
51+
return 0
52+
},
53+
radiusBottomRight: (d: ChartData) => {
54+
if (d[y[0].value] && d[y[0].value] < 0) {
55+
return 4
56+
}
57+
return 0
58+
},
3759
},
3860
axis: {
3961
x: {

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,30 @@ export class Column extends BaseG2Chart {
3131
color: series.length > 0 ? series[0].value : undefined,
3232
},
3333
style: {
34-
radiusTopLeft: 4,
35-
radiusTopRight: 4,
34+
radiusTopLeft: (d: ChartData) => {
35+
if (d[y[0].value] && d[y[0].value] > 0) {
36+
return 4
37+
}
38+
return 0
39+
},
40+
radiusTopRight: (d: ChartData) => {
41+
if (d[y[0].value] && d[y[0].value] > 0) {
42+
return 4
43+
}
44+
return 0
45+
},
46+
radiusBottomLeft: (d: ChartData) => {
47+
if (d[y[0].value] && d[y[0].value] < 0) {
48+
return 4
49+
}
50+
return 0
51+
},
52+
radiusBottomRight: (d: ChartData) => {
53+
if (d[y[0].value] && d[y[0].value] < 0) {
54+
return 4
55+
}
56+
return 0
57+
},
3658
},
3759
axis: {
3860
x: {

0 commit comments

Comments
 (0)