Label

The "position" in view box of Cartesian Coordinates

The "position" in view box of PieChart

The "position" in view box of RadialBarChart

Properties

  • anglenumberoptional

    Text rotation angle in degrees. The text will be rotated around the (x, y) coordinates as the pivot point. Positive values rotate clockwise, negative values rotate counterclockwise.

    DEFAULT: 0

  • childrenReactNodeoptional

    The value of label can be set as children or as the value prop

    FORMAT:

    <Label>foo</Label>
  • classNamestringoptional

  • contentReactNode | Functionoptional

    If set a React element, the option is the custom react element of rendering label. If set a function, the function will be called to render label content.

    FORMAT:

    <Label content={CustomizedLabel} />
    const renderCustomLabel = (props) => <text {...props}>Custom Label</text>;
    <Label content={renderCustomLabel} />
  • formatterFunctionoptional

    The formatter function of label value which has only one parameter - the value of label.

  • idstringoptional

    The unique id of this component, which will be used to generate unique clip path id internally. This props is suggested to be set in SSR.

  • indexnumberoptional

  • labelRefnull | React.RefObject<SVGTextElement>optional

  • offsetstring | numberoptional

    The offset to the specified "position". Direction of the offset depends on the position.

    DEFAULT: 5

  • parentViewBoxRequired<CartesianViewBox> | Required<PolarViewBox>optional

  • position"end" | "top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "center" | "centerTop" | "centerBottom" | "middle" | { x?: number | `${number}%` | undefined; y?: number | `${number}%` | undefined; }optional

    The position of label relative to the view box.

    DEFAULT: "middle"

  • textBreakAllbooleanoptional

    DEFAULT: false

  • valuenull | string | number | false | trueoptional

    The value of label can be set as children or as the value prop

    FORMAT:

    <Label value="foo" />
  • viewBoxRequired<CartesianViewBox> | Required<PolarViewBox>optional

    The box of viewing area. Used for positioning. If undefined, viewBox will be calculated based on surrounding context.

  • zIndexnumberoptional

    DEFAULT: 2000