Coder Social home page Coder Social logo

lensbrush's Introduction

Lensbrush

Lensbrush is a simple d3 plugin, which allows you to perform a selection based on a lens. You can initiate the lensbrush the same way as d3.svg.brush:

var brush = d3.svg.lensbrush();

Please note that the extent method returns an array which contains three values:

  1. center x-value of the lens
  2. center y-value of the lens
  3. radius
brush.extent();

In order to test if a specific point lies within the lens, you can use the following method, which expects a x- and y-value:

if (brush.isWithinLens(x, y)) {
	console.log(“Within the lens: (, x, y, ));
}

Usage

  • Create a new lens: Press and hold the left mouse button. Moving the mouse will change the radius of the lens. Release the mouse button to conclude your selection.
  • Relocate the lens: Drag and drop the lens.
  • Resize the lens: Position the mouse on the border of the lens. Press and hold the left mouse to change the radius. Release the mouse button to conclude your selection.
  • Delete the lens: Click somewhere outside the lens.

Files

The file d3.lensbrush.js contains the plugin and the file lens.html contains a simple example on how to use the plugin.

lensbrush's People

Contributors

dominikjaeckle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

nbydy

lensbrush's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.