File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
visx-xychart/src/components/grid Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 11import { CSSProperties , ReactNode } from 'react' ;
2- import { D3Scale , NumberLike } from '@visx/scale' ;
2+ import { D3Scale , NumberLike , ScaleInput } from '@visx/scale' ;
33
44// In order to plot values on an axis, output of the scale must be number.
55// Some scales return undefined.
@@ -31,8 +31,12 @@ export type CommonGridProps = {
3131 strokeWidth ?: string | number ;
3232 /** Grid line stroke-dasharray attribute. */
3333 strokeDasharray ?: string ;
34- /** Approximate number of grid lines. Approximate due to d3 alogrithm, specify `tickValues ` for precise control. */
34+ /** Approximate number of grid lines. Approximate due to d3 alogrithm, specify `rowTickValues` or `columnTickValues ` for precise control. */
3535 numTicks ?: number ;
36+ /** Exact values to be used for GridRows lines, passed to yScale. Use this if you need precise control over GridRows values. */
37+ rowTickValues ?: ScaleInput < GridScale > [ ] ;
38+ /** Exact values to be used for GridColumns lines, passed to xScale. Use this if you need precise control over GridColumns values. */
39+ columnTickValues ?: ScaleInput < GridScale > [ ] ;
3640 /** Styles to apply as grid line style. */
3741 lineStyle ?: CSSProperties ;
3842 /** Pixel offset to apply as a translation (y- for Rows, x- for Columns) to each grid lines. */
Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ export default function BaseGrid({
2222 columns = true ,
2323 GridRowsComponent,
2424 GridColumnsComponent,
25+ rowTickValues,
26+ columnTickValues,
2527 ...props
2628} : BaseGridProps ) {
2729 const {
@@ -43,6 +45,7 @@ export default function BaseGrid({
4345 lineStyle = { gridLineStyles }
4446 width = { innerWidth }
4547 scale = { rowsScale }
48+ tickValues = { rowTickValues }
4649 { ...props }
4750 />
4851 ) }
@@ -52,6 +55,7 @@ export default function BaseGrid({
5255 lineStyle = { gridLineStyles }
5356 height = { innerHeight }
5457 scale = { columnsScale }
58+ tickValues = { columnTickValues }
5559 { ...props }
5660 />
5761 ) }
You can’t perform that action at this time.
0 commit comments