forked from github/dataease
fix(图表): 表格序号列标签溢出
This commit is contained in:
parent
a3881c2f6b
commit
3d7a45926b
@ -147,18 +147,15 @@ export class TableInfo extends S2ChartView<TableSheet> {
|
||||
}
|
||||
// 开启序号之后,第一列就是序号列,修改 label 即可
|
||||
if (s2Options.showSeriesNumber) {
|
||||
s2Options.colCell = (node, sheet, config) => {
|
||||
if (node.colIndex === 0) {
|
||||
let indexLabel = customAttr.tableHeader.indexLabel
|
||||
if (!indexLabel) {
|
||||
indexLabel = ''
|
||||
}
|
||||
const cell = new TableColCell(node, sheet, config)
|
||||
const shape = cell.getTextShape() as any
|
||||
shape.attrs.text = indexLabel
|
||||
return cell
|
||||
let indexLabel = customAttr.tableHeader.indexLabel
|
||||
if (!indexLabel) {
|
||||
indexLabel = ''
|
||||
}
|
||||
s2Options.layoutCoordinate = (_, __, col) => {
|
||||
if (col.colIndex === 0 && col.rowIndex === 0) {
|
||||
col.label = indexLabel
|
||||
col.value = indexLabel
|
||||
}
|
||||
return new TableColCell(node, sheet, config)
|
||||
}
|
||||
}
|
||||
s2Options.dataCell = viewMeta => {
|
||||
|
@ -135,21 +135,15 @@ export class TableNormal extends S2ChartView<TableSheet> {
|
||||
}
|
||||
// 开启序号之后,第一列就是序号列,修改 label 即可
|
||||
if (s2Options.showSeriesNumber) {
|
||||
s2Options.colCell = (node, sheet, config) => {
|
||||
if (node.colIndex === 0) {
|
||||
let indexLabel = customAttr.tableHeader.indexLabel
|
||||
if (!indexLabel) {
|
||||
indexLabel = ''
|
||||
}
|
||||
const cell = new TableColCell(node, sheet, config)
|
||||
const shape = cell.getTextShape() as any
|
||||
shape.attrs.text = indexLabel
|
||||
return cell
|
||||
}
|
||||
return new TableColCell(node, sheet, config)
|
||||
let indexLabel = customAttr.tableHeader.indexLabel
|
||||
if (!indexLabel) {
|
||||
indexLabel = ''
|
||||
}
|
||||
s2Options.dataCell = viewMeta => {
|
||||
return new TableDataCell(viewMeta, viewMeta?.spreadsheet)
|
||||
s2Options.layoutCoordinate = (_, __, col) => {
|
||||
if (col.colIndex === 0 && col.rowIndex === 0) {
|
||||
col.label = indexLabel
|
||||
col.value = indexLabel
|
||||
}
|
||||
}
|
||||
}
|
||||
// tooltip
|
||||
|
@ -83,10 +83,6 @@ export abstract class S2ChartView<P extends SpreadSheet> extends AntVAbstractCha
|
||||
break
|
||||
case 'rowCell':
|
||||
case 'colCell':
|
||||
if (meta.field === SERIES_NUMBER_FIELD) {
|
||||
content = cell.getTextShape()['attrs'].text
|
||||
break
|
||||
}
|
||||
content = meta.label
|
||||
field = find(metaConfig, item => item.field === content)
|
||||
if (field) {
|
||||
|
Loading…
Reference in New Issue
Block a user