feat: bar column label position

This commit is contained in:
ulleo
2025-07-29 15:49:17 +08:00
parent e6839b8ce4
commit ab11a20e2e
2 changed files with 12 additions and 1 deletions
@@ -113,6 +113,12 @@ export class Bar extends BaseG2Chart {
}
return `${value}${_data.isPercent ? '%' : ''}`
},
position: (data: any) => {
if (data[y[0].value] < 0) {
return 'left'
}
return 'right'
},
transform: [
{ type: 'contrastReverse' },
{ type: 'exceedAdjust' },
@@ -102,7 +102,12 @@ export class Column extends BaseG2Chart {
}
return `${value}${_data.isPercent ? '%' : ''}`
},
position: 'top',
position: (data: any) => {
if (data[y[0].value] < 0) {
return 'bottom'
}
return 'top'
},
transform: [
{ type: 'contrastReverse' },
{ type: 'exceedAdjust' },