logo

S2

  • Manual
  • API
  • Examples
  • Playground
  • ChangeLog
  • Productsantv logo arrow
  • 2.x
  • Introduction
  • Quick Start
  • Basic Tutorial
    • Base Concept
    • Sheet Type
      • Pivot Mode
        Updated
      • Table Mode
    • Conditions
      Updated
    • Totals
    • Sort
      • Custom Sort
        Updated
      • Group Sort
        Updated
    • Theme
      Updated
    • Tooltip
      Updated
    • Internationalization
    • 数据格式化
      New
    • Multi Line
      New
    • Pagination
      New
  • Advanced Tutorial
    • Advanced Tutorial
      • Link
      • Render Chart In Cell
      • Draw Chart With @antv/g2
    • Custom
      • Customize Hook
        Updated
      • Customize Tree
        New
      • Customize Icon
      • Customize Cell Alignment
      • Customize Cell Size
        Updated
      • Customize Order
      • Custom Collapse/Expand Nodes
    • Interaction
      • Basic Interaction
      • Custom Interaction
      • Hide Columns
      • Cell Resize
      • Merge Cell
      • Scroll
      • Copy
        New
      • Highlight and select cell
        New
    • Analyze Component
      • Introduction
        New
      • Advanced Sort
        Updated
      • Switcher
      • Export
        Updated
      • Pagination
      • Drill Down
    • Sheet Component
      • Editable Mode
      • Strategy Sheet
        Updated
    • HD Adapter
    • Get Instance
    • Get Cell Data
      Updated
    • Table adaptive
    • AntV/G Plugins
      New
    • Pivot Chart
      Experimental
    • Vue 3.0
  • Extended Reading
    • Data Process
      • Pivot
      • Table
    • Layout
      • Pivot
      • Table
    • Performance
      Updated
  • Contribution
  • FAQ
  • S2 2.0 Migration Guide

Base Concept

Previous
Quick Start
Next
Pivot Mode

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...

This article introduces the basic concepts of pivot tables.

Introduction

In statistics, a pivot table is a table in matrix format that displays multivariate frequency distributions. They provide a basic picture of the relationship between two variables (or more), which can help discover the interaction between them and help businesses conduct cross-exploration analysis. They are currently one of the most frequently used charts in the field of commercial BI analysis. one.

basic concept

  • Measure (Indicator): The value itself, such as price, quantity, etc.
  • Dimension: It can be understood as the angle of analyzing data, such as province, type, etc.

constitute

A pivot table consists of five parts, namely row header, column header, corner header, data cell, and frame, as shown in the following figure:

preview

row header (rowHeader)

The structure of the row header is determined by s2DataConfig.fields.rows , which is used for row analysis dimension display. The line head supports two display forms:平铺模式(grid) and树状模式(tree) .

For example, the line header data configures province, city fields

const s2DataConfig = {
fields: {
rows: ['province', 'city']
}
}

Displayed in tiled mode as:

const s2Options = {
hierarchyType: 'grid'
}

row

Displayed in tree mode as:

const s2Options = {
hierarchyType: 'tree'
}

column

column header (colHeader)

Note that when it is a detailed table, only columns need to be set.

The structure of the column header is determined by s2DataConfig.fields.columns , which is used for column analysis dimension display.

For example, the column header data configures two fields, type, sub_type , which are displayed as:

const s2DataConfig = {
fields: {
columns: ['type', 'sub_type']
}
}

column

Corner Header (cornerHeader)

The corner header refers to the upper left corner of the table and plays an important role in the layout of the table.

In the layout of the table, S2 is extended based on the corner header to calculate the size and coordinates of rows and columns.

Corner headers are also used to display row headers and column header names, such as省份and城市in the example.

In addition, S2 also provides custom extensions for scenarios that require custom corner headers, see cornerCell and cornerHeader for details.

Data cell (dataCell)

The data cell is the data area generated by the intersection of the row and column dimension values of the table. Usually, it should be the measurement value, and it is the core data presentation area of the table data analysis.

In the data cell area, we can display basic cross data, use field tags to assist analysis, and display derivative indicators such as year-on- year comparisons. You can also customize data cells by customizing Hooks . For more information, refer to dataCell .

frame

The frame layout area, located above the other four areas, is used as a spacer frame between areas, or logic such as scroll bars, and shadows of frame interval lines.