Skip to content

Instantly share code, notes, and snippets.

@milkbread
milkbread / RKToolbox.js
Last active December 18, 2015 01:48
JavaScript: Timeline example
//should be able to define: indicWidth, indicSideWidth
function timeLine(container,width,height){
//initialize some variables
var indicWidth = 12, indicSideWidth = 4, indicatorGroup, indicatorLeftpart, indicatorRightpart, indicatorLeft, indicatorRight;
var axisScale = d3.time.scale();
var timelineSVG = container.append("svg")
.attr("width", width)
@milkbread
milkbread / index.html
Last active December 18, 2015 02:39
Gist_Demonstration
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
</style>
</head>
<body>
<div id=content></div>
@milkbread
milkbread / earthquakes052012.json
Created June 5, 2013 12:15
JSON: Data examples
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@milkbread
milkbread / earthquakes052012.json
Last active December 18, 2015 02:48
HTML: simple earthquake visualisation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//adding an overlay to an existing leaflet map object
function mapOverlay(map_){
this.map=map_;
this.overlaySVG = d3.select(this.map.getPanes().overlayPane).append("svg");
this.overlay=this.overlaySVG.append("g").attr("class", "leaflet-zoom-hide")
var path_geo = d3.geo.path().projection(project);
//necessary for zooming the map...corresponded to: map.on("viewreset", reset);
this.resetView=resetView;
function resetView(bounds_map_){
var bottomLeft = project(bounds_map_[0]),
@milkbread
milkbread / simplify_RK_1.0.js
Created June 5, 2013 12:54
JavaScript: Simplify_RK
(function() {
d3.simplify = function() {
var projection = d3.geo.mercator();
function simplify(feature) {
if (feature.type !== "MultiPolygon" && feature.type !== "LineString" && feature.type !== "Polygon" && feature.type !== "MultiLineString") throw new Error("not yet supported");
var heap = minHeap(),
maxArea = 0,
@milkbread
milkbread / myStyles.css
Last active December 18, 2015 02:48
CSS: My Styles
@import url(http://fonts.googleapis.com/css?family=Molle:400italic);
@import url(http://fonts.googleapis.com/css?family=Courgette);
div {color:white;
margin-bottom:10px;}
span{
color:grey;
}
#version_info{
background: rgba(255,0,0,0.3);
@milkbread
milkbread / RKToolbox.js
Last active December 18, 2015 03:39
HTML: Earthquakes with interactive filtering (crossfilter.js) -- PREV: earthquakes_1.0.html
//should be able to define: indicWidth, indicSideWidth
function timeLine(container,width,height){
//initialize some variables
var indicWidth = 8, indicSideWidth = 3, indicatorGroup, indicatorLeftpart, indicatorRightpart, indicatorLeft, indicatorRight;
var axisScale = d3.time.scale();
var timelineSVG = container.append("svg")
.attr("width", width)
@milkbread
milkbread / testfunction.js
Last active December 18, 2015 04:49
JavaScript: Files for the linking test
function testing(test_var){
alert(test_var+", I am a testfunction!")
}
@milkbread
milkbread / RKToolbox.js
Last active December 18, 2015 07:00
HTML: Slider example
//SLIDER - 1 indicator
function slider(container,width,height){
//initialize some variables
var indicWidth = 12, clickListenerTest=false, hoverListenerTest=false, clickListener, hoverListener, indicPos = width/2;
var indicatorStartPosition = 0;
var axisScale = d3.scale.linear();
var sliderSVG = container.append("svg")
.attr("width", width)