logo

Ant Design Charts

  • Manual
  • Components
  • Examples
  • Options
  • Productsantv logo arrow
  • 2.6.5
  • Common Configuration Statistical Charts
    • Title
    • Axis
    • Legend
    • Scrollbar
    • Slider
    • Tooltip
    • Label
    • Color
    • event
    • Interaction
      • Overview
      • brushAxisHighlight
      • brushHighlight
      • brushXHighlight
      • brushYHighlight
      • brushFilter
      • brushXFilter
      • brushYFilter
      • chartIndex
      • elementHighlight
      • elementHighlightByColor
      • elementHighlightByX
      • elementSelect
      • elementSelectByColor
      • elementSelectByX
      • fisheye
      • legendFilter
      • legendHighlight
      • poptip
      • scrollbarFilter
      • sliderFilter
    • State
    • Style
    • Scale
      • overview
      • band
      • linear
      • log
      • ordinal
      • point
      • pow
      • quantile
      • quantize
      • sqrt
      • threshold
      • time
    • Animate
      • overview
      • fadeIn
      • fadeOut
      • growInX
      • growInY
      • morphing
      • pathIn
      • scaleInX
      • scaleInY
      • scaleOutX
      • scaleOutY
      • waveIn
      • zoomIn
      • zoomOut
    • Theme
      • overview
      • Academy
      • classic
      • classicDark
    • Data
      • overview
      • custom
      • ema
      • fetch
      • filter
      • fold
      • inline
      • join
      • kde
      • log
      • map
      • pick
      • rename
      • slice
      • sort
      • sortBy

Axis

Previous
Title
Next
Legend

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 2026 Ant Group Co., Ltd..备案号:京ICP备15032932号-38

Loading...

Overview

In Ant Design Charts, the Axis component serves as the "ruler" of charts, establishing the mapping relationship between data and visual positions. Through scales, labels, grid lines, and other elements, it helps users intuitively understand data distribution and proportions. It enables you to quickly comprehend the position and numerical values in graphics.

Simply put, axis help us correlate data numbers with positions on the chart, making charts easier to understand.

For example: In a bar chart, the horizontal axis usually represents time, and the vertical axis represents sales. This way, you can see at a glance that "sales were 2 million in March and rose to 3 million in April."

Axis Usage Diagram

Components

Usage

Through the overview content above, I believe you now have a clear understanding of axis. So how exactly do you use them? Next, I'll guide you step by step on how to configure axis.

Configuring axis is like building with blocks - just remember a simple core principle: "Use the axis property, configure by direction, change what needs to be changed where it needs to be changed."

Step 1: Enable Axis (enabled by default)

Ant Design Charts automatically generates axis based on your data types. No configuration is needed to see basic axis.

Enable Axis (enabled by default)

{
width: 500,
height: 300,
data: [
{ id: 1, month: 'March', sales: 200 },
{ id: 3, month: 'April', sales: 300 },
{ id: 4, month: 'May', sales: 400 },
{ id: 5, month: 'June', sales: 500 },
{ id: 6, month: 'July', sales: 600 },
{ id: 7, month: 'August', sales: 700 },
],
xField: 'month',
yField: 'sales',
// No axis configuration needed for automatic axis generation
// axis: {},
colorField: 'month'
}

Step 2: Configure by Direction

Configure x (horizontal direction) axis

{
width: 500,
height: 300,
data: [
{ id: 1, month: 'March', sales: 200 },
{ id: 3, month: 'April', sales: 300 },
{ id: 4, month: 'May', sales: 400 },
{ id: 5, month: 'June', sales: 500 },
{ id: 6, month: 'July', sales: 600 },
{ id: 7, month: 'August', sales: 700 },
],
xField: 'month',
yField: 'sales',
colorField: 'month',
// Configure axis
axis: {
// Configure horizontal axis properties
x: {
// Configuration parameters and examples can be found below...
},
}
}

Configure y (vertical direction) axis

{
width: 500,
height: 300,
data: [
{ id: 1, month: 'March', sales: 200 },
{ id: 3, month: 'April', sales: 300 },
{ id: 4, month: 'May', sales: 400 },
{ id: 5, month: 'June', sales: 500 },
{ id: 6, month: 'July', sales: 600 },
{ id: 7, month: 'August', sales: 700 },
],
xField: 'month',
yField: 'sales',
colorField: 'month',
// Configure axis
axis: {
// Configure vertical axis properties
y: {
// Configuration parameters and examples can be found below...
},
}
}

Configuration Levels

Axis can be configured at the Mark level. In Ant Design Charts, each mark has its own axis. If the marks correspond to synchronized scales, the axis will be merged.

({
axis: {
x: { labelFormatter: '%0' },
y: { tickCount: 5 },
},
});

Hide Axis

Hide axis for each channel:

Axis hiding demonstration

Hide x axis:

({
axis: { x: false }, // Hide x horizontal axis
});

Hide y axis:

({
axis: { y: false }, // Hide y vertical axis
});

Hide multiple axis

({
axis: false,
});

Configuration Options

Each axis consists of title, line, tick, label, grid, and breaks.

