Skip to content

Instantly share code, notes, and snippets.

View mathisonian's full-sized avatar

Matthew Conlen mathisonian

View GitHub Profile
@mathisonian
mathisonian / test.md
Created March 11, 2016 04:14
test title

test.1

var aspectRatio= '16:9';
var viewBox = '0 0 ' + aspectRatio.split(':').join(' ');
var svg = d3.select('#example-4')
.append('svg')
.attr('width', '100%')
.attr('viewBox', viewBox);
// draw the background
var aspectRatio= '16:9'
var svg = d3.select('#example-4')
.append('svg')
.attr('width', '100%')
.attr('viewBox', '0 0 ' + aspectRatio.split(':').join(' '));
// draw a rect to act as an outline
svg.append('rect')
// Assume a variable called `svg`
// has already been created,
// corresponding to a d3 selection
// of an SVG element.
//
// For this example take the
// 'size' of the svg to be 202x202 pixels
var marginSize = 1;
// This can be generalized to arbitrary
// aspect ratios. See last example for
// more on that.
// See calculation for total size in
// example above
var size = 202;
// 1st example - set an explicit
var svg = d3.select('#example-3')
.append('svg')
.attr('width', '100%')
.attr('viewBox', '0 0 202 202');
var data = d3.range(10).map(function (d, i) {
return i;
});
var svg = d3.select('#example-2')
.append('svg')
.attr('width', '100%')
.attr('viewBox', '0 0 202 202');
var data = d3.range(10).map(function (d, i) {
return i;
});
var svg = d3.select('#example-1')
.append('svg')
.attr('width', 202)
.attr('height', 202);
var data = d3.range(10).map(function (d, i) {
return i;
});
@mathisonian
mathisonian / index.py
Last active September 10, 2015 03:53
existing viz example
from lightning import Lightning, Visualization
lgn = Lightning()
# use a saved session id
lgn.use_session(sesion_id)
# use an existing visualization
viz = Visualization(session=lgn.session, json={'id': visualization_id})
@mathisonian
mathisonian / index.js
Created July 6, 2015 15:37
react transitions
var TransitioningClass = React.createClass(
transitions: ['myVarA', 'myVarB'] // uses d3 to guess interpolation type
});
var TransitioningClass = React.createClass(
transitions: {
myVarA: 'color'