JavaScript - d3-dragrect
A JavaScript D3 drag selection rectangle component. Only horizontal at the moment.
This essentially allows you to use a graph that you created in D3 and then drag and visually select portions of the graph. You can create multiple selections.
Screenshots and examples coming when the API stabilizes a bit.
Install
Script
Browserify
npm install --save d3-dragrect
Component
component install jprichardson/d3-dragrect
Usage
Example
//only use 'require' if using browserify or componentvar d3dragrect = //'svg' is your svg element, typically 'height' would be the height of 'svg'var dragBehavior = svg
Methods
dragBehavior.createRect(x, y, width, height, [id])
dragBehavior.isPointInAnyRect(pt)
dragBehavior.getLastRectData()
dragBehavior.deleteAllSelected(callback)
dragBehavior.on('dragstart|drag|dragend', callback)
Styling
The default styling will be very ugly. This makes it look alright:
License
(MIT License)
Copyright 2013, JP Richardson jprichardson@gmail.com