This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function histogramChart() { | |
| var margin = {top: 0, right: 0, bottom: 20, left: 0}, | |
| width = 960, | |
| height = 500; | |
| var histogram = d3.layout.histogram(), | |
| x = d3.scale.ordinal(), | |
| y = d3.scale.linear(), | |
| xAxis = d3.svg.axis().scale(x).orient("bottom").tickSize(6, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Swimlane using d3.js</title> | |
| <script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script> | |
| <script type="text/javascript" src="randomData.js"></script> | |
| <style> | |
| .chart { | |
| shape-rendering: crispEdges; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <meta charset="utf-8"> | |
| <style> | |
| path { | |
| fill: none; | |
| stroke: #000; | |
| stroke-width: .6px; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns pas.tree | |
| (:use [clojure.pprint :only [pprint]])) | |
| (def reg-cntry-list | |
| {"America" ["USA" "Canada" "Mexico" "Venezuala" "Brazil" "Argentina" "Cuba"] | |
| "Asia" ["India" "Pakistan" "Singapore" "China" "Japan" "Sri Lanka" "Malaysia"] | |
| "Europe" ["UK" "Germany" "France" "Italy" "Belgium" "Turkey" "Finland"] | |
| "Middle East" ["Saudi Arabia" "Bahrain" "UAE" "Kuwait" "Yemen" "Qatar" "Iraq"] | |
| "Africa" ["Libya" "Tanzania" "South Africa" "Kenya" "Ethiopia" "Morocco" "Zimbabwe"]}) |
NewerOlder