Skip to content

Instantly share code, notes, and snippets.

View jgaffuri's full-sized avatar

Julien Gaffuri jgaffuri

View GitHub Profile
@christophermanning
christophermanning / README.md
Last active December 22, 2019 10:32 — forked from tmcw/index.html
Unknown Pleasures

Forked from Tom MacWright and updated by Christopher Manning

Summary

This adds simplex noise to the waves. The 3D noise uses the parameters x and y. z is a function of the velocity and frame from d3.timer.

Controls

  • Drag up and down to adjust the height of the noise
@gisminister
gisminister / README.md
Last active April 11, 2024 18:52
Markercluster pie charts

The map shows traffic accidents recorded in Oslo, Norway, for the year 2013.

The Leaflet Markercluster plugin is wonderful. Since the markerclusters are divIcons you can put whatever you want inside them using the iconCreateFunction. I wanted my clusters to reveal more information than just the marker count and figured a pie chart would do the job. So I told the iconCreateFunction to do some D3 magic and this is the result.

The example is a bit more complicated than necessary due to how my dataset is structured. But if you take a look at the defineClusterIcon() function you'll see that I use d3.nest() to build a dataset for the pie chart based on a given property from all the cluster's children. Then I pass this dataset over to the bakeThePie() function together with instructions on how to style the chart. The function returns svg markup which in turn is placed inside the divIcon.

Feel free to suggest improvements.

@mbostock
mbostock / .block
Last active December 19, 2022 18:35
Arc Padding
license: gpl-3.0
redirect: https://observablehq.com/@d3/arc-pad-angle
@jgaffuri
jgaffuri / .block
Last active November 10, 2020 20:55
NUTS regions (simple map)
license: EUPL-1.2
height: 600
scrolling: no
border: no
@jgaffuri
jgaffuri / .block
Last active November 10, 2020 20:58
NUTS regions
license: EUPL-1.1
height: 900
scrolling: no
border: no
@jgaffuri
jgaffuri / .block
Last active January 9, 2020 20:52
Population of Europe
license: EUPL-1.1
height: 780
scrolling: no
border: no
@jgaffuri
jgaffuri / .block
Last active December 22, 2019 10:34
Communes de France
license: EUPL-1.1
height: 700
scrolling: no
border: yes
@jgaffuri
jgaffuri / .block
Last active December 22, 2019 10:34
Revenus en France, par commune
license: EUPL-1.1
height: 700
scrolling: no
border: yes
@jgaffuri
jgaffuri / .block
Last active December 22, 2019 10:35
Eurostat table
license: EUPL-1.1
height: 700
scrolling: no
border: yes
@jgaffuri
jgaffuri / index.html
Last active December 22, 2019 10:35
d3 example: join, update, enter, exit
<!DOCTYPE html>
<script src="https://d3js.org/d3.v4.min.js"></script>
<div id="join"></div>
<script>
//see:
//https://bost.ocks.org/mike/join/
//https://bl.ocks.org/mbostock/3808218
//http://rajapradhan.com/blogs/d3-js-v4-essentials/the-enter-update-exit-pattern/