Skip to content

Instantly share code, notes, and snippets.

View hugolpz's full-sized avatar
🎯
Focusing

Lopez Hugo hugolpz

🎯
Focusing
View GitHub Profile
@hugolpz
hugolpz / README.md
Created April 28, 2017 16:10 — forked from ericcoopey/README.md
Animating Changes in Force Diagram

Demonstrates how to dynamically add and remove nodes to a force diagram. This was functionality that should seemingly be easy, but was surprisingly hard. Many people were asking how to do this in forums, and this final product is the amalgamation of several commenters half baked (but not really functioning) solutions.

This one demonstrates changes in a social network diagram as relationships are added, removed, and updated. Add nodes by name, add links complete with custom lengths.

Also shows how to add labels to a force diagram.

@hugolpz
hugolpz / README.md
Created November 4, 2016 18:10 — forked from syntagmatic/README.md
Comparing Map Projections

A mashup of Map Projection Distortions and transitions using the D3.js extended geographic projections plugin.

A comparison of map projections by four different types of distortion:

  • Acc. 40° 150% – The Acceptance index is a numerical measure that summarizes overall projection distortion, in this case with a maximum angular distortion of 40° and areal distortion of up to 150%.
  • Scale – The weighted mean error for overall scale distortion.
  • Areal – The weighted mean error for areal distortion.
  • Angular – The mean angular deformation index.

Lower is better. Data transcribed from the Natural Earth Projection by @mbostock.

@hugolpz
hugolpz / .block
Last active November 4, 2016 18:01 — forked from mbostock/.block
Vector Tiles
license: gpl-3.0
@hugolpz
hugolpz / child_window.js
Created December 17, 2015 15:37 — forked from asiviero/child_window.js
Open a child window on Alloy/Titanium
$.child_window.open();
@hugolpz
hugolpz / admin_0.topo.json
Last active August 29, 2015 14:16
Minimal d3js line smoothing, topojson version
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hugolpz
hugolpz / d3.geo.projection.v0.min.js
Last active August 29, 2015 14:16 — forked from emeeks/index.html
Minimal D3js line smoothing
!function(){function t(t,a){return{type:"Feature",id:t.id,properties:t.properties,geometry:n(t.geometry,a)}}function n(t,a){if(!t)return null;if("GeometryCollection"===t.type)return{type:"GeometryCollection",geometries:object.geometries.map(function(t){return n(t,a)})};if(!la.hasOwnProperty(t.type))return null;var r=la[t.type];return d3.geo.stream(t,a(r)),r.result()}function a(){}function r(t){if((n=t.length)<4)return!1;for(var n,a=0,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++a<n;)r+=t[a-1][1]*t[a][0]-t[a-1][0]*t[a][1];return 0>=r}function e(t,n){for(var a=n[0],r=n[1],e=!1,o=0,i=t.length,h=i-1;i>o;h=o++){var u=t[o],M=u[0],s=u[1],c=t[h],f=c[0],v=c[1];s>r^v>r&&(f-M)*(r-s)/(v-s)+M>a&&(e=!e)}return e}function o(t){return t?t/Math.sin(t):1}function i(t){return t>0?1:0>t?-1:0}function h(t){return t>1?pa:-1>t?-pa:Math.asin(t)}function u(t){return t>1?0:-1>t?ba:Math.acos(t)}function M(t){return t>0?Math.sqrt(t):0}function s(t){function n(t,n){var a=Math.cos(t),e=Math.cos(n),o=Math.sin(n),i=e*a,h=-((1-i?Math.log(.5*(1+i)
@hugolpz
hugolpz / README.md
Last active October 4, 2018 08:47
Printing map.svg file via D3js, Nodejs, Jsdom

D3 map client & server side

Minimal demo on how to create maps both :

  1. client side via d3js, topojson, & queue.js
  2. server side via exact same ressources + nodejs.

JS

  • d3.v3.min.js
  • topojson.v1.min.js
@hugolpz
hugolpz / GHA_adm.topo.json
Last active August 29, 2015 14:16
Minimal D3js + GADM map
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hugolpz
hugolpz / README.md
Last active August 29, 2015 14:14
Google map API v.3

see alsohttps://developers.google.com/maps/documentation/javascript/styling?utm_source=welovemapsdevelopers

@hugolpz
hugolpz / SVG-Pattern-&-D3js.markdown
Last active August 29, 2015 14:14
SVG Pattern & D3js for diagonal hash

While looking to add hash to maps areas I came out with this "svg patterns & d3js" gist.