PropertyDescriptionTypeDefault ValueRequired
titleSet axis title text and styletitle-
lineSet axis line display and styleline-
tickSet axis tick display and styletick-
labelSet axis label display and stylelabel-
gridSet axis grid display and stylegrid-
breaksSet axis breaks display and stylebreaks-
animateSet axis animation effectsboolean | animate-
positionSet axis positionleft | right | top | bottomx: bottom | y: left

Note

Title, line, tick, label, and grid configurations are at the same level, not configured as objects, but through prefix + property approach.

For example, to configure label rotation, it's not configured under a label object, but through the following approach:

({
axis: {
x: {
title: 'X Axis Title',
labelFontSize: 12,
labelFormatter: (d) => `2025-${d}`,
transform: [
// Rotation
{
type: 'rotate',
optionalAngles: [0, 45, 90], // Try rotating 0°, 45°, 90°
recoverWhenFailed: true, // Recover to default angle if rotation fails
},
],
},
},
});

title

PropertyDescriptionTypeDefault ValueRequired
titleTurn off title or set title contentfalse|string | number | DisplayObject-
titleSpacingDistance from title to axisnumber | (datum, index, data) => number10
titlePositionTitle position relative to axis'top'|'bottom'|'left'|'right''lb'
titleFontSizeTitle font sizenumber | (datum, index, data) => number-
titleFontWeightTitle font weightnumber | (datum, index, data) => number-
titleFontFamilyTitle font familystring | (datum, index, data) => string-
titleFillTitle text fill colorstring | (datum, index, data) => string-
titleOpacityTitle text overall opacitynumber | (datum, index, data) => number1

line

PropertyDescriptionTypeDefault ValueRequired
lineWhether to show axis linebooleanfalse
arrowWhether to show arrowbooleantrue
lineLineWidthAxis line stroke widthnumber | (datum, index, data) => number-
lineStrokeAxis line stroke colorstring | (datum, index, data) => string-
lineOpacityAxis line overall opacitynumber | (datum, index, data) => number1

tick

PropertyDescriptionTypeDefault ValueRequired
tickWhether to show ticksbooleantrue
tickCountSet recommended number of ticks to generatenumber-
tickLengthTick lengthnumber|(datum, index, data)=>number15
tickStrokeTick stroke colorstring | (datum, index, data, Vector)=>string-

label

PropertyDescriptionTypeDefault ValueRequired
labelWhether to show tick labelsboolean-
labelFontSizeLabel font sizenumber | (datum, index, data)=>number-
labelFormatterLabel formatting, accepts function or d3-format supported stringstring | (datum, index, array) => string-
labelAlignLabel alignment: 'horizontal', 'parallel', 'perpendicular''horizontal' | 'parallel' | 'perpendicular'parallel
labelFillLabel text fill colorstring | (datum, index, data)=>string-

grid

PropertyDescriptionTypeDefault ValueRequired
gridWhether to show grid linesbooleanfalse
gridStrokeGrid line stroke colorstring | (datum, index, data)=> string-
gridLineWidthGrid line stroke widthnumber | (datum, index, data)=> number-
gridLineDashGrid line stroke dash configuration[number,number] | (datum, index, data)=> [number,number]-

breaks

Configure axis breaks for discontinuous data ranges.

{
breaks: [
{
start: 5000,
end: 50000,
gap: '3%',
}
]
}

animate

PropertyDescriptionTypeDefault ValueRequired
animateWhether to enable animationboolean | EffectTiming-

Example

import { Column } from '@ant-design/plots';
import React from 'react';
import { createRoot } from 'react-dom/client';
const Demo = () => {
const config = {
marginTop: 40,
data: [
{ id: 1, label: 'X Axis Label 1', value: 200 },
{ id: 2, label: 'X Axis Label 2', value: 300 },
{ id: 3, label: 'X Axis Label 3', value: 400 },
{ id: 4, label: 'X Axis Label 4', value: 500 },
{ id: 5, label: 'X Axis Label 5', value: 600 },
{ id: 6, label: 'X Axis Label 6', value: 700 },
],
xField: 'label',
yField: 'value',
axis: {
x: {
position: 'bottom',
title: 'X Axis Title',
titleFontWeight: 500,
grid: true,
gridLineWidth: 2,
line: true,
lineLineWidth: 5,
lineStroke: '#f50',
tick: true,
tickLineWidth: 5,
tickLength: 10,
tickStroke: '#3366ff',
label: true,
labelFontSize: 12,
labelFill: '#009900',
labelFontWeight: 500,
},
y: {
position: 'left',
title: 'Y Axis Title',
titleFontWeight: 500,
grid: true,
gridLineWidth: 2,
line: true,
lineLineWidth: 5,
lineStroke: '#f50',
tick: true,
tickLineWidth: 5,
tickLength: 10,
tickStroke: '#3366ff',
label: true,
labelFontSize: 12,
labelFill: '#009900',
labelFontWeight: 500,
},
}
};
return <Column {...config} />;
};
createRoot(document.getElementById('container')).render(<Demo />);

For more examples, see the Chart Examples - Axis page.