logo

S2

  • Manual
  • API
  • Examples
  • Playground
  • ChangeLog
  • Productsantv logo arrow
  • 2.x
  • Common Configuration
    • S2DataConfig
    • S2Options
      Updated
    • S2Theme
      Updated
    • S2Event
  • Basic Class
    • SpreadSheet
    • Interaction
      Updated
    • Store
    • BaseCell
      Updated
    • BaseDataSet
    • Node
    • BaseTooltip
    • BaseFacet
      Updated
    • Hierarchy
      New
    • BaseBBox
      New
    • CellData
      New
  • Components
    • table component
    • DrillDown
    • Switcher
    • Advanced Sort
    • Export
      Updated
  • Graphic style
  • 透视组合图拓展 S2Options

BaseCell

Previous
Store
Next
BaseDataSet

Resources

Ant Design
Galacea Effects
Umi-React Application Framework
Dumi-Component doc generator
ahooks-React Hooks Library

Community

Ant Financial Experience Tech
seeconfSEE Conf-Experience Tech Conference

Help

GitHub
StackOverflow

more productsMore Productions

Ant DesignAnt Design-Enterprise UI design language
yuqueYuque-Knowledge creation and Sharing tool
EggEgg-Enterprise-class Node development framework
kitchenKitchen-Sketch Tool set
GalaceanGalacean-互动图形解决方案
xtechLiven Experience technology
© Copyright 2025 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Function description: cell base class. details

cell.getActualText()
parameterillustratetype
getMetaGet cell metadata() => ViewMeta
setMetaSet cell metadata(vieMeta: ViewMeta ) => void
getIconStyleGet cell icon style() => IconTheme
getStyleget cell style() => DefaultCellTheme
getTextAndIconPositionGet the position of cell text and icon(iconCount: number ) => TextAndIconPosition
getActualTextget the drawn text() => string
cellTypecell typeCellType
initCellInitialize cells() => void
updateupdate cell() => void
getTextStyleget text style() => void
getFormattedFieldValueGet the formatted field value() => { formattedValue: string, value: string }
getMaxTextWidthGet the maximum width of the text() => number
getTextPositionget text coordinatespoint
getContentAreaget content area() => { x: number, y: number, width: number, height: number }
updateByStateUpdate cell styles based on state(stateName: InteractionStateName, cell: S2CellType) => void
hideInteractionShapeInteractive layers for hidden cells() => void
clearUnselectedStateclear unchecked() => void
getTextShapeget text layer() => IShape
getTextShapesGet all text layers() => IShape[]
addTextShapeAdd a text layer(shape: IShape) => void
getConditionIconShapeGet the icon layer() => GuiIcon
getConditionIconShapesGet all icon layers() => GuiIcon[]
addConditionIconShapeAdd icon layer(shape: GuiIcon) => void

ViewMeta

object is required, default: {} function description: information such as cell data and position

parametertyperequiredDefaultsFunctional description
spreadsheetSpreadSheetTable class instance, which can access any configuration information
idstringcell unique identifier
xnumbercell x-coordinate
the ynumbercell y coordinate
widthnumbercell width
heightnumbercell height
dataRecord<string, any>Cell Raw Data Metrics
rowIndexnumberThe index of the cell in the row leaf node
colIndexnumberThe index of the cell in the column leaf node
valueFieldstringmetric-id
fieldValueDataItemThe true value of the metric display
isTotalsbooleanWhether it is a total: true is a total, false is a subtotal
rowQueryRecord<string, any>Row query condition
colQueryRecord<string, any>Column query condition
rowIdstringthe row id of the cell
colIdstringthe column id of the cell

point

interface Point {
x: number,
y: number
}

TextAndIconPosition

interface TextAndIconPosition {
text: Point
icon: Point
}

CellType

export enum CellType {
DATA_CELL = 'dataCell',
ROW_CELL = 'rowCell',
COL_CELL = 'colCell',
CORNER_CELL = 'cornerCell',
MERGED_CELL = 'mergedCell',
}

S2CellType

import type { SimpleBBox } from '@antv/g-canvas';
export type S2CellType<T extends SimpleBBox = ViewMeta> =
| DataCell
| HeaderCell
| ColCell
| CornerCell
| RowCell
| MergedCell
| BaseCell<T>;