Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add missing tickValues prop type #1855

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/visx-grid/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CSSProperties, ReactNode } from 'react';
import { D3Scale, NumberLike } from '@visx/scale';
import { D3Scale, NumberLike, ScaleInput } from '@visx/scale';

// In order to plot values on an axis, output of the scale must be number.
// Some scales return undefined.
Expand Down Expand Up @@ -31,8 +31,12 @@ export type CommonGridProps = {
strokeWidth?: string | number;
/** Grid line stroke-dasharray attribute. */
strokeDasharray?: string;
/** Approximate number of grid lines. Approximate due to d3 alogrithm, specify `tickValues` for precise control. */
/** Approximate number of grid lines. Approximate due to d3 alogrithm, specify `rowTickValues` or `columnTickValues` for precise control. */
numTicks?: number;
/** Exact values to be used for GridRows lines, passed to yScale. Use this if you need precise control over GridRows values. */
rowTickValues?: ScaleInput<GridScale>[];
/** Exact values to be used for GridColumns lines, passed to xScale. Use this if you need precise control over GridColumns values. */
columnTickValues?: ScaleInput<GridScale>[];
/** Styles to apply as grid line style. */
lineStyle?: CSSProperties;
/** Pixel offset to apply as a translation (y- for Rows, x- for Columns) to each grid lines. */
Expand Down
4 changes: 4 additions & 0 deletions packages/visx-xychart/src/components/grid/BaseGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export default function BaseGrid({
columns = true,
GridRowsComponent,
GridColumnsComponent,
rowTickValues,
columnTickValues,
...props
}: BaseGridProps) {
const {
Expand All @@ -43,6 +45,7 @@ export default function BaseGrid({
lineStyle={gridLineStyles}
width={innerWidth}
scale={rowsScale}
tickValues={rowTickValues}
{...props}
/>
)}
Expand All @@ -52,6 +55,7 @@ export default function BaseGrid({
lineStyle={gridLineStyles}
height={innerHeight}
scale={columnsScale}
tickValues={columnTickValues}
{...props}
/>
)}
Expand Down
Loading