logo

G2

  • Docs
  • Chart Introduction
  • API
  • Examples
  • Theme
  • Ecosystem
  • Productsantv logo arrow
  • 5.3.3
  • Get Started
  • Introduction
    • What is G2
    • Use In Framework
    • Experimental Spec API
  • Core Concepts
    • Chart
      • Components of G2 Charts
      • How to Use Charts
    • Mark
      • overview
      • area
      • box
      • boxplot
      • cell
      • chord
      • density
      • gauge
      • heatmap
      • image
      • interval
      • line
      • lineX
      • lineY
      • link
      • liquid
      • sunburst
      • point
      • polygon
      • range
      • rangeX
      • rangeY
      • rect
      • shape
      • text
      • vector
      • wordCloud
    • View
    • Data
      • overview
      • custom
      • ema
      • fetch
      • filter
      • fold
      • inline
      • join
      • kde
      • log
      • map
      • pick
      • rename
      • slice
      • sort
      • sortBy
    • Encode
    • 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
      • helix
    • 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
    • Color
  • Chart API
  • Chart Component
    • 标题(Title)
    • Axis
    • Legend
    • Scrollbar
    • Slider
    • Tooltip
    • Label
  • Extra Topics
    • Graph
      • forceGraph
      • pack
      • sankey
      • tree
      • treemap
    • Geo
      • geoPath
      • geoView
    • 3D
      • Draw 3D Chart
      • point3D
      • line3D
      • interval3D
      • surface3D
    • Plugin
      • renderer
      • rough
      • lottie
      • a11y
    • Package on demand
    • Set pattern
    • Server-side rendering(SSR)
    • Spec Function Expression Support (Available in 5.3.0)
  • Whats New
    • New Version Features
    • Migration from v4 to v5
  • Frequently Asked Questions (FAQ)

liquid

Previous
link
Next
sunburst

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

概述

liquid 图形标记可用于绘制各种 水波图(涟漪图或波形图),通过模拟水面上波纹扩散的动态过程,从视觉上的波动传达信息或增强用户体验。常用于 UI 设计、数据可视化或动画效果中。

import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
});
chart.options({
height: 300,
type: 'liquid',
data: 0.3, // [0, 1]
// 配置样式
style: {
outlineBorder: 4, // 外部边宽
outlineDistance: 8, // 水波运动时间
waveLength: 128, // 水波长度
},
// 配置坐标系
coordinate: {},
});
chart.render();

更多的案例,可以查看图表示例 - 水波图页面。

配置项

属性描述类型默认值必选
style配置 liquid 标记的图形样式style-

style

配置 liquid 标记的样式。

属性描述类型默认值必选
shape形状numbercircle
stroke边框颜色string-
fill水波颜色string-
outlineBorder边框宽度number2
outlineDistance内间距number0
waveLength波长number192
waveCount波数number3
backgroundFill背景颜色string-
contentText文本内容string-
contentFill文本颜色string-
contentFontSize文本大小string-

import { Chart } from '@antv/g2';
const chart = new Chart({
container: 'container',
});
chart.options({
type: 'liquid',
data: 0.75,
style: {
fill: 'pink', // 水波颜色
stroke: 'red', // 描边颜色
backgroundFill: '#f5f5f5', // 背景颜色
// outline 为描边样式
outlineBorder: 10, // 外部边宽
outlineDistance: 10, // 水波运动时间
// wave为水波配置
waveLength: 188, // 水波长度
waveCount: 6, // 波数 会自动 从 1 ~ 0.2 分配透明度
// content 为中心文本配置
contentText: 'center text',
contentFill: '#000',
contentStroke: '#fff',
contentFontSize: 32,
contentLineWidth: 3,
},
// 配置坐标系
coordinate: {},
});
chart.render();

shape

liquid 标记内置支持的形状如下:

形状描述示例
rect矩形
circle圆形
pin水滴
triangle三角

如果需要自定义形状,可以通过自定义 shape 提供实现。 其中, 回调 (x, y, r, w, h) => string, 传入参数分别为 x y 中心点坐标, r 图表可画圆最大半径, w h 图表可画宽高,从而画出想要的形状,需要对 svg 或者 canvas 有一定理解。

尝试自己画一下: