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

Drill Down

Previous
Pagination
Next
Editable 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...

The "dimension drill-down" capability provided by S2 can dig out more detailed data in different dimensions for you, making your data insights clearer.

preview

Introduction

basic concept

  • It is mainly applicable to data sources with hierarchical relationships. For a certain data information, drill down to the data performance of different levels. 🌰 For example: to view sales data in different regions, when you view sales in Central China, you can drill down to view sales in Hubei Province.
  • Drill-down is a way to drill down from the summary data to the details, layer by layer, so as to view the data in more detail, making the data clearer and helping to fully tap the value behind the data.

Functional description

Configure dimension drill-down, currently only supports drill-down in the perspective mode tree structure, row header dimension drill-down

expand

Drill Up: Drill Up exists to view sales data in different regions. When you view sales in Zhejiang Province, you can drill up to view sales in East China.

Get started quickly

Click to view the PartDrillDown dimension drill down configuration
 
const sex = [ '男', '女' ];

const PartDrillDown = {   drillConfig: {     dataSet: [ //  下钻数据源配置       {         name: '客户性别',         value: 'sex',         type: 'text',       },     ],   },

  //  点击下钻后的回调   fetchData: (meta, drillFields) =>     new Promise((resolve) => {       const dataSet = meta.spreadsheet.dataSet;       const field = drillFields[0];       const rowDatas = dataSet.getCellMultiData(meta.query, true, true);       const drillDownData = [];       rowDatas.forEach((data) => {         const { city, number, province, sub_type: subType, type } = data;         const number0 = Math.ceil(Math.random() * (number - 50)) + 50;         const number1 = number - number0;         const dataItem0 = {           city,           number: number0,           province,           sub_type: subType,           type,           [field]: sex[0],         };         drillDownData.push(dataItem0);         const dataItem1 = {           city,           number: number1,           province,           sub_type: subType,           type,           [field]: sex[1],         };

        drillDownData.push(dataItem1);       });

      resolve({         drillField: field, //  下钻维度 value  值         drillData: drillDownData, //  下钻数据       });     }), };

import React from 'react';
import ReactDOM from 'react-dom';
import { SheetComponent } from '@antv/s2-react';
const s2Options = {
hierarchyType: 'tree', // 树形结构
};
ReactDOM.render(
<SheetComponent
dataCfg={s2DataConfig}
options={s2Options}
partDrillDown={PartDrillDown}
/>,
document.getElementById('container'),
);
No Found
404
Sorry, the page you visited does not exist.

scenes to be used

🌰 Case: insight into abnormal data : when the sales leader finds that the sales in Central China are abnormal, which is much lower than other regions. He drills down to the provinces to view the sales of all provinces in Central China. When abnormal sales in Hubei Province are found, you can drill down to the city 🏙 through the province and find that the sales in city B are abnormal. Through drilling down, we quickly discovered the root cause of abnormal sales.

preview

APIs

React Drilldown Components

const s2Options = {
width: 600,
height: 480,
hierarchyType: 'tree', // 树形结构
};
<SheetComponent
options={s2Options}
partDrillDown={PartDrillDown}
sheetType="pivot" // 透视模式
/>

​📊 Check out the React version of the drilldown demo

Vue drilldown component

The drill-down component can only be used in table and perspective mode.

const s2Options = {
width: 600,
height: 480,
hierarchyType: 'tree',
};
<template>
<SheetComponent
ref="s2"
:sheetType="pivot"
:partDrillDown="partDrillDown"
:options="s2Options"
/>
</template>

​📊 Check out the Vue version of the drilldown demo

public API

Function description: Configure dimension drill-down, currently only supports drill-down in the perspective mode tree structure, row header dimension drill-down

Part Drill Down

Type: object , optional , default: {}

parameterillustratetypeDefaultsrequiredRemarkVersion
drillConfigDrill down menu component configuration itemsDrillDownProps-✓
drillItemsNumThe number of displayed items after the drill-down is completed, and all are displayed by defaultnumber-1
fetchDataCallback after clicking the drilldownFetchCallBack-✓
clearDrillDownClear the drill-down information. When the specified rowId is passed, clear the drill-down information corresponding to the rowId; if the parameter is an empty object {}, clear all the drill-down information{rowId: string;}-Only React components support this property
displayConditionConfigure the display conditions of the drilldown icon , same as HeaderActionIcon(meta: Node, iconName: string) => boolean-Only React components support this property1.26.0 returns the iconName and presses a single icon to control the display and hiding

Note: The drillConfig and displayCondition fields in PartDrillDown will affect the re-rendering of the drill-down mode, please note that use memo or state to control its variability.

FetchCallBack

(meta: Node, drillFields: string[]) => Promise<PartDrillDownInfo>

Function description: Callback parameters after clicking the drilldown: PartDrillDownInfo

PartDrillDownInfo

Type: object , required , default value: {}

Function description: Drill down data request parameter configuration

parameterillustratetyperequiredDefaults
drillDatadrill down dataRecord<string, stringnumber>[]✓
drillFieldDrill down dimension value valuestring✓

DrillDownProps

Type: object , required , default value: {}

Function description: Drill down menu component configuration items

parameterillustratetypeDefaultsrequiredRemark
dataSetDrill down to data source configurationDataSet[]✓
classNameTransparent style namestring
titletitlestring
searchTextSearch Box Copywritingstring
clearTextreset button copystring
disabledFieldsDimensions that do not allow drill-downstring[]
getDrillFieldsInternally get the callback of the current drill-down dimensionFunction
setDrillFieldsInternally set the callback of the current drill-down dimensionFunction
extraCustomize the inserted node, inserted between the search box and the drill-down menuReactNodeOnly React components support this property
drillFieldsDimensions that allow drill-downstring[]Only React components support this property
DataSet

Type: object , required , default value: {}

Function description: drill down data source configuration

parameterillustratetypeDefaultsrequired
nameshow namestring✓
valuespecific valuestring✓
typeDimension type, different types correspond to different iconstext | location | date
disabledIs it allowed to chooseboolean
iconThe icon of the list itemReactNode