CartesianGrid

父组件

Properties

  • xNumber

    x 坐标。

    默认值:0

  • yNumber

    y 坐标。

    默认值:0

  • widthNumber

    宽度。

    默认值:0

  • heightNumber

    高度。

    默认值:0

  • horizontalBoolean

    是否展示水平方向的网格线。

    默认值:true

  • verticalBoolean

    是否展示竖直方向的网格线。

    默认值:true

  • horizontalPointsArray

    所有水平网格线的 y 坐标。

    默认值:[]

  • horizontalCoordinatesGeneratorFunctionoptional

    生成所有水平线的 y 坐标的函数。生成器传递一个形状为 { yAxis, width, height, offset } 的对象。

    格式:

    <CartesianGrid strokeDasharray="3 3" horizontalCoordinatesGenerator={(props) => props.height > 250 ? [75, 150, 225] : [100, 200]} />
  • verticalPointsArray

    所有竖直网格线的 x 坐标。

    默认值:[]

  • verticalCoordinatesGeneratorFunctionoptional

    生成所有垂直线的 x 坐标的函数。生成器传递一个形状为 { xAxis, width, height, offset } 的对象

    格式:

    <CartesianGrid strokeDasharray="3 3" verticalCoordinatesGenerator={(props) => props.width > 450 ? [150, 300, 450] : [200, 400]} />
  • fillStringoptional

    网格之间用于填充的背景颜色

    格式:

    <CartesianGrid strokeDasharray="3 3" fill="red" />
    <CartesianGrid strokeDasharray="3 3" fill="#ccc" />
  • fillOpacityNumberoptional

    网格之间用于填充的背景的透明度

    格式:

    <CartesianGrid strokeDasharray="3 3" fill="red" fillOpacity={0.6} />
  • strokeDasharrayStringoptional

    用于绘制网格的虚线和间隔的模式

    格式:

    <CartesianGrid strokeDasharray="4" />
    <CartesianGrid strokeDasharray="4 1" />
    <CartesianGrid strokeDasharray="4 1 2" />
  • xAxisIdString | Numberoptional

    The id of x-axis which you would like to add grid lines for. Must match if xAxisId is set on XAxis or a graphical component .

    默认值:0

    格式:

    <CartesianGrid xAxisId="top" />
    <XAxis xAxisId="top" />
    <Bar dataKey="temp" xAxisId="top" />
  • yAxisIdString | Numberoptional

    The id of y-axis which you would like to add grid lines for. Must match if yAxisId is set on YAxis or a graphical component.

    默认值:0

    格式:

    <CartesianGrid yAxisId="left" />
    <YAxis yAxisId="left" />
    <Bar dataKey="temp" yAxisId="left" />