Skip to content

Instantly share code, notes, and snippets.

View jalapic's full-sized avatar

James Curley jalapic

View GitHub Profile
@jalapic
jalapic / README.md
Last active September 9, 2015 02:16
Soccer shotplot

Soccer shotplots with d3.js

Contact me at twitter @jalapic

@jalapic
jalapic / index.html
Last active September 20, 2015 01:12
Horizontal Bar with scale and axes
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<title>horizontal bar</title>
<style type="text/css">
@jalapic
jalapic / index.html
Created September 20, 2015 03:04
Scatterplot, transition + diagonal line
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<title>scatterplot|transition</title>
<style type="text/css">
@jalapic
jalapic / README.md
Last active September 20, 2015 16:12
Simple scatter transition

Simple Scatter Transition

This is tweaked code building upon the examples given by Scott Murray @alignedleft

@jalapic
jalapic / README.md
Created September 20, 2015 19:25
bar chart transitions

Bar Chart Transitions

Based on examples made by Scott Murray - alignedleft

  • css fill transition
  • assigning transitions by class of elements
  • filtering data by assigning classes using .classed
  • using .each with .select(this) to dynamically assign classes
@jalapic
jalapic / README.md
Last active September 20, 2015 23:25
bars: groups, events

Bars: groups, tooltips, events

Adapted from Scott Murray's examples. Used for my own learning:

  • use div for tooltip styling

  • use css class for event styling

  • mouseover / mouseout

@jalapic
jalapic / README.md
Created September 21, 2015 01:41
Bars, sort buttons

Bars, sort buttons

A sort button example taken from Scott Murray's excellent tutorials and tweaked a little.

  • divs for buttons
  • sort data dynamically by changing order of 's based on data values
@jalapic
jalapic / README.md
Last active September 22, 2015 00:56
bars: links,sorting

Linked bar charts with sorting functions

Copied and tweaked from Scott Murray's examples. This gives introduction to:

  • linking together two graphs built from same dataset
  • adding 3 different sorting buttons based on ascending/descending of different variables
@jalapic
jalapic / README.md
Last active September 22, 2015 04:17
bars, sidebyside, sort

Laying out pages

Example tweaked from original example by Scott Murray.

  • use div, class & id to layout page with HTML

  • use d3.select, .node().clientWidth to ensure svg width is consistent with css

  • use d3.select to append svg to correct chartContainer (id), ids have to be unique

@jalapic
jalapic / README.md
Last active September 23, 2015 04:49
Slope Chart

Slope Chart

  • a very simple slope chart