Socket
Book a DemoInstallSign in
Socket

cellgridrenderer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cellgridrenderer

A browser module for rendering grids of cells.

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

cellgridrenderer

This is a browser module for rendering grids of cells. The cells should be in this format:

{
  d: {
    // Stuff
  },
  coords: [5, 2]
}

Installation

npm install cellgridrenderer

Usage

Include D3. Then, add this to your html file:

<script src="node_modules/accessorizer.js"></script>
<script src="cellgridrenderer.js"></script>

In a JavaScript file:

var renderer = createCellGridRenderer({
  selectors: {
    svg: 'svg#board',
    root: 'g#root'        
  },
  cellWidth: 10,
  cellHeight: 10,
  cellClass: 'cell'
});

Here's a working example.

With Browserify:

var createRenderer = require('cellgridrenderer').createCellGridRenderer;
// Then, the rest is the same.

If you are working with a fixed grid that is not going to change in size over time, you can use FixedCellGridRenderer, which is more efficient for that case.

var createRenderer = require('cellgridrenderer').createFixedCellGridRenderer;

Here's a working browserified example.

License

MIT.

Keywords

browser

FAQs

Package last updated on 17 Feb 2015

Did you know?

Socket

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