logo

G2

  • Chart Gallery
  • Docs
  • Examples
  • Theme
  • Ecosystem
  • Productsantv logo arrow
  • 5.3.3
  • Get Started
  • Introduction
    • What is G2
    • Using in Frontend Frameworks
    • Experimental Spec API
  • Chart 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
      • connector
      • 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
      • quantile
      • quantize
      • sqrt
      • threshold
      • time
      • pow
    • Transform
      • Overview
      • bin
      • binX
      • diffY
      • dodgeX
      • flexX
      • group
      • groupColor
      • groupX
      • groupY
      • jitter
      • jitterX
      • jitterY
      • normalizeY
      • pack
      • sample
      • select
      • selectX
      • selectY
      • sortColor
      • sortX
      • sortY
      • stackEnter
      • stackY
      • symmetryY
    • Coordinate
      • Overview
      • fisheye
      • parallel
      • polar
      • theta
      • transpose
      • radial
      • 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
      • legendFilter
      • legendHighlight
      • poptip
      • scrollbarFilter
      • sliderFilter
      • fisheye
    • Composition
      • Overview
      • facetCircle
      • facetRect
      • repeatMatrix
      • spaceFlex
      • spaceLayer
      • timingKeyframe
    • Theme
      • Overview
      • academy
      • classic
      • classicDark
    • Events
    • Color Mapping
  • Chart Component
    • Title
    • Axis
    • Legend
    • Scrollbar
    • Slider
    • Tooltip
    • Data 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)

symmetryY

Previous
stackY
Next
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...

Overview

Group by specified channel and add offset to the y and y1 channels of each group to achieve symmetry effect.

Use Cases

SymmetryY (Y-axis symmetry) is typically used to emphasize or highlight data symmetry, comparison, or mirror relationships. Here are common application scenarios with chart types and practical examples:

ScenarioChart TypeDescriptionExample
Compare Two GroupsBar Chart, Column ChartTwo groups of data displayed on both sides of the Y-axis, intuitively showing comparison differences (e.g., A/B test results).Male vs Female Income Distribution
Mirror Relationship AnalysisLine Chart, Area ChartData symmetrically distributed around the Y-axis, showing positive and negative correlations (e.g., profit vs loss, import/export balance).Company Monthly Profit vs Loss Comparison
Symmetry Distribution VerificationBox Plot, Violin PlotCheck if data follows symmetric distribution (e.g., normal distribution test).Height/Weight Symmetry Analysis
Bidirectional Deviation DisplayError Bar ChartDisplay both positive and negative deviations simultaneously (e.g., difference between predicted and actual values).Weather Forecast Error Range

Summary of Uses

  1. Comparative Analysis: Quickly identify differences or similarities between two groups of data.
  2. Symmetry Verification: Test whether data follows symmetric distribution (e.g., normality).
  3. Bidirectional Expression: Display both positive and negative trends simultaneously (e.g., profit/loss, errors).
  4. Natural Law Visualization: Reveal symmetric phenomena in nature or science (e.g., physics, biology).

Configuration

PropertyDescriptionTypeDefault
groupBySpecify grouping channel, can be a single channel name or multiple channels (string array)string | string[]x

groupBy

When symmetryY is executed, the data needs to be grouped, and the calculation logic of symmetryY is executed in each group. For example, for area charts, y data under the same x value needs to be grouped, and then the maximum and minimum value processing logic is applied within the group, so groupBy is set to the x channel.

Theoretically, groupBy can be set to all channel values. For details, please refer to the encode documentation. All enumeration values are as follows:

export type ChannelTypes =
| 'x'
| 'y'
| 'z'
| 'x1'
| 'y1'
| 'series'
| 'color'
| 'opacity'
| 'shape'
| 'size'
| 'key'
| 'groupKey'
| 'position'
| 'series'
| 'enterType'
| 'enterEasing'
| 'enterDuration'
| 'enterDelay'
| 'updateType'
| 'updateEasing'
| 'updateDuration'
| 'updateDelay'
| 'exitType'
| 'exitEasing'
| 'exitDuration'
| 'exitDelay'
| `position${number}`;

Examples

Here is a simple example code. Please note the .transform({ type: 'symmetryY' }) transformation and compare the corresponding output:

import { Chart } from '@antv/g2';
const chart = new Chart({ container: 'container' });
chart.options({
type: 'area',
data: {
type: 'fetch',
value: 'https://assets.antv.antgroup.com/g2/unemployment-by-industry.json',
transform: [
{
type: 'map',
callback: (d) => ({
...d,
date: new Date(d.date),
}),
},
],
},
encode: { x: 'date', y: 'unemployed', color: 'industry' },
transform: [{ type: 'stackY' }, { type: 'symmetryY' }],
});
chart.render();

The above code will render the corresponding chart:

symmetryY

Similarly, how to draw a symmetric bar chart? Use this transform as well, as follows:

import { Chart } from '@antv/g2';
const chart = new Chart({ container: 'container' });
chart.options({
type: 'interval',
width: 800,
height: 300,
data: [
{ x: 'A', y: 100 },
{ x: 'B', y: 200 },
{ x: 'C', y: 300 },
{ x: 'D', y: 250 },
],
encode: { x: 'x', y: 'y', color: 'x' },
transform: [{ type: 'stackY' }, { type: 'symmetryY' }],
scale: { x: { padding: 0.5 } },
coordinate: { transform: [{ type: 'transpose' }] },
legend: false,
});
chart.render();

Please note the final .transform({ type: 'symmetryY' }) transformation function.

Funnel Chart

SymmetryY has another important application scenario in funnel charts (comparison funnel charts, conversion funnel charts), and pyramid charts, which are used to show data conversion and result presentation. For example, a typical funnel chart is shown as follows:

symmetryY

The corresponding example code is:

import { Chart } from '@antv/g2';
const chart = new Chart({ container: 'container' });
chart.options({
type: 'interval',
autoFit: true,
data: [
{ action: 'Browse Website', pv: 50000 },
{ action: 'Add to Cart', pv: 35000 },
{ action: 'Generate Order', pv: 25000 },
{ action: 'Pay Order', pv: 15000 },
{ action: 'Complete Transaction', pv: 8000 },
],
encode: { x: 'action', y: 'pv', color: 'action', shape: 'funnel' },
transform: [{ type: 'symmetryY' }],
scale: { x: { padding: 0 } },
coordinate: { transform: [{ type: 'transpose' }] },
animate: { enter: { type: 'fadeIn' } },
axis: false,
labels: [
{
text: (d) => `${d.action}\
${d.pv}`,
position: 'inside',
transform: [{ type: 'contrastReverse' }],
},
],
});
chart.render();

For more specific cases, please refer to the chart example page links provided above.