logo

Ant Design Charts

  • Manual
  • Options
  • Examples
  • Productsantv logo arrow
  • 2.0.0
  • Component Overview
  • Common Configuration Statistical Charts
    • Chart composition
    • Component
      • 标题(Title)
      • Axis
      • Legend
      • Scrollbar
      • Slider
      • Tooltip
      • Label
    • Core
      • Color En
      • View
      • Data
        • overview
        • custom
        • ema
        • fetch
        • filter
        • fold
        • inline
        • join
        • kde
        • log
        • map
        • pick
        • rename
        • slice
        • sort
        • sortBy
      • Scale
        • overview
        • band
        • linear
        • log
        • ordinal
        • point
        • pow
        • quantile
        • quantize
        • sqrt
        • threshold
        • time
      • Transform
        • overview
        • bin
        • binX
        • diffY
        • dodgeX
        • flexX
        • group
        • groupColor
        • groupX
        • groupY
        • jitter
        • jitterX
        • jitterY
        • normalizeY
        • pack
        • sample
        • select
        • selectX
        • selectX
        • sortColor
        • sortX
        • sortY
        • stackEnter
        • stackY
        • symmetryY
      • Coordinate
        • overview
        • fisheye
        • parallel
        • polar
        • radial
        • theta
        • transpose
        • cartesian3D
      • 样式(Style)
      • Animate
        • overview
        • fadeIn
        • fadeOut
        • growInX
        • growInY
        • morphing
        • pathIn
        • scaleInX
        • scaleInY
        • scaleOutX
        • scaleOutY
        • waveIn
        • zoomIn
        • zoomOut
      • 状态(State)
      • Interaction
        • Overview
        • brushAxisHighlight
        • brushHighlight
        • brushXHighlight
        • brushYHighlight
        • brushFilter
        • brushXFilter
        • brushYFilter
        • chartIndex
        • elementHighlight
        • elementHighlightByColor
        • elementHighlightByX
        • elementSelect
        • elementSelectByColor
        • elementSelectByX
        • fisheye
        • legendFilter
        • legendHighlight
        • poptip
        • scrollbarFilter
        • sliderFilter
      • Composition
        • overview
        • facetCircle
        • facetRect
        • repeatMatrix
        • spaceFlex
        • spaceLayer
        • timingKeyframe
      • Theme
        • overview
        • Academy
        • classic
        • classicDark
      • event
    • Specal Plot
      • Area
      • Bar
      • CirclePacking
      • DualAxes
      • Gauge
      • Line
      • Rose
      • Sankey
      • Scatter
      • Sunburst
      • Treemap
      • Venn
      • WordCloud
      • Column
      • Pie
      • BidirectionalBar
      • Box
      • Bullet
      • Funnel
      • Heatmap
      • Histogram
      • Liquid
      • Radar
      • Stock
      • Tiny
      • Violin
      • Waterfall
      • RadialBar
  • Relation Graph Components
    • Overview
    • MindMap
    • Fishbone
    • IndentedTree
    • Dendrogram
    • OrganizationChart
    • FlowGraph
    • FlowDirectionGraph
    • NetworkGraph
    • FAQ

tooltip

Next
Component Overview

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

展示提示信息。

开始使用

example
{
interaction: { tooltip: true },
}

选项

属性描述类型默认值
wait提示信息更新的时间间隔,单位为毫秒number50
leading是否在时间间隔开始的时候更新提示信息booleantrue
trailing是否在时间间隔结束的时候更新提示信息booleanfalse
shared相同 x 的元素是否共享 tooltipbooleanfalse
series是否是系列元素的 tooltipboolean-
body是否展示 tooltipbooleantrue
marker是否展示 markerbooleantrue
groupName是否使用 groupNamebooleantrue
positiontooltip 位置TooltipPosition-
mounttooltip 渲染的 dom 节点string | HTMLElement图表容器
boundingtooltip 渲染的限制区域,超出会自动调整位置BBox图表区域大小
crosshairs是否展示指示线boolean-
crosshairs${StyleAttrs}指示线的样式number | string-
marker${StyleAttrs}marker 的样式number | string-
render自定义 tooltip 渲染函数(event, options) => HTMLElement | string-
sortitem 排序器(d: TooltipItemValue) => any-
filteritem 筛选器(d: TooltipItemValue) => any-
disableNative是否响应原生事件(pointerover 和 pointerout)trueboolean
css设置容器的 css 样式-Record<string, any>
type TooltipPosition =
| 'top'
| 'bottom'
| 'left'
| 'right'
| 'top-left'
| 'top-right'
| 'bottom-left'
| 'bottom-right';
type BBox = { x: number; y: number; width: number; height: number };

案例

自定义 Tooltip

custom-tooltip
{
interaction: {
tooltip: {
render: (event, { title, items }) => <div>Your custom render content here.</div>,
},
},
}

获得提示数据

let chart;
const config = {
onReady: (c) => chart = c
}
chart.on('tooltip:show', (event) => {
console.log(event.data.data);
});
chart.on('tooltip:hide', () => {
console.log('hide');
});

手动控制展示/隐藏

对于 Interval、Point 等非系列 Mark,控制展示的方式如下:

// 条形图、点图等
{
onReady: chart => {
chart.emit('tooltip:show', {
data: {
// 会找从原始数据里面找到匹配的数据
data: { genre: 'Sports' },
},
})
}
}

对于 Line、Area 等系列 Mark,控制展示的方式如下:

{
onReady: chart => {
chart.emit('tooltip:show', {
data: {
data: { x: new Date('2010-11-16') },
},
})
}
}

隐藏的方式如下:

chart.emit('tooltip:hide');

开始/禁止交互

chart.emit('tooltip:disable'); // 禁用 tooltip
chart.emit('tooltip:enable'); // 启用交互