Basic Configuration
The Y-axis supports four axis types:value, category, time, and log. The type determines how data is scaled and displayed.
Axis Types
Value Axis
Numerical axis suitable for continuous data. This is the most common type for Y-axis.Category Axis
Ordinal axis for discrete categorical data. Less common for Y-axis but useful for horizontal bar charts.Time Axis
Temporal axis optimized for time-series data displayed vertically.Log Axis
Logarithmic axis for exponential data patterns.Key Properties
Axis type determines the scale and data interpretation.Reference: src/coord/axisCommonTypes.ts:34
Position of the Y-axis. Default is
'left'.Reference: src/coord/cartesian/AxisModel.ts:31-36Offset in pixels from the default position. Useful for multiple axes on the same position.Reference: src/coord/cartesian/AxisModel.ts:38
Index of the grid component that the axis belongs to.Reference: src/coord/cartesian/AxisModel.ts:34
Axis name displayed on the chart.Reference: src/coord/axisCommonTypes.ts:44
Location of the axis name:
'start': place name based on axis.extent[0]'end': place name based on axis.extent[1]'middle'or'center': place name at the center
Gap between axis name and axis line.Reference: src/coord/axisCommonTypes.ts:67
Rotation angle of the axis name in degrees.Reference: src/coord/axisCommonTypes.ts:53
Whether to inverse the axis direction.Reference: src/coord/axisCommonTypes.ts:42
Minimum value of the axis. Can be:
- A specific number
'dataMin': use the minimum value in data- A function that returns the min value
null/undefined: auto-calculated
Maximum value of the axis. Can be:
- A specific number
'dataMax': use the maximum value in data- A function that returns the max value
null/undefined: auto-calculated
For category axis: whether to add gap at both ends (default
true).
For value/time/log axis: gap value at both ends as [GAP, GAP] where GAP can be absolute pixel or percent.Reference: src/coord/axisCommonTypes.ts:140Number of segments the axis is split into. Only works for value, time, and log axes.Reference: src/coord/axisCommonTypes.ts:145
Mandatory interval for axis ticks. Overrides automatic calculation.Reference: src/coord/axisCommonTypes.ts:149
Minimum interval when auto-calculating tick intervals.Reference: src/coord/axisCommonTypes.ts:153
Maximum interval when auto-calculating tick intervals.Reference: src/coord/axisCommonTypes.ts:157
Only for value axis. If
false, axis always includes zero. If true, the axis may not contain zero.Reference: src/coord/axisCommonTypes.ts:216Whether to align ticks with the first axis that doesn’t use
alignTicks. Ignored if interval is set.Reference: src/coord/axisCommonTypes.ts:165Axis Label Configuration
Configuration for axis labels.Reference: src/coord/axisCommonTypes.ts:89
Whether to show axis labels.
Whether labels are inside the grid or outside.Reference: src/coord/axisCommonTypes.ts:315
Rotation angle of labels in degrees. Positive values rotate clockwise.Reference: src/coord/axisCommonTypes.ts:316
Margin between label and axis line.Reference: src/coord/axisCommonTypes.ts:331
Label formatter. Can be a template string or callback function.Reference: src/coord/axisCommonTypes.ts:340
Whether to show the minimum label.Reference: src/coord/axisCommonTypes.ts:319
Whether to show the maximum label.Reference: src/coord/axisCommonTypes.ts:321
Whether to hide overlapping labels automatically.Reference: src/coord/axisCommonTypes.ts:335
Axis Line & Ticks
Configuration for the axis line.Reference: src/coord/axisCommonTypes.ts:92
Whether to show the axis line.Reference: src/coord/axisCommonTypes.ts:232
Whether the axis line aligns with the zero position of the other axis.Reference: src/coord/axisCommonTypes.ts:233
Configuration for axis ticks.Reference: src/coord/axisCommonTypes.ts:93
Whether to show axis ticks.Reference: src/coord/axisCommonTypes.ts:245
Whether ticks are inside the grid or outside.Reference: src/coord/axisCommonTypes.ts:247
Length of axis ticks in pixels.Reference: src/coord/axisCommonTypes.ts:249
Configuration for minor ticks between major ticks.Reference: src/coord/axisCommonTypes.ts:94
Whether to show minor ticks.Reference: src/coord/axisCommonTypes.ts:347
Number of minor ticks between two major ticks.Reference: src/coord/axisCommonTypes.ts:348
Split Lines & Areas
Configuration for split lines (grid lines).Reference: src/coord/axisCommonTypes.ts:95
Whether to show split lines.Reference: src/coord/axisCommonTypes.ts:354
Configuration for minor split lines.Reference: src/coord/axisCommonTypes.ts:96
Whether to show minor split lines.Reference: src/coord/axisCommonTypes.ts:365
Configuration for split areas (alternating background areas).Reference: src/coord/axisCommonTypes.ts:97
Whether to show split areas.Reference: src/coord/axisCommonTypes.ts:370
Advanced Examples
Multiple Y-Axes
Logarithmic Scale
Custom Value Range with Padding
Horizontal Bar Chart
Related Components
- X-Axis - Horizontal axis configuration
- Grid - Cartesian coordinate system
- Angle Axis - Angular axis for polar charts
- Radius Axis - Radial axis for polar charts