logo

S2

  • Manual
  • API
  • Examples
  • Playground
  • ChangeLog
  • Productsantv logo arrow
  • 2.x
  • Common Configuration
    • S2DataConfig
    • S2Options
      Updated
    • S2Theme
      Updated
    • S2Event
  • Basic Class
    • SpreadSheet
    • Interaction
      Updated
    • Store
    • BaseCell
      Updated
    • BaseDataSet
    • Node
    • BaseTooltip
    • BaseFacet
      Updated
    • Hierarchy
      New
    • BaseBBox
      New
    • CellData
      New
  • Components
    • table component
    • DrillDown
    • Switcher
    • Advanced Sort
    • Export
      Updated
  • Graphic style
  • 透视组合图拓展 S2Options

Graphic style

Previous
Export
Next
透视组合图拓展 S2Options

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

S2 uses AntV/G as the graphics engine. Some graphics style configurations, such as the fill attribute and stroke attribute of cells, and the fontFamily and fontSize of drawing fonts, etc., are directly transparently transmitted to AntV/G drawing attributes .

Here is a brief introduction to the commonly used drawing properties of S2:

Configure graphic styles

attribute nametypeFunctional description
fillstringThe fill color of the graphics background supports [gradient color configuration] (#configure gradient color), texture configuration
fill OpacitynumberFill transparency of the graphic background
strokestringGraphic stroke, support [gradient color configuration](#Configure gradient color), texture configuration
lineWidthnumberShape stroke width
lineDash[number,number]The dotted line configuration of the graphic stroke, the first value is the length of each segment of the dotted line, and the second value is the distance between segments
lineOpacitynumbergraphic stroke stroke transparency
opacitynumberoverall transparency of the graph
shadowColorstringGraphic shadow color
shadowBlurnumberGaussian blur factor for figure shadows
shadowOffsetXnumberSet the horizontal distance of the shadow from the shape
shadowOffsetYnumberSets the vertical distance of the shadow from the shape
cursorstringMouse style. mouse style with css

Configure Line Style

attribute nametypeFunctional description
strokestringLine segment color, support [gradient color configuration](#Configure gradient color), texture configuration
lineWidthnumberline width
lineDash[number,number]Line segment dotted line configuration, the first value is the length of each segment of the dotted line, and the second value is the distance between segments
opacitynumberline transparency
shadowColorstringline shadow color
shadowBlurnumberLine Segment Gaussian Blur Coefficient
shadowOffsetXnumberSets the horizontal distance of the shadow from the line segment
shadowOffsetYnumberSets the vertical distance of the shadow from the line segment
cursorstringMouse style. mouse style with css

Configure Text Style

attribute nametypeFunctional description
fontSizenumberfont size
fontFamilystringtext font
fontWeightnumberfont weight
lineHeightnumberline height of text
textAligncenter | left | right | start | endSets the alignment of the text content
textBaselinetop | middle | bottom | alphabetic hangingSets the current text baseline to use when drawing text
fillstringText fill color, support [gradient color configuration](#Configure gradient color), texture configuration
fill Opacitynumbertext fill transparency
strokestringText stroke, support [gradient color configuration](#Configure gradient color), texture configuration
lineWidthnumbertext stroke width
lineDash[number,number]The dotted line configuration of the stroke, the first value is the length of each segment of the dotted line, and the second value is the distance between segments
line Opacitynumberstroke transparency
opacitynumberThe overall transparency of the text
shadowColorstringtext shadow color
shadowBlurnumberGaussian blur factor for text shadows
shadowOffsetXnumberSet the horizontal distance of the shadow from the text
shadowOffsetYnumberSets the vertical distance of the shadow from the text
cursorstringMouse style. css mouse styles

Configure Gradients

S2 provides two forms of linear gradient and circular gradient

linear gradient

linear
  • l means to use linear gradient, that is, linear gradient , the green font is a variable, which can be customized
  • The color variable can be in the form of hexadecimal or rgb(a)

Example:

// 使用渐变色填充,渐变角度为 0,渐变的起始点颜色 #95F0FF,结束的渐变色为 #3A9DBF
fill: `l(0) 0:#95F0FF 1:#3A9DBF`,

Effect:

preview

circular gradient

radial
  • r means to use radial gradient, that is, radial gradient , and the green font is a variable, which can be customized
  • The x , y , and r values of the circle are all relative values, ranging from 0 to 1
  • The color variable can be in the form of hexadecimal or rgb(a)

Example:

// 使用渐变色填充,渐变起始圆的圆心坐标为被填充物体的包围盒中心点,半径为(包围盒对角线长度 / 2) 的 1 倍,渐变的起始点颜色 #ffffff,结束的渐变色为 #1890ff
fill: 'r(0.5, 0.5, 1) 0:#ffffff 0.5:#1890ff';

Effect:

preview

Configure Textures

Fill the shape with a specific texture. Texture content can be directly images or Data URLs.

radial
  • p means to use texture, that is pattern , the green font is a variable, which can be customized

  • There are 4 types of repetitions:

    • a : the pattern repeats horizontally and vertically
    • x : the pattern repeats only horizontally
    • y : the pattern repeats only vertically
    • n : the pattern is displayed only once (not repeated)

Example:

fill: 'p(a)https://gw.alipayobjects.com/mdn/rms_d314dd/afts/img/A*58XjQY1tO7gAAAAAAAAAAABkARQnAQ';

Effect:

pattern