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
| <!DOCTYPE html> | |
| <body> | |
| <script src='http://d3js.org/d3.v3.js'></script> | |
| <script src='http://d3js.org/colorbrewer.v1.js'></script> | |
| <script> | |
| var format = d3.time.format('%m/%d/%y') | |
| var width = 600 | |
| var height = 400 | |
| var x = d3.time.scale().range([0, width]) | |
| var y = d3.scale.linear().range([height - 10, 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
| license: mit |
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
| license: mit |
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
| <script src="http://d3js.org/d3.v3.min.js"></script> | |
| <script> | |
| var width = 960, | |
| height = 480; | |
| var svg = d3.select("body").append("svg") | |
| .attr("width", width) | |
| .attr("height", height); | |
| var projection = d3.geo.equirectangular() |
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
| <script src="http://d3js.org/d3.v3.min.js"></script> | |
| <script> | |
| var width = 960, | |
| height = 480; | |
| var svg = d3.select("body").append("svg") | |
| .attr("width", width) | |
| .attr("height", height); | |
| var projection = d3.geo.equirectangular() |
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
| uint8_t my_sqrt(uint16_t input) { | |
| uint16_t res = 0; | |
| uint16_t one = 1u << 14; | |
| while (one > input) one /= 4; | |
| while (one != 0) { | |
| if (input >= res + one) { | |
| res += one; | |
| input -= res; |
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
| process.nextTick(function () { | |
| var contents = ''; | |
| tuple.contents.forEach(function (file) { | |
| var oneFile = fs.readFileSync(sourcePath + file + '.js', 'utf-8'); | |
| if (debug) | |
| contents += oneFile | |
| else | |
| contents += jsmin.jsmin(oneFile); | |
| }); | |
| fs.writeFile(targetPath + tuple.name + '.js', contents, errbacker.create(log.error)); |
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
| var testCell = function (current, test) { | |
| var actor = current.piece; | |
| var target = test.piece; | |
| if (current == test && (!current.maze || actor.is('C'))) { | |
| return 'empty'; | |
| } |
NewerOlder