CartesianGrid

Renders background grid with lines and fill colors in a Cartesian chart.

父组件

CartesianGrid consumes context provided by these components:

Props

  • fillstringoptional

    The background color used to fill the space between grid lines

    默认值:"none"

    格式:

    <CartesianGrid fill="red" />
    <CartesianGrid fill="#ccc" />
  • fillOpacitynumber | stringoptional

    The opacity of the background used to fill the space between grid lines

    格式:

    <CartesianGrid fill="red" fillOpacity={0.6} />
  • heightnumber | stringoptional

    The height of grid. If undefined, covers the full height of the chart plot area.

  • horizontal(union of 5 variants)optional

    If set false, no horizontal grid lines will be drawn.

    默认值:true

  • horizontalCoordinatesGeneratorHorizontalCoordinatesGeneratoroptional

    A function that generates the y-coordinates of all horizontal lines.

  • horizontalFillArray<string>optional

    Defines background color of stripes.

    The values from this array will be passed in as the fill property in a rect SVG element. For possible values see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill#rect

    In case there are more stripes than colors, the colors will start from beginning. So for example: horizontalFill['yellow', 'black'] produces a pattern of yellow|black|yellow|black

    If this is undefined, or an empty array, then there is no background fill. Note: Grid lines will be rendered above these background stripes.

    默认值:[]

  • horizontalPointsArray<number>optional

    Array of coordinates in pixels where to draw horizontal grid lines. Has priority over syncWithTicks and horizontalValues.

    默认值:[]

  • horizontalValuesArray<number> | Array<string>optional

    Array of values, where horizontal lines will be drawn. Numbers or strings, in dependence on axis type. Has priority over syncWithTicks but not over horizontalPoints.

  • strokeDasharraynumber | stringoptional

    The pattern of dashes and gaps used to paint the lines of the grid

    格式:

    <CartesianGrid strokeDasharray="3 3" />
    <CartesianGrid strokeDasharray={[5, 5, 1, 5]} />
    <CartesianGrid strokeDasharray="5 5 1 5" />
  • syncWithTicksbooleanoptional

    If true, only the lines that correspond to the axes ticks values will be drawn. If false, extra lines could be added for each axis (at min and max coordinates), if there will not such ticks. horizontalPoints, verticalPoints, horizontalValues, verticalValues have priority over syncWithTicks.

    默认值:false

  • vertical(union of 5 variants)optional

    If set false, no vertical grid lines will be drawn.

    默认值:true

  • verticalCoordinatesGeneratorVerticalCoordinatesGeneratoroptional

    A function that generates the x-coordinates of all vertical lines.

  • verticalFillArray<string>optional

    Defines background color of stripes.

    The values from this array will be passed in as the fill property in a rect SVG element. For possible values see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill#rect

    In case there are more stripes than colors, the colors will start from beginning. So for example: verticalFill['yellow', 'black'] produces a pattern of yellow|black|yellow|black

    If this is undefined, or an empty array, then there is no background fill. Note: Grid lines will be rendered above these background stripes.

    默认值:[]

  • verticalPointsArray<number>optional

    Array of coordinates in pixels where to draw vertical grid lines. Has priority over syncWithTicks and verticalValues.

    默认值:[]

  • verticalValuesArray<number> | Array<string>optional

    Array of values, where vertical lines will be drawn. Numbers or strings, in dependence on axis type. Has priority over syncWithTicks but not over verticalPoints.

  • widthnumber | stringoptional

    The width of grid. If undefined, covers the full width of the chart plot area.

  • xnumber | stringoptional

    The x-coordinate of grid. If left undefined, it will be computed from the chart's offset and margins.

  • xAxisIdnumber | stringoptional

    The id of XAxis which is corresponding to the data. Required when there are multiple XAxes.

    默认值:0

  • ynumber | stringoptional

    The y-coordinate of grid. If left undefined, it will be computed from the chart's offset and margins.

  • yAxisIdnumber | stringoptional

    The id of YAxis which is corresponding to the data. Required when there are multiple YAxes.

    默认值:0

  • zIndexnumberoptional

    默认值:-100