Socket
Socket
Sign inDemoInstall

@visx/grid

Package Overview
Dependencies
34
Maintainers
4
Versions
39
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @visx/grid

visx grid


Version published
Weekly downloads
293K
decreased by-23.66%
Maintainers
4
Created
Weekly downloads
 

Package description

What is @visx/grid?

@visx/grid is a part of the VisX library, which provides a set of low-level visualization components for building custom visualizations in React. The @visx/grid package specifically offers components for rendering grid lines in charts, which can help in creating more readable and organized data visualizations.

What are @visx/grid's main functionalities?

Grid Rows

This feature allows you to render horizontal grid lines (rows) in your chart. The GridRows component takes a scale, width, height, and other styling properties to render the grid lines.

import { GridRows } from '@visx/grid';
import { scaleLinear } from '@visx/scale';
import { extent } from 'd3-array';

const data = [10, 20, 30, 40, 50];
const yScale = scaleLinear({
  domain: extent(data),
  range: [0, 400],
});

<GridRows
  scale={yScale}
  width={500}
  height={400}
  stroke="black"
  strokeDasharray="2,2"
/>

Grid Columns

This feature allows you to render vertical grid lines (columns) in your chart. The GridColumns component takes a scale, height, and other styling properties to render the grid lines.

import { GridColumns } from '@visx/grid';
import { scaleLinear } from '@visx/scale';
import { extent } from 'd3-array';

const data = [10, 20, 30, 40, 50];
const xScale = scaleLinear({
  domain: extent(data),
  range: [0, 500],
});

<GridColumns
  scale={xScale}
  height={400}
  stroke="black"
  strokeDasharray="2,2"
/>

Grid

This feature allows you to render both horizontal and vertical grid lines in your chart. The Grid component takes xScale, yScale, width, height, and other styling properties to render the grid lines.

import { Grid } from '@visx/grid';
import { scaleLinear } from '@visx/scale';
import { extent } from 'd3-array';

const data = [10, 20, 30, 40, 50];
const xScale = scaleLinear({
  domain: extent(data),
  range: [0, 500],
});
const yScale = scaleLinear({
  domain: extent(data),
  range: [0, 400],
});

<Grid
  xScale={xScale}
  yScale={yScale}
  width={500}
  height={400}
  stroke="black"
  strokeDasharray="2,2"
/>

Other packages similar to @visx/grid

Changelog

Source

v1.1.0

:rocket: Enhancements
  • [scale] bump @types/d3-scale to ^3.1.0 #856 closes #855
  • [shape] set Line shapeRendering to crispEdges if rectilinear #840
  • [network] apply fill & radius to DefaultNode #859
  • [tooltip] add applyPositionStyle prop so users don't have to set absolute positioning when unstyled=true #857
  • [responsive] add initialWidth and initialHeight to withParentSize #836 closes #554
  • [responsive] add ignoreDimensions prop to optimize re-renders #834 closes #247
  • [xychart (unpublished)] add BarSeries #808
  • [xychart (unpublished)] add BarGroup #870 #871
  • [xychart (unpublished)] add BarStack #865 #866
  • [xychart (unpublished)] add EventEmitterContext, TooltipContext #825
  • [xychart (unpublished)] add Tooltip #852
:bug: Bug Fix
  • [tooltip] fix TooltipWithBounds overlowing its parent on small screens #837 closes #466
  • [tooltip] fix TooltipWithBounds positioning when unstyled=true #828
  • [stats] don't throw when first and third quartile are equal #841 closes #427
  • [stats] update min/max to handle no outliers case #853 closes #851
  • [text] render 0 as number #814 fixes #813
  • [shape] render LinkHorizontalStep horizontally not vertically #847 closes #820
  • [axis] fix tickLabelProps when hideZero=true #818 fixes #815
  • [demo/areas] handle non-zero margins #877
:house: Internal
  • [responsive] refactor ParentSize to function component #834
  • [text] improve test coverage #833
  • [pattern] remove code duplication #838
:memo: Documentation
  • [in the wild] add Wall Street Journal: Americans Familiarize Themselves with the Word ‘Forbearance’ #843
  • [in the wild] add dollar-to-food-emoji #860
  • [in the wild] remove deadlinks, add Taiwan Real-time Air Quality Index #867
  • [project readme] fix typos #826
:trophy: Contributors
Changes:
 - @visx/annotation: 1.0.0 => 1.1.0
 - @visx/axis: 1.0.0 => 1.1.0
 - @visx/brush: 1.0.0 => 1.1.0
 - @visx/demo: 1.0.0 => 1.1.0
 - @visx/grid: 1.0.0 => 1.1.0
 - @visx/legend: 1.0.0 => 1.1.0
 - @visx/marker: 1.0.0 => 1.1.0
 - @visx/network: 1.0.0 => 1.1.0
 - @visx/pattern: 1.0.0 => 1.1.0
 - @visx/react-spring: 1.0.0 => 1.1.0
 - @visx/responsive: 1.0.0 => 1.1.0
 - @visx/scale: 1.0.0 => 1.1.0
 - @visx/shape: 1.0.0 => 1.1.0
 - @visx/stats: 1.0.0 => 1.1.0
 - @visx/text: 1.0.0 => 1.1.0
 - @visx/threshold: 1.0.0 => 1.1.0
 - @visx/tooltip: 1.0.0 => 1.1.0
 - @visx/visx: 1.0.0 => 1.1.0
 - @visx/xychart: 1.0.0 => 1.1.0 (private)

Readme

Source

@visx/grid

The @visx/grid package lets you create gridlines for charts. <GridRows /> render horizontally, <GridColumns /> render vertically, or you can use a <Grid /> to get them both at once!

Usage

import { Grid } from '@visx/grid';
// or
// import * as Grid from '@visx/grid';
// <Grid.Grid />

const grid = (
  <Grid
    xScale={xScale}
    yScale={yScale}
    width={xMax}
    height={yMax}
    numTicksRows={numTicksForHeight(height)}
    numTicksColumns={numTicksForWidth(width)}
  />
);

Installation

npm install --save @visx/grid

Keywords

FAQs

Last updated on 17 Oct 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